]> git.imager.perl.org - imager.git/blobdiff - imdatatypes.h
[rt #69243] simplify XS for i_findcolor()
[imager.git] / imdatatypes.h
index d760d4baebe29bf32977cfc269745c0491c2c4c1..1fa7c0b530b703f8d01f3d23a95690d80fccf5be 100644 (file)
@@ -6,6 +6,11 @@
 
 #define MAXCHANNELS 4
 
+typedef struct im_context_tag *im_context_t;
+
+typedef ptrdiff_t im_slot_t;
+typedef void (*im_slot_destroy_t)(void *);
+
 /* used for palette indices in some internal code (which might be 
    exposed at some point
 */
@@ -36,6 +41,7 @@ May be larger than int on some platforms.
 */
 
 typedef ptrdiff_t i_img_dim;
+typedef size_t i_img_dim_u;
 
 /*
 =item i_color
@@ -175,6 +181,12 @@ typedef i_img_dim (*i_f_gsamp_bits_t)(i_img *im, i_img_dim x, i_img_dim r, i_img
                            const int *chans, int chan_count, int bits);
 typedef i_img_dim (*i_f_psamp_bits_t)(i_img *im, i_img_dim x, i_img_dim r, i_img_dim y, unsigned const *samp,
                                 const int *chans, int chan_count, int bits);
+typedef i_img_dim
+(*i_f_psamp_t)(i_img *im, i_img_dim x, i_img_dim r, i_img_dim y, 
+               const i_sample_t *samp, const int *chan, int chan_count);
+typedef i_img_dim
+(*i_f_psampf_t)(i_img *im, i_img_dim x, i_img_dim r, i_img_dim y,
+               const i_fsample_t *samp, const int *chan, int chan_count);
 
 /*
 =item i_img
@@ -269,6 +281,22 @@ i_f_gsamp_bits - implements i_gsamp_bits() for this image.
 
 i_f_psamp_bits - implements i_psamp_bits() for this image.
 
+=item *
+
+i_f_psamp - implements psamp() for this image.
+
+=item *
+
+i_f_psampf - implements psamp() for this image.
+
+=item *
+
+C<im_data> - image specific data internal to Imager.
+
+=item *
+
+C<context> - the Imager API context this image belongs to.
+
 =back
 
 =cut
@@ -316,7 +344,14 @@ struct i_img_ {
   i_f_gsamp_bits_t i_f_gsamp_bits;
   i_f_psamp_bits_t i_f_psamp_bits;
 
+  /* as of 0.88 */
+  i_f_psamp_t i_f_psamp;
+  i_f_psampf_t i_f_psampf;
+
   void *im_data;
+
+  /* 0.91 */
+  im_context_t context;
 };
 
 /* ext_data for paletted images
@@ -522,6 +557,18 @@ typedef enum {
   ic_color
 } i_combine_t;
 
+/*
+=item i_mutex_t
+X<i_mutex>
+=category mutex
+=synopsis i_mutex_t mutex;
+
+Opaque type for Imager's mutex API.
+
+=cut
+ */
+typedef struct i_mutex_tag *i_mutex_t;
+
 /*
    describes an axis of a MM font.
    Modelled on FT2's FT_MM_Axis.
@@ -569,6 +616,9 @@ typedef enum i_make_colors_tag {
   mc_addi, /* Addi's algorithm */
   mc_median_cut, /* median cut - similar to giflib, hopefully */
   mc_mono, /* fixed mono color map */
+  mc_gray, /* 256 gray map */
+  mc_gray4, /* four step gray map */
+  mc_gray16, /* sixteen step gray map */
   mc_mask = 0xFF /* (mask for generator) */
 } i_make_colors;
 
@@ -608,10 +658,6 @@ typedef enum i_ord_dith_tag
   od_custom /* custom 8x8 map */
 } i_ord_dith;
 
-typedef struct i_gif_pos_tag {
-  int x, y;
-} i_gif_pos;
-
 /* passed into i_writegif_gen() to control quantization */
 typedef struct i_quantize_tag {
   int version;
@@ -654,45 +700,6 @@ typedef struct i_quantize_tag {
   /* version 2 members after here */
 } i_quantize;
 
-typedef struct i_gif_opts {
-  /* each image has a local color map */
-  int each_palette;
-
-  /* images are interlaced */
-  int interlace;
-
-  /* time for which image is displayed 
-   (in 1/100 seconds)
-   default: 0
-  */
-  int delay_count;
-  int *delays;
-
-  /* user input flags 
-     default: 0
-   */
-  int user_input_count;
-  char *user_input_flags;
-
-  /* disposal
-     default: 0 */
-  int disposal_count;
-  char *disposal;
-
-  /* this is added to the color table when we make an image transparent */
-  i_color tran_color;
-
-  /* image positions */
-  int position_count;
-  i_gif_pos *positions;
-
-  /* Netscape loop extension - number of loops */
-  int loop_count;
-
-  /* should be eliminate unused colors? */
-  int eliminate_unused;
-} i_gif_opts;
-
 /* distance measures used by some filters */
 enum {
   i_dmeasure_euclidean = 0,
@@ -703,6 +710,13 @@ enum {
 
 #include "iolayert.h"
 
+/* error message information returned by im_errors() */
+
+typedef struct {
+  char *msg;
+  int code;
+} i_errmsg;
+
 typedef struct i_render_tag i_render;
 
 #ifdef IMAGER_FORMAT_ATTR
@@ -712,6 +726,15 @@ typedef struct i_render_tag i_render;
 #define I_FORMAT_ATTR(format_index, va_index)
 #endif
 
+#ifdef _MSC_VER
+#  ifndef vsnprintf
+#  define vsnprintf _vsnprintf
+#  endif
+#  ifndef snprintf
+#  define snprintf _snprintf
+#  endif
+#endif
+
 /*
 =item i_DF
 =category Data Types