LibGd 2.4.0-dev
GD Graphics library
Loading...
Searching...
No Matches
gd_gradient.h
1#ifndef GD_GRADIENT_H
2#define GD_GRADIENT_H
3
4#include "gd_compositor.h"
5#include "gd_vector2d_private.h"
6#include <stddef.h>
7#include <stdint.h>
8
9#define GD_GRADIENT_LUT_SIZE 1024
10
11typedef enum { GD_GRADIENT_LINEAR, GD_GRADIENT_RADIAL } gdGradientKind;
12
13typedef struct {
14 double offset;
15 gdPremulPixelF color;
16 uint64_t sequence;
17} gdColorStop;
18
19struct gdGradientStruct {
20 gdGradientKind kind;
21 gdExtendMode extend;
22 gdPathMatrix matrix;
23 gdPathMatrix inverse;
24 gdColorStop *stops;
25 size_t stop_count, stop_capacity;
26 uint64_t next_sequence;
27 gdPremulPixelF lut[GD_GRADIENT_LUT_SIZE];
28 union {
29 struct {
30 double x0, y0, dx, dy, inverse_length_squared, scale;
31 } linear;
32 struct {
33 double x0, y0, r0, x1, y1, r1, cdx, cdy, dr, quadratic_a, scale;
34 } radial;
35 } geometry;
36};
37
38void gdGradientDestroy(gdGradient *gradient);
39int gdExtendFold(double raw, gdExtendMode mode, double *folded);
40gdPremulPixelF gdGradientSample(const gdGradient *gradient, const gdPathMatrix *device_to_pattern,
41 double device_x, double device_y);
42
43#endif
gdExtendMode
Definition gd_vector2d.h:181
Affine transformation matrix.
Definition gd_vector2d.h:139