karbon

art_render_misc.h
1/* This file is part of the KDE project.
2 * art_render_misc.c: Here I store some routines I feel should be in libart :)
3 *
4 * Copyright (C) 2002, The Karbon Developers
5 *
6 * This code is adapted from :
7 *
8 * art_render_gradient.h: Gradient image source for modular rendering.
9 *
10 * Libart_LGPL - library of basic graphic primitives
11 * Copyright (C) 2000 Raph Levien
12 *
13 * This library is free software; you can redistribute it and/or
14 * modify it under the terms of the GNU Library General Public
15 * License as published by the Free Software Foundation; either
16 * version 2 of the License, or (at your option) any later version.
17 *
18 * This library is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21 * Library General Public License for more details.
22 *
23 * You should have received a copy of the GNU Library General Public
24 * License along with this library; if not, write to the
25 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
26 * Boston, MA 02110-1301, USA.
27 *
28 * Authors: Raph Levien <raph@acm.org>
29 * Alexander Larsson <alla@lysator.liu.se>
30 */
31
32#ifndef __ART_RENDER_MISC_H__
33#define __ART_RENDER_MISC_H__
34
35#ifdef LIBART_COMPILATION
36#include "art_filterlevel.h"
37#include "art_render.h"
38#else
39#include <libart_lgpl/art_filterlevel.h>
40#include <libart_lgpl/art_render.h>
41#endif
42
43#ifdef __cplusplus
44extern "C" {
45#endif /* __cplusplus */
46
47typedef struct _ArtGradientLinear ArtGradientLinear;
48typedef struct _ArtGradientRadial ArtGradientRadial;
49typedef struct _ArtGradientConical ArtGradientConical;
50typedef struct _ArtGradientStop ArtGradientStop;
51
52typedef enum {
53 ART_GRADIENT_PAD,
54 ART_GRADIENT_REFLECT,
55 ART_GRADIENT_REPEAT
56} ArtGradientSpread;
57
58struct _ArtGradientLinear {
59 double a;
60 double b;
61 double c;
62 ArtGradientSpread spread;
63 int n_stops;
64 ArtGradientStop *stops;
65};
66
67struct _ArtGradientRadial {
68 double affine[6]; /* transforms user coordinates to unit circle */
69 double fx, fy; /* focal point in unit circle coords */
70 int n_stops;
71 ArtGradientSpread spread;
72 ArtGradientStop *stops;
73};
74
75struct _ArtGradientConical {
76 double cx, cy; /* focal point in unit circle coords */
77 double r; /* focal point in unit circle coords */
78 ArtGradientSpread spread;
79 art_u8 *buf;
80 int n_stops;
81 ArtGradientStop *stops;
82};
83
84
85struct _ArtGradientStop {
86 double offset;
87 ArtPixMaxDepth color[ART_MAX_CHAN + 1];
88};
89
90void
91art_karbon_render_gradient_linear (ArtRender *render,
92 const ArtGradientLinear *gradient,
93 ArtFilterLevel level);
94
95void
96art_karbon_render_gradient_radial (ArtRender *render,
97 const ArtGradientRadial *gradient,
98 ArtFilterLevel level);
99
100void
101art_karbon_render_gradient_conical (ArtRender *render,
102 const ArtGradientConical *gradient,
103 ArtFilterLevel level);
104
105#ifdef __cplusplus
106}
107#endif /* __cplusplus */
108
109#endif /* __ART_RENDER_MISC_H__ */