2 "$Id: image.c 9201 2008-06-01 17:32:45Z anmaster $";
45 #include <gdk/gdkwin32.h>
47 #include <gdk/gdkkeysyms.h>
51 #include <SDL_image.h>
86 #define MAX_ICON_SPACES 10
109 #define ROTATE_RIGHT(c) if ((c) & 01) (c) = ((c) >>1) + 0x80000000; else (c) >>= 1;
119 LOG (
LOG_ERROR,
"gtk::create_icon_image",
"Unable to create scaled image, dest num = %d\n", pixmap_num);
129 #if defined(HAVE_SDL)
135 #if SDL_BYTEORDER == SDL_LIL_ENDIAN
138 0xff00, 0xff0000, 0xff000000);
140 fog = SDL_CreateRGBSurface(SDL_SRCALPHA | SDL_HWSURFACE,
142 0xff00, 0xff0000, 0xff000000);
143 SDL_LockSurface(fog);
146 l = (
uint8 *) (data + i*4);
157 g=(77*(*l)+151*(*(l+1))+28*(*(l+2)))>>8;
158 p = (
uint32*) fog->pixels + i;
159 *p = g | (g << 8) | (g << 16) | (*(l + 3) << 24);
162 SDL_UnlockSurface(fog);
168 0xff0000, 0xff00, 0xff);
170 fog = SDL_CreateRGBSurface(SDL_SRCALPHA | SDL_HWSURFACE,
172 0xff0000, 0xff00, 0xff);
173 SDL_LockSurface(fog);
181 l = (
uint8 *) (data + i*4);
192 g=(77*(*l)+151*(*(l+1))+28*(*(l+2)))>>8;
193 p = (
uint32*) fog->pixels + i;
194 *p = (g << 8) | (g << 16) | (g << 24) | *(l + 3);
204 p = (
uint32*) (fog->pixels + i);
205 g = ( ((*p >> 24) & 0xff) + ((*p >> 16) & 0xff) + ((*p >> 8) & 0xff)) / 3;
206 tmp = (
uint32*) fog->pixels + i;
207 *tmp = (g << 24) | (g << 16) | (g << 8) | (*p & 0xff);
211 SDL_UnlockSurface(fog);
232 free(((SDL_Surface*)pi->
map_image)->pixels);
254 int nx, ny, iscale, factor;
338 png_tmp = malloc(width * height *
BPP);
339 memcpy(png_tmp, rgba_data, width * height * BPP);
418 static GtkAdjustment *
padj=NULL;
421 int x, y, wx, wy, w, h;
424 padj = (GtkAdjustment*) gtk_adjustment_new (0, 1, total, 0, 0, 0);
426 pbar = gtk_progress_bar_new_with_adjustment(
padj);
427 gtk_progress_set_format_string(GTK_PROGRESS(
pbar),
"Downloading image %v of %u (%p%% complete)");
428 gtk_progress_bar_set_bar_style(GTK_PROGRESS_BAR(
pbar), GTK_PROGRESS_CONTINUOUS);
429 gtk_progress_set_show_text(GTK_PROGRESS(
pbar),
TRUE);
438 gtk_widget_set_uposition(
pbar_window, (wx + w)/2, (wy + h) / 2);
441 gtk_widget_show(
pbar);
444 if (start == total) {
452 gtk_progress_set_value(GTK_PROGRESS(
pbar), start);
453 while ( gtk_events_pending() ) {
454 gtk_main_iteration();
static void free_pixmap(PixmapInfo *pi)
#define DEFAULT_IMAGE_SIZE
void image_update_download_status(int start, int end, int total)
struct @2 private_cache[MAXPIXMAPNUM]
void get_window_coord(GtkWidget *win, int *x, int *y, int *wx, int *wy, int *w, int *h)
sint16 want_config[CONFIG_NUMS]
int create_and_rescale_image_from_data(Cache_Entry *ce, int pixmap_num, uint8 *rgba_data, int width, int height)
void LOG(LogLevel level, const char *origin, const char *format,...)
void addsmooth(uint16 face, uint16 smooth_face)
sint16 use_config[CONFIG_NUMS]
void reset_image_cache_data(void)
uint8 * rescale_rgba_data(uint8 *data, int *width, int *height, int scale)
void reset_image_data(void)
int rgba_to_gdkpixmap(GdkWindow *window, uint8 *data, int width, int height, GdkPixmap **pix, GdkBitmap **mask, GdkColormap *colormap)
static GtkAdjustment * padj
static void create_map_image(uint8 *data, PixmapInfo *pi)
static GtkWidget * pbar_window
static int icon_rescale_factor[MAX_ICON_SPACES]
static void create_icon_image(uint8 *data, PixmapInfo *pi, int pixmap_num)
PixmapInfo * pixmaps[MAXPIXMAPNUM]
void get_map_image_size(int face, uint8 *w, uint8 *h)
#define CONFIG_DISPLAYMODE
int associate_cache_entry(Cache_Entry *ce, int pixnum)
const char *const rcsid_gtk_image_c