Package | com.yworks.canvas.drawing |
Class | public class AbstractTextPaintable |
Inheritance | AbstractTextPaintable ![]() |
Implements | IDisplayObjectCreator, IBoundsProvider |
Subclasses | SimpleTextPaintable |
IDisplayObjectCreator
implementations for drawing text.
This is an abstract class that provides factory methods that each return
a concrete subclass of this.
Property | Defined By | ||
---|---|---|---|
text : String
The text to draw. | AbstractTextPaintable | ||
textFormat : UITextFormat
The text format to use for the text. | AbstractTextPaintable |
Method | Defined By | ||
---|---|---|---|
AbstractTextPaintable(textFormat:UITextFormat)
Constructor. | AbstractTextPaintable | ||
Returns a tight rectangular area where the whole rendering
would fit into. | AbstractTextPaintable | ||
[static]
Creates a dynamic display object creator that renders the string in its created DisplayObject
using the textFormat at the given location. | AbstractTextPaintable | ||
createDisplayObject(context:IDisplayObjectContext):DisplayObject | AbstractTextPaintable | ||
AbstractTextPaintable | |||
updateDisplayObject(oldDisplayObject:DisplayObject, context:IDisplayObjectContext):DisplayObject | AbstractTextPaintable |
text | property |
text:String
The text to draw.
public function get text():String
public function set text(value:String):void
textFormat | property |
textFormat:UITextFormat
The text format to use for the text.
public function get textFormat():UITextFormat
public function set textFormat(value:UITextFormat):void
AbstractTextPaintable | () | Constructor |
public function AbstractTextPaintable(textFormat:UITextFormat)
Constructor. Should only be called from child classes.
ParameterstextFormat:UITextFormat |
calculateBounds | () | method |
public function calculateBounds(scratch:IMutableRectangle, ctx:ICanvasContext):IRectangle
Returns a tight rectangular area where the whole rendering would fit into.
Implementations can use the scratch
rectangle to put their
results in and return it as the result of the operation.
Client has to always provide a non-null
instance as
a parameter. They may however decide to return an internally
cached or dynamically created IRectangle
implementation and
disregard the scratch parameter.
If calculating the bounds is too expensive or the painting is not
bound to a certain area, this method may return null
.
If nothing is painted, this method should return an empty rectangle, where
either or both the width and height is non-positive or
ImmutableRectangle.Empty
.
Parameters
scratch:IMutableRectangle — An instance that can optionally be used to fill with the
corresponding values and be returned
| |
ctx:ICanvasContext — The context to calculate the bounds for (currently not used)
|
IRectangle — The bounds or null to indicate an unbound area
|
create | () | method |
public static function create(text:String, textFormat:UITextFormat, location:IPoint):AbstractTextPaintable
Creates a dynamic display object creator that renders the string in its created DisplayObject
using the textFormat at the given location.
Parameters
text:String — The string to draw.
| |
textFormat:UITextFormat — The text format to use.
| |
location:IPoint — Where to draw the text (top left anchor).
|
AbstractTextPaintable — A dynamic display object creator that renders the text in its created DisplayObject.
|
createDisplayObject | () | method |
public function createDisplayObject(context:IDisplayObjectContext):DisplayObject
Parameters
context:IDisplayObjectContext |
DisplayObject |
paint | () | method |
updateDisplayObject | () | method |
public function updateDisplayObject(oldDisplayObject:DisplayObject, context:IDisplayObjectContext):DisplayObject
Parameters
oldDisplayObject:DisplayObject | |
context:IDisplayObjectContext |
DisplayObject |