summaryrefslogtreecommitdiff
path: root/fitz/fitz-internal.h
diff options
context:
space:
mode:
Diffstat (limited to 'fitz/fitz-internal.h')
-rw-r--r--fitz/fitz-internal.h69
1 files changed, 61 insertions, 8 deletions
diff --git a/fitz/fitz-internal.h b/fitz/fitz-internal.h
index 1d641817..5d94896f 100644
--- a/fitz/fitz-internal.h
+++ b/fitz/fitz-internal.h
@@ -957,9 +957,13 @@ void fz_print_text(fz_context *ctx, FILE *out, fz_text*);
enum
{
- FZ_LINEAR,
- FZ_RADIAL,
- FZ_MESH,
+ 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
};
typedef struct fz_shade_s fz_shade;
@@ -978,12 +982,36 @@ struct fz_shade_s
int use_function;
float function[256][FZ_MAX_COLORS + 1];
- int type; /* linear, radial, mesh */
- int extend[2];
+ int type; /* function, axial, radial, mesh */
+ union
+ {
+ struct
+ {
+ int extend[2];
+ float coords[2][3]; /* (x,y,r) twice */
+ } a_or_r;
+ struct
+ {
+ int vprow;
+ int bpflag;
+ int bpcoord;
+ int bpcomp;
+ float x0, x1;
+ float y0, y1;
+ float c0[FZ_MAX_COLORS];
+ float c1[FZ_MAX_COLORS];
+ } m;
+ struct
+ {
+ fz_matrix matrix;
+ int xdivs;
+ int ydivs;
+ float domain[2][2];
+ float *fn_vals;
+ } f;
+ } u;
- int mesh_len;
- int mesh_cap;
- float *mesh; /* [x y 0], [x y r], [x y t] or [x y c1 ... cn] */
+ fz_buffer *buffer;
};
fz_shade *fz_keep_shade(fz_context *ctx, fz_shade *shade);
@@ -993,6 +1021,31 @@ void fz_free_shade_imp(fz_context *ctx, fz_storable *shade);
fz_rect fz_bound_shade(fz_context *ctx, fz_shade *shade, fz_matrix ctm);
void fz_paint_shade(fz_context *ctx, fz_shade *shade, fz_matrix ctm, fz_pixmap *dest, fz_bbox bbox);
+/*
+ * Handy routine for processing mesh based shades
+ */
+typedef struct fz_vertex_s fz_vertex;
+
+struct fz_vertex_s
+{
+ fz_point p;
+ float c[FZ_MAX_COLORS];
+};
+
+typedef struct fz_mesh_processor_s fz_mesh_processor;
+
+typedef void (fz_mesh_process_fn)(void *arg, fz_vertex *av, fz_vertex *bv, fz_vertex *cv);
+
+struct fz_mesh_processor_s {
+ fz_context *ctx;
+ fz_shade *shade;
+ fz_mesh_process_fn *process;
+ void *process_arg;
+};
+
+void fz_process_mesh(fz_context *ctx, fz_shade *shade, fz_matrix ctm,
+ fz_mesh_process_fn *process, void *process_arg);
+
#ifndef NDEBUG
void fz_print_shade(fz_context *ctx, FILE *out, fz_shade *shade);
#endif