mshtml: Added IHTMLElement::get_offsetHeight implementation.
[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
33 #include "gdiplus.h"
34
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)
39
40 #define VERSION_MAGIC 0xdbc01001
41
42 COLORREF ARGB2COLORREF(ARGB color);
43 extern INT arc2polybezier(GpPointF * points, REAL x1, REAL y1, REAL x2, REAL y2,
44     REAL startAngle, REAL sweepAngle);
45 extern REAL gdiplus_atan2(REAL dy, REAL dx);
46 extern GpStatus hresult_to_status(HRESULT res);
47 extern REAL convert_unit(HDC hdc, GpUnit unit);
48
49 static inline INT roundr(REAL x)
50 {
51     return (INT) floorf(x + 0.5);
52 }
53
54 static inline REAL deg2rad(REAL degrees)
55 {
56     return M_PI * degrees / 180.0;
57 }
58
59 struct GpPen{
60     UINT style;
61     GpUnit unit;
62     REAL width;
63     GpLineCap endcap;
64     GpLineCap startcap;
65     GpDashCap dashcap;
66     GpCustomLineCap *customstart;
67     GpCustomLineCap *customend;
68     GpLineJoin join;
69     REAL miterlimit;
70     GpDashStyle dash;
71     REAL *dashes;
72     INT numdashes;
73     REAL offset;    /* dash offset */
74     GpBrush *brush;
75     GpPenAlignment align;
76 };
77
78 struct GpGraphics{
79     HDC hdc;
80     HWND hwnd;
81     SmoothingMode smoothing;
82     CompositingQuality compqual;
83     InterpolationMode interpolation;
84     PixelOffsetMode pixeloffset;
85     CompositingMode compmode;
86     TextRenderingHint texthint;
87     GpUnit unit;    /* page unit */
88     REAL scale;     /* page scale */
89     GpMatrix * worldtrans; /* world transform */
90 };
91
92 struct GpBrush{
93     HBRUSH gdibrush;
94     GpBrushType bt;
95     LOGBRUSH lb;
96 };
97
98 struct GpSolidFill{
99     GpBrush brush;
100     ARGB color;
101 };
102
103 struct GpPathGradient{
104     GpBrush brush;
105     PathData pathdata;
106     ARGB centercolor;
107     GpWrapMode wrap;
108     BOOL gamma;
109     GpPointF center;
110     GpPointF focus;
111     REAL* blendfac;  /* blend factors */
112     REAL* blendpos;  /* blend positions */
113     INT blendcount;
114 };
115
116 struct GpLineGradient{
117     GpBrush brush;
118     GpPointF startpoint;
119     GpPointF endpoint;
120     ARGB startcolor;
121     ARGB endcolor;
122     GpWrapMode wrap;
123     BOOL gamma;
124 };
125
126 struct GpTexture{
127     GpBrush brush;
128 };
129
130 struct GpPath{
131     GpFillMode fill;
132     GpPathData pathdata;
133     BOOL newfigure; /* whether the next drawing action starts a new figure */
134     INT datalen; /* size of the arrays in pathdata */
135 };
136
137 struct GpMatrix{
138     REAL matrix[6];
139 };
140
141 struct GpPathIterator{
142     GpPathData pathdata;
143     INT subpath_pos;    /* for NextSubpath methods */
144     INT marker_pos;     /* for NextMarker methods */
145     INT pathtype_pos;   /* for NextPathType methods */
146 };
147
148 struct GpCustomLineCap{
149     GpPathData pathdata;
150     BOOL fill;      /* TRUE for fill, FALSE for stroke */
151     GpLineCap cap;  /* as far as I can tell, this value is ignored */
152     REAL inset;     /* how much to adjust the end of the line */
153     GpLineJoin join;
154     REAL scale;
155 };
156
157 struct GpImage{
158     IPicture* picture;
159     ImageType type;
160     UINT flags;
161 };
162
163 struct GpMetafile{
164     GpImage image;
165     GpRectF bounds;
166     GpUnit unit;
167 };
168
169 struct GpBitmap{
170     GpImage image;
171     INT width;
172     INT height;
173     PixelFormat format;
174     ImageLockMode lockmode;
175     INT numlocks;
176     BYTE *bitmapbits;   /* pointer to the buffer we passed in BitmapLockBits */
177 };
178
179 struct GpImageAttributes{
180     WrapMode wrap;
181 };
182
183 struct GpFont{
184     LOGFONTW lfw;
185     REAL emSize;
186     Unit unit;
187 };
188
189 struct GpStringFormat{
190     INT attr;
191     LANGID lang;
192     LANGID digitlang;
193     StringAlignment align;
194     StringTrimming trimming;
195     HotkeyPrefix hkprefix;
196     StringAlignment vertalign;
197     StringDigitSubstitute digitsub;
198     INT tabcount;
199     REAL firsttab;
200     REAL *tabs;
201 };
202
203 struct GpFontCollection{
204     GpFontFamily* FontFamilies;
205 };
206
207 struct GpFontFamily{
208     NEWTEXTMETRICW tmw;
209     WCHAR FamilyName[LF_FACESIZE];
210 };
211
212 typedef struct region_element
213 {
214     DWORD type; /* Rectangle, Path, SpecialRectangle, or CombineMode */
215     union
216     {
217         GpRectF rect;
218         struct
219         {
220             GpPath* path;
221             struct
222             {
223                 DWORD size;
224                 DWORD magic;
225                 DWORD count;
226                 DWORD flags;
227             } pathheader;
228         } pathdata;
229         struct
230         {
231             struct region_element *left;  /* the original region */
232             struct region_element *right; /* what *left was combined with */
233         } combine;
234     } elementdata;
235 } region_element;
236
237 struct GpRegion{
238     struct
239     {
240         DWORD size;
241         DWORD checksum;
242         DWORD magic;
243         DWORD num_children;
244     } header;
245     region_element node;
246 };
247
248 #endif