pixiflash.Graphics Class
The class to emulate createjs.Graphics
Constructor
pixiflash.Graphics
()
Item Index
Properties
- BASE_64 static
Methods
a
-
x
-
y
-
radius
-
startAngle
-
endAngle
-
anticlockwise
Shortcut to arc.
Parameters:
Returns:
The Graphics instance the method is called on (useful for chaining calls.)
at
-
x1
-
y1
-
x2
-
y2
-
radius
Shortcut to arcTo.
Returns:
The Graphics instance the method is called on (useful for chaining calls.)
bf
()
pixiflash.Graphics
Placeholder method for a beginBitmapFill. Pixi does not support bitmap fills.
Returns:
The Graphics instance the method is called on (useful for chaining calls.)
bs
()
pixiflash.Graphics
Placeholder method for a beginBitmapStroke. Pixi does not support bitmap strokes.
Returns:
The Graphics instance the method is called on (useful for chaining calls.)
bt
-
cp1x
-
cp1y
-
cp2x
-
cp2y
-
x
-
y
Draws a bezier curve from the current drawing point to (x, y) using the control points (cp1x, cp1y) and (cp2x, cp2y). For detailed information, read the whatwg spec. A tiny API method "bt" also exists.
Returns:
The Graphics instance the method is called on (useful for chaining calls.)
cp
()
pixiflash.Graphics
Closes the current path, effectively drawing a line from the current drawing point to the first drawing point specified since the fill or stroke was last set. A tiny API method "cp" also exists.
Returns:
The Graphics instance the method is called on (useful for chaining calls.)
dc
-
x
-
y
-
radius
Shortcut to drawCircle.
Parameters:
Returns:
The Graphics instance the method is called on (useful for chaining calls.)
de
-
x
-
y
-
width
-
height
Override the draw ellipse method
dr
-
x
-
y
-
w
-
h
Shortcut to drawRect.
Returns:
The Graphics instance the method is called on (useful for chaining calls.)
f
-
color
Begins a fill with the specified color. This ends the current sub-path. A tiny API method "f" also exists.
Parameters:
-
color
StringA CSS compatible color value (ex. "red", "#FF0000", or "rgba(255,0,0,0.5)"). Setting to null will result in no fill.
Returns:
The Graphics instance the method is called on (useful for chaining calls.)
lf
-
colorArray
Placeholder method for a linear fill. Pixi does not support linear fills, so we just pick the first color in colorArray
Parameters:
-
colorArray
ArrayAn array of CSS compatible color values @see
f
Returns:
The Graphics instance the method is called on (useful for chaining calls.)
ls
()
pixiflash.Graphics
Placeholder method for a beginLinearGradientStroke. Pixi does not support gradient strokes.
Returns:
The Graphics instance the method is called on (useful for chaining calls.)
lt
-
x
-
y
Draws a line from the current drawing point to the specified position, which become the new current drawing point. A tiny API method "lt" also exists.
For detailed information, read the whatwg spec.
Parameters:
Returns:
The Graphics instance the method is called on (useful for chaining calls.)
mt
-
x
-
y
Moves the drawing point to the specified position. A tiny API method "mt" also exists.
Parameters:
Returns:
The Graphics instance the method is called on (useful for chaining calls).
op
()
pixiflash.Graphics
private
Open path method for drawing, ensure that the draw shape is not closed
Returns:
The Graphics instance the method is called on (useful for chaining calls.)
p
-
str
Decodes a compact encoded path string into a series of draw instructions. This format is not intended to be human readable, and is meant for use by authoring tools. The format uses a base64 character set, with each character representing 6 bits, to define a series of draw commands.
Each command is comprised of a single "header" character followed by a variable number of alternating x and y position values. Reading the header bits from left to right (most to least significant): bits 1 to 3 specify the type of operation (0-moveTo, 1-lineTo, 2-quadraticCurveTo, 3-bezierCurveTo, 4-closePath, 5-7 unused). Bit 4 indicates whether position values use 12 bits (2 characters) or 18 bits (3 characters), with a one indicating the latter. Bits 5 and 6 are currently unused.
Following the header is a series of 0 (closePath), 2 (moveTo, lineTo), 4 (quadraticCurveTo), or 6 (bezierCurveTo) parameters. These parameters are alternating x/y positions represented by 2 or 3 characters (as indicated by the 4th bit in the command char). These characters consist of a 1 bit sign (1 is negative, 0 is positive), followed by an 11 (2 char) or 17 (3 char) bit integer value. All position values are in tenths of a pixel. Except in the case of move operations which are absolute, this value is a delta from the previous x or y position (as appropriate).
For example, the string "A3cAAMAu4AAA" represents a line starting at -150,0 and ending at 150,0.
A - bits 000000. First 3 bits (000) indicate a moveTo operation. 4th bit (0) indicates 2 chars per
parameter.
n0 - 110111011100. Absolute x position of -150.0px. First bit indicates a negative value, remaining bits
indicate 1500 tenths of a pixel.
AA - 000000000000. Absolute y position of 0.
I - 001100. First 3 bits (001) indicate a lineTo operation. 4th bit (1) indicates 3 chars per parameter.
Au4 - 000000101110111000. An x delta of 300.0px, which is added to the previous x value of -150.0px to
provide an absolute position of +150.0px.
AAA - 000000000000000000. A y delta value of 0.
A tiny API method "p" also exists.
Parameters:
-
str
StringThe path string to decode.
Returns:
The Graphics instance the method is called on (useful for chaining calls.)
qt
-
cpx
-
cpy
-
x
-
y
Draws a quadratic curve from the current drawing point to (x, y) using the control point (cpx, cpy). For detailed information, read the whatwg spec. A tiny API method "qt" also exists.
Returns:
The Graphics instance the method is called on (useful for chaining calls.)
r
-
x
-
y
-
w
-
h
Shortcut to drawRect.
Returns:
The Graphics instance the method is called on (useful for chaining calls.)
rc
-
x
-
y
-
w
-
h
-
radius
Shortcut to drawRoundRectComplex. Not supported by pixiflash
Parameters:
Returns:
The Graphics instance the method is called on (useful for chaining calls.)
rf
-
colorArray
Placeholder method for a radial fill. Pixi does not support radial fills, so we just pick the first color in colorArray
Parameters:
-
colorArray
ArrayAn array of CSS compatible color values @see
f
Returns:
The Graphics instance the method is called on (useful for chaining calls.)
rr
-
x
-
y
-
w
-
h
-
radius
Shortcut to drawRoundedRect.
Parameters:
Returns:
The Graphics instance the method is called on (useful for chaining calls.)
rs
()
pixiflash.Graphics
Placeholder method for a beginRadialGradientStroke. Pixi does not support gradient strokes.
Returns:
The Graphics instance the method is called on (useful for chaining calls.)
s
-
color
Begins a stroke with the specified color. This ends the current sub-path. A tiny API method "s" also exists.
Parameters:
-
color
StringA CSS compatible color value (ex. "#FF0000", "red", or "rgba(255,0,0,0.5)"). Setting to null will result in no stroke.
Returns:
The Graphics instance the method is called on (useful for chaining calls.)
sd
()
pixiflash.Graphics
Placeholder method for a setStrokeDash. Pixi does not support dashed strokes.
Returns:
The Graphics instance the method is called on (useful for chaining calls.)
ss
-
thickness
-
[caps=0]
-
[joints=0]
-
[miterLimit=10]
-
[ignoreScale=false]
Sets the stroke style. Like all drawing methods, this can be chained, so you can define the stroke style and color in a single line of code like so:
myGraphics.setStrokeStyle(8,"round").beginStroke("#F00");
A tiny API method "ss" also exists.
Parameters:
-
thickness
NumberThe width of the stroke.
-
[caps=0]
String | Number optionalIndicates the type of caps to use at the end of lines. One of butt, round, or square. Defaults to "butt". Also accepts the values 0 (butt), 1 (round), and 2 (square) for use with the tiny API.
-
[joints=0]
String | Number optionalSpecifies the type of joints that should be used where two lines meet. One of bevel, round, or miter. Defaults to "miter". Also accepts the values 0 (miter), 1 (round), and 2 (bevel) for use with the tiny API.
-
[miterLimit=10]
Number optionalIf joints is set to "miter", then you can specify a miter limit ratio which controls at what point a mitered joint will be clipped.
-
[ignoreScale=false]
Boolean optionalIf true, the stroke will be drawn at the specified thickness regardless of active transformations.
Returns:
The Graphics instance the method is called on (useful for chaining calls.)
Properties
BASE_64
Object
private
final
static
Map of Base64 characters to values. Used by Graphics/decodePath.