secur32: Report an error if libgnutls isn't found.
[wine] / dlls / gdiplus / gdiplus_private.h
1 /*
2  * Copyright (C) 2007 Google (Evan Stade)
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; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
17  */
18
19 #ifndef __WINE_GP_PRIVATE_H_
20 #define __WINE_GP_PRIVATE_H_
21
22 #include <math.h>
23 #include <stdarg.h>
24
25 #include "windef.h"
26 #include "wingdi.h"
27 #include "winbase.h"
28 #include "winuser.h"
29
30 #include "objbase.h"
31 #include "ocidl.h"
32 #include "wine/list.h"
33
34 #include "gdiplus.h"
35
36 #define GP_DEFAULT_PENSTYLE (PS_GEOMETRIC | PS_SOLID | PS_ENDCAP_FLAT | PS_JOIN_MITER)
37 #define MAX_ARC_PTS (13)
38 #define MAX_DASHLEN (16) /* this is a limitation of gdi */
39 #define INCH_HIMETRIC (2540)
40
41 #define VERSION_MAGIC 0xdbc01001
42 #define TENSION_CONST (0.3)
43
44 COLORREF ARGB2COLORREF(ARGB color);
45 HBITMAP ARGB2BMP(ARGB color);
46 extern INT arc2polybezier(GpPointF * points, REAL x1, REAL y1, REAL x2, REAL y2,
47     REAL startAngle, REAL sweepAngle);
48 extern REAL gdiplus_atan2(REAL dy, REAL dx);
49 extern GpStatus hresult_to_status(HRESULT res);
50 extern REAL convert_unit(HDC hdc, GpUnit unit);
51
52 extern void calc_curve_bezier(CONST GpPointF *pts, REAL tension, REAL *x1,
53     REAL *y1, REAL *x2, REAL *y2);
54 extern void calc_curve_bezier_endp(REAL xend, REAL yend, REAL xadj, REAL yadj,
55     REAL tension, REAL *x, REAL *y);
56
57 extern void free_installed_fonts(void);
58
59 extern BOOL lengthen_path(GpPath *path, INT len);
60
61 extern GpStatus trace_path(GpGraphics *graphics, GpPath *path);
62
63 typedef struct region_element region_element;
64 extern void delete_element(region_element *element);
65
66 static inline INT roundr(REAL x)
67 {
68     return (INT) floorf(x + 0.5);
69 }
70
71 static inline INT ceilr(REAL x)
72 {
73     return (INT) ceilf(x);
74 }
75
76 static inline REAL deg2rad(REAL degrees)
77 {
78     return M_PI * degrees / 180.0;
79 }
80
81 extern const char *debugstr_rectf(CONST RectF* rc);
82
83 extern const char *debugstr_pointf(CONST PointF* pt);
84
85 extern void convert_32bppARGB_to_32bppPARGB(UINT width, UINT height,
86     BYTE *dst_bits, INT dst_stride, const BYTE *src_bits, INT src_stride);
87
88 struct GpPen{
89     UINT style;
90     GpUnit unit;
91     REAL width;
92     GpLineCap endcap;
93     GpLineCap startcap;
94     GpDashCap dashcap;
95     GpCustomLineCap *customstart;
96     GpCustomLineCap *customend;
97     GpLineJoin join;
98     REAL miterlimit;
99     GpDashStyle dash;
100     REAL *dashes;
101     INT numdashes;
102     REAL offset;    /* dash offset */
103     GpBrush *brush;
104     GpPenAlignment align;
105 };
106
107 struct GpGraphics{
108     HDC hdc;
109     HWND hwnd;
110     BOOL owndc;
111     SmoothingMode smoothing;
112     CompositingQuality compqual;
113     InterpolationMode interpolation;
114     PixelOffsetMode pixeloffset;
115     CompositingMode compmode;
116     TextRenderingHint texthint;
117     GpUnit unit;    /* page unit */
118     REAL scale;     /* page scale */
119     GpMatrix * worldtrans; /* world transform */
120     BOOL busy;      /* hdc handle obtained by GdipGetDC */
121     GpRegion *clip;
122     UINT textcontrast; /* not used yet. get/set only */
123     struct list containers;
124     GraphicsContainer contid; /* last-issued container ID */
125 };
126
127 struct GpBrush{
128     HBRUSH gdibrush;
129     GpBrushType bt;
130     LOGBRUSH lb;
131 };
132
133 struct GpHatch{
134     GpBrush brush;
135     HatchStyle hatchstyle;
136     ARGB forecol;
137     ARGB backcol;
138 };
139
140 struct GpSolidFill{
141     GpBrush brush;
142     ARGB color;
143     HBITMAP bmp;
144 };
145
146 struct GpPathGradient{
147     GpBrush brush;
148     PathData pathdata;
149     ARGB centercolor;
150     GpWrapMode wrap;
151     BOOL gamma;
152     GpPointF center;
153     GpPointF focus;
154     REAL* blendfac;  /* blend factors */
155     REAL* blendpos;  /* blend positions */
156     INT blendcount;
157 };
158
159 struct GpLineGradient{
160     GpBrush brush;
161     GpPointF startpoint;
162     GpPointF endpoint;
163     ARGB startcolor;
164     ARGB endcolor;
165     RectF rect;
166     GpWrapMode wrap;
167     BOOL gamma;
168     REAL* blendfac;  /* blend factors */
169     REAL* blendpos;  /* blend positions */
170     INT blendcount;
171     ARGB* pblendcolor; /* preset blend colors */
172     REAL* pblendpos; /* preset blend positions */
173     INT pblendcount;
174 };
175
176 struct GpTexture{
177     GpBrush brush;
178     GpMatrix *transform;
179     WrapMode wrap;  /* not used yet */
180 };
181
182 struct GpPath{
183     GpFillMode fill;
184     GpPathData pathdata;
185     BOOL newfigure; /* whether the next drawing action starts a new figure */
186     INT datalen; /* size of the arrays in pathdata */
187 };
188
189 struct GpMatrix{
190     REAL matrix[6];
191 };
192
193 struct GpPathIterator{
194     GpPathData pathdata;
195     INT subpath_pos;    /* for NextSubpath methods */
196     INT marker_pos;     /* for NextMarker methods */
197     INT pathtype_pos;   /* for NextPathType methods */
198 };
199
200 struct GpCustomLineCap{
201     GpPathData pathdata;
202     BOOL fill;      /* TRUE for fill, FALSE for stroke */
203     GpLineCap cap;  /* as far as I can tell, this value is ignored */
204     REAL inset;     /* how much to adjust the end of the line */
205     GpLineJoin join;
206     REAL scale;
207 };
208
209 struct GpAdustableArrowCap{
210     GpCustomLineCap cap;
211 };
212
213 struct GpImage{
214     IPicture* picture;
215     ImageType type;
216     GUID format;
217     UINT flags;
218     UINT palette_flags;
219     UINT palette_count;
220     UINT palette_size;
221     ARGB *palette_entries;
222     REAL xres, yres;
223 };
224
225 struct GpMetafile{
226     GpImage image;
227     GpRectF bounds;
228     GpUnit unit;
229 };
230
231 struct GpBitmap{
232     GpImage image;
233     INT width;
234     INT height;
235     PixelFormat format;
236     ImageLockMode lockmode;
237     INT numlocks;
238     BYTE *bitmapbits;   /* pointer to the buffer we passed in BitmapLockBits */
239     HBITMAP hbitmap;
240     HDC hdc;
241     BYTE *bits; /* actual image bits if this is a DIB */
242     INT stride; /* stride of bits if this is a DIB */
243 };
244
245 struct GpCachedBitmap{
246     GpImage *image;
247 };
248
249 struct color_key{
250     BOOL enabled;
251     ARGB low;
252     ARGB high;
253 };
254
255 struct color_matrix{
256     BOOL enabled;
257     ColorMatrixFlags flags;
258     ColorMatrix colormatrix;
259     ColorMatrix graymatrix;
260 };
261
262 struct GpImageAttributes{
263     WrapMode wrap;
264     struct color_key colorkeys[ColorAdjustTypeCount];
265     struct color_matrix colormatrices[ColorAdjustTypeCount];
266 };
267
268 struct GpFont{
269     LOGFONTW lfw;
270     REAL emSize;
271     UINT height;
272     LONG line_spacing;
273     Unit unit;
274 };
275
276 struct GpStringFormat{
277     INT attr;
278     LANGID lang;
279     LANGID digitlang;
280     StringAlignment align;
281     StringTrimming trimming;
282     HotkeyPrefix hkprefix;
283     StringAlignment vertalign;
284     StringDigitSubstitute digitsub;
285     INT tabcount;
286     REAL firsttab;
287     REAL *tabs;
288     CharacterRange *character_ranges;
289     INT range_count;
290 };
291
292 struct GpFontCollection{
293     GpFontFamily **FontFamilies;
294     INT count;
295     INT allocated;
296 };
297
298 struct GpFontFamily{
299     NEWTEXTMETRICW tmw;
300     WCHAR FamilyName[LF_FACESIZE];
301 };
302
303 /* internal use */
304 typedef enum RegionType
305 {
306     RegionDataRect          = 0x10000000,
307     RegionDataPath          = 0x10000001,
308     RegionDataEmptyRect     = 0x10000002,
309     RegionDataInfiniteRect  = 0x10000003,
310 } RegionType;
311
312 struct region_element
313 {
314     DWORD type; /* Rectangle, Path, SpecialRectangle, or CombineMode */
315     union
316     {
317         GpRectF rect;
318         struct
319         {
320             GpPath* path;
321             struct
322             {
323                 DWORD size;
324                 DWORD magic;
325                 DWORD count;
326                 DWORD flags;
327             } pathheader;
328         } pathdata;
329         struct
330         {
331             struct region_element *left;  /* the original region */
332             struct region_element *right; /* what *left was combined with */
333         } combine;
334     } elementdata;
335 };
336
337 struct GpRegion{
338     struct
339     {
340         DWORD size;
341         DWORD checksum;
342         DWORD magic;
343         DWORD num_children;
344     } header;
345     region_element node;
346 };
347
348 #endif