]> git.mxchange.org Git - simgear.git/blob - simgear/canvas/ShivaVG/src/shPaint.h
Update for OpenSceneGraph 3.3.2 API changes.
[simgear.git] / simgear / canvas / ShivaVG / src / shPaint.h
1 /*
2  * Copyright (c) 2007 Ivan Leben
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  * 
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Lesser General Public License for more details.
13  * 
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library in the file COPYING;
16  * if not, write to the Free Software Foundation, Inc.,
17  * 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
18  *
19  */
20
21 #ifndef __SHPAINT_H
22 #define __SHPAINT_H
23
24 #include "shDefs.h"
25 #include "shArrays.h"
26 #include "shImage.h"
27
28 typedef struct
29 {
30   float offset;
31   SHColor color;
32   
33 } SHStop;
34
35 #define _ITEM_T SHStop
36 #define _ARRAY_T SHStopArray
37 #define _FUNC_T shStopArray
38 #define _ARRAY_DECLARE
39 #include "shArrayBase.h"
40
41 typedef struct
42 {
43   VGPaintType type;
44   SHColor color;
45   SHColorArray colors;
46   SHStopArray instops;
47   SHStopArray stops;
48   VGboolean premultiplied;
49   VGColorRampSpreadMode spreadMode;
50   VGTilingMode tilingMode;
51   SHfloat linearGradient[4];
52   SHfloat radialGradient[5];
53   GLuint texture;
54   VGImage pattern;
55   
56 } SHPaint;
57
58 #define SH_GRADIENT_TEX_SIZE 1024
59
60 void SHPaint_ctor(SHPaint *p);
61 void SHPaint_dtor(SHPaint *p);
62
63 #define _ITEM_T SHPaint*
64 #define _ARRAY_T SHPaintArray
65 #define _FUNC_T shPaintArray
66 #define _ARRAY_DECLARE
67 #include "shArrayBase.h"
68
69 void shValidateInputStops(SHPaint *p);
70 void shSetGradientTexGLState(SHPaint *p);
71
72 int shDrawLinearGradientMesh(SHPaint *p, SHVector2 *min, SHVector2 *max,
73                              VGPaintMode mode, GLenum texUnit);
74   
75 int shDrawRadialGradientMesh(SHPaint *p, SHVector2 *min, SHVector2 *max,
76                              VGPaintMode mode, GLenum texUnit);
77
78 int shDrawPatternMesh(SHPaint *p, SHVector2 *min, SHVector2 *max,
79                       VGPaintMode mode, GLenum texUnit);
80   
81
82 #endif /* __SHPAINT_H */