Last updated

API / geotoolkit / attributes / GradientStyle / GradientStyle

Class: GradientStyle

attributes.GradientStyle.GradientStyle

Defines an abstract gradient fill style. It contains information about gradient stops and colors.

Hierarchy

Table of contents

Constructors
Accessors
Methods
Css Properties
Name Type Description
colorstringColor in CSS form
evenoddmodebooleanEven-odd fill mode
fillpatternPatternPattern
fillpattern-containernamestringAn optional container name, which creates an image pattern. This parameter is used for serialization if you want to save are reference to pattern instead of the pattern itself
fillpattern-patternnamestringName of this pattern for indexing
fillpattern-scalablebooleanFlag that sets scalability of the pattern coordinates, or relative to the shape it is filling (It is not supported)
foregroundstringForeground color
patternPatternPattern
spreadmethodSpreadMethodsSpread method defines how the gradient fills given area if gradient vector does not cover the whole area
transformationTransformationGradient transformation
transformation-dxnumberX axis translation
transformation-dynumberY axis translation
transformation-xxnumberX scale
transformation-xynumberXy skew
transformation-yxnumberYx skew
transformation-yynumberY scale
unittypeGradientUnitsType of coordinated used to define gradient

Contents

Constructors

new GradientStyle(color, pattern, foreground, evenoddmode, spreadMethod, unitType, transformation)

new GradientStyle(color?, pattern?, foreground?, evenoddmode?, spreadMethod?, unitType?, transformation?)

Create GradientStyle

Parameters

Name Type Description
Optional colorstring | RgbaColor | OptionsColor of FillStyle (not used in Gradient) or JSON with parameters
Optional patternPatternThe background pattern (not used in Gradient)
Optional foregroundstring | RgbaColorThe foreground color of the pattern (not used in Gradient)
Optional evenoddmodebooleanThe flag indicating whether even-odd fill mode is to be used.
Optional spreadMethodstringSpread method defines how the gradient fills given area if gradient vector does not cover the whole area
Optional unitTypestringType of coordinated used to define gradient
Optional transformationTransformationGradient transformation

Overrides

FillStyle.constructor

Accessors

Empty

Static get Empty(): FillStyle

Empty style

Returns

FillStyle

Inherited from

FillStyle.Empty


Pick

Static get Pick(): FillStyle

Pick style

Returns

FillStyle

Inherited from

FillStyle.Pick

Methods

addStopPoint

addStopPoint(position, color): GradientStyle

Add a new stop point at a given position and color.

Parameters

Name Type Description
positionnumberposition of the stop point, if in relative coordinates from 0 to 1
colorstringcolor in CSS form for specified stop point

Returns

GradientStyle

this


cleanDuplicatePoints

cleanDuplicatePoints(): GradientStyle

Removes points that are identical, leaving only one

Returns

GradientStyle

this


clearStopPoints

clearStopPoints(): GradientStyle

Clear all stop points

Returns

GradientStyle

this


clone

clone(): GradientStyle

All inheritors should implement copy constructor or provide custom implementation for this method

Returns

GradientStyle

this

Overrides

FillStyle.clone


copyConstructor

Protected copyConstructor(src, deepCopy?): GradientStyle

copy constructor

Parameters

Name Type Description
srcGradientStyleSource to copy from
Optional deepCopybooleandeep copy

Returns

GradientStyle

this

Overrides

FillStyle.copyConstructor


dispose

dispose(): void

Dispose.

Returns

void

Inherited from

FillStyle.dispose


equalsTo

equalsTo(other): boolean

Returns true if fills are identical

Parameters

Name Type Description
otherFillStyleFillStyle to compare against

Returns

boolean

Inherited from

FillStyle.equalsTo


getClassName

getClassName(): string

Returns

string

Inherited from

FillStyle.getClassName


getColor

getColor(): string

Returns color

Returns

string

color in CSS form

Inherited from

FillStyle.getColor


getEvenOddMode

getEvenOddMode(): boolean

Gets the even odd fill mode

Returns

boolean

evenOddMode The even odd fill mode flag.

Inherited from

FillStyle.getEvenOddMode


getForegroundColor

getForegroundColor(): string

Gets foreground color

Returns

string

color in CSS form

Inherited from

FillStyle.getForegroundColor


getPattern

getPattern(context?): any

Return fill pattern. Can pass in rendering context to get HTML DOM pattern, or no arguments to get fillPattern object.

Parameters

Name Type Description
Optional contextIPatternContextnative rendering context

Returns

any

image pattern

Inherited from

FillStyle.getPattern


getProperties

getProperties(): OptionsOut

Gets all the properties pertaining to this object

Returns

OptionsOut

properties

Overrides

FillStyle.getProperties


getRaster

getRaster(xMin?, yMin?, xMax?, yMax?): Raster

Returns a new instance of Raster

Parameters

Name Type Description
Optional xMinnumberx Min position to get color
Optional yMinnumbery Min position to get color
Optional xMaxnumberx Max position to get color
Optional yMaxnumbery Max position to get color

Returns

Raster

Inherited from

FillStyle.getRaster


getRgbaColor

getRgbaColor(): RgbaColor

Return RGBA color

Returns

RgbaColor

color

Inherited from

FillStyle.getRgbaColor


getShadow

getShadow(): Shadow

Gets all properties pertaining to shadow

Returns

Shadow

JSON with offsetX, offsetY, color and blur properties

Inherited from

FillStyle.getShadow


getSpreadMethod

getSpreadMethod(): SpreadMethods

Returns

SpreadMethods


getStopPointColor

getStopPointColor(index): string

Return color at a stop point by index.

Parameters

Name Type Description
indexnumberindex of a stop point

Returns

string

color in CSS format, or null if index is out of range.


getStopPointPosition

getStopPointPosition(index): number

Return stop point position

Parameters

Name Type Description
indexnumberindex of stop point

Returns

number

position either in relative or absolute terms or null if index is out of range.


getStopPointsCount

getStopPointsCount(): number

Return the number of defined gradient stop points

Returns

number

stops number of stops


getStyleType

getStyleType(): string

Returns style type

Returns

string

STYLE_TYPE_GRADIENT

Overrides

FillStyle.getStyleType


getTimeStamp

getTimeStamp(): number

Gets time stamp

Returns

number

timeStamp

Inherited from

FillStyle.getTimeStamp


getTransformation

getTransformation(): Transformation

Returns the transformation set on the gradient

Returns

Transformation


getUnits

getUnits(): GradientUnits

Gets the type of units

Returns

GradientUnits


hasEventListener

hasEventListener(type, callback?): boolean

Check if a list of event listeners for this type contains this listener

Parameters

Name Type Description
typestringtype of event or property
Optional callbackFunctionto be called, if null, check if any callback is registered

Returns

boolean

Inherited from

FillStyle.hasEventListener


invalidate

invalidate(): GradientStyle

notify the node that the style is invalidated

Returns

GradientStyle

this

Inherited from

FillStyle.invalidate


isDisposed

isDisposed(): boolean

Returns whether this object has been disposed

Returns

boolean

Inherited from

FillStyle.isDisposed


isSilent

isSilent(): boolean

Return true if the event dispatcher doesn't notify any events

Returns

boolean

Inherited from

FillStyle.isSilent


notify

notify<E>(type, source, args?): GradientStyle

Notify listeners

Type parameters

NameType
Eextends string

Parameters

Name Type Description
typeEevent types
sourceStyleof the event
Optional argsEventMap[E]arguments of the event

Returns

GradientStyle

this

Inherited from

FillStyle.notify


off

off<E>(type, callback?): GradientStyle

Detach listener on event. Calling .off() with no arguments removes all attached listeners. Calling .off(type) with no callback removes all attached listeners for specific type.

Type parameters

NameType
Eextends string

Parameters

Name Type Description
typeEtype of the event
Optional callback(eventType: E, sender: GradientStyle, args: EventMap[E]) => voidfunction to be called

Returns

GradientStyle

this

Inherited from

FillStyle.off


on

on<E>(type, callback): GradientStyle

Attach listener on event that will be called whenever the specified event is delivered to the target

If the callback function is already in the list of event listeners for this target, the function is not added a second time.

If a particular anonymous function is in the list of event listeners registered for a certain target, and then later in the code, an identical anonymous function is given in an "on" call, the second function will also be added to the list of event listeners for that target.

Type parameters

NameType
Eextends string

Parameters

Name Type Description
typeEtype of event or property
callback(eventType: E, sender: GradientStyle, args: EventMap[E]) => voidto be called

Returns

GradientStyle

this

Inherited from

FillStyle.on


removeStopPoint

removeStopPoint(index): GradientStyle

Removes stop point at index.

Parameters

Name Type Description
indexnumberindex of the stop point

Returns

GradientStyle

this


setColor

setColor(color): GradientStyle

Sets color

Parameters

Name Type Description
colorstring | RgbaColor | HsvColor | HlsColorin CSS string form or RgbaColor object

Returns

GradientStyle

this

Inherited from

FillStyle.setColor


setEvenOddMode

setEvenOddMode(evenOddMode): GradientStyle

Sets the even odd fill mode

Parameters

Name Type Description
evenOddModebooleanThe even odd fill mode flag.

Returns

GradientStyle

this

Inherited from

FillStyle.setEvenOddMode


setForegroundColor

setForegroundColor(color): GradientStyle

Sets foreground color

Parameters

Name Type Description
colorstring | RgbaColor | HsvColor | HlsColorRgbaColor for foreground

Returns

GradientStyle

this

Inherited from

FillStyle.setForegroundColor


setPattern

setPattern(pattern?): GradientStyle

Sets fill pattern.

Parameters

Name Type Description
Optional patternPatternfill pattern

Returns

GradientStyle

this

Inherited from

FillStyle.setPattern


setProperties

setProperties(properties?): GradientStyle

Sets all the properties pertaining to this object

Parameters

Name Type Description
Optional propertiesOptionsAn object containing the properties to set

Returns

GradientStyle

this

Overrides

FillStyle.setProperties


setShadow

setShadow(shadow): GradientStyle

Sets all properties pertaining to shadow

Parameters

Name Type Description
shadowPartial<Merge<Shadow, { color?: string | RgbaColor }>>data

Returns

GradientStyle

this

Inherited from

FillStyle.setShadow


setSilent

setSilent(bool, force?): GradientStyle

Set silent mode

Parameters

Name Type Description
boolbooleanflag to enable silent mode
Optional forcebooleantrue if parent should be invalidated immediately

Returns

GradientStyle

this

Inherited from

FillStyle.setSilent


setSpreadMethod

setSpreadMethod(sMethod): GradientStyle

Changes spread method for the gradient

Parameters

Name Type Description
sMethod"repeat" | "reflect" | "pad" | SpreadMethodsSpread method to apply to the gradient

Returns

GradientStyle

this


setStopPointColor

setStopPointColor(index, color): GradientStyle

Sets color to a stop point by index.

Parameters

Name Type Description
indexnumberindex of a stop point
colorstringColor to set to the stop point

Returns

GradientStyle


setTransformation

setTransformation(transform): GradientStyle

Sets transformation for the gradient

Parameters

Name Type Description
transformTransformationThe new gradient transformation

Returns

GradientStyle


setUnits

setUnits(u): GradientStyle

Sets unit type for the gradient

Parameters

Name Type Description
uGradientUnitsUnit type

Returns

GradientStyle

this


toGrayScale

toGrayScale(clone?): FillStyle

Clone the instance in grayscale style, or convert itself if [clone] is false.

Parameters

Name Type Description
Optional clonebooleanclone instance if true, default is true

Returns

FillStyle

Inherited from

FillStyle.toGrayScale


updateTimeStamp

updateTimeStamp(silent?): GradientStyle

Update time stamp to indicate that style has been changed.

Parameters

Name Type Description
Optional silentbooleansilent mode. If this parameter equals to true then style doesn't send invalidate event

Returns

GradientStyle

this

Inherited from

FillStyle.updateTimeStamp


getClassName

Static getClassName(): string

Returns

string

Inherited from

FillStyle.getClassName


isStyleNotificationEnabled

Static isStyleNotificationEnabled(): boolean

Return status of the global notification for all styles.

Returns

boolean

Inherited from

FillStyle.isStyleNotificationEnabled