Class Canvas
Inheritance
Object | Canvas 🡄 CustomCanvas 🡄 Object |
Properties
Brush | The brush object. |
Font | The font object |
Height | Height of the canvas. |
Pen | The pen object. |
Width | Width of the canvas. |
Methods
Inheritance
- Object
- Canvas 🡄 CustomCanvas 🡄 Object
Properties
- Brush
-
The brush object.
Type:
- Font
-
The font object
Type:
- Height
-
Height of the canvas.
Type:
integer - Pen
-
The pen object.
Type:
- Width
-
Width of the canvas.
Type:
integer
Methods
- clear ()
- Clears the canvas.
- copyRect ( dest_x1, dest_y1, dest_x2, dest_y2, sourceCanvas, source_x1, source_y1, source_x2, source_y2 )
-
Draws an image from one source to another.
Useful in cases of doublebuffering.
Parameters:
- dest_x1
- dest_y1
- dest_x2
- dest_y2
- sourceCanvas
- source_x1
- source_y1
- source_x2
- source_y2
- draw ( x, y, graphic )
-
Draw the image of a specific Graphic class.
Parameters:
- x integer
- y integer
- graphic
- ellipse ( x1, y1, x2, y2 )
-
Parameters:
- x1
- y1
- x2
- y2
- fillRect ( x1, y1, x2, y2 )
-
Parameters:
- x1
- y1
- x2
- y2
- floodFill ( x, y, color, opt )
-
Fills the picture till/with a color.
filltype can be: - fsSurface: fill till the color (it fills all except this color)
- fsBorder: fill this color (it fills only connected pixels of this color)Parameters:
- x
- y
- color (default=brush.Color) (optional)
- opt ] filltype (default=fsSurface)
- getBrush ()
-
Returns the brush object of this canvas.
Returns:
- getClipRect ()
-
Returns a table containing the fields Left, Top, Right and Bottom, which define the invalidated region of the graphical object.
Use this to only render what needs to be rendered in the onPaint event of objects.
Returns:
- getFont ()
-
Returns the font object of this canvas.
Returns:
- getHeight ()
-
Returns:
-
integer
- getPen ()
-
Returns the pen object of this canvas.
Returns:
- getPenPosition ()
- getPixel ( x, y )
-
Parameters:
- x
- y
- getTextHeight ( text )
-
Parameters:
- text
- getTextWidth ( text )
-
Parameters:
- text
- getWidth ()
-
Returns:
-
integer
- gradientFill ( x1, y1, x2, y2, startcolor, stopcolor, direction )
-
Gradient fills a rectangle.
Direction can be 0 or 1. 0=Vertical 1=Horizontal.
Parameters:
- x1
- y1
- x2
- y2
- startcolor
- stopcolor
- direction integer
- line ( sourcex, sourcey, destinationx, destinationy )
-
Parameters:
- sourcex
- sourcey
- destinationx
- destinationy
- lineTo ( destinationx, destinationy )
-
Parameters:
- destinationx
- destinationy
- rect ( x1, y1, x2, y2 )
-
Parameters:
- x1
- y1
- x2
- y2
- setPenPosition ( x, y )
-
Parameters:
- x integer
- y integer
- setPixel ( x, y, color )
-
Parameters:
- x
- y
- color
- textOut ( x, y, text )
-
Parameters:
- x
- y
- text