Represents a hardware-accelerated image that can be efficiently rendered.
Texture(file_path: str | PathLike[str], filter: FilterMode = FilterMode.DEFAULT, access: TextureAccess = TextureAccess.STATIC, usage: TextureUsage = TextureUsage.DRAWABLE) → TextureTexture(file_path: str | PathLike[str], filter: FilterMode = FilterMode.DEFAULT, access: TextureAccess = TextureAccess.STATIC, usage: TextureUsage = TextureUsage.DRAWABLE) → Texture
Texture(pixel_array: PixelArray, filter: FilterMode = FilterMode.DEFAULT, access: TextureAccess = TextureAccess.STATIC, usage: TextureUsage = TextureUsage.DRAWABLE) → TextureTexture(pixel_array: PixelArray, filter: FilterMode = FilterMode.DEFAULT, access: TextureAccess = TextureAccess.STATIC, usage: TextureUsage = TextureUsage.DRAWABLE) → Texture
Texture(width: int, height: int, filter: FilterMode = FilterMode.DEFAULT, usage: TextureUsage = TextureUsage.DRAWABLE) → TextureTexture(width: int, height: int, filter: FilterMode = FilterMode.DEFAULT, usage: TextureUsage = TextureUsage.DRAWABLE) → Texture
Represents a hardware-accelerated image that can be efficiently rendered.
| Name | Description | Type |
|---|---|---|
alpha | Get or set the alpha modulation of the texture as a float between 0.0 and 1.0. | float |
clip_area | Get or set the clip area (atlas region) of the texture. | Rect |
flip | The flip settings for horizontal and vertical mirroring. | Texture.Flip |
height | The height of the texture in pixels. | int |
size | The dimensions of the texture as a Vec2. | Vec2 |
tint | Get or set the color tint applied to the texture. | Color |
usage | The usage flags describing how the texture can be used. | TextureUsage |
width | The width of the texture in pixels. | int |
get_rect() → Rectget_rect() → RectReturn a Rect with position (0, 0) and the texture's dimensions.
Returns
Rect : A rectangle representing the texture's bounds.
has_usage(usage: TextureUsage) → boolhas_usage(usage: TextureUsage) → boolCheck whether the texture was created with a specific usage flag.
Args
usage : Usage flag to test.Returns
bool : True if the usage flag is present.
make_additive() → Nonemake_additive() → NoneSet the texture to use additive blending mode.
In additive mode, the texture's colors are added to the destination, creating bright, glowing effects.
make_multiply() → Nonemake_multiply() → NoneSet the texture to use multiply blending mode.
In multiply mode, the texture's colors are multiplied with the destination, creating darkening and shadow effects.
make_normal() → Nonemake_normal() → NoneSet the texture to use normal (alpha) blending mode.
This is the default blending mode for standard transparency effects.