Namespace: graphics

rat. graphics

rat graphics module
Source:

Classes

Color
Image
ImageRef

Methods

(static) drawArc()

Draw an arc (part of a circle)
Source:

(static) drawCircle(circ, yopt, ropt)

Draw an open (not filled) circle (rat.shapes.Circle)
Parameters:
Name Type Attributes Description
circ Object | number
y number <optional>
r number <optional>
Source:

(static) drawLine(p1, p2, p3, p4opt)

Draw a line
Parameters:
Name Type Attributes Description
p1 Object | Number
p2 Object | Number
p3 Object | Number
p4 Number <optional>
Source:

(static) drawRect(rect, opsopt)

Draw a rectangle (rat.shapes.Rect)
Parameters:
Name Type Attributes Description
rect Object
ops Object <optional>
Source:

(static) drawSegmentOrArc(segment, color, widthopt)

Draws the line segment or arc.
Parameters:
Name Type Attributes Description
segment Object | Object represents the arc or strait line.
color string | Object of the segment.
width number <optional>
of the segment.
Source:

(static) drawShapeList(list)

Draw a list of shapes (see r_collision2d)
Parameters:
Name Type Description
list Array
Source:

(static) drawText(text, xopt, yopt, maxWidthopt)

Draw some text
Parameters:
Name Type Attributes Description
text string
x number <optional>
y number <optional>
maxWidth number <optional>
Source:

(static) drawTextArc()

See http: www.html5canvastutorials.com/labs/html5-canvas-text-along-arc-path/
Source:

(static) init(canvasID)

Init rat.graphics
Parameters:
Name Type Description
canvasID string optional
Source:

(static) popPerfMark()

Pop off a gfx profiling mark. Only works under wraith
Source:

(static) pushPerfMark()

Push a gfx profiling mark. Only works under wraith
Source:

(static) resetTransform(tctxopt)

Reset the transformation matrix
Parameters:
Name Type Attributes Description
tctx Object <optional>
Source:

(static) restore()

Restore a saved rendering state
Source:

(static) rotate(r, tctxopt)

Rotate the current matrix
Parameters:
Name Type Attributes Description
r number
tctx Object <optional>
Source:

(static) save(optionsopt)

Save the current rendering state
Parameters:
Name Type Attributes Description
options Object <optional>
{ignoreRatMat:true} You can never set ignoreRatMat to false if it was true. it goes back to false after a .restore
Source:

(static) scale(x, y, tctxopt)

Scale the current matrix
Parameters:
Name Type Attributes Description
x number
y number
tctx Object <optional>
Source:

(static) setImageSmoothing()

set canvas imagesmoothing flag on/off return previously set smoothing flag
Source:

(static) setupMatrixForRendering()

Setup the matrix to have any global translation or scale wanted by the game.
Source:

(static) transformPoint(destopt)

Parameters:
Name Type Attributes Description
dest Object <optional>
Source:

(static) translate(x, y, tctxopt)

Translate the current matrix
Parameters:
Name Type Attributes Description
x number
y number
tctx Object <optional>
Source: