26 |
/* Opaque type for a color space reference. */ |
/* Opaque type for a color space reference. */ |
27 |
typedef struct GFColorSpace *GFColorSpaceRef; |
typedef struct GFColorSpace *GFColorSpaceRef; |
28 |
|
|
29 |
|
/* From SVG Specification regarding spread methods: |
30 |
|
Indicates what happens if the gradient starts or ends inside the |
31 |
|
bounds of the target rectangle. Possible values are: pad, which |
32 |
|
says to use the terminal colors of the gradient to fill the remainder |
33 |
|
of the target region reflect, which says to reflect the gradient |
34 |
|
pattern start-to-end, end-to-start, start-to-end, etc. continuously |
35 |
|
until the target rectangle is filled, and repeat, which says to |
36 |
|
repeat the gradient pattern start-to-end, start-to-end, start-to-end, |
37 |
|
etc. continuously until the target region is filled. */ |
38 |
|
enum GFGradientSpreadMethod |
39 |
|
{ |
40 |
|
kGFGradientSpreadPad, |
41 |
|
kGFGradientSpreadReflect, |
42 |
|
kGFGradientSpreadRepeat |
43 |
|
}; |
44 |
|
typedef enum GFGradientSpreadMethod GFGradientSpreadMethod; |
45 |
|
|
46 |
|
|
47 |
|
/* OFFSET is a number usually ranging from 0 to 1 which indicates |
48 |
|
where the gradient stop is placed. |
49 |
|
|
50 |
|
For linear gradients, the offset attribute represents a location |
51 |
|
along the gradient vector. |
52 |
|
For radial gradients, it represents a percentage distance from |
53 |
|
(FX,FY) to the edge of the outermost/largest circle. |
54 |
|
|
55 |
|
The STOP_COLOR property indicates what color to use at that |
56 |
|
gradient stop. It includes the stop opacity. */ |
57 |
|
struct GFGradientStop |
58 |
|
{ |
59 |
|
float offset; |
60 |
|
float stop_color [4]; /* ??? */ |
61 |
|
}; |
62 |
|
typedef struct GFGradientStop GFGradiantStop; |
63 |
|
|
64 |
|
|
65 |
/* Releases a reference to color space COLORSPACE. */ |
/* Releases a reference to color space COLORSPACE. */ |
66 |
GF_EXTERN void GFColorSpaceRelease (GFColorSpaceRef colorspace); |
GF_EXTERN void GFColorSpaceRelease (GFColorSpaceRef colorspace); |
67 |
|
|
69 |
GF_EXTERN void GFColorSpaceRetain (GFColorSpaceRef colorspace); |
GF_EXTERN void GFColorSpaceRetain (GFColorSpaceRef colorspace); |
70 |
|
|
71 |
/* Create a device dependent gray color space. A reference to the |
/* Create a device dependent gray color space. A reference to the |
72 |
color space is returned. Number of components: 1. */ |
color space is returned. Number of components: 2. */ |
73 |
GF_EXTERN GFColorSpaceRef GFColorSpaceCreateDeviceGray (void); |
GF_EXTERN GFColorSpaceRef GFColorSpaceCreateDeviceGray (void); |
74 |
|
|
75 |
/* Create a device dependent RGB color space. A reference to the |
/* Create a device dependent RGB color space. A reference to the |
76 |
color space is returned. Number of components: 3. */ |
color space is returned. Number of components: 4. */ |
77 |
GF_EXTERN GFColorSpaceRef GFColorSpaceCreateDeviceRGB (void); |
GF_EXTERN GFColorSpaceRef GFColorSpaceCreateDeviceRGB (void); |
78 |
|
|
79 |
|
/* Create a device dependent CMYK color space. A reference to the |
80 |
|
color space is returned. Number of components: 5. */ |
81 |
|
GF_EXTERN GFColorSpaceRef GFColorSpaceCreateDeviceCMYK (void); |
82 |
|
|
83 |
|
/* Return number of components in COLORSPACE. */ |
84 |
|
GF_EXTERN int GFColorSpaceNumberOfComponents (GFColorSpaceRef colorspace); |
85 |
|
|
86 |
|
/* Note that stops have to be allocated as long as the color space |
87 |
|
is used. This means that you can change color values and offsets |
88 |
|
while using the color space. ??? should we allow this?*/ |
89 |
|
|
90 |
|
/* Note that a gardient color space can not be used for creating |
91 |
|
bitmap contexts. */ |
92 |
|
|
93 |
|
/* Create a linear gradient color space. PARENT_COLORSPACE is the |
94 |
|
colorspace used for the STOP_COLORs in STOPS. N_STOPS is the |
95 |
|
number of stops in the STOPS array. We return a reference to |
96 |
|
the colorspace. X1, Y1, X2, Y2 define a gradient vector for |
97 |
|
the linear gradient. This gradient vector provides starting |
98 |
|
and ending points onto which the gradient stops are mapped. */ |
99 |
|
GF_EXTERN GFColorSpaceRef |
100 |
|
GFColorSpaceCreateGradientLinear (GFColorSpaceRef parent_colorspace, |
101 |
|
GFGradiantStop *stops, int n_stops, |
102 |
|
GFGradientSpreadMethod spread, |
103 |
|
float x1, float y1, float x2, float y2); |
104 |
|
|
105 |
|
/* Create a radial gradient color space. PARENT_COLORSPACE is the |
106 |
|
colorspace used for the STOP_COLORs in STOPS. N_STOPS is the |
107 |
|
number of stops in the STOPS array. |
108 |
|
|
109 |
|
CX, CY, R define the largest (i.e., outermost) circle for the radial |
110 |
|
gradient. The gradient will be drawn such that the 100% gradient |
111 |
|
stop is mapped to the perimeter of this largest (i.e., outermost) circle. |
112 |
|
|
113 |
|
FX, FY define the focal point for the radial gradient. The gradient |
114 |
|
will be drawn such that the 0% gradient stop is mapped to (FX, FY). */ |
115 |
|
GF_EXTERN GFColorSpaceRef |
116 |
|
GFColorSpaceCreateGradientRadial (GFColorSpaceRef parent_colorspace, |
117 |
|
GFGradiantStop *stops, int n_stops, |
118 |
|
GFGradientSpreadMethod spread, |
119 |
|
float cx, float cy, float r, |
120 |
|
float fx, float fy); |
121 |
|
|
122 |
#endif /* GFColorSpace.h */ |
#endif /* GFColorSpace.h */ |