push 5aff8350ceade24f8243f07a9cf7ecb816236fb1
[wine/hacks.git] / dlls / gdiplus / gdiplus_private.h
blobdccc8349dc022071fe8f4dd9af8b3ea8e93664bd
1 /*
2 * Copyright (C) 2007 Google (Evan Stade)
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.
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.
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
19 #ifndef __WINE_GP_PRIVATE_H_
20 #define __WINE_GP_PRIVATE_H_
22 #include <math.h>
23 #include <stdarg.h>
25 #include "windef.h"
26 #include "wingdi.h"
27 #include "winbase.h"
28 #include "winuser.h"
30 #include "objbase.h"
31 #include "ocidl.h"
32 #include "wine/list.h"
34 #include "gdiplus.h"
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)
41 #define VERSION_MAGIC 0xdbc01001
42 #define TENSION_CONST (0.3)
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);
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);
57 extern void free_installed_fonts(void);
59 extern BOOL lengthen_path(GpPath *path, INT len);
61 extern GpStatus trace_path(GpGraphics *graphics, GpPath *path);
63 typedef struct region_element region_element;
64 extern inline void delete_element(region_element *element);
66 static inline INT roundr(REAL x)
68 return (INT) floorf(x + 0.5);
71 static inline REAL deg2rad(REAL degrees)
73 return M_PI * degrees / 180.0;
76 extern const char *debugstr_rectf(CONST RectF* rc);
78 struct GpPen{
79 UINT style;
80 GpUnit unit;
81 REAL width;
82 GpLineCap endcap;
83 GpLineCap startcap;
84 GpDashCap dashcap;
85 GpCustomLineCap *customstart;
86 GpCustomLineCap *customend;
87 GpLineJoin join;
88 REAL miterlimit;
89 GpDashStyle dash;
90 REAL *dashes;
91 INT numdashes;
92 REAL offset; /* dash offset */
93 GpBrush *brush;
94 GpPenAlignment align;
97 struct GpGraphics{
98 HDC hdc;
99 HWND hwnd;
100 BOOL owndc;
101 SmoothingMode smoothing;
102 CompositingQuality compqual;
103 InterpolationMode interpolation;
104 PixelOffsetMode pixeloffset;
105 CompositingMode compmode;
106 TextRenderingHint texthint;
107 GpUnit unit; /* page unit */
108 REAL scale; /* page scale */
109 GpMatrix * worldtrans; /* world transform */
110 BOOL busy; /* hdc handle obtained by GdipGetDC */
111 GpRegion *clip;
112 UINT textcontrast; /* not used yet. get/set only */
113 struct list containers;
114 GraphicsContainer contid; /* last-issued container ID */
117 struct GpBrush{
118 HBRUSH gdibrush;
119 GpBrushType bt;
120 LOGBRUSH lb;
123 struct GpHatch{
124 GpBrush brush;
125 HatchStyle hatchstyle;
126 ARGB forecol;
127 ARGB backcol;
130 struct GpSolidFill{
131 GpBrush brush;
132 ARGB color;
133 HBITMAP bmp;
136 struct GpPathGradient{
137 GpBrush brush;
138 PathData pathdata;
139 ARGB centercolor;
140 GpWrapMode wrap;
141 BOOL gamma;
142 GpPointF center;
143 GpPointF focus;
144 REAL* blendfac; /* blend factors */
145 REAL* blendpos; /* blend positions */
146 INT blendcount;
149 struct GpLineGradient{
150 GpBrush brush;
151 GpPointF startpoint;
152 GpPointF endpoint;
153 ARGB startcolor;
154 ARGB endcolor;
155 RectF rect;
156 GpWrapMode wrap;
157 BOOL gamma;
158 REAL* blendfac; /* blend factors */
159 REAL* blendpos; /* blend positions */
160 INT blendcount;
163 struct GpTexture{
164 GpBrush brush;
165 GpMatrix *transform;
166 WrapMode wrap; /* not used yet */
169 struct GpPath{
170 GpFillMode fill;
171 GpPathData pathdata;
172 BOOL newfigure; /* whether the next drawing action starts a new figure */
173 INT datalen; /* size of the arrays in pathdata */
176 struct GpMatrix{
177 REAL matrix[6];
180 struct GpPathIterator{
181 GpPathData pathdata;
182 INT subpath_pos; /* for NextSubpath methods */
183 INT marker_pos; /* for NextMarker methods */
184 INT pathtype_pos; /* for NextPathType methods */
187 struct GpCustomLineCap{
188 GpPathData pathdata;
189 BOOL fill; /* TRUE for fill, FALSE for stroke */
190 GpLineCap cap; /* as far as I can tell, this value is ignored */
191 REAL inset; /* how much to adjust the end of the line */
192 GpLineJoin join;
193 REAL scale;
196 struct GpAdustableArrowCap{
197 GpCustomLineCap cap;
200 struct GpImage{
201 IPicture* picture;
202 ImageType type;
203 UINT flags;
206 struct GpMetafile{
207 GpImage image;
208 GpRectF bounds;
209 GpUnit unit;
212 struct GpBitmap{
213 GpImage image;
214 INT width;
215 INT height;
216 PixelFormat format;
217 ImageLockMode lockmode;
218 INT numlocks;
219 BYTE *bitmapbits; /* pointer to the buffer we passed in BitmapLockBits */
222 struct GpCachedBitmap{
223 GpImage *image;
226 struct color_key{
227 BOOL enabled;
228 ARGB low;
229 ARGB high;
232 struct GpImageAttributes{
233 WrapMode wrap;
234 struct color_key colorkeys[ColorAdjustTypeCount];
237 struct GpFont{
238 LOGFONTW lfw;
239 REAL emSize;
240 UINT height;
241 LONG line_spacing;
242 Unit unit;
245 struct GpStringFormat{
246 INT attr;
247 LANGID lang;
248 LANGID digitlang;
249 StringAlignment align;
250 StringTrimming trimming;
251 HotkeyPrefix hkprefix;
252 StringAlignment vertalign;
253 StringDigitSubstitute digitsub;
254 INT tabcount;
255 REAL firsttab;
256 REAL *tabs;
259 struct GpFontCollection{
260 GpFontFamily **FontFamilies;
261 INT count;
262 INT allocated;
265 struct GpFontFamily{
266 NEWTEXTMETRICW tmw;
267 WCHAR FamilyName[LF_FACESIZE];
270 /* internal use */
271 typedef enum RegionType
273 RegionDataRect = 0x10000000,
274 RegionDataPath = 0x10000001,
275 RegionDataEmptyRect = 0x10000002,
276 RegionDataInfiniteRect = 0x10000003,
277 } RegionType;
279 struct region_element
281 DWORD type; /* Rectangle, Path, SpecialRectangle, or CombineMode */
282 union
284 GpRectF rect;
285 struct
287 GpPath* path;
288 struct
290 DWORD size;
291 DWORD magic;
292 DWORD count;
293 DWORD flags;
294 } pathheader;
295 } pathdata;
296 struct
298 struct region_element *left; /* the original region */
299 struct region_element *right; /* what *left was combined with */
300 } combine;
301 } elementdata;
304 struct GpRegion{
305 struct
307 DWORD size;
308 DWORD checksum;
309 DWORD magic;
310 DWORD num_children;
311 } header;
312 region_element node;
315 #endif