Class

ShumateVectorSpriteSheet

Description [src]

final class Shumate.VectorSpriteSheet : GObject.Object {
  /* No available fields */
}

A collection of ShumateVectorSprites.

Sprites are used as icons in symbols or as the pattern for a fill layer.

Most MapLibre stylesheets provide their spritesheet as a PNG image and a JSON description of the sprites. This spritesheet can be added using shumate_vector_sprite_sheet_add_page(). Sprites can also be added individually using shumate_vector_sprite_sheet_add_sprite().

Some map styles rely on application code to provide some or all of their sprites. This is supported using a fallback function, which can be set using shumate_vector_sprite_sheet_set_fallback(). This function can generate sprites on demand. For example, it could load a symbolic icon from the GtkIconTheme or render a custom highway shield.

HiDPI support

Map styles should provide a double resolution spritesheet for high DPI displays. That spritesheet can be added as a separate page. The ShumateVectorSpriteSheet will pick the best sprites for the display’s scale factor.

If a fallback function is set, it receives the requested scale factor as an argument. It should use this to generate the sprite at the correct size. For example, if the scale factor is 2, the image should be twice as large (but the sprite’s width and height should be the same).

Thread Safety

ShumateVectorSpriteSheet is thread safe.

Available since:1.1

Ancestors

  • GObject

Constructors

shumate_vector_sprite_sheet_new

Creates a new, empty ShumateVectorSpriteSheet.

Available since: 1.1

Instance methods

shumate_vector_sprite_sheet_add_page

Adds a page to the spritesheet.

Available since: 1.1

shumate_vector_sprite_sheet_add_sprite

Adds a sprite to the spritesheet.

Available since: 1.1

shumate_vector_sprite_sheet_get_sprite

Gets a sprite from the spritesheet.

Available since: 1.1

shumate_vector_sprite_sheet_set_fallback

Sets a fallback function to generate sprites.

Available since: 1.1

Class structure

struct ShumateVectorSpriteSheetClass {
  GObjectClass parent_class;
  
}
Class members
parent_class
GObjectClass
  No description available.