push 7b9d1d3e232f77c5ced022f5bf5eb0928a3b0c7c
[wine/hacks.git] / dlls / gdiplus / gdiplus_private.h
blob8df1c74b5b01d805573b5424815f7b5775add374
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"
33 #include "gdiplus.h"
35 #define GP_DEFAULT_PENSTYLE (PS_GEOMETRIC | PS_SOLID | PS_ENDCAP_FLAT | PS_JOIN_MITER)
36 #define MAX_ARC_PTS (13)
37 #define MAX_DASHLEN (16) /* this is a limitation of gdi */
38 #define INCH_HIMETRIC (2540)
40 #define VERSION_MAGIC 0xdbc01001
41 #define TENSION_CONST (0.3)
43 COLORREF ARGB2COLORREF(ARGB color);
44 extern INT arc2polybezier(GpPointF * points, REAL x1, REAL y1, REAL x2, REAL y2,
45 REAL startAngle, REAL sweepAngle);
46 extern REAL gdiplus_atan2(REAL dy, REAL dx);
47 extern GpStatus hresult_to_status(HRESULT res);
48 extern REAL convert_unit(HDC hdc, GpUnit unit);
50 extern void calc_curve_bezier(CONST GpPointF *pts, REAL tension, REAL *x1,
51 REAL *y1, REAL *x2, REAL *y2);
52 extern void calc_curve_bezier_endp(REAL xend, REAL yend, REAL xadj, REAL yadj,
53 REAL tension, REAL *x, REAL *y);
55 extern BOOL lengthen_path(GpPath *path, INT len);
57 static inline INT roundr(REAL x)
59 return (INT) floorf(x + 0.5);
62 static inline REAL deg2rad(REAL degrees)
64 return M_PI * degrees / 180.0;
67 struct GpPen{
68 UINT style;
69 GpUnit unit;
70 REAL width;
71 GpLineCap endcap;
72 GpLineCap startcap;
73 GpDashCap dashcap;
74 GpCustomLineCap *customstart;
75 GpCustomLineCap *customend;
76 GpLineJoin join;
77 REAL miterlimit;
78 GpDashStyle dash;
79 REAL *dashes;
80 INT numdashes;
81 REAL offset; /* dash offset */
82 GpBrush *brush;
83 GpPenAlignment align;
86 struct GpGraphics{
87 HDC hdc;
88 HWND hwnd;
89 SmoothingMode smoothing;
90 CompositingQuality compqual;
91 InterpolationMode interpolation;
92 PixelOffsetMode pixeloffset;
93 CompositingMode compmode;
94 TextRenderingHint texthint;
95 GpUnit unit; /* page unit */
96 REAL scale; /* page scale */
97 GpMatrix * worldtrans; /* world transform */
98 BOOL busy; /* hdc handle obtained by GdipGetDC */
101 struct GpBrush{
102 HBRUSH gdibrush;
103 GpBrushType bt;
104 LOGBRUSH lb;
107 struct GpSolidFill{
108 GpBrush brush;
109 ARGB color;
112 struct GpPathGradient{
113 GpBrush brush;
114 PathData pathdata;
115 ARGB centercolor;
116 GpWrapMode wrap;
117 BOOL gamma;
118 GpPointF center;
119 GpPointF focus;
120 REAL* blendfac; /* blend factors */
121 REAL* blendpos; /* blend positions */
122 INT blendcount;
125 struct GpLineGradient{
126 GpBrush brush;
127 GpPointF startpoint;
128 GpPointF endpoint;
129 ARGB startcolor;
130 ARGB endcolor;
131 GpWrapMode wrap;
132 BOOL gamma;
135 struct GpTexture{
136 GpBrush brush;
139 struct GpPath{
140 GpFillMode fill;
141 GpPathData pathdata;
142 BOOL newfigure; /* whether the next drawing action starts a new figure */
143 INT datalen; /* size of the arrays in pathdata */
146 struct GpMatrix{
147 REAL matrix[6];
150 struct GpPathIterator{
151 GpPathData pathdata;
152 INT subpath_pos; /* for NextSubpath methods */
153 INT marker_pos; /* for NextMarker methods */
154 INT pathtype_pos; /* for NextPathType methods */
157 struct GpCustomLineCap{
158 GpPathData pathdata;
159 BOOL fill; /* TRUE for fill, FALSE for stroke */
160 GpLineCap cap; /* as far as I can tell, this value is ignored */
161 REAL inset; /* how much to adjust the end of the line */
162 GpLineJoin join;
163 REAL scale;
166 struct GpImage{
167 IPicture* picture;
168 ImageType type;
169 UINT flags;
172 struct GpMetafile{
173 GpImage image;
174 GpRectF bounds;
175 GpUnit unit;
178 struct GpBitmap{
179 GpImage image;
180 INT width;
181 INT height;
182 PixelFormat format;
183 ImageLockMode lockmode;
184 INT numlocks;
185 BYTE *bitmapbits; /* pointer to the buffer we passed in BitmapLockBits */
188 struct GpImageAttributes{
189 WrapMode wrap;
192 struct GpFont{
193 LOGFONTW lfw;
194 REAL emSize;
195 Unit unit;
198 struct GpStringFormat{
199 INT attr;
200 LANGID lang;
201 LANGID digitlang;
202 StringAlignment align;
203 StringTrimming trimming;
204 HotkeyPrefix hkprefix;
205 StringAlignment vertalign;
206 StringDigitSubstitute digitsub;
207 INT tabcount;
208 REAL firsttab;
209 REAL *tabs;
212 struct GpFontCollection{
213 GpFontFamily* FontFamilies;
216 struct GpFontFamily{
217 NEWTEXTMETRICW tmw;
218 WCHAR FamilyName[LF_FACESIZE];
221 typedef struct region_element
223 DWORD type; /* Rectangle, Path, SpecialRectangle, or CombineMode */
224 union
226 GpRectF rect;
227 struct
229 GpPath* path;
230 struct
232 DWORD size;
233 DWORD magic;
234 DWORD count;
235 DWORD flags;
236 } pathheader;
237 } pathdata;
238 struct
240 struct region_element *left; /* the original region */
241 struct region_element *right; /* what *left was combined with */
242 } combine;
243 } elementdata;
244 } region_element;
246 struct GpRegion{
247 struct
249 DWORD size;
250 DWORD checksum;
251 DWORD magic;
252 DWORD num_children;
253 } header;
254 region_element node;
257 #endif