Graphics

Methods
25
Fields
None

Methods

MethodReturnsDescription
setColor(Color?)()Sets the colour (and the paint) for the draws that follow; nil is ignored.
getColor()ColorThe current colour (the last setColor, or the colour of the last colour paint).
setFont(Font?)()Sets the font; nil is ignored.
getFont()FontThe current font.
getFontMetrics()FontMetrics(Graphics) -> FontMetrics: The metrics of the current font, under the current text antialiasing.
getFontMetrics(Font)FontMetrics
clipRect(number, number, number, number)()Intersects the clip with a rectangle.
setClip(Shape?)()(Graphics, Shape?) -> (): Replaces the clip with shape; nil removes it.
setClip(number, number, number, number)()
getClip()Shape?The clip in user space, or nil with none.
getClipBounds()Rectangle?The clip's bounds in user space, or nil with none.
hitClip(number, number, number, number)booleanWhether a rectangle might intersect the clip (a bounds test).
create()Graphics2D(Graphics) -> Graphics2D: A new graphics object with a copy of this one's state.
create(number, number, number, number)Graphics2D
dispose()()Releases a graphics object create made; later calls on it draw nothing. The graphics render is handed is never released.
drawLine(number, number, number, number)()A line (Bresenham without antialiasing).
drawRect(number, number, number, number)()A rectangle's outline: columns x..=x+w, rows y..=y+h.
fillRect(number, number, number, number)()A filled rectangle.
clearRect(number, number, number, number)()Fills a rectangle with the background colour.
drawOval(number, number, number, number)()An oval's outline in the rectangle.
fillOval(number, number, number, number)()A filled oval in the rectangle.
drawRoundRect(number, number, number, number, number, number)()A rounded rectangle's outline.
fillRoundRect(number, number, number, number, number, number)()A filled rounded rectangle.
drawArc(number, number, number, number, number, number)()An open arc's outline (angles in degrees, counter-clockwise from 3 o'clock).
fillArc(number, number, number, number, number, number)()A filled pie arc.
drawPolygon(Polygon)()(Graphics, Polygon) -> (): A closed polygon's outline.
drawPolygon({number}, {number}, number)()
fillPolygon(Polygon)()(Graphics, Polygon) -> (): A filled polygon (even-odd).
fillPolygon({number}, {number}, number)()
drawPolyline({number}, {number}, number)()An open polyline from the first n points.

Method details

setColor

setColor: (Graphics, Color?) -> ()

Sets the colour (and the paint) for the draws that follow; nil is ignored.

getColor

getColor: (Graphics) -> Color

The current colour (the last setColor, or the colour of the last colour paint).

clipRect

clipRect: (Graphics, number, number, number, number) -> ()

Intersects the clip with a rectangle.

setClip

setClip: ((Graphics, Shape?) -> ()) & ((Graphics, number, number, number, number) -> ())

(Graphics, Shape?) -> (): Replaces the clip with shape; nil removes it.

(Graphics, number, number, number, number) -> (): Replaces the clip with a rectangle.

hitClip

hitClip: (Graphics, number, number, number, number) -> boolean

Whether a rectangle might intersect the clip (a bounds test).

create

create: ((Graphics) -> Graphics2D) & ((Graphics, number, number, number, number) -> Graphics2D)

(Graphics) -> Graphics2D: A new graphics object with a copy of this one's state.

(Graphics, number, number, number, number) -> Graphics2D: A new graphics object translated to (x, y) and clipped to (0, 0, w, h).

dispose

dispose: (Graphics) -> ()

Releases a graphics object create made; later calls on it draw nothing. The graphics render is handed is never released.

drawLine

drawLine: (Graphics, number, number, number, number) -> ()

A line (Bresenham without antialiasing).

drawRect

drawRect: (Graphics, number, number, number, number) -> ()

A rectangle's outline: columns x..=x+w, rows y..=y+h.

fillRect

fillRect: (Graphics, number, number, number, number) -> ()

A filled rectangle.

clearRect

clearRect: (Graphics, number, number, number, number) -> ()

Fills a rectangle with the background colour.

drawOval

drawOval: (Graphics, number, number, number, number) -> ()

An oval's outline in the rectangle.

fillOval

fillOval: (Graphics, number, number, number, number) -> ()

A filled oval in the rectangle.

drawRoundRect

drawRoundRect: (Graphics, number, number, number, number, number, number) -> ()

A rounded rectangle's outline.

fillRoundRect

fillRoundRect: (Graphics, number, number, number, number, number, number) -> ()

A filled rounded rectangle.

drawArc

drawArc: (Graphics, number, number, number, number, number, number) -> ()

An open arc's outline (angles in degrees, counter-clockwise from 3 o'clock).

fillArc

fillArc: (Graphics, number, number, number, number, number, number) -> ()

A filled pie arc.

drawPolygon

drawPolygon: ((Graphics, Polygon) -> ()) & ((Graphics, {number}, {number}, number) -> ())

(Graphics, Polygon) -> (): A closed polygon's outline.

(Graphics, {number}, {number}, number) -> (): A closed polygon's outline from the first n points of the two arrays.

fillPolygon

fillPolygon: ((Graphics, Polygon) -> ()) & ((Graphics, {number}, {number}, number) -> ())

(Graphics, Polygon) -> (): A filled polygon (even-odd).

(Graphics, {number}, {number}, number) -> (): A filled polygon from the first n points (even-odd).

drawPolyline

drawPolyline: (Graphics, {number}, {number}, number) -> ()

An open polyline from the first n points.