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

Go to the source code of this file.

Classes

struct  fz_shade
struct  fz_vertex

Typedefs

typedef struct fz_shade_color_cache fz_shade_color_cache
typedef void fz_shade_prepare_fn(fz_context *ctx, void *arg, fz_vertex *v, const float *c)
typedef void fz_shade_process_fn(fz_context *ctx, void *arg, fz_vertex *av, fz_vertex *bv, fz_vertex *cv)

Enumerations

enum  {
  FZ_FUNCTION_BASED = 1 , FZ_LINEAR = 2 , FZ_RADIAL = 3 , FZ_MESH_TYPE4 = 4 ,
  FZ_MESH_TYPE5 = 5 , FZ_MESH_TYPE6 = 6 , FZ_MESH_TYPE7 = 7
}

Functions

fz_shadefz_keep_shade (fz_context *ctx, fz_shade *shade)
void fz_drop_shade (fz_context *ctx, fz_shade *shade)
fz_rect fz_bound_shade (fz_context *ctx, fz_shade *shade, fz_matrix ctm)
void fz_drop_shade_color_cache (fz_context *ctx, fz_shade_color_cache *cache)
void fz_paint_shade (fz_context *ctx, fz_shade *shade, fz_colorspace *override_cs, fz_matrix ctm, fz_pixmap *dest, fz_color_params color_params, fz_irect bbox, const fz_overprint *eop, fz_shade_color_cache **cache)
void fz_process_shade (fz_context *ctx, fz_shade *shade, fz_matrix ctm, fz_rect scissor, fz_shade_prepare_fn *prepare, fz_shade_process_fn *process, void *process_arg)
void fz_drop_shade_imp (fz_context *ctx, fz_storable *shade)

Typedef Documentation

◆ fz_shade_color_cache

◆ fz_shade_prepare_fn

typedef void fz_shade_prepare_fn(fz_context *ctx, void *arg, fz_vertex *v, const float *c)

Callback function type for use with fz_process_shade.

arg: Opaque pointer from fz_process_shade caller.

v: Pointer to a fz_vertex structure to populate.

c: Pointer to an array of floats used to populate v.

◆ fz_shade_process_fn

typedef void fz_shade_process_fn(fz_context *ctx, void *arg, fz_vertex *av, fz_vertex *bv, fz_vertex *cv)

Callback function type for use with fz_process_shade.

arg: Opaque pointer from fz_process_shade caller.

av, bv, cv: Pointers to a fz_vertex structure describing the corner locations and colors of a triangle to be filled.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum

The shading code uses gouraud shaded triangle meshes.

Enumerator
FZ_FUNCTION_BASED 
FZ_LINEAR 
FZ_RADIAL 
FZ_MESH_TYPE4 
FZ_MESH_TYPE5 
FZ_MESH_TYPE6 
FZ_MESH_TYPE7 

Function Documentation

◆ fz_bound_shade()

fz_rect fz_bound_shade ( fz_context * ctx,
fz_shade * shade,
fz_matrix ctm )

Bound a given shading.

shade: The shade to bound.

ctm: The transform to apply to the shade before bounding.

r: Pointer to storage to put the bounds in.

Returns r, updated to contain the bounds for the shading.

◆ fz_drop_shade()

void fz_drop_shade ( fz_context * ctx,
fz_shade * shade )

Decrement the reference count for the shade structure. When the reference count hits zero, the structure is freed.

Never throws exceptions.

◆ fz_drop_shade_color_cache()

void fz_drop_shade_color_cache ( fz_context * ctx,
fz_shade_color_cache * cache )

◆ fz_drop_shade_imp()

void fz_drop_shade_imp ( fz_context * ctx,
fz_storable * shade )

Internal function to destroy a shade. Only exposed for use with the fz_store.

shade: The reference to destroy.

◆ fz_keep_shade()

fz_shade * fz_keep_shade ( fz_context * ctx,
fz_shade * shade )

Increment the reference count for the shade structure. The same pointer is returned.

Never throws exceptions.

◆ fz_paint_shade()

void fz_paint_shade ( fz_context * ctx,
fz_shade * shade,
fz_colorspace * override_cs,
fz_matrix ctm,
fz_pixmap * dest,
fz_color_params color_params,
fz_irect bbox,
const fz_overprint * eop,
fz_shade_color_cache ** cache )

Render a shade to a given pixmap.

shade: The shade to paint.

override_cs: NULL, or colorspace to override the shades inbuilt colorspace.

ctm: The transform to apply.

dest: The pixmap to render into.

color_params: The color rendering settings

bbox: Pointer to a bounding box to limit the rendering of the shade.

eop: NULL, or pointer to overprint bitmap.

cache: *cache is used to cache color information. If *cache is NULL it is set to point to a new fz_shade_color_cache. If cache is NULL it is ignored.

◆ fz_process_shade()

void fz_process_shade ( fz_context * ctx,
fz_shade * shade,
fz_matrix ctm,
fz_rect scissor,
fz_shade_prepare_fn * prepare,
fz_shade_process_fn * process,
void * process_arg )

Process a shade, using supplied callback functions. This decomposes the shading to a mesh (even ones that are not natively meshes, such as linear or radial shadings), and processes triangles from those meshes.

shade: The shade to process.

ctm: The transform to use

prepare: Callback function to 'prepare' each vertex. This function is passed an array of floats, and populates a fz_vertex structure.

process: This function is passed 3 pointers to vertex structures, and actually performs the processing (typically filling the area between the vertices).

process_arg: An opaque argument passed through from caller to callback functions.