Last updated

API / geotoolkit / attributes / LinearGradientStyle / LinearGradientStyle

Class: LinearGradientStyle

attributes.LinearGradientStyle.LinearGradientStyle

Defines a linear gradient fill style to provide smooth transitions between two or more specified colors.

Hierarchy

Table of contents

Constructors
Accessors
Methods
Css Properties
Name Type Description
colorstringColor in CSS form
colorproviderColorProviderColorProvider
colorprovider-maxnumber
colorprovider-minnumber
colorprovider-scaleKnownScales
endcolorstringEnd color in CSS format
endpointPointEnd point of gradient in relative form, 0-1 or absolute coordinates
endpoint-xnumberX coordinate
endpoint-ynumberY coordinate
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
startcolorstringStart color in CSS format
startpointPointStart point of gradient in relative form, 0-1 or absolute coordinates
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 LinearGradientStyle(startColor, endColor, startPoint, endPoint, colorProvider, spreadMethod, unitType, transformation)

new LinearGradientStyle(startColor?, endColor?, startPoint?, endPoint?, colorProvider?, spreadMethod?, unitType?, transformation?)

Create LinearGradientStyle

Parameters

Name Type Description
Optional startColorstring | Optionsstart color in CSS format or JSON with parameters
Optional endColorstringend color in CSS format
Optional startPointPoint | Optionsstart point of gradient in relative form, 0-1 or absolute coordinates
Optional endPointPoint | Optionsend point of gradient in relative form, 0-1 or absolute coordinates
Optional colorProviderColorProvidercolorProvider
Optional spreadMethod"repeat" | "reflect" | "pad" | SpreadMethodsSpread 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

GradientStyle.constructor

Accessors

Empty

Static get Empty(): FillStyle

Empty style

Returns

FillStyle

Inherited from

GradientStyle.Empty


Pick

Static get Pick(): FillStyle

Pick style

Returns

FillStyle

Inherited from

GradientStyle.Pick

Methods

addStopPoint

addStopPoint(position, color): LinearGradientStyle

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

LinearGradientStyle

this

Inherited from

GradientStyle.addStopPoint


cleanDuplicatePoints

cleanDuplicatePoints(): LinearGradientStyle

Removes points that are identical, leaving only one

Returns

LinearGradientStyle

this

Inherited from

GradientStyle.cleanDuplicatePoints


clearStopPoints

clearStopPoints(): LinearGradientStyle

Clear all stop points

Returns

LinearGradientStyle

this

Inherited from

GradientStyle.clearStopPoints


clone

clone(): LinearGradientStyle

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

Returns

LinearGradientStyle

this

Overrides

GradientStyle.clone


copyConstructor

Protected copyConstructor(src, deepCopy?): LinearGradientStyle

copy constructor

Parameters

Name Type Description
srcLinearGradientStyleSource to copy from
Optional deepCopybooleandeep copy

Returns

LinearGradientStyle

this

Overrides

GradientStyle.copyConstructor


dispose

dispose(): void

Dispose.

Returns

void

Inherited from

GradientStyle.dispose


equalsTo

equalsTo(other): boolean

Returns true if fills are identical

Parameters

Name Type Description
otherFillStyleFillStyle to compare against

Returns

boolean

Inherited from

GradientStyle.equalsTo


getClassName

getClassName(): string

Returns

string

Inherited from

GradientStyle.getClassName


getColor

getColor(): string

Returns color

Returns

string

color in CSS form

Inherited from

GradientStyle.getColor


getEndColor

getEndColor(): string

Returns end color

Returns

string

color color in CSS format


getEndPoint

getEndPoint(): Point

Return end point from 0 to 1

Returns

Point

end point


getEvenOddMode

getEvenOddMode(): boolean

Gets the even odd fill mode

Returns

boolean

evenOddMode The even odd fill mode flag.

Inherited from

GradientStyle.getEvenOddMode


getForegroundColor

getForegroundColor(): string

Gets foreground color

Returns

string

color in CSS form

Inherited from

GradientStyle.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

GradientStyle.getPattern


getProperties

getProperties(): OptionsOut

Gets all the properties pertaining to this object

Returns

OptionsOut

An object containing the properties to set

Overrides

GradientStyle.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

GradientStyle.getRaster


getRgbaColor

getRgbaColor(): RgbaColor

Return RGBA color

Returns

RgbaColor

color

Inherited from

GradientStyle.getRgbaColor


getShadow

getShadow(): Shadow

Gets all properties pertaining to shadow

Returns

Shadow

JSON with offsetX, offsetY, color and blur properties

Inherited from

GradientStyle.getShadow


getSpreadMethod

getSpreadMethod(): SpreadMethods

Returns

SpreadMethods

Inherited from

GradientStyle.getSpreadMethod


getStartColor

getStartColor(): string

Returns start color

Returns

string

color in CSS format


getStartPoint

getStartPoint(): Point

Return start point from 0 to 1

Returns

Point

point


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.

Inherited from

GradientStyle.getStopPointColor


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.

Inherited from

GradientStyle.getStopPointPosition


getStopPointsCount

getStopPointsCount(): number

Return the number of defined gradient stop points

Returns

number

stops number of stops

Inherited from

GradientStyle.getStopPointsCount


getStyleType

getStyleType(): string

Return type of the style.

Returns

string

STYLE_TYPE_LINEAR_GRADIENT

Overrides

GradientStyle.getStyleType


getTimeStamp

getTimeStamp(): number

Gets time stamp

Returns

number

timeStamp

Inherited from

GradientStyle.getTimeStamp


getTransformation

getTransformation(): Transformation

Returns the transformation set on the gradient

Returns

Transformation

Inherited from

GradientStyle.getTransformation


getUnits

getUnits(): GradientUnits

Gets the type of units

Returns

GradientUnits

Inherited from

GradientStyle.getUnits


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

GradientStyle.hasEventListener


invalidate

invalidate(): LinearGradientStyle

notify the node that the style is invalidated

Returns

LinearGradientStyle

this

Inherited from

GradientStyle.invalidate


isDisposed

isDisposed(): boolean

Returns whether this object has been disposed

Returns

boolean

Inherited from

GradientStyle.isDisposed


isSilent

isSilent(): boolean

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

Returns

boolean

Inherited from

GradientStyle.isSilent


notify

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

Notify listeners

Type parameters

NameType
Eextends string

Parameters

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

Returns

LinearGradientStyle

this

Inherited from

GradientStyle.notify


off

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

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: LinearGradientStyle, args: EventMap[E]) => voidfunction to be called

Returns

LinearGradientStyle

this

Inherited from

GradientStyle.off


on

on<E>(type, callback): LinearGradientStyle

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: LinearGradientStyle, args: EventMap[E]) => voidto be called

Returns

LinearGradientStyle

this

Inherited from

GradientStyle.on


removeStopPoint

removeStopPoint(index): LinearGradientStyle

Removes stop point at index.

Parameters

Name Type Description
indexnumberindex of the stop point

Returns

LinearGradientStyle

this

Inherited from

GradientStyle.removeStopPoint


setColor

setColor(color): LinearGradientStyle

Sets color

Parameters

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

Returns

LinearGradientStyle

this

Inherited from

GradientStyle.setColor


setEndColor

setEndColor(color): LinearGradientStyle

Sets end color

Parameters

Name Type Description
colorstringcolor to set in CSS format

Returns

LinearGradientStyle

this


setEndPoint

setEndPoint(p): LinearGradientStyle

Set end point from 0 to 1

Parameters

Name Type Description
pPointend point

Returns

LinearGradientStyle

this


setEvenOddMode

setEvenOddMode(evenOddMode): LinearGradientStyle

Sets the even odd fill mode

Parameters

Name Type Description
evenOddModebooleanThe even odd fill mode flag.

Returns

LinearGradientStyle

this

Inherited from

GradientStyle.setEvenOddMode


setForegroundColor

setForegroundColor(color): LinearGradientStyle

Sets foreground color

Parameters

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

Returns

LinearGradientStyle

this

Inherited from

GradientStyle.setForegroundColor


setPattern

setPattern(pattern?): LinearGradientStyle

Sets fill pattern.

Parameters

Name Type Description
Optional patternPatternfill pattern

Returns

LinearGradientStyle

this

Inherited from

GradientStyle.setPattern


setProperties

setProperties(properties?): LinearGradientStyle

Sets all the properties pertaining to this object

Parameters

Name Type Description
Optional propertiesOptionsAn object containing the properties to set

Returns

LinearGradientStyle

Overrides

GradientStyle.setProperties


setShadow

setShadow(shadow): LinearGradientStyle

Sets all properties pertaining to shadow

Parameters

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

Returns

LinearGradientStyle

this

Inherited from

GradientStyle.setShadow


setSilent

setSilent(bool, force?): LinearGradientStyle

Set silent mode

Parameters

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

Returns

LinearGradientStyle

this

Inherited from

GradientStyle.setSilent


setSpreadMethod

setSpreadMethod(sMethod): LinearGradientStyle

Changes spread method for the gradient

Parameters

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

Returns

LinearGradientStyle

this

Inherited from

GradientStyle.setSpreadMethod


setStartColor

setStartColor(color): LinearGradientStyle

Sets start color

Parameters

Name Type Description
colorstringcolor to set

Returns

LinearGradientStyle

this


setStartPoint

setStartPoint(p): LinearGradientStyle

Set start point from 0 to 1

Parameters

Name Type Description
pPointstart point

Returns

LinearGradientStyle

this


setStopPointColor

setStopPointColor(index, color): LinearGradientStyle

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

LinearGradientStyle

Inherited from

GradientStyle.setStopPointColor


setTransformation

setTransformation(transform): LinearGradientStyle

Sets transformation for the gradient

Parameters

Name Type Description
transformTransformationThe new gradient transformation

Returns

LinearGradientStyle

Inherited from

GradientStyle.setTransformation


setUnits

setUnits(u): LinearGradientStyle

Sets unit type for the gradient

Parameters

Name Type Description
uGradientUnitsUnit type

Returns

LinearGradientStyle

this

Inherited from

GradientStyle.setUnits


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

GradientStyle.toGrayScale


updateTimeStamp

updateTimeStamp(silent?): LinearGradientStyle

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

LinearGradientStyle

this

Inherited from

GradientStyle.updateTimeStamp


getClassName

Static getClassName(): string

Returns

string

Inherited from

GradientStyle.getClassName


isStyleNotificationEnabled

Static isStyleNotificationEnabled(): boolean

Return status of the global notification for all styles.

Returns

boolean

Inherited from

GradientStyle.isStyleNotificationEnabled