shapes

PP. shapes

The namespace containing functions for the management of differnt kind of shapes.
Source:

Methods

(static) arc_add(scene, x, y, radius, start_angle, end_angle, anticlockwise, fill_color, fill_alpha)

Add and position a new arc into the scene.
Source:
Parameters:
Name Type Description
scene object The scene object where to add the image.
x number The horizontal initial position in pixels of the shape.
y number The vertical initial position in pixels of the shape.
radius number The radius in pixels
start_angle number The starting angle in degrees
end_angle number The final angle in degrees
anticlockwise boolean The start and final angle should be considered anticlockwise?
fill_color string The 6-digits HEX representation of the color in the format 0xABCDEF.
fill_alpha number The alpha value between 0 and 1.
Returns:
A shape object representing an arc.

(static) destroy(shape_obj)

Remove a shape object (rectangle, triangle, ...) from the scene
Source:
Parameters:
Name Type Description
shape_obj object The scene object to destroy and remove from the scene.

(static) destroy(shape_obj, stroke_width, stroke_color, stroke_alpha)

Set the style, color, and alpha of a given shape.
Source:
Parameters:
Name Type Description
shape_obj object The scene object to destroy and remove from the scene.
stroke_width number The thikness of the stroke.
stroke_color string The 6-digits HEX representation of the color in the format 0xABCDEF.
stroke_alpha number The alpha value between 0 and 1.

(static) polygon_add(scene, x, y, points, fill_color, fill_alpha)

Add and position a new polygon (of an arbitrary number of edges) into the scene.
Source:
Parameters:
Name Type Description
scene object The scene object where to add the image.
x number The horizontal initial position in pixels of the shape.
y number The vertical initial position in pixels of the shape.
points array The array of points of the polygon: [x1, y1, x2, y2, ...]
fill_color string The 6-digits HEX representation of the color in the format 0xABCDEF.
fill_alpha number The alpha value between 0 and 1.
Returns:
A shape object representing a polygon.

(static) rectangle_add(scene, x, y, width, height, fill_color, fill_alpha)

Add and position a new rectangle into the scene.
Source:
Parameters:
Name Type Description
scene object The scene object where to add the image.
x number The horizontal initial position in pixels of the shape.
y number The vertical initial position in pixels of the shape.
width number The width of the rectangle in pixels.
height number The height of the rectangle in pixels.
fill_color string The 6-digits HEX representation of the color in the format 0xABCDEF.
fill_alpha number The alpha value between 0 and 1.
Returns:
A shape object representing a rectangle.

(static) text_add(scene, x, y, text)

Add and position a new piece of text into the scene.
Source:
Parameters:
Name Type Description
scene object The scene object where to add the image.
x number The horizontal initial position in pixels of the shape.
y number The vertical initial position in pixels of the shape.
text string The text to be written in the scene.
Returns:
A shape object representing the text.

(static) text_change(text_instance, newtext)

Modify the text of an Text Object
Source:
Parameters:
Name Type Description
text_instance object the object containing the text to modify
newtext string The new text to modify

(static) text_styled_add(scene, x, y, text, fontSize, fontFamily, fontStyle, color, background_color, pivot_x, pivot_y)

Add and position a new piece of text into the scene with style.
Source:
Parameters:
Name Type Description
scene object The scene object where to add the image.
x number The horizontal initial position in pixels of the shape.
y number The vertical initial position in pixels of the shape.
text string The text to be written in the scene.
fontSize number The dimension of the text in pixel.
fontFamily string The font family to use.
fontStyle string The style of the font to be used ("normal", "italic", "oblique", "bold").
color string The 6-digits HEX representation of the text color in the format 0xABCDEF.
background_color string The 6-digits HEX representation of the background color in the format 0xABCDEF. May be null.
pivot_x number The pivot of the text on the x axis (0 to 1).
pivot_y number The pivot of the text on the y axis (0 to 1).
Returns:
A shape object representing the text.