S or /

SourceClass TextureHandle

from egui import TextureHandle
class TextureHandle:

Used to paint images.

An image is pixels stored in RAM, and represented using ImageData. Before you can paint it however, you need to convert it to a texture.

If you are using egui, use egui.Context.load_texture.

The TextureHandle can be cloned cheaply. When the last TextureHandle for specific texture is dropped, the texture is freed.

See also TextureManager.

Properties§

Source@property def size(self, /) -> tuple[int, int]§

width x height

Source@property def size_vec2(self, /) -> Vec2§

width x height

@property def texture_id(self, /) -> TextureId§

Methods§

Sourcedef aspect_ratio(self, /) -> float§

width / height

Sourcedef byte_size(self, /) -> int§

width x height x bytes_per_pixel

def clone_ref(self, /) -> TextureHandle§
Sourcedef id(self, /) -> TextureId§
Sourcedef name(self, /) -> str§

Debug-name.

Source@staticmethod def new(ctx: Context, name: str, image: ColorImage, texture_options: TextureOptions) -> TextureHandle§

If you are using egui, use egui.Context.load_texture instead.

Sourcedef set(self, /, image: ColorImage, texture_options: TextureOptions) -> None§

Assign a new image to an existing texture.

Sourcedef set_partial(self, /, pos: tuple[int, int], image: ColorImage, texture_options: TextureOptions) -> None§

Assign a new image to a subregion of the whole texture.

def sized(self, /, size: Vec2 |None = None) -> SizedTexture§