Freeciv-3.1: /fast/freeciv/nightly/S3_1/client/gui-gtk-4.0/sprite.h File Reference

Freeciv-3.1

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 sprite * | sprite_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 sprite * | crop_blankspace (struct sprite *s)
GdkPixbuf * | sprite_get_pixbuf (struct sprite *sprite)
GdkPixbuf * | surface_get_pixbuf (cairo_surface_t *surf, int width, int height)
GdkPixbuf * | create_extra_pixbuf (const struct extra_type *pextra)
GtkWidget * | picture_new_from_surface (cairo_surface_t *surf)
void | picture_set_from_surface (GtkPicture *image, cairo_surface_t *surf)

## 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.

Referenced by editbar_reload_tileset(), get_tool_value_pixbuf(), and select_tgt_extra().

## ◆ 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.

Referenced by create_races_dialog().

## ◆ picture_new_from_surface()

GtkWidget * picture_new_from_surface | ( | cairo_surface_t * | surf | ) |

Create a GtkPicture from cairo surface.

Definition at line 526 of file sprite.c.

Referenced by setup_widgets().

## ◆ picture_set_from_surface()

void picture_set_from_surface | ( | GtkPicture * | pic,
|  | cairo_surface_t * | surf
| ) |  |

Set a GtkPicture from cairo surface.

Definition at line 544 of file sprite.c.

Referenced by city_dialog_update_citizens(), create_diplomacy_dialog(), put_unit_picture(), put_unit_picture_city_overlays(), refresh_feeling_surface(), set_help_tile_from_extra(), set_help_tile_from_sprite(), set_help_tile_from_terrain(), set_indicator_icons(), and update_info_label().

## ◆ 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.

Referenced by crop_blankspace(), get_flag(), meswin_dialog_refresh(), and update_max_unit_size().

## ◆ 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.

Referenced by cell_render_func(), city_dialog_update_building(), city_dialog_update_improvement_list(), create_city_dialog(), create_races_dialog(), drag_begin(), economy_report_update(), editbar_add_mode_button(), editbar_add_tool_button(), editbar_create(), editbar_reload_tileset(), editinfobox_refresh(), extviewer_refresh_widgets(), extviewer_view_cell_toggled(), get_flag(), get_thumb_pixbuf(), get_tool_mode_pixbuf(), get_tool_value_pixbuf(), load_cursors(), meswin_dialog_refresh(), populate_unit_image_table(), populate_unit_pic_table(), property_page_set_store_value(), real_menus_init(), select_tgt_extra(), select_tgt_unit(), tileset_changed(), and ui_main().

## ◆ 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.

Referenced by cell_render_func(), create_main_page(), drag_begin(), and load_sprite().

## ◆ 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.

Referenced by create_extra_pixbuf(), create_pixbuf_from_layers(), create_player_icon(), create_terrain_pixbuf(), picture_new_from_surface(), picture_set_from_surface(), sprite_get_pixbuf(), usdlg_get_unit_image(), and usdlg_tab_append_utype().