The functions in this module can be used within the scene.Scene.draw() method when using the classic render loop mode of the scene module.
Set the blend mode for following drawing operations. mode can be BLEND_NORMAL, BLEND_ADD or BLEND_MULTIPLY.
Set the current stroke color.
Disables filling rectangles and ellipses. Combined with stroke_weight() and stroke() (to set the color), this allows you to draw shape outlines. Alternatively, you can set a transparent fill color with fill(0, 0, 0, 0).
Disables the drawing of borders around rectangles and ellipses.
Disables tinting images. Equivalent to tint(1, 1, 1, 1).
Set the current stroke color.
Sets the current stroke weight (line width) for the rect() and ellipse() functions.
Use the given scene.Shader for subsequent drawing.
Fill the background of the current scene with a solid color.
Draw an ellipse in a rectangle with the current settings for fill color, stroke color and stroke width.
Draw a named image into a rectangle.
The name parameter can be a built-in image name or an image identifier that is returned from render_text() or load_pil_image().
If the w(idth) and h(eight) parameters are omitted, the image is drawn at the full size with the origin at (x, y). Using the optional from_x, from_y, from_w, and from_h parameters, you can draw a rectangular portion of the image instead of the whole image.
Draw a named image into a quad.
The name parameter can be a built-in image name or an image identifier that is returned from render_text() or load_pil_image().
The corners of the quad that the image is drawn into is given by the first set of xn/yn values. The from_xn/from_yn values can optionally be used to draw a quadrangular portion of the image instead of the whole image.
Draw a straight line between two points with the current stroke() color and stroke_weight().
Draw a rectangle with the current settings for fill color, stroke color and stroke width.
Draw a string at a given point with a given font. The alignment parameter has 9 possible values that correspond to the positions on a numeric keypad (with 1 in the bottom lefthand corner). The default (5) centers the text on the point.
The color of the text can be set by calling the tint() function.
Set the current tint color that is used for drawing images and text.
A white tint color is the default and causes images to be drawn in their natural colors. Setting a white color (r = g = b = 1.0) with an alpha value < 1.0 makes the image translucent.
Draw a triangle strip with the given points (a list of 2-tuples), using the current fill color or an image. If an image is used, the tex_coords list should be a list of UV coordinates (of the same length as points).
Translates the current transformation matrix.
Restores the transformation matrix before the last call of push_matrix(). This is usually used in combination with rotate(), translate() and scale().
Pushes the current transformation matrix on the stack. This is usually used in combination with rotate(), translate() and scale().
Rotate the current transformation matrix. The angle is in degrees.
Scale the current transformation matrix
Loads the named image. This can be used to improve performance, e.g. by loading all images that are about to be used in the setup() method of your Scene.
Load the image at the given file path and return a name that can be used with the image() drawing function.
Loads a PIL Image into a scene and returns a name that can be used with the image() drawing function.
Note
Only images using the ‘RGBA’ mode are supported at the moment.
Render a string of text as an image name (that can be used with the image() function). Returns a tuple of the name and a Size object.
This can be used to determine the size of a string before drawing it, or to repeatedly draw the same text slightly more efficiently.
Remove an image from the scene cache. This is meant to be used with image names returned from load_pil_image() that are no longer needed.