eBookReaderSwitch/include/mupdf/fitz/bitmap.h

51 lines
1.5 KiB
C

#ifndef MUPDF_FITZ_BITMAP_H
#define MUPDF_FITZ_BITMAP_H
#include "mupdf/fitz/system.h"
#include "mupdf/fitz/context.h"
#include "mupdf/fitz/pixmap.h"
/*
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.
*/
typedef struct fz_bitmap_s fz_bitmap;
fz_bitmap *fz_keep_bitmap(fz_context *ctx, fz_bitmap *bit);
void fz_drop_bitmap(fz_context *ctx, fz_bitmap *bit);
/*
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.
*/
typedef struct fz_halftone_s fz_halftone;
fz_bitmap *fz_new_bitmap_from_pixmap(fz_context *ctx, fz_pixmap *pix, fz_halftone *ht);
fz_bitmap *fz_new_bitmap_from_pixmap_band(fz_context *ctx, fz_pixmap *pix, fz_halftone *ht, int band_start);
struct fz_bitmap_s
{
int refs;
int w, h, stride, n;
int xres, yres;
unsigned char *samples;
};
fz_bitmap *fz_new_bitmap(fz_context *ctx, int w, int h, int n, int xres, int yres);
void fz_bitmap_details(fz_bitmap *bitmap, int *w, int *h, int *n, int *stride);
void fz_clear_bitmap(fz_context *ctx, fz_bitmap *bit);
fz_halftone *fz_default_halftone(fz_context *ctx, int num_comps);
fz_halftone *fz_keep_halftone(fz_context *ctx, fz_halftone *half);
void fz_drop_halftone(fz_context *ctx, fz_halftone *ht);
#endif