d3dxof: Do not expect a separator when there is no element.
[wine/multimedia.git] / dlls / gdiplus / gdiplus_private.h
blobd82eec1547f3f1d8fa1e4a77af6d42e59763fa10
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 void delete_element(region_element *element);
66 static inline INT roundr(REAL x)
68 return (INT) floorf(x + 0.5);
71 static inline INT ceilr(REAL x)
73 return (INT) ceilf(x);
76 static inline REAL deg2rad(REAL degrees)
78 return M_PI * degrees / 180.0;
81 extern const char *debugstr_rectf(CONST RectF* rc);
83 extern const char *debugstr_pointf(CONST PointF* pt);
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);
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;
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 */
127 struct GpBrush{
128 HBRUSH gdibrush;
129 GpBrushType bt;
130 LOGBRUSH lb;
133 struct GpHatch{
134 GpBrush brush;
135 HatchStyle hatchstyle;
136 ARGB forecol;
137 ARGB backcol;
140 struct GpSolidFill{
141 GpBrush brush;
142 ARGB color;
143 HBITMAP bmp;
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;
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;
176 struct GpTexture{
177 GpBrush brush;
178 GpMatrix *transform;
179 WrapMode wrap; /* not used yet */
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 */
189 struct GpMatrix{
190 REAL matrix[6];
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 */
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;
209 struct GpAdustableArrowCap{
210 GpCustomLineCap cap;
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;
225 struct GpMetafile{
226 GpImage image;
227 GpRectF bounds;
228 GpUnit unit;
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 */
245 struct GpCachedBitmap{
246 GpImage *image;
249 struct color_key{
250 BOOL enabled;
251 ARGB low;
252 ARGB high;
255 struct color_matrix{
256 BOOL enabled;
257 ColorMatrixFlags flags;
258 ColorMatrix colormatrix;
259 ColorMatrix graymatrix;
262 struct GpImageAttributes{
263 WrapMode wrap;
264 struct color_key colorkeys[ColorAdjustTypeCount];
265 struct color_matrix colormatrices[ColorAdjustTypeCount];
266 BOOL gamma_enabled[ColorAdjustTypeCount];
267 REAL gamma[ColorAdjustTypeCount];
270 struct GpFont{
271 LOGFONTW lfw;
272 REAL emSize;
273 UINT height;
274 LONG line_spacing;
275 Unit unit;
278 struct GpStringFormat{
279 INT attr;
280 LANGID lang;
281 LANGID digitlang;
282 StringAlignment align;
283 StringTrimming trimming;
284 HotkeyPrefix hkprefix;
285 StringAlignment vertalign;
286 StringDigitSubstitute digitsub;
287 INT tabcount;
288 REAL firsttab;
289 REAL *tabs;
290 CharacterRange *character_ranges;
291 INT range_count;
294 struct GpFontCollection{
295 GpFontFamily **FontFamilies;
296 INT count;
297 INT allocated;
300 struct GpFontFamily{
301 NEWTEXTMETRICW tmw;
302 WCHAR FamilyName[LF_FACESIZE];
305 /* internal use */
306 typedef enum RegionType
308 RegionDataRect = 0x10000000,
309 RegionDataPath = 0x10000001,
310 RegionDataEmptyRect = 0x10000002,
311 RegionDataInfiniteRect = 0x10000003,
312 } RegionType;
314 struct region_element
316 DWORD type; /* Rectangle, Path, SpecialRectangle, or CombineMode */
317 union
319 GpRectF rect;
320 struct
322 GpPath* path;
323 struct
325 DWORD size;
326 DWORD magic;
327 DWORD count;
328 DWORD flags;
329 } pathheader;
330 } pathdata;
331 struct
333 struct region_element *left; /* the original region */
334 struct region_element *right; /* what *left was combined with */
335 } combine;
336 } elementdata;
339 struct GpRegion{
340 struct
342 DWORD size;
343 DWORD checksum;
344 DWORD magic;
345 DWORD num_children;
346 } header;
347 region_element node;
350 #endif