Logo Search packages:      
Sourcecode: ace-of-penguins version File versions  Download package


#ifndef _IMAGELIB_H_
#define _IMAGELIB_H_

#define PIXELS_TYPE void *

typedef struct image {
  /* filled in by make-imglib */
  int width;
  int height;
  const unsigned char *file_data;
  /* available to program */
  struct image *next;
  int type;
  PIXELS_TYPE pixels; /* platform and display specific format, like XImage or Pixmap */
  struct image_list *list;
  void (*synth_func)(struct image *); /* if set, is synthetic */
  int synth_flags;
} image;

struct image_list;

typedef image *(*synth_imagelist_function)(struct image_list *list, int type, int width, int height);

typedef struct image_list {
  /* filled in by make-imglib */
  char *name;
  int across;
  int down;
  image *subimage[3];
  /* available to program */
  struct image_list *next;
  synth_imagelist_function synth_func; /* if set, is synthetic */
  int synth_flags;
} image_list;

/* Put to this to display on the display's main window. */
extern image *display_image;

#ifdef __cplusplus
extern "C" {
#if 0
} /* To keep emacs from indenting all the below functions. */

int _register_imagelib(image_list *);

image *alloc_synth_image (image_list *list, int width, int height, int type);

void   get_image_set_display_type (int type);
image *get_image (char *name, int preferred_width, int preferred_height, int flags);
/* This means the preferred dimensions are absolute maximums. */
#define GI_NOT_BIGGER   0x01
/* This means that a close size match is more important than the right type. */
#define GI_ANY_TYPE     0x02

#define PUT_INVERTED    0x01
#define PUT_ROTATED     0x02
/* dx dy relative to where src's origin would have been, not relative
   to the x, y point indicated here. */
void put_image (image *src, int x, int y, int w, int h,
            image *dest, int dx, int dy, int flags);
/* Same, but copies mask (creating one if needed) */
void put_mask (image *src, int x, int y, int w, int h,
             image *dest, int dx, int dy, int flags);
/* Similar, but always the whole subimage (based on across, down in image_list) */
void put_subimage (image *src, int col, int row,
               image *dest, int dx, int dy, int flags);
/* For synthesizing images. */
void fill_image (image *dest, int x, int y, int w, int h,
             int r, int g, int b);

#ifdef __cplusplus
#define REGISTER_IMAGE_LIBRARY(x) static int __register = _register_imagelib(x);
#define REGISTER_IMAGE_LIBRARY(x) static void __register() __attribute__((constructor)); \
      static void __register() { _register_imagelib(x); }


Generated by  Doxygen 1.6.0   Back to index