Constructor
new Graphics(obj)
Creates a new instance of the Graphics class.
Parameters:
Name | Type | Description |
---|---|---|
obj |
rune.display.DisplayObject | The display object to which the class is linked. |
- Source:
Members
autoClear :boolean
Whether the object should clear its rendering queue after it has
completed its rendering of the current queue. By default, the queue is
preserved, which results in drawn graphics remaining until it is
manually cleared, or changed via new drawing commands.
Type:
- boolean
- Default Value:
- false
- Source:
(readonly) numOperations :number
Returns the number of drawing calls queued in the Graphics object. If the
result is 0, no graphics are drawn by the API.
Type:
- number
- Source:
Methods
clear() → {undefined}
Clears the graphics that were drawn with this Graphics object.
- Source:
Returns:
- Type
- undefined
drawArc(x, y, r, sa, ea, c, s, aopt) → {undefined}
Draws a circular arc centered at (x, y) with a radius of r. The path starts
at sa, ends at ea, and travels in the direction given by counterclockwise
(defaulting to clockwise).
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
x |
number | The horizontal coordinate of the arc's center. | |
y |
number | The vertical coordinate of the arc's center. | |
r |
number | The arc's radius. Must be positive. | |
sa |
number | The angle at which the arc starts in radians, measured from the positive x-axis. | |
ea |
number | The angle at which the arc ends in radians, measured from the positive x-axis. | |
c |
string | The color of the line. | |
s |
number | The thickness (size) of the line. | |
a |
number |
<optional> |
An optional boolean value. If true, draws the arc counter-clockwise between the start and end angles. The default is false (clockwise). |
- Source:
Returns:
- Type
- undefined
drawFill(c) → {undefined}
Draw fill color.
Parameters:
Name | Type | Description |
---|---|---|
c |
string | Fill color, specified as a DOMString. |
- Source:
Returns:
- Type
- undefined
drawImage(img, ox, oy, ow, oh, cxopt, cyopt, cwopt, chopt) → {undefined}
Draw a (32-bit) bitmap image.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
img |
HTMLImageElement | Image to draw. | |
ox |
number | Image x position. | |
oy |
number | Image y position. | |
ow |
number | Image width. | |
oh |
number | Image height. | |
cx |
number |
<optional> |
Crop x position. |
cy |
number |
<optional> |
Crop y position. |
cw |
number |
<optional> |
Crop width. |
ch |
number |
<optional> |
Crop height. |
- Source:
Returns:
- Type
- undefined
drawImageFill(img, x, y, w, h) → {undefined}
Draw with a picture as a flood filling.
Parameters:
Name | Type | Description |
---|---|---|
img |
HTMLImageElement | Image to draw. |
x |
number | Image x position. |
y |
number | Image y position. |
w |
number | Image width. |
h |
number | Image height. |
- Source:
Returns:
- Type
- undefined
drawLine(x1, y1, x2, y2, c, s) → {undefined}
Draw a line.
Parameters:
Name | Type | Description |
---|---|---|
x1 |
number | Start x position. |
y1 |
number | Start y position. |
x2 |
number | End x position. |
y2 |
number | End y position. |
c |
string | Line color. |
s |
number | Line thickness. |
- Source:
Returns:
- Type
- undefined
drawRect(x, y, w, h, c, s) → {undefined}
Draw a rectangle.
Parameters:
Name | Type | Description |
---|---|---|
x |
number | The x position of the upper left corner of the rectangle. |
y |
number | The y position of the upper left corner of the rectangle. |
w |
number | The width of the rectangle. |
h |
number | The height of the rectangle. |
c |
string | Line color. |
s |
number | Line thickness. |
- Source:
Returns:
- Type
- undefined
drawRectFill(x, y, w, h, c) → {undefined}
Draw a filled rectangle.
Parameters:
Name | Type | Description |
---|---|---|
x |
number | The x position of the upper left corner of the rectangle. |
y |
number | The y position of the upper left corner of the rectangle. |
w |
number | The width of the rectangle. |
h |
number | The height of the rectangle. |
c |
string | Fill color. |
- Source:
Returns:
- Type
- undefined