1 #ifndef __NR_GRADIENT_H__
2 #define __NR_GRADIENT_H__
4 /*
5 * Pixel buffer rendering library
6 *
7 * Authors:
8 * Lauris Kaplinski <lauris@kaplinski.com>
9 *
10 * Copyright (C) 2001-2002 Lauris Kaplinski
11 * Copyright (C) 2001-2002 Ximian, Inc.
12 *
13 * Released under GNU GPL, read the file 'COPYING' for more information
14 */
16 /*
17 * Derived in part from public domain code by Lauris Kaplinski
18 */
20 #include <libnr/nr-matrix.h>
21 #include <libnr/nr-render.h>
23 #define NR_GRADIENT_VECTOR_LENGTH 1024
25 enum {
26 NR_GRADIENT_SPREAD_PAD,
27 NR_GRADIENT_SPREAD_REFLECT,
28 NR_GRADIENT_SPREAD_REPEAT
29 };
31 /* Linear */
33 struct NRLGradientRenderer {
34 NRRenderer renderer;
35 const unsigned char *vector;
36 unsigned int spread;
37 double x0, y0;
38 double dx, dy;
39 };
41 NRRenderer *nr_lgradient_renderer_setup (NRLGradientRenderer *lgr,
42 const unsigned char *cv,
43 unsigned int spread,
44 const NRMatrix *gs2px,
45 float x0, float y0,
46 float x1, float y1);
48 /* Radial */
50 struct NRRGradientRenderer {
51 NRRenderer renderer;
52 const unsigned char *vector;
53 unsigned int spread;
54 NRMatrix px2gs;
55 float cx, cy;
56 float fx, fy;
57 float r;
58 float C;
59 };
61 NRRenderer *nr_rgradient_renderer_setup (NRRGradientRenderer *rgr,
62 const unsigned char *cv,
63 unsigned int spread,
64 const NRMatrix *gs2px,
65 float cx, float cy,
66 float fx, float fy,
67 float r);
71 #endif