struct fz_bitmap
{
int refs;
int w, h, stride, n;
int xres, yres;
unsigned char *samples;
}
Bitmaps have 1 bit per component. Only used for creating halftoned versions of contone buffers, and saving out. Samples are stored msb first, akin to pbms.
The internals of this struct are considered implementation details and subject to change. Where possible, accessor functions should be used in preference.
fz_bitmap *
fz_keep_bitmap (
fz_context *ctx,
fz_bitmap *bit
)
Take an additional reference to the bitmap. The same pointer is returned.
Never throws exceptions.
void
fz_drop_bitmap (
fz_context *ctx,
fz_bitmap *bit
)
Drop a reference to the bitmap. When the reference count reaches zero, the bitmap will be destroyed.
Never throws exceptions.
void
fz_invert_bitmap (
fz_context *ctx,
fz_bitmap *bmp
)
Invert bitmap.
Never throws exceptions.
typedef struct fz_halftone fz_halftone
A halftone is a set of threshold tiles, one per component. Each threshold tile is a pixmap, possibly of varying sizes and phases. Currently, we only provide one ‘default’ halftone tile for operating on 1 component plus alpha pixmaps (where the alpha is ignored). This is signified by a fz_halftone pointer to NULL.
fz_bitmap *
fz_new_bitmap_from_pixmap (
fz_context *ctx,
fz_pixmap *pix,
fz_halftone *ht
)
Make a bitmap from a pixmap and a halftone.
Returns the resultant bitmap. Throws exceptions in the case of failure to allocate.
fz_bitmap *
fz_new_bitmap_from_image (
fz_context *ctx,
fz_image *img,
fz_halftone *ht
)
Make a bitmap from a pixmap and a halftone.
Returns the resultant bitmap. Throws exceptions in the case of failure to allocate.
fz_bitmap *
fz_new_bitmap_from_pixmap_band (
fz_context *ctx,
fz_pixmap *pix,
fz_halftone *ht,
int band_start
)
Make a bitmap from a pixmap and a halftone, allowing for the position of the pixmap within an overall banded rendering.
Returns the resultant bitmap. Throws exceptions in the case of failure to allocate.
fz_bitmap *
fz_new_bitmap (
fz_context *ctx,
int w,
int h,
int n,
int xres,
int yres
)
Create a new bitmap.
Returns pointer to created bitmap structure. The bitmap data is uninitialised.
void
fz_bitmap_details (
fz_bitmap *bitmap,
int *w,
int *h,
int *n,
int *stride
)
Retrieve details of a given bitmap.
void
fz_clear_bitmap (
fz_context *ctx,
fz_bitmap *bit
)
Set the entire bitmap to 0.
Never throws exceptions.
fz_halftone *
fz_default_halftone (
fz_context *ctx,
int num_comps
)
Create a ‘default’ halftone structure for the given number of components.
Returns a simple default halftone. The default halftone uses the same halftone tile for each plane, which may not be ideal for all purposes.
fz_halftone *
fz_keep_halftone (
fz_context *ctx,
fz_halftone *half
)
Take an additional reference to the halftone. The same pointer is returned.
Never throws exceptions.
void
fz_drop_halftone (
fz_context *ctx,
fz_halftone *ht
)
Drop a reference to the halftone. When the reference count reaches zero, the halftone is destroyed.
Never throws exceptions.