From: Tony Cook Date: Thu, 26 Mar 2015 06:01:08 +0000 (+1100) Subject: more types documentation for the API X-Git-Tag: v1.002~2 X-Git-Url: http://git.imager.perl.org/imager.git/commitdiff_plain/7a6d192f47a930fb2ae1d3171531a4dbae43c406 more types documentation for the API --- diff --git a/imdatatypes.h b/imdatatypes.h index dcb8e9a3..8a194908 100644 --- a/imdatatypes.h +++ b/imdatatypes.h @@ -6,8 +6,26 @@ #define MAXCHANNELS 4 +/* +=item im_context_t +=category Data Types + +Imager's per-thread context. + +=cut +*/ + typedef struct im_context_tag *im_context_t; +/* +=item im_slot_t +=category Data Types + +Represents a slot in the context object. + +=cut +*/ + typedef ptrdiff_t im_slot_t; typedef void (*im_slot_destroy_t)(void *); @@ -41,6 +59,18 @@ May be larger than int on some platforms. */ typedef ptrdiff_t i_img_dim; + +/* +=item i_img_dim_u +=category Data Types +=synopsis i_img_dim_u limit; +=order 90 + +An unsigned variant of L. + +=cut +*/ + typedef size_t i_img_dim_u; #define i_img_dim_MAX ((i_img_dim)(~(i_img_dim_u)0 >> 1)) @@ -442,12 +472,54 @@ enum bounding_box_index_t { BOUNDING_BOX_COUNT }; +/* +=item i_polygon_t +=category Data Types + +Represents a polygon. Has the following members: + +=over + +=item * + +C, C - arrays of x and y locations of vertices. + +=item * + +C - the number of entries in the C and C arrays. + +=back + +=cut +*/ + typedef struct i_polygon_tag { const double *x; const double *y; size_t count; } i_polygon_t; +/* +=item i_poly_fill_mode_t +=category Data Types + +Control how polygons are filled. Has the following values: + +=over + +=item * + +C - simple even-odd fills. + +=item * + +C - non-zero winding rule fills. + +=back + +=cut +*/ + typedef enum i_poly_fill_mode_tag { i_pfm_evenodd, i_pfm_nonzero @@ -614,6 +686,40 @@ typedef struct TT_Fonthandle_ TT_Fonthandle; #endif +/* +=item i_transp +=category Data Types + +An enumerated type for controlling how transparency is handled during +quantization. + +This has the following possible values: + +=over + +=item * + +C - ignore the alpha channel + +=item * + +C - simple transparency thresholding. + +=item * + +C - use error diffusion to control which pixels are +transparent. + +=item * + +C - use ordered dithering to control which pixels are +transparent. + +=back + +=cut +*/ + /* transparency handling for quantized output */ typedef enum i_transp_tag { tr_none, /* ignore any alpha channel */ @@ -622,7 +728,49 @@ typedef enum i_transp_tag { tr_ordered /* an ordered dither */ } i_transp; -/* controls how we build the colour map */ +/* +=item i_make_colors +=category Data Types + +An enumerated type used to control the method used for produce the +color map: + +=over + +=item * + +C - the user supplied map is used. + +=item * + +C - use the classic web map. Any existing fixed colors +are ignored. + +=item * + +C - use median cut + +=item * + +C - use a fixed black and white map. + +=item * + +C - 256 step gray map. + +=item * + +C - 4 step gray map. + +=item * + +C - 16 step gray map. + +=back + +=cut +*/ + typedef enum i_make_colors_tag { mc_none, /* user supplied colour map only */ mc_web_map, /* Use the 216 colour web colour map */ @@ -635,6 +783,37 @@ typedef enum i_make_colors_tag { mc_mask = 0xFF /* (mask for generator) */ } i_make_colors; +/* +=item i_translate +=category Data Types + +An enumerated type that controls how colors are translated: + +=over + +=item * + +C - obsolete, forces C to use median cut and +acts like C. + +=item * + +C - always use the closest color. + +=item * + +C - add random values to each sample and find the closest +color. + +=item * + +C - error diffusion dither. + +=back + +=cut +*/ + /* controls how we translate the colours */ typedef enum i_translate_tag { pt_giflib, /* get gif lib to do it (ignores make_colours) */ @@ -643,6 +822,41 @@ typedef enum i_translate_tag { pt_errdiff /* error diffusion dither - uses errdiff */ } i_translate; +/* +=item i_errdiff +=category Data Types + +Controls the type of error diffusion to use: + +=over + +=item * + +C - floyd-steinberg + +=item * + +C - Jarvis, Judice and Ninke + +=item * + +C - Stucki + +=item * + +C - not usable for transparency dithering, allows a custom +error diffusion map to be used. + +=item * + +C - or with the error diffusion type to use alternate +directions on each line of the dither. + +=back + +=cut +*/ + /* Which error diffusion map to use */ typedef enum i_errdiff_tag { ed_floyd, /* floyd-steinberg */ @@ -653,8 +867,55 @@ typedef enum i_errdiff_tag { ed_bidir = 0x100 /* change direction for each row */ } i_errdiff; -/* which ordered dither map to use - currently only available for transparency +/* +=item i_ord_dith +=category Data Types + +Which ordered dither map to use, currently only available for +transparency. Values are: + +=over + +=item * + +C - a pre-generated random map. + +=item * + +C - large dot dither. + +=item * + +C - smaller dot dither + +=item * + +C - horizontal line dither. + +=item * + +C - vertical line dither. + +=item * + +C - C line dither. + +=item * + +C - C<\> line dither. + +=item * + +C - small checkbox dither + +=item * + +C - custom dither map. + +=back + +=cut + I don't know of a way to do ordered dither of an image against some general palette */ @@ -671,7 +932,89 @@ typedef enum i_ord_dith_tag od_custom /* custom 8x8 map */ } i_ord_dith; -/* passed into i_writegif_gen() to control quantization */ +/* +=item i_quantize +=category Data Types + +A structure type used to supply image quantization, ie. when +converting a direct color image to a paletted image. + +This has the following members: + +=over + +=item * + +C - how to handle transparency, see L. + +=item * + +C - when C is C, this is the alpha +level at which pixels become transparent. + +=item * + +C - when C is C this controls the type +of error diffusion to be done. This may not be C for this +member. + +=item * + +C - when C is C this controls the +patten used for dithering transparency. + +=item * + +C - when C is C this is the ordered +dither mask. + +=item * + +C - the method used to generate the color palette, see +L. + +=item * + +C - an array of C L entries used to +define the fixed colors (controlled by C and to return the +generated color list. + +=item * + +C - the size of the buffer allocated to C in +C units. + +=item * + +C - the number of initialized colors in C. + +=item * + +C - how RGB colors are translated to palette indexes, see +L. + +=item * + +C - when C is C this controls the type +of error diffusion to be done. + +=item * + +C, C, C, C - when C is +C this controls the error diffusion map. C is an +array of C integers. C is the position +of the current pixel in the error diffusion map, always on the top +row. + +=item * + +C - the amount to perturb pixels when C is +C. + +=back + +=cut +*/ typedef struct i_quantize_tag { int version; @@ -737,7 +1080,7 @@ typedef struct i_render_tag i_render; =category Data Types =order 95 -Returned by L to indicate the color model of +Returned by L to indicate the color model of the image. An enumerated type with the following possible values: diff --git a/lib/Imager/APIRef.pod b/lib/Imager/APIRef.pod index 69e1b140..a912d1d7 100644 --- a/lib/Imager/APIRef.pod +++ b/lib/Imager/APIRef.pod @@ -28,6 +28,7 @@ Imager::APIRef - Imager's C API - reference. black.rgba.r = black.rgba.g = black.rgba.b = black.rgba.a = 0; i_fill_t *fill; i_img_dim x, y; + i_img_dim_u limit; printf("left %" i_DF "\n", i_DFc(x)); printf("point (" i_DFp ")\n", i_DFcp(x, y)); @@ -382,6 +383,62 @@ Unless you're implementing a new fill type you'll typically treat this as an opaque type. +=for comment +From: File imdatatypes.h + +=item i_poly_fill_mode_t + +Control how polygons are filled. Has the following values: + +=over + +=item * + +C - simple even-odd fills. + +=item * + +C - non-zero winding rule fills. + +=back + + +=for comment +From: File imdatatypes.h + +=item i_polygon_t + +Represents a polygon. Has the following members: + +=over + +=item * + +C, C - arrays of x and y locations of vertices. + +=item * + +C - the number of entries in the C and C arrays. + +=back + + +=for comment +From: File imdatatypes.h + +=item im_context_t + +Imager's per-thread context. + + +=for comment +From: File imdatatypes.h + +=item im_slot_t + +Represents a slot in the context object. + + =for comment From: File imdatatypes.h @@ -394,6 +451,16 @@ A signed integer type that represents an image dimension or ordinate. May be larger than int on some platforms. +=for comment +From: File imdatatypes.h + +=item i_img_dim_u + + i_img_dim_u limit; + +An unsigned variant of L. + + =for comment From: File imdatatypes.h @@ -2528,22 +2595,6 @@ will change: =item * -B - -=item * - -B - -=item * - -B - -=item * - -B - -=item * - B =item * @@ -2552,10 +2603,6 @@ B =item * -B - -=item * - B