Class PatternBuilder
- java.lang.Object
-
- org.pepstock.charba.client.colors.PatternBuilder
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Pattern
build()
Builds and returns a pattern instance.static Pattern
build(NativeObject nativeObject)
Creates a pattern, previously stored in the a native java script objectstatic PatternBuilder
create(CanvasPatternItem canvasPattern)
Creates the object using an already created canvas pattern.
The dimension of canvas pattern image will be the defaultTilesFactoryDefaults.DEFAULT_SIZE
.static PatternBuilder
create(CanvasPatternItem canvasPattern, int squareSize)
Creates the object using an already created canvas pattern.
The dimension of canvas pattern image is unique then the image of pattern is a square.static PatternBuilder
create(CanvasPatternItem canvasPattern, int width, int height)
Creates the object using an already created canvas pattern.
This is mainly used by tiles.static PatternBuilder
create(Img image)
Creates the object using an image to use in the pattern.
The repetition used is repeat.static PatternBuilder
create(Img image, Repetition repetition)
Creates the object using an image to use in the pattern and repetition to apply to pattern.static Pattern
retrieve(CanvasPatternItem canvasPattern)
Retrieves a cached pattern by aCanvasPatternItem
instance.
If the pattern doesn't exist, returnsnull
.
-
-
-
Method Detail
-
create
public static PatternBuilder create(Img image)
Creates the object using an image to use in the pattern.
The repetition used is repeat.- Parameters:
image
- image to use as pattern- Returns:
- pattern builder instance
-
create
public static PatternBuilder create(Img image, Repetition repetition)
Creates the object using an image to use in the pattern and repetition to apply to pattern.- Parameters:
image
- image to use as patternrepetition
- repetition value to apply to pattern- Returns:
- pattern builder instance
-
create
public static PatternBuilder create(CanvasPatternItem canvasPattern)
Creates the object using an already created canvas pattern.
The dimension of canvas pattern image will be the defaultTilesFactoryDefaults.DEFAULT_SIZE
. This is mainly used by tiles.- Parameters:
canvasPattern
- canvas pattern instance- Returns:
- pattern builder instance
-
create
public static PatternBuilder create(CanvasPatternItem canvasPattern, int squareSize)
Creates the object using an already created canvas pattern.
The dimension of canvas pattern image is unique then the image of pattern is a square. This is mainly used by tiles.- Parameters:
canvasPattern
- canvas pattern instancesquareSize
- size of image applied to canvasPattern to be a square- Returns:
- pattern builder instance
-
create
public static PatternBuilder create(CanvasPatternItem canvasPattern, int width, int height)
Creates the object using an already created canvas pattern.
This is mainly used by tiles.- Parameters:
canvasPattern
- canvas pattern instancewidth
- width of image applied to canvasPatternheight
- height of image applied to canvasPattern- Returns:
- pattern builder instance
-
build
public Pattern build()
Builds and returns a pattern instance.- Returns:
- a pattern instance, built by the builder.
-
build
public static Pattern build(NativeObject nativeObject)
Creates a pattern, previously stored in the a native java script object- Parameters:
nativeObject
- native java script object wrapped by pattern.- Returns:
- a pattern instance, built by the builder.
-
retrieve
public static Pattern retrieve(CanvasPatternItem canvasPattern)
Retrieves a cached pattern by aCanvasPatternItem
instance.
If the pattern doesn't exist, returnsnull
.- Parameters:
canvasPattern
- the canvas pattern to use for searching- Returns:
- a cached pattern by a
CanvasPatternItem
instance.
If the pattern doesn't exist, returnsnull
-
-