public final class Utilities extends Object
Modifier and Type | Field and Description |
---|---|
static String |
CSS_BACKGROUND_COLOR_PROPERTY
Constant for CSS property for
IsColor . |
static String |
CSS_BACKGROUND_IMAGE_PROPERTY
Constant for CSS property for
Gradient . |
static String |
CSS_BACKGROUND_PROPERTY
Constant for CSS property for
Pattern . |
static String |
CSS_BACKGROUND_SIZE_PROPERTY
Constant for CSS property for
Gradient . |
static String |
CSS_BORDER_COLOR_PROPERTY
Constant for CSS property for
IsColor , for border. |
static String |
CSS_BORDER_IMAGE_PROPERTY
Constant for CSS property for
Gradient , for border. |
static String |
CSS_BORDER_PROPERTY
Constant for CSS property for
Pattern for border. |
static String |
CSS_FONT_PROPERTY
Constant for CSS property for font.
|
Modifier and Type | Method and Description |
---|---|
static String |
applyTemplate(String template,
Object... values)
Creates a string in order to change a template filling with the replacements.
The replacement must be set as following: |
static Style.Cursor |
getCursorOfChart(IsChart chart)
Returns the cursor currently set into chart.
|
static String |
toCSSBackgroundProperty(FillStrokeStyle style,
int width,
int height)
Returns a URL CSS property for the current content of a fill or stroke canvas style instance.
|
static String |
toCSSBackgroundProperty(Gradient gradient)
Returns the CSS syntax to represent the gradient.
The dimension of canvas pattern image will be the dimension of pattern. |
static String |
toCSSBackgroundProperty(Image image)
Returns a URL CSS property for the current content of an image instance.
|
static String |
toCSSBackgroundProperty(ImageElement image)
Returns a URL CSS property for the current content of an image element instance.
|
static String |
toCSSBackgroundProperty(ImageResource image)
Returns a URL CSS property for the current content of an image resource instance.
|
static String |
toCSSBackgroundProperty(Pattern pattern)
Returns the CSS syntax to represent the pattern.
The dimension of canvas pattern image will be the dimension of pattern. |
static String |
toCSSBackgroundProperty(Pattern pattern,
int squareSize)
Returns the CSS syntax to represent the pattern.
The dimension of canvas pattern image is unique then the image of pattern is a square. |
static String |
toCSSBackgroundProperty(Pattern pattern,
int width,
int height)
Returns the CSS syntax to represent the pattern.
|
static String |
toCSSBackgroundProperty(String dataUrl)
Returns a URL CSS property for the data URL for the current content of the canvas element.
|
static String |
toCSSBackgroundProperty(String dataUrl,
Context2d.Repetition repetition)
Returns a URL CSS property for the data URL for the current content of the canvas element.
|
static String |
toCSSFontProperty(FontStyle style,
int size,
String family)
Builds the font string (shorthand property of CSS font) to use in the canvas object.
The format is [font-style] [font-variant] [font-weight] [font-size] [font-family]. See here CSS specification. |
static ImageElement |
toImageElement(Image image)
Creates a image element by image widget that displays the image at a given URL.
|
static ImageElement |
toImageElement(Image image,
int width,
int height)
Creates a image element by image widget that displays the image at a given URL, forcing the size.
|
static ImageElement |
toImageElement(ImageResource image)
Creates a image element by image resource which provides access to image data at runtime.
|
static ImageElement |
toImageElement(ImageResource image,
int width,
int height)
Creates a image element by image resource which provides access to image data at runtime, forcing the size.
|
static ImageElement |
toImageElement(String url)
Creates a image element by a data URL which is a URI scheme that provides a way to in-line data in a document, and it's
commonly used to embed images in HTML and CSS.
|
static ImageElement |
toImageElement(String url,
int width,
int height)
Creates a image element by a data URL which is a URI scheme that provides a way to in-line data in a document, and it's
commonly used to embed images in HTML and CSS, forcing the size.
|
public static final String CSS_FONT_PROPERTY
public static final String CSS_BACKGROUND_PROPERTY
Pattern
.public static final String CSS_BORDER_PROPERTY
Pattern
for border.public static final String CSS_BACKGROUND_IMAGE_PROPERTY
Gradient
.public static final String CSS_BACKGROUND_SIZE_PROPERTY
Gradient
.public static final String CSS_BORDER_IMAGE_PROPERTY
Gradient
, for border.public static final String CSS_BACKGROUND_COLOR_PROPERTY
IsColor
.public static final String CSS_BORDER_COLOR_PROPERTY
IsColor
, for border.public static String toCSSFontProperty(FontStyle style, int size, String family)
style
- font style to usesize
- font sizefamily
- font familypublic static String toCSSBackgroundProperty(Pattern pattern)
pattern
- object to export into CSSpublic static String toCSSBackgroundProperty(Pattern pattern, int squareSize)
pattern
- object to export into CSSsquareSize
- size of image applied to canvasPattern to be a squarepublic static String toCSSBackgroundProperty(Pattern pattern, int width, int height)
pattern
- object to export into CSSwidth
- width of image applied to canvasPatternheight
- height of image applied to canvasPatternpublic static String toCSSBackgroundProperty(String dataUrl)
dataUrl
- the data URL for the current content of the canvas elementpublic static String toCSSBackgroundProperty(String dataUrl, Context2d.Repetition repetition)
dataUrl
- the data URL for the current content of the canvas elementrepetition
- repetition of imagepublic static String toCSSBackgroundProperty(FillStrokeStyle style, int width, int height)
style
- fill or stroke canvas style instancewidth
- width of image applied to canvasPatternheight
- height of image applied to canvasPatternpublic static String toCSSBackgroundProperty(ImageResource image)
image
- image resource instance to get as CSS propertypublic static String toCSSBackgroundProperty(Image image)
image
- image instance to get as CSS propertypublic static String toCSSBackgroundProperty(ImageElement image)
image
- image element instance to fet as CSS propertypublic static String toCSSBackgroundProperty(Gradient gradient)
gradient
- object to export into CSSpublic static ImageElement toImageElement(String url)
url
- a URI scheme that provides a way to in-line datanull
if argument is not consistentpublic static ImageElement toImageElement(String url, int width, int height)
url
- a URI scheme that provides a way to in-line datawidth
- width of imageheight
- height of imagenull
if argument is not consistentpublic static ImageElement toImageElement(ImageResource image)
image
- image resource instancenull
if argument is not consistentpublic static ImageElement toImageElement(ImageResource image, int width, int height)
image
- image resource instancewidth
- width of imageheight
- height of imagenull
if argument is not consistentpublic static ImageElement toImageElement(Image image)
image
- image widget instancenull
if argument is not consistentpublic static ImageElement toImageElement(Image image, int width, int height)
image
- image widget instancewidth
- width of imageheight
- height of imagenull
if argument is not consistentpublic static Style.Cursor getCursorOfChart(IsChart chart)
chart
- chart instanceStyle.Cursor.DEFAULT
.public static String applyTemplate(String template, Object... values)
{0} ... {1} ... {n}where the value into the brackets represents the index of the obecjt into the array, passed as argument.
template
- template of messagevalues
- values to apply into template