Crossfire Client, Trunk
|
#include "client.h"
#include <gtk/gtk.h>
#include "image.h"
#include "main.h"
#include "gtk2proto.h"
#include "../../pixmaps/question.xpm"
Go to the source code of this file.
Macros | |
#define | BPP 4 |
#define | MAX_ICON_SPACES 10 |
#define | ROTATE_RIGHT(c) if ((c) & 01) (c) = ((c) >>1) + 0x80000000; else (c) >>= 1; |
Functions | |
void | addsmooth (guint16 face, guint16 smooth_face) |
int | associate_cache_entry (Cache_Entry *ce, int pixnum) |
int | create_and_rescale_image_from_data (Cache_Entry *ce, int pixmap_num, guint8 *rgba_data, int width, int height) |
static void | create_full_icon_image (guint8 *data, PixmapInfo *pi) |
static void | create_icon_image (guint8 *data, PixmapInfo *pi) |
static void | create_map_image (guint8 *data, PixmapInfo *pi) |
void | do_new_image (guint8 *data, PixmapInfo *pi) |
static void | free_pixmap (PixmapInfo *pi) |
void | get_map_image_size (int face, guint8 *w, guint8 *h) |
void | image_update_download_status (int start, int end, int total) |
void | init_image_cache_data (void) |
void | reset_image_data (void) |
Variables | |
int | have_new_image =0 |
static const int | icon_rescale_factor [MAX_ICON_SPACES] |
int | image_size =DEFAULT_IMAGE_SIZE |
static GtkWidget * | pbar |
static GtkWidget * | pbar_window |
PixmapInfo * | pixmaps [MAXPIXMAPNUM] |
GtkWidget * | window_root |
Contains highlevel image related functions and mostly deals with the image caching, processing the image commands from the server, etc. It is gtk-specific as it returns gtk pixmaps.
Definition in file image.c.
#define ROTATE_RIGHT | ( | c | ) | if ((c) & 01) (c) = ((c) >>1) + 0x80000000; else (c) >>= 1; |
void addsmooth | ( | guint16 | face, |
guint16 | smooth_face | ||
) |
Referenced from common/commands.c
face | |
smooth_face |
Definition at line 251 of file image.c.
References pixmaps, and PixmapInfo::smooth_face.
Referenced by SmoothCmd().
int associate_cache_entry | ( | Cache_Entry * | ce, |
int | pixnum | ||
) |
This functions associates image_data in the cache entry with the specific pixmap number. Currently, there is no failure condition, but there is the potential that in the future, we want to more closely look at the data and if it isn't valid, return the failure code.
Definition at line 264 of file image.c.
References Cache_Entry::image_data, and pixmaps.
Referenced by finish_face_cmd().
int create_and_rescale_image_from_data | ( | Cache_Entry * | ce, |
int | pixmap_num, | ||
guint8 * | rgba_data, | ||
int | width, | ||
int | height | ||
) |
Takes the pixmap to put the data into, as well as the rgba data (ie, already loaded with png_to_data). Scales and stores the relevant data into the pixmap structure.
ce | can be NULL |
pixmap_num | |
rgba_data | |
width | |
height |
Definition at line 142 of file image.c.
References CFG_DM_OPENGL, CONFIG_CACHE, CONFIG_DISPLAYMODE, CONFIG_ICONSCALE, create_full_icon_image(), create_icon_image(), create_map_image(), DEFAULT_IMAGE_SIZE, free_pixmap(), PixmapInfo::full_icon_height, PixmapInfo::full_icon_width, have_new_image, height, PixmapInfo::icon_height, PixmapInfo::icon_image, icon_rescale_factor, PixmapInfo::icon_width, Cache_Entry::image_data, PixmapInfo::map_image, MAX_ICON_SPACES, MAXPIXMAPNUM, pixmaps, rescale_rgba_data(), use_config, and width.
Referenced by display_newpng(), and finish_face_cmd().
|
static |
Definition at line 88 of file image.c.
References PixmapInfo::full_icon_height, PixmapInfo::full_icon_image, PixmapInfo::full_icon_width, and rgba_to_gdkpixbuf().
Referenced by create_and_rescale_image_from_data(), and do_new_image().
|
static |
Helper function to make the code more readable
Definition at line 84 of file image.c.
References PixmapInfo::icon_height, PixmapInfo::icon_image, PixmapInfo::icon_width, and rgba_to_gdkpixbuf().
Referenced by create_and_rescale_image_from_data(), and do_new_image().
|
static |
Helper function to make the code more readable
data | |
pi |
Definition at line 98 of file image.c.
References PixmapInfo::full_icon_height, PixmapInfo::full_icon_width, PixmapInfo::map_image, and rgba_to_cairo_surface().
Referenced by create_and_rescale_image_from_data(), and do_new_image().
void do_new_image | ( | guint8 * | data, |
PixmapInfo * | pi | ||
) |
Wrapper for accessing outside this file.
Definition at line 105 of file image.c.
References create_full_icon_image(), create_icon_image(), and create_map_image().
Referenced by map_init().
|
static |
Memory management.
pi |
Definition at line 116 of file image.c.
References PixmapInfo::full_icon_image, PixmapInfo::icon_image, and PixmapInfo::map_image.
Referenced by create_and_rescale_image_from_data(), and reset_image_data().
void get_map_image_size | ( | int | face, |
guint8 * | w, | ||
guint8 * | h | ||
) |
face | |
w | |
h |
Definition at line 341 of file image.c.
References CFG_DM_PIXMAP, CONFIG_DISPLAYMODE, CONFIG_MAPSCALE, PixmapInfo::full_icon_height, PixmapInfo::full_icon_width, map_image_size, MAXPIXMAPNUM, pixmaps, and use_config.
Referenced by mapdata_get_image_size().
void image_update_download_status | ( | int | start, |
int | end, | ||
int | total | ||
) |
Draws a status bar showing where we our in terms of downloading all the image data. A few hacks: If start is 1, this is the first batch, so it means we need to create the appropriate status window. If start = end = total, it means were finished, so destroy the gui element.
start | The start value just sent to the server. |
end | |
total | The total number of images. |
Definition at line 309 of file image.c.
References get_window_coord(), pbar, pbar_window, and window_root.
Referenced by client_negotiate().
void init_image_cache_data | ( | void | ) |
Initializes the data for image caching Create question mark to display in each supported rendering mode when an image is not cached. When image caching is enabled, if a needed image is not yet in the cache, a question mark image is displayed instead. The image displayed is unique to the display mode. This function creates the image to use when OpenGL mode is in effect.
Definition at line 380 of file image.c.
References PixmapInfo::full_icon_height, PixmapInfo::full_icon_image, PixmapInfo::full_icon_width, PixmapInfo::icon_height, PixmapInfo::icon_image, PixmapInfo::icon_width, init_common_cache_data(), PixmapInfo::map_image, map_image_size, MAXPIXMAPNUM, pixmaps, and PixmapInfo::smooth_face.
Referenced by main().
void reset_image_data | ( | void | ) |
Connecting to different servers, try to clear out any old images. Try to free the data to prevent memory leaks. This could be more clever, ie, if we're caching images and go to a new server and get a name, we should try to re-arrange our cache or the like.
Definition at line 276 of file image.c.
References CONFIG_CACHE, free_pixmap(), MAXPIXMAPNUM, pixmaps, reset_image_cache_data(), and want_config.
Referenced by main().
int have_new_image =0 |
Definition at line 37 of file image.c.
Referenced by create_and_rescale_image_from_data(), and redraw().
|
static |
Definition at line 54 of file image.c.
Referenced by create_and_rescale_image_from_data().
int image_size =DEFAULT_IMAGE_SIZE |
Definition at line 30 of file image.c.
Referenced by config_check(), draw_inv_table(), init_choose_char_window(), map_init(), and setup_list_columns().
|
static |
Definition at line 296 of file image.c.
Referenced by image_update_download_status().
|
static |
Definition at line 296 of file image.c.
Referenced by image_update_download_status().
PixmapInfo* pixmaps[MAXPIXMAPNUM] |
Definition at line 34 of file image.c.
Referenced by add_object_to_store(), addsmooth(), animate_inventory(), animate_look(), associate_cache_entry(), create_and_rescale_image_from_data(), draw_inv_table(), drawingarea_inventory_table_expose_event(), drawsmooth(), get_map_image_size(), init_image_cache_data(), map_draw_layer(), map_init(), reset_image_data(), update_character_choose(), and update_spell_information().
GtkWidget* window_root |
In main.c
Definition at line 103 of file main.c.
Referenced by image_update_download_status(), init_create_character_window(), init_new_character_window(), load_window_positions(), and save_winpos().