Texture
A 2D texture that can be rendered to the screen.
Constructor
-
Texture(file_path: str) -
Texture(pixel_array: PixelArray)
Parameters
file_path: Path to the image file to load.pixel_array: The pixel array to convert to a texture.
Properties
| Name | Description | Type |
|---|---|---|
flip | Whether the texture is flipped horizontally and/or vertically | Flip |
size | The original width and height of the texture | Vec2 |
alpha | The alpha modulation of the texture (0.0 to 1.0) | float |
tint | The color tint applied to the texture during rendering | Color |
Methods
Get Rect
get_rect() → RectGet the rectangle of the texture.
Returns
Rect : The dimensions of the texture as a Rect.
Make Additive
make_additive() → NoneSet the texture's blending mode to additive.
Make Multiply
make_multiply() → NoneSet the texture's blending mode to multiply.
Make Normal
make_normal() → NoneSet the texture's blending mode to normal.