mupdf
Loading...
Searching...
No Matches
pixmap.h File Reference
Include dependency graph for pixmap.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  fz_pixmap

Typedefs

typedef struct fz_overprint fz_overprint

Enumerations

enum  { FZ_PIXMAP_FLAG_INTERPOLATE = 1 , FZ_PIXMAP_FLAG_FREE_SAMPLES = 2 }

Functions

fz_irect fz_pixmap_bbox (fz_context *ctx, const fz_pixmap *pix)
int fz_pixmap_width (fz_context *ctx, const fz_pixmap *pix)
int fz_pixmap_height (fz_context *ctx, const fz_pixmap *pix)
int fz_pixmap_x (fz_context *ctx, const fz_pixmap *pix)
int fz_pixmap_y (fz_context *ctx, const fz_pixmap *pix)
size_t fz_pixmap_size (fz_context *ctx, fz_pixmap *pix)
fz_pixmapfz_new_pixmap (fz_context *ctx, fz_colorspace *cs, int w, int h, fz_separations *seps, int alpha)
fz_pixmapfz_new_pixmap_with_bbox (fz_context *ctx, fz_colorspace *colorspace, fz_irect bbox, fz_separations *seps, int alpha)
fz_pixmapfz_new_pixmap_with_data (fz_context *ctx, fz_colorspace *colorspace, int w, int h, fz_separations *seps, int alpha, int stride, unsigned char *samples)
fz_pixmapfz_new_pixmap_with_bbox_and_data (fz_context *ctx, fz_colorspace *colorspace, fz_irect rect, fz_separations *seps, int alpha, unsigned char *samples)
fz_pixmapfz_new_pixmap_from_pixmap (fz_context *ctx, fz_pixmap *pixmap, const fz_irect *rect)
fz_pixmapfz_clone_pixmap (fz_context *ctx, const fz_pixmap *old)
fz_pixmapfz_keep_pixmap (fz_context *ctx, fz_pixmap *pix)
void fz_drop_pixmap (fz_context *ctx, fz_pixmap *pix)
fz_colorspacefz_pixmap_colorspace (fz_context *ctx, const fz_pixmap *pix)
int fz_pixmap_components (fz_context *ctx, const fz_pixmap *pix)
int fz_pixmap_colorants (fz_context *ctx, const fz_pixmap *pix)
int fz_pixmap_spots (fz_context *ctx, const fz_pixmap *pix)
int fz_pixmap_alpha (fz_context *ctx, const fz_pixmap *pix)
unsigned char * fz_pixmap_samples (fz_context *ctx, const fz_pixmap *pix)
int fz_pixmap_stride (fz_context *ctx, const fz_pixmap *pix)
void fz_set_pixmap_resolution (fz_context *ctx, fz_pixmap *pix, int xres, int yres)
void fz_clear_pixmap_with_value (fz_context *ctx, fz_pixmap *pix, int value)
void fz_fill_pixmap_with_color (fz_context *ctx, fz_pixmap *pix, fz_colorspace *colorspace, float *color, fz_color_params color_params)
void fz_clear_pixmap_rect_with_value (fz_context *ctx, fz_pixmap *pix, int value, fz_irect r)
void fz_clear_pixmap (fz_context *ctx, fz_pixmap *pix)
void fz_invert_pixmap (fz_context *ctx, fz_pixmap *pix)
void fz_invert_pixmap_alpha (fz_context *ctx, fz_pixmap *pix)
void fz_invert_pixmap_luminance (fz_context *ctx, fz_pixmap *pix)
void fz_tint_pixmap (fz_context *ctx, fz_pixmap *pix, int black, int white)
void fz_invert_pixmap_rect (fz_context *ctx, fz_pixmap *image, fz_irect rect)
void fz_invert_pixmap_raw (fz_context *ctx, fz_pixmap *pix)
void fz_gamma_pixmap (fz_context *ctx, fz_pixmap *pix, float gamma)
fz_pixmapfz_convert_pixmap (fz_context *ctx, const fz_pixmap *pix, fz_colorspace *cs_des, fz_colorspace *prf, fz_default_colorspaces *default_cs, fz_color_params color_params, int keep_alpha)
int fz_is_pixmap_monochrome (fz_context *ctx, fz_pixmap *pixmap)
fz_pixmapfz_alpha_from_gray (fz_context *ctx, fz_pixmap *gray)
fz_pixmapfz_alpha_from_rgb (fz_context *ctx, fz_pixmap *color)
void fz_decode_tile (fz_context *ctx, fz_pixmap *pix, const float *decode)
void fz_md5_pixmap (fz_context *ctx, fz_pixmap *pixmap, unsigned char digest[16])
fz_streamfz_unpack_stream (fz_context *ctx, fz_stream *src, int depth, int w, int h, int n, int indexed, int pad, int skip)
fz_pixmapfz_warp_pixmap (fz_context *ctx, fz_pixmap *src, fz_quad points, int width, int height)
fz_pixmapfz_autowarp_pixmap (fz_context *ctx, fz_pixmap *src, fz_quad points)
int fz_detect_document (fz_context *ctx, fz_quad *points, fz_pixmap *src)
fz_pixmapfz_clone_pixmap_area_with_different_seps (fz_context *ctx, fz_pixmap *src, const fz_irect *bbox, fz_colorspace *dcs, fz_separations *seps, fz_color_params color_params, fz_default_colorspaces *default_cs)
fz_pixmapfz_new_pixmap_from_alpha_channel (fz_context *ctx, fz_pixmap *src)
fz_pixmapfz_new_pixmap_from_color_and_mask (fz_context *ctx, fz_pixmap *color, fz_pixmap *mask)
fz_pixmapfz_scale_pixmap (fz_context *ctx, fz_pixmap *src, float x, float y, float w, float h, const fz_irect *clip)
void fz_subsample_pixmap (fz_context *ctx, fz_pixmap *tile, int factor)
void fz_copy_pixmap_rect (fz_context *ctx, fz_pixmap *dest, fz_pixmap *src, fz_irect r, const fz_default_colorspaces *default_cs)

Typedef Documentation

◆ fz_overprint

typedef struct fz_overprint fz_overprint

Pixmaps represent a set of pixels for a 2 dimensional region of a plane. Each pixel has n components per pixel. The components are in the order process-components, spot-colors, alpha, where there can be 0 of any of those types. The data is in premultiplied alpha when rendering, but non-premultiplied for colorspace conversions and rescaling.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
FZ_PIXMAP_FLAG_INTERPOLATE 
FZ_PIXMAP_FLAG_FREE_SAMPLES 

Function Documentation

◆ fz_alpha_from_gray()

fz_pixmap * fz_alpha_from_gray ( fz_context * ctx,
fz_pixmap * gray )

◆ fz_alpha_from_rgb()

fz_pixmap * fz_alpha_from_rgb ( fz_context * ctx,
fz_pixmap * color )

◆ fz_autowarp_pixmap()

fz_pixmap * fz_autowarp_pixmap ( fz_context * ctx,
fz_pixmap * src,
fz_quad points )

◆ fz_clear_pixmap()

void fz_clear_pixmap ( fz_context * ctx,
fz_pixmap * pix )

Sets all components (including alpha) of all pixels in a pixmap to 0.

pix: The pixmap to clear.

◆ fz_clear_pixmap_rect_with_value()

void fz_clear_pixmap_rect_with_value ( fz_context * ctx,
fz_pixmap * pix,
int value,
fz_irect r )

Clears a subrect of a pixmap with the given value.

pix: The pixmap to clear.

value: Values in the range 0 to 255 are valid. Each component sample for each pixel in the pixmap will be set to this value, while alpha will always be set to 255 (non-transparent).

r: the rectangle.

◆ fz_clear_pixmap_with_value()

void fz_clear_pixmap_with_value ( fz_context * ctx,
fz_pixmap * pix,
int value )

Clears a pixmap with the given value.

pix: The pixmap to clear.

value: Values in the range 0 to 255 are valid. Each component sample for each pixel in the pixmap will be set to this value, while alpha will always be set to 255 (non-transparent).

This function is horrible, and should be removed from the API and replaced with a less magic one.

◆ fz_clone_pixmap()

fz_pixmap * fz_clone_pixmap ( fz_context * ctx,
const fz_pixmap * old )

Clone a pixmap, copying the pixels and associated data to new storage.

The reference count of 'old' is unchanged.

◆ fz_clone_pixmap_area_with_different_seps()

fz_pixmap * fz_clone_pixmap_area_with_different_seps ( fz_context * ctx,
fz_pixmap * src,
const fz_irect * bbox,
fz_colorspace * dcs,
fz_separations * seps,
fz_color_params color_params,
fz_default_colorspaces * default_cs )

◆ fz_convert_pixmap()

fz_pixmap * fz_convert_pixmap ( fz_context * ctx,
const fz_pixmap * pix,
fz_colorspace * cs_des,
fz_colorspace * prf,
fz_default_colorspaces * default_cs,
fz_color_params color_params,
int keep_alpha )

Convert an existing pixmap to a desired colorspace. Other properties of the pixmap, such as resolution and position are copied to the converted pixmap.

pix: The pixmap to convert.

default_cs: If NULL pix->colorspace is used. It is possible that the data may need to be interpreted as one of the color spaces in default_cs.

cs_des: Desired colorspace, may be NULL to denote alpha-only.

prf: Proofing color space through which we need to convert.

color_params: Parameters that may be used in conversion (e.g. ri).

keep_alpha: If 0 any alpha component is removed, otherwise alpha is kept if present in the pixmap.

◆ fz_copy_pixmap_rect()

void fz_copy_pixmap_rect ( fz_context * ctx,
fz_pixmap * dest,
fz_pixmap * src,
fz_irect r,
const fz_default_colorspaces * default_cs )

◆ fz_decode_tile()

void fz_decode_tile ( fz_context * ctx,
fz_pixmap * pix,
const float * decode )

◆ fz_detect_document()

int fz_detect_document ( fz_context * ctx,
fz_quad * points,
fz_pixmap * src )

◆ fz_drop_pixmap()

void fz_drop_pixmap ( fz_context * ctx,
fz_pixmap * pix )

Decrement the reference count for the pixmap. When the reference count hits 0, the pixmap is freed.

Never throws exceptions.

◆ fz_fill_pixmap_with_color()

void fz_fill_pixmap_with_color ( fz_context * ctx,
fz_pixmap * pix,
fz_colorspace * colorspace,
float * color,
fz_color_params color_params )

Fill pixmap with solid color.

◆ fz_gamma_pixmap()

void fz_gamma_pixmap ( fz_context * ctx,
fz_pixmap * pix,
float gamma )

Apply gamma correction to a pixmap. All components of all pixels are modified (except alpha, which is unchanged).

gamma: The gamma value to apply; 1.0 for no change.

◆ fz_invert_pixmap()

void fz_invert_pixmap ( fz_context * ctx,
fz_pixmap * pix )

Invert all the pixels in a pixmap. All components (process and spots) of all pixels are inverted (except alpha, which is unchanged).

◆ fz_invert_pixmap_alpha()

void fz_invert_pixmap_alpha ( fz_context * ctx,
fz_pixmap * pix )

Invert the alpha of all the pixels in a pixmap.

◆ fz_invert_pixmap_luminance()

void fz_invert_pixmap_luminance ( fz_context * ctx,
fz_pixmap * pix )

Transform the pixels in a pixmap so that luminance of each pixel is inverted, and the chrominance remains unchanged (as much as accuracy allows).

All components of all pixels are inverted (except alpha, which is unchanged). Only supports Grey and RGB bitmaps.

◆ fz_invert_pixmap_raw()

void fz_invert_pixmap_raw ( fz_context * ctx,
fz_pixmap * pix )

Invert all the pixels in a non-premultiplied pixmap in a very naive manner.

◆ fz_invert_pixmap_rect()

void fz_invert_pixmap_rect ( fz_context * ctx,
fz_pixmap * image,
fz_irect rect )

Invert all the pixels in a given rectangle of a (premultiplied) pixmap. All components of all pixels in the rectangle are inverted (except alpha, which is unchanged).

◆ fz_is_pixmap_monochrome()

int fz_is_pixmap_monochrome ( fz_context * ctx,
fz_pixmap * pixmap )

Check if the pixmap is a 1-channel image containing samples with only values 0 and 255

◆ fz_keep_pixmap()

fz_pixmap * fz_keep_pixmap ( fz_context * ctx,
fz_pixmap * pix )

Increment the reference count for the pixmap. The same pointer is returned.

Never throws exceptions.

◆ fz_md5_pixmap()

void fz_md5_pixmap ( fz_context * ctx,
fz_pixmap * pixmap,
unsigned char digest[16] )

◆ fz_new_pixmap()

fz_pixmap * fz_new_pixmap ( fz_context * ctx,
fz_colorspace * cs,
int w,
int h,
fz_separations * seps,
int alpha )

Create a new pixmap, with its origin at (0,0)

cs: The colorspace to use for the pixmap, or NULL for an alpha plane/mask.

w: The width of the pixmap (in pixels)

h: The height of the pixmap (in pixels)

seps: Details of separations.

alpha: 0 for no alpha, 1 for alpha.

Returns a pointer to the new pixmap. Throws exception on failure to allocate.

◆ fz_new_pixmap_from_alpha_channel()

fz_pixmap * fz_new_pixmap_from_alpha_channel ( fz_context * ctx,
fz_pixmap * src )

◆ fz_new_pixmap_from_color_and_mask()

fz_pixmap * fz_new_pixmap_from_color_and_mask ( fz_context * ctx,
fz_pixmap * color,
fz_pixmap * mask )

◆ fz_new_pixmap_from_pixmap()

fz_pixmap * fz_new_pixmap_from_pixmap ( fz_context * ctx,
fz_pixmap * pixmap,
const fz_irect * rect )

Create a new pixmap that represents a subarea of the specified pixmap. A reference is taken to this pixmap that will be dropped on destruction.

The supplied rectangle must be wholly contained within the original pixmap.

Returns a pointer to the new pixmap. Throws exception on failure to allocate.

◆ fz_new_pixmap_with_bbox()

fz_pixmap * fz_new_pixmap_with_bbox ( fz_context * ctx,
fz_colorspace * colorspace,
fz_irect bbox,
fz_separations * seps,
int alpha )

Create a pixmap of a given size, location and pixel format.

The bounding box specifies the size of the created pixmap and where it will be located. The colorspace determines the number of components per pixel. Alpha is always present. Pixmaps are reference counted, so drop references using fz_drop_pixmap.

colorspace: Colorspace format used for the created pixmap. The pixmap will keep a reference to the colorspace.

bbox: Bounding box specifying location/size of created pixmap.

seps: Details of separations.

alpha: 0 for no alpha, 1 for alpha.

Returns a pointer to the new pixmap. Throws exception on failure to allocate.

◆ fz_new_pixmap_with_bbox_and_data()

fz_pixmap * fz_new_pixmap_with_bbox_and_data ( fz_context * ctx,
fz_colorspace * colorspace,
fz_irect rect,
fz_separations * seps,
int alpha,
unsigned char * samples )

Create a pixmap of a given size, location and pixel format, using the supplied data block.

The bounding box specifies the size of the created pixmap and where it will be located. The colorspace determines the number of components per pixel. Alpha is always present. Pixmaps are reference counted, so drop references using fz_drop_pixmap.

colorspace: Colorspace format used for the created pixmap. The pixmap will keep a reference to the colorspace.

rect: Bounding box specifying location/size of created pixmap.

seps: Details of separations.

alpha: Number of alpha planes (0 or 1).

samples: The data block to keep the samples in.

Returns a pointer to the new pixmap. Throws exception on failure to allocate.

◆ fz_new_pixmap_with_data()

fz_pixmap * fz_new_pixmap_with_data ( fz_context * ctx,
fz_colorspace * colorspace,
int w,
int h,
fz_separations * seps,
int alpha,
int stride,
unsigned char * samples )

Create a new pixmap, with its origin at (0,0) using the supplied data block.

cs: The colorspace to use for the pixmap, or NULL for an alpha plane/mask.

w: The width of the pixmap (in pixels)

h: The height of the pixmap (in pixels)

seps: Details of separations.

alpha: 0 for no alpha, 1 for alpha.

stride: The byte offset from the pixel data in a row to the pixel data in the next row.

samples: The data block to keep the samples in.

Returns a pointer to the new pixmap. Throws exception on failure to allocate.

◆ fz_pixmap_alpha()

int fz_pixmap_alpha ( fz_context * ctx,
const fz_pixmap * pix )

Return the number of alpha planes in a pixmap.

Returns the number of alphas. Does not throw exceptions.

◆ fz_pixmap_bbox()

fz_irect fz_pixmap_bbox ( fz_context * ctx,
const fz_pixmap * pix )

Return the bounding box for a pixmap.

◆ fz_pixmap_colorants()

int fz_pixmap_colorants ( fz_context * ctx,
const fz_pixmap * pix )

Return the number of colorants in a pixmap.

Returns the number of colorants (components, less any spots and alpha).

◆ fz_pixmap_colorspace()

fz_colorspace * fz_pixmap_colorspace ( fz_context * ctx,
const fz_pixmap * pix )

Return the colorspace of a pixmap

Returns colorspace.

◆ fz_pixmap_components()

int fz_pixmap_components ( fz_context * ctx,
const fz_pixmap * pix )

Return the number of components in a pixmap.

Returns the number of components (including spots and alpha).

◆ fz_pixmap_height()

int fz_pixmap_height ( fz_context * ctx,
const fz_pixmap * pix )

Return the height of the pixmap in pixels.

◆ fz_pixmap_samples()

unsigned char * fz_pixmap_samples ( fz_context * ctx,
const fz_pixmap * pix )

Returns a pointer to the pixel data of a pixmap.

Returns the pointer.

◆ fz_pixmap_size()

size_t fz_pixmap_size ( fz_context * ctx,
fz_pixmap * pix )

Return sizeof fz_pixmap plus size of data, in bytes.

◆ fz_pixmap_spots()

int fz_pixmap_spots ( fz_context * ctx,
const fz_pixmap * pix )

Return the number of spots in a pixmap.

Returns the number of spots (components, less colorants and alpha). Does not throw exceptions.

◆ fz_pixmap_stride()

int fz_pixmap_stride ( fz_context * ctx,
const fz_pixmap * pix )

Return the number of bytes in a row in the pixmap.

◆ fz_pixmap_width()

int fz_pixmap_width ( fz_context * ctx,
const fz_pixmap * pix )

Return the width of the pixmap in pixels.

◆ fz_pixmap_x()

int fz_pixmap_x ( fz_context * ctx,
const fz_pixmap * pix )

Return the x value of the pixmap in pixels.

◆ fz_pixmap_y()

int fz_pixmap_y ( fz_context * ctx,
const fz_pixmap * pix )

Return the y value of the pixmap in pixels.

◆ fz_scale_pixmap()

fz_pixmap * fz_scale_pixmap ( fz_context * ctx,
fz_pixmap * src,
float x,
float y,
float w,
float h,
const fz_irect * clip )

◆ fz_set_pixmap_resolution()

void fz_set_pixmap_resolution ( fz_context * ctx,
fz_pixmap * pix,
int xres,
int yres )

Set the pixels per inch resolution of the pixmap.

◆ fz_subsample_pixmap()

void fz_subsample_pixmap ( fz_context * ctx,
fz_pixmap * tile,
int factor )

◆ fz_tint_pixmap()

void fz_tint_pixmap ( fz_context * ctx,
fz_pixmap * pix,
int black,
int white )

Tint all the pixels in an RGB, BGR, or Gray pixmap.

black: Map black to this hexadecimal RGB color.

white: Map white to this hexadecimal RGB color.

◆ fz_unpack_stream()

fz_stream * fz_unpack_stream ( fz_context * ctx,
fz_stream * src,
int depth,
int w,
int h,
int n,
int indexed,
int pad,
int skip )

◆ fz_warp_pixmap()

fz_pixmap * fz_warp_pixmap ( fz_context * ctx,
fz_pixmap * src,
fz_quad points,
int width,
int height )