CHAPTER 13. THE IMAGE INTERFACE 134
get_size: The function to be called to return the storage size
used by this image.
drop: The function to be called to dispose of this image once
the last reference is dropped.
Returns a pointer to an allocated structure of the required size,
with the first sizeof(fz_image) bytes initialised as appropriate
given the supplied parameters, and the other bytes set to zero.
*/
fz_image *fz_new_image_of_size(fz_context *ctx, int w, int h, int bpc,
fz_colorspace *colorspace, int xres, int yres, int interpolate, int
imagemask, float *decode, int *colorkey, fz_image *mask, int size,
fz_image_get_pixmap_fn *get, fz_image_get_size_fn *get_size,
fz_drop_image_fn *drop);
#define fz_new_image(CTX,W,H,B,CS,X,Y,I,IM,D,C,M,T,G,S,Z) \
((T*)Memento_label(fz_new_image_of_size(CTX,W,H,B,CS,X,Y,I,IM,D,C,M,sizeof(T),G,S,Z),#T))
The macro takes identical parameters to the function other than passing the
structure type in place of the structure type saved, and performing a typecast
to simplify the typical enclosing code.
Both function and macro take pointers to 3 functions that need to be defined
for the new format. Firstly, foo get is of the following type:
/*
fz_get_pixmap_fn: Function type to get a decoded pixmap
for an image.
im: The image to decode.
subarea: NULL, or the subarea of the image required. Expressed
in terms of a rectangle in the original width/height of the
image. If non NULL, this should be updated by the function to
the actual subarea decoded - which must include the requested
area!
w, h: The actual width and height that the whole image would
need to be decoded to.
l2factor: On entry, the log 2 subsample factor required. If
possible the decode process can take care of (all or some) of
this subsampling, and must then update the value so the caller
knows what remains to be done.
Returns a reference to a decoded pixmap that satisfies the
requirements of the request.