Class WBrush
A brush defines the properties of how areas (the interior of shapes) are filled. A brush is defined either as a solid color or a gradient.
JavaScript exposability
A WBrush is JavaScript exposable. If a WBrush is JavaScript bound
, it can be accessed in your
custom JavaScript code through its handle's jsRef()
. At
the moment, only the getColor()
property is exposed, e.g. a brush with
the color WColor(10,20,30,255) will be represented in JavaScript as:
{
color: [10,20,30,255]
}
Warning: A WBrush that is JavaScript exposed should be modified only through its
handle
. Any attempt at modifying it will cause an exception to be
thrown.
-
Constructor Summary
ConstructorDescriptionWBrush()
Creates a brush.WBrush
(BrushStyle style) Creates a brush with the given style.WBrush
(StandardColor color) Creates a solid brush with a standard color.Creates a solid brush of a given color.Creates a gradient brush. -
Method Summary
Modifier and TypeMethodDescriptionprotected void
assignFromJSON
(com.google.gson.JsonElement value) clone()
Clone method.boolean
Indicates whether some other object is "equal to" this one.getColor()
Returns the brush color.Returns the brush gradient.Returns a JavaScript representation of the value of this object.getStyle()
Returns the fill style.void
Sets the brush color.void
setGradient
(WGradient gradient) Sets the brush gradient.void
setStyle
(BrushStyle style) Sets the brush style.Methods inherited from class eu.webtoolkit.jwt.WJavaScriptExposableObject
assignBinding, assignBinding, checkModifiable, closeTo, getJsRef, isJavaScriptBound, sameBindingAs
-
Constructor Details
-
WBrush
public WBrush()Creates a brush.Creates a brush with a BrushStyle::None fill style.
-
WBrush
Creates a brush with the given style. -
WBrush
Creates a solid brush of a given color.Creates a solid brush with the indicated
color
. -
WBrush
Creates a solid brush with a standard color.Creates a solid brush with the indicated
color
. -
WBrush
Creates a gradient brush.
-
-
Method Details
-
clone
Clone method.Clones this brush.
- Specified by:
clone
in classWJavaScriptExposableObject
-
equals
Indicates whether some other object is "equal to" this one.Returns
true
if the brushes are exactly the same. -
setStyle
Sets the brush style.- See Also:
-
getStyle
Returns the fill style.- See Also:
-
setColor
Sets the brush color.If the current style is a gradient style, then it is reset to BrushStyle::Solid.
- See Also:
-
getColor
Returns the brush color.- See Also:
-
setGradient
Sets the brush gradient.This also sets the style to BrushStyle::Gradient.
-
getGradient
Returns the brush gradient. -
getJsValue
Description copied from class:WJavaScriptExposableObject
Returns a JavaScript representation of the value of this object.Note: The value returned will reflect the current server side value of the object. If this object is JavaScript bound, this value may not reflect the actual client side value. If you need access to the client side value, use
getJsRef()
intead.- Specified by:
getJsValue
in classWJavaScriptExposableObject
-
assignFromJSON
protected void assignFromJSON(com.google.gson.JsonElement value) - Specified by:
assignFromJSON
in classWJavaScriptExposableObject
-