webperimental: killstack decides stack protects.
[freeciv.git] / client / gui-stub / sprite.c
blob388e099c385133cd1b2d8bc4740dc3040ac250a0
1 /**********************************************************************
2 Freeciv - Copyright (C) 1996 - A Kjeldberg, L Gregersen, P Unold
3 This program is free software; you can redistribute it and/or modify
4 it under the terms of the GNU General Public License as published by
5 the Free Software Foundation; either version 2, or (at your option)
6 any later version.
8 This program is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 GNU General Public License for more details.
12 ***********************************************************************/
14 #ifdef HAVE_CONFIG_H
15 #include <fc_config.h>
16 #endif
18 #include <stdlib.h>
20 /* gui main header */
21 #include "gui_stub.h"
23 #include "sprite.h"
25 /****************************************************************************
26 Return a NULL-terminated, permanently allocated array of possible
27 graphics types extensions. Extensions listed first will be checked
28 first.
29 ****************************************************************************/
30 const char **gfx_fileextensions(void)
32 /* PORTME */
34 /* hack to allow stub to run */
35 static const char *ext[] = {
36 "png", /* png should be the default. */
37 /* ...etc... */
38 NULL
41 return ext;
44 /****************************************************************************
45 Load the given graphics file into a sprite. This function loads an
46 entire image file, which may later be broken up into individual sprites
47 with crop_sprite.
48 ****************************************************************************/
49 struct sprite *gui_load_gfxfile(const char *filename)
51 /* PORTME */
52 return NULL;
55 /****************************************************************************
56 Create a new sprite by cropping and taking only the given portion of
57 the image.
59 source gives the sprite that is to be cropped.
61 x,y, width, height gives the rectangle to be cropped. The pixel at
62 position of the source sprite will be at (0,0) in the new sprite, and
63 the new sprite will have dimensions (width, height).
65 mask gives an additional mask to be used for clipping the new
66 sprite. Only the transparency value of the mask is used in
67 crop_sprite. The formula is: dest_trans = src_trans *
68 mask_trans. Note that because the transparency is expressed as an
69 integer it is common to divide it by 256 afterwards.
71 mask_offset_x, mask_offset_y is the offset of the mask relative to the
72 origin of the source image. The pixel at (mask_offset_x,mask_offset_y)
73 in the mask image will be used to clip pixel (0,0) in the source image
74 which is pixel (-x,-y) in the new image.
75 ****************************************************************************/
76 struct sprite *gui_crop_sprite(struct sprite *source,
77 int x, int y, int width, int height,
78 struct sprite *mask,
79 int mask_offset_x, int mask_offset_y,
80 float scale, bool smooth)
82 /* PORTME */
83 return NULL;
86 /****************************************************************************
87 Create a new sprite with the given height, width and color.
88 ****************************************************************************/
89 struct sprite *gui_create_sprite(int width, int height, struct color *pcolor)
91 /* PORTME */
92 return NULL;
95 /****************************************************************************
96 Find the dimensions of the sprite.
97 ****************************************************************************/
98 void gui_get_sprite_dimensions(struct sprite *sprite, int *width, int *height)
100 /* PORTME */
101 #if 0
102 *width = sprite->width;
103 *height = sprite->height;
104 #endif
107 /****************************************************************************
108 Free a sprite and all associated image data.
109 ****************************************************************************/
110 void gui_free_sprite(struct sprite *s)
112 /* PORTME */