Freeciv-3.2
Loading...
Searching...
No Matches
Data Structures | Functions
sprite.h File Reference
#include <gtk/gtk.h>
#include "sprite_g.h"

Go to the source code of this file.

Data Structures

struct  sprite
 

Functions

struct spritesprite_scale (struct sprite *src, int new_w, int new_h)
 
void sprite_get_bounding_box (struct sprite *sprite, int *start_x, int *start_y, int *end_x, int *end_y)
 
struct spritecrop_blankspace (struct sprite *s)
 
GdkPixbufsprite_get_pixbuf (struct sprite *sprite)
 
GdkPixbufsurface_get_pixbuf (cairo_surface_t *surf, int width, int height)
 
GdkPixbufcreate_extra_pixbuf (const struct extra_type *pextra)
 

Function Documentation

◆ create_extra_pixbuf()

GdkPixbuf * create_extra_pixbuf ( const struct extra_type pextra)

Create a pixbuf containing a representative image for the given extra type, to be used as an icon in the GUI.

May return NULL on error.

NB: You must call g_object_unref on the non-NULL return value when you no longer need it.

Definition at line 494 of file sprite.c.

◆ crop_blankspace()

struct sprite * crop_blankspace ( struct sprite s)

Crops all blankspace from a sprite (insofar as is possible as a rectangle)

Definition at line 386 of file sprite.c.

◆ sprite_get_bounding_box()

void sprite_get_bounding_box ( struct sprite sprite,
int start_x,
int start_y,
int end_x,
int end_y 
)

Method returns the bounding box of a sprite. It assumes a rectangular object/mask. The bounding box contains the border (pixel which have unset pixel as neighbors) pixel.

Definition at line 321 of file sprite.c.

◆ sprite_get_pixbuf()

GdkPixbuf * sprite_get_pixbuf ( struct sprite sprite)

Render a pixbuf from the sprite.

NOTE: the pixmap and mask of a sprite must not change after this function is called!

Definition at line 402 of file sprite.c.

◆ sprite_scale()

struct sprite * sprite_scale ( struct sprite src,
int  new_w,
int  new_h 
)

Scales a sprite. If the sprite contains a mask, the mask is scaled as as well.

Definition at line 291 of file sprite.c.

◆ surface_get_pixbuf()

GdkPixbuf * surface_get_pixbuf ( cairo_surface_t surf,
int  width,
int  height 
)

Render a pixbuf from the cairo surface

Definition at line 418 of file sprite.c.