VectorSprite#

Added in version 1.1.

class VectorSprite(**properties: Any)#

Superclasses: Object

Implemented Interfaces: Paintable, SymbolicPaintable

A sprite used to draw textures or icons.

Symbolic icons#

If a sprite is created from a SymbolicPaintable source, such as a symbolic icon, then when the sprite is part of a symbol layer it will be drawn using the icon-color property (or the text color, if the sprite is part of a formatted string).

Constructors#

class VectorSprite
classmethod new(source_paintable: Paintable) VectorSprite#

Creates a new VectorSprite using the paintable’s intrinsic size.

Added in version 1.1.

Parameters:

source_paintable – a Paintable

classmethod new_full(source_paintable: Paintable, width: int, height: int, scale_factor: float, source_rect: Rectangle | None = None) VectorSprite#

Creates a new VectorSprite with the given size, scale factor, and area of the source paintable.

Added in version 1.1.

Parameters:
  • source_paintable – a Paintable

  • width – the width of the sprite in pixels

  • height – the height of the sprite in pixels

  • scale_factor – the intended scale factor of the sprite

  • source_rect – the source rectangle of the sprite, or None to use the entire paintable

Methods#

class VectorSprite
get_height() int#

Gets the height at which the sprite should be drawn.

Added in version 1.1.

get_scale_factor() float#

Gets the intended scale factor of the sprite.

Added in version 1.1.

get_source_paintable() Paintable#

Gets the source Paintable used to draw the sprite.

Note that VectorSprite also implements Paintable. In most cases, you should draw the sprite rather than the original paintable.

Added in version 1.1.

get_source_rect() Rectangle | None#

Gets the source rectangle of the sprite.

Added in version 1.1.

get_width() int#

Gets the width at which the sprite should be drawn.

Added in version 1.1.

Properties#

class VectorSprite
props.height: int#

The type of the None singleton.

Added in version 1.1.

props.scale_factor: float#

The type of the None singleton.

Added in version 1.1.

props.source_paintable: Paintable#

The type of the None singleton.

Added in version 1.1.

props.source_rect: Rectangle#

The type of the None singleton.

Added in version 1.1.

props.width: int#

The type of the None singleton.

Added in version 1.1.