#ifndef MUPDF_FITZ_BITMAP_H1#define MUPDF_FITZ_BITMAP_H23#include "mupdf/fitz/system.h"4#include "mupdf/fitz/context.h"5#include "mupdf/fitz/pixmap.h"67/*8Bitmaps have 1 bit per component. Only used for creating halftoned9versions of contone buffers, and saving out. Samples are stored msb10first, akin to pbms.11*/12typedef struct fz_bitmap_s fz_bitmap;1314/*15fz_keep_bitmap: Take a reference to a bitmap.1617bit: The bitmap to increment the reference for.1819Returns bit. Does not throw exceptions.20*/21fz_bitmap *fz_keep_bitmap(fz_context *ctx, fz_bitmap *bit);2223/*24fz_drop_bitmap: Drop a reference and free a bitmap.2526Decrement the reference count for the bitmap. When no27references remain the pixmap will be freed.2829Does not throw exceptions.30*/31void fz_drop_bitmap(fz_context *ctx, fz_bitmap *bit);3233/*34A halftone is a set of threshold tiles, one per component. Each35threshold tile is a pixmap, possibly of varying sizes and phases.36Currently, we only provide one 'default' halftone tile for operating37on 1 component plus alpha pixmaps (where the alpha is ignored). This38is signified by an fz_halftone pointer to NULL.39*/40typedef struct fz_halftone_s fz_halftone;4142/*43fz_halftone_pixmap: Make a bitmap from a pixmap and a halftone.4445pix: The pixmap to generate from. Currently must be a single color46component + alpha (where the alpha is assumed to be solid).4748ht: The halftone to use. NULL implies the default halftone.4950Returns the resultant bitmap. Throws exceptions in the case of51failure to allocate.52*/53fz_bitmap *fz_halftone_pixmap(fz_context *ctx, fz_pixmap *pix, fz_halftone *ht);5455struct fz_bitmap_s56{57int refs;58int w, h, stride, n;59int xres, yres;60unsigned char *samples;61};6263fz_bitmap *fz_new_bitmap(fz_context *ctx, int w, int h, int n, int xres, int yres);6465void fz_bitmap_details(fz_bitmap *bitmap, int *w, int *h, int *n, int *stride);6667void fz_clear_bitmap(fz_context *ctx, fz_bitmap *bit);6869struct fz_halftone_s70{71int refs;72int n;73fz_pixmap *comp[1];74};7576fz_halftone *fz_new_halftone(fz_context *ctx, int num_comps);77fz_halftone *fz_default_halftone(fz_context *ctx, int num_comps);78void fz_drop_halftone(fz_context *ctx, fz_halftone *half);79fz_halftone *fz_keep_halftone(fz_context *ctx, fz_halftone *half);8081#endif828384