mupdf
Toggle main menu visibility
Loading...
Searching...
No Matches
shade.h
Go to the documentation of this file.
1
// Copyright (C) 2004-2025 Artifex Software, Inc.
2
//
3
// This file is part of MuPDF.
4
//
5
// MuPDF is free software: you can redistribute it and/or modify it under the
6
// terms of the GNU Affero General Public License as published by the Free
7
// Software Foundation, either version 3 of the License, or (at your option)
8
// any later version.
9
//
10
// MuPDF is distributed in the hope that it will be useful, but WITHOUT ANY
11
// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12
// FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
13
// details.
14
//
15
// You should have received a copy of the GNU Affero General Public License
16
// along with MuPDF. If not, see <https://www.gnu.org/licenses/agpl-3.0.en.html>
17
//
18
// Alternative licensing terms are available from the licensor.
19
// For commercial licensing, see <https://www.artifex.com/> or contact
20
// Artifex Software, Inc., 39 Mesa Street, Suite 108A, San Francisco,
21
// CA 94129, USA, for further information.
22
23
#ifndef MUPDF_FITZ_SHADE_H
24
#define MUPDF_FITZ_SHADE_H
25
26
#include "
mupdf/fitz/system.h
"
27
#include "
mupdf/fitz/context.h
"
28
#include "
mupdf/fitz/geometry.h
"
29
#include "
mupdf/fitz/store.h
"
30
#include "
mupdf/fitz/pixmap.h
"
31
#include "
mupdf/fitz/compressed-buffer.h
"
32
36
37
enum
38
{
39
FZ_FUNCTION_BASED
= 1,
40
FZ_LINEAR
= 2,
41
FZ_RADIAL
= 3,
42
FZ_MESH_TYPE4
= 4,
43
FZ_MESH_TYPE5
= 5,
44
FZ_MESH_TYPE6
= 6,
45
FZ_MESH_TYPE7
= 7
46
};
47
52
typedef
struct
53
{
54
fz_storable
storable
;
55
56
fz_rect
bbox
;
/* can be fz_infinite_rect */
57
fz_colorspace
*
colorspace
;
58
59
fz_matrix
matrix
;
/* matrix from pattern dict */
60
int
use_background
;
/* background color for fills but not 'sh' */
61
float
background
[
FZ_MAX_COLORS
];
62
63
/* Just to be confusing, PDF Shadings of Type 1 (Function Based
64
* Shadings), do NOT use function, but all the others do. This
65
* is because Type 1 shadings take 2 inputs, whereas all the
66
* others (when used with a function take 1 input. The type 1
67
* data is in the 'f' field of the union below. */
68
/* If function_stride = 0, then function is not used. Otherwise
69
* function points to 256*function_stride entries. */
70
int
function_stride
;
71
float
*
function
;
72
73
int
type
;
/* function, linear, radial, mesh */
74
union
75
{
76
struct
77
{
78
int
extend
[2];
79
float
coords
[2][3];
/* (x,y,r) twice */
80
} l_or_r;
81
struct
82
{
83
int
vprow
;
84
int
bpflag
;
85
int
bpcoord
;
86
int
bpcomp
;
87
float
x0
,
x1
;
88
float
y0
,
y1
;
89
float
c0
[
FZ_MAX_COLORS
];
90
float
c1
[
FZ_MAX_COLORS
];
91
} m;
92
struct
93
{
94
fz_matrix
matrix;
95
int
xdivs
;
96
int
ydivs
;
97
float
domain
[2][2];
98
float
*
fn_vals
;
99
} f;
100
} u;
101
102
fz_compressed_buffer
*
buffer
;
103
}
fz_shade
;
104
111
fz_shade
*
fz_keep_shade
(
fz_context
*ctx,
fz_shade
*shade);
112
119
void
fz_drop_shade
(
fz_context
*ctx,
fz_shade
*shade);
120
132
fz_rect
fz_bound_shade
(
fz_context
*ctx,
fz_shade
*shade,
fz_matrix
ctm);
133
134
typedef
struct
fz_shade_color_cache
fz_shade_color_cache
;
135
136
void
fz_drop_shade_color_cache
(
fz_context
*ctx,
fz_shade_color_cache
*cache);
137
161
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);
162
166
typedef
struct
167
{
168
fz_point
p
;
169
float
c
[
FZ_MAX_COLORS
];
170
}
fz_vertex
;
171
182
typedef
void (
fz_shade_prepare_fn
)(
fz_context
*ctx,
void
*arg,
fz_vertex
*
v
,
const
float
*c);
183
194
typedef
void (
fz_shade_process_fn
)(
fz_context
*ctx,
void
*arg,
fz_vertex
*av,
fz_vertex
*bv,
fz_vertex
*cv);
195
217
void
fz_process_shade
(
fz_context
*ctx,
fz_shade
*shade,
fz_matrix
ctm,
fz_rect
scissor,
218
fz_shade_prepare_fn
*prepare,
219
fz_shade_process_fn
*process,
220
void
*process_arg);
221
222
223
/* Implementation details: subject to change. */
224
231
void
fz_drop_shade_imp
(
fz_context
*ctx,
fz_storable
*shade);
232
233
#endif
FZ_MAX_COLORS
@ FZ_MAX_COLORS
Definition
color.h:102
compressed-buffer.h
context.h
geometry.h
v
void HEAP_TYPE_NAME HEAP_CONTAINER_TYPE v
Definition
heap-imp.h:51
pixmap.h
fz_overprint
struct fz_overprint fz_overprint
Definition
pixmap.h:41
fz_shade_process_fn
void fz_shade_process_fn(fz_context *ctx, void *arg, fz_vertex *av, fz_vertex *bv, fz_vertex *cv)
Definition
shade.h:194
fz_shade_color_cache
struct fz_shade_color_cache fz_shade_color_cache
Definition
shade.h:134
fz_drop_shade_imp
void fz_drop_shade_imp(fz_context *ctx, fz_storable *shade)
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)
fz_shade_prepare_fn
void fz_shade_prepare_fn(fz_context *ctx, void *arg, fz_vertex *v, const float *c)
Definition
shade.h:182
FZ_LINEAR
@ FZ_LINEAR
Definition
shade.h:40
FZ_MESH_TYPE6
@ FZ_MESH_TYPE6
Definition
shade.h:44
FZ_MESH_TYPE4
@ FZ_MESH_TYPE4
Definition
shade.h:42
FZ_MESH_TYPE5
@ FZ_MESH_TYPE5
Definition
shade.h:43
FZ_RADIAL
@ FZ_RADIAL
Definition
shade.h:41
FZ_FUNCTION_BASED
@ FZ_FUNCTION_BASED
Definition
shade.h:39
FZ_MESH_TYPE7
@ FZ_MESH_TYPE7
Definition
shade.h:45
fz_bound_shade
fz_rect fz_bound_shade(fz_context *ctx, fz_shade *shade, fz_matrix ctm)
fz_keep_shade
fz_shade * fz_keep_shade(fz_context *ctx, fz_shade *shade)
fz_drop_shade_color_cache
void fz_drop_shade_color_cache(fz_context *ctx, fz_shade_color_cache *cache)
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)
fz_drop_shade
void fz_drop_shade(fz_context *ctx, fz_shade *shade)
store.h
fz_color_params
Definition
color.h:72
fz_colorspace
Definition
color.h:417
fz_compressed_buffer
Definition
compressed-buffer.h:93
fz_context
Definition
context.h:886
fz_irect
Definition
geometry.h:248
fz_matrix
Definition
geometry.h:388
fz_pixmap
Definition
pixmap.h:432
fz_point
Definition
geometry.h:187
fz_rect
Definition
geometry.h:231
fz_shade
Definition
shade.h:53
fz_shade::vprow
int vprow
Definition
shade.h:83
fz_shade::function
float * function
Definition
shade.h:71
fz_shade::x0
float x0
Definition
shade.h:87
fz_shade::c1
float c1[FZ_MAX_COLORS]
Definition
shade.h:90
fz_shade::matrix
fz_matrix matrix
Definition
shade.h:59
fz_shade::bpcoord
int bpcoord
Definition
shade.h:85
fz_shade::fn_vals
float * fn_vals
Definition
shade.h:98
fz_shade::y0
float y0
Definition
shade.h:88
fz_shade::domain
float domain[2][2]
Definition
shade.h:97
fz_shade::storable
fz_storable storable
Definition
shade.h:54
fz_shade::c0
float c0[FZ_MAX_COLORS]
Definition
shade.h:89
fz_shade::bbox
fz_rect bbox
Definition
shade.h:56
fz_shade::xdivs
int xdivs
Definition
shade.h:95
fz_shade::y1
float y1
Definition
shade.h:88
fz_shade::coords
float coords[2][3]
Definition
shade.h:79
fz_shade::bpflag
int bpflag
Definition
shade.h:84
fz_shade::background
float background[FZ_MAX_COLORS]
Definition
shade.h:61
fz_shade::use_background
int use_background
Definition
shade.h:60
fz_shade::bpcomp
int bpcomp
Definition
shade.h:86
fz_shade::type
int type
Definition
shade.h:73
fz_shade::x1
float x1
Definition
shade.h:87
fz_shade::ydivs
int ydivs
Definition
shade.h:96
fz_shade::function_stride
int function_stride
Definition
shade.h:70
fz_shade::extend
int extend[2]
Definition
shade.h:78
fz_shade::colorspace
fz_colorspace * colorspace
Definition
shade.h:57
fz_shade::buffer
fz_compressed_buffer * buffer
Definition
shade.h:102
fz_storable
Definition
store.h:76
fz_vertex
Definition
shade.h:167
fz_vertex::c
float c[FZ_MAX_COLORS]
Definition
shade.h:169
fz_vertex::p
fz_point p
Definition
shade.h:168
system.h
include
mupdf
fitz
shade.h
Generated by
1.17.0