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_BITS 10
24 #define NR_GRADIENT_VECTOR_LENGTH (1<<NR_GRADIENT_VECTOR_BITS)
26 enum NRGradientSpread {
27 NR_GRADIENT_SPREAD_PAD,
28 NR_GRADIENT_SPREAD_REFLECT,
29 NR_GRADIENT_SPREAD_REPEAT
30 };
32 struct NRGradientRenderer : public NRRenderer {
33 const unsigned char *vector;
34 unsigned int spread;
35 };
37 /* Linear */
39 struct NRLGradientRenderer : public NRGradientRenderer {
40 double x0, y0;
41 double dx, dy;
42 };
44 NRRenderer *nr_lgradient_renderer_setup (NRLGradientRenderer *lgr,
45 const unsigned char *cv,
46 unsigned int spread,
47 const NRMatrix *gs2px,
48 float x0, float y0,
49 float x1, float y1);
51 /* Radial */
53 struct NRRGradientRenderer : public NRGradientRenderer {
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
72 /*
73 * Local Variables:
74 * mode:c++
75 * c-file-style:"stroustrup"
76 * c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
77 * indent-tabs-mode:nil
78 * fill-column:99
79 * End:
80 */
81 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :