Texture Transforms

class arcade.texture.transforms.VertexOrder(value)[source]

Bases: Enum

Order for texture coordinates.

LOWER_LEFT = 2
LOWER_RIGHT = 3
UPPER_LEFT = 0
UPPER_RIGHT = 1
class arcade.texture.transforms.Transform[source]

Bases:

Base class for all texture transforms.

Transforms are responsible for transforming the texture coordinates and hit box points.

order = (0, 1, 2, 3)

How texture coordinates order should be changed for this transform. upper_left, upper_right, lower_left, lower_right

static transform_hit_box_points(points: Sequence[tuple[float | int, float | int] | Vec2]) Sequence[tuple[float | int, float | int] | Vec2][source]

Transforms hit box points.

classmethod transform_texture_coordinates_order(texture_coordinates: tuple[float, float, float, float, float, float, float, float], order: tuple[int, int, int, int]) tuple[float, float, float, float, float, float, float, float][source]

Change texture coordinates order by a vertex order.

Parameters:
  • texture_coordinates – Texture coordinates to transform

  • order – The new order

classmethod transform_vertex_order(order: tuple[int, int, int, int]) tuple[int, int, int, int][source]

Transforms the vertex order with the incoming order.

This gives us important metadata on how to quickly transform the texture coordinates without iterating all applied transforms.

Parameters:

order – The incoming order

Returns:

The new vertex order

class arcade.texture.transforms.Rotate90Transform[source]

Bases: Transform

Rotate 90 degrees clockwise.

order = (2, 0, 3, 1)

How texture coordinates order should be changed for this transform. upper_left, upper_right, lower_left, lower_right

static transform_hit_box_points(points: Sequence[tuple[float | int, float | int] | Vec2]) Sequence[tuple[float | int, float | int] | Vec2][source]

Transform hit box points by rotating them 90 degrees clockwise.

class arcade.texture.transforms.Rotate180Transform[source]

Bases: Transform

Rotate 180 degrees clockwise.

order = (3, 2, 1, 0)

How texture coordinates order should be changed for this transform. upper_left, upper_right, lower_left, lower_right

static transform_hit_box_points(points: Sequence[tuple[float | int, float | int] | Vec2]) Sequence[tuple[float | int, float | int] | Vec2][source]

Transform hit box points by rotating them 180 degrees clockwise.

class arcade.texture.transforms.Rotate270Transform[source]

Bases: Transform

Rotate 270 degrees clockwise.

order = (1, 3, 0, 2)

How texture coordinates order should be changed for this transform. upper_left, upper_right, lower_left, lower_right

static transform_hit_box_points(points: Sequence[tuple[float | int, float | int] | Vec2]) Sequence[tuple[float | int, float | int] | Vec2][source]

Transform hit box points by rotating them 270 degrees clockwise.

class arcade.texture.transforms.FlipLeftRightTransform[source]

Bases: Transform

Flip texture horizontally / left to right.

order = (1, 0, 3, 2)

How texture coordinates order should be changed for this transform. upper_left, upper_right, lower_left, lower_right

static transform_hit_box_points(points: Sequence[tuple[float | int, float | int] | Vec2]) Sequence[tuple[float | int, float | int] | Vec2][source]

Transform hit box points by flipping them left to right.

class arcade.texture.transforms.FlipTopBottomTransform[source]

Bases: Transform

Flip texture vertically / top to bottom.

order = (2, 3, 0, 1)

How texture coordinates order should be changed for this transform. upper_left, upper_right, lower_left, lower_right

static transform_hit_box_points(points: Sequence[tuple[float | int, float | int] | Vec2]) Sequence[tuple[float | int, float | int] | Vec2][source]

Transform hit box points by flipping them top to bottom.

class arcade.texture.transforms.TransposeTransform[source]

Bases: Transform

Transpose texture.

order = (0, 2, 1, 3)

How texture coordinates order should be changed for this transform. upper_left, upper_right, lower_left, lower_right

static transform_hit_box_points(points: Sequence[tuple[float | int, float | int] | Vec2]) Sequence[tuple[float | int, float | int] | Vec2][source]

Transform hit box points by transposing them.

class arcade.texture.transforms.TransverseTransform[source]

Bases: Transform

Transverse texture.

order = (3, 1, 2, 0)

How texture coordinates order should be changed for this transform. upper_left, upper_right, lower_left, lower_right

static transform_hit_box_points(points: Sequence[tuple[float | int, float | int] | Vec2]) Sequence[tuple[float | int, float | int] | Vec2][source]

Transform hit box points by transversing them.