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 };
76
77 struct GpGraphics{
78 HDC hdc;
79 HWND hwnd;
80 SmoothingMode smoothing;
81 CompositingQuality compqual;
82 InterpolationMode interpolation;
83 PixelOffsetMode pixeloffset;
84 CompositingMode compmode;
85 TextRenderingHint texthint;
86 GpUnit unit; /* page unit */
87 REAL scale; /* page scale */
88 GpMatrix * worldtrans; /* world transform */
89 };
90
91 struct GpBrush{
92 HBRUSH gdibrush;
93 GpBrushType bt;
94 LOGBRUSH lb;
95 };
96
97 struct GpSolidFill{
98 GpBrush brush;
99 ARGB color;
100 };
101
102 struct GpPathGradient{
103 GpBrush brush;
104 PathData pathdata;
105 ARGB centercolor;
106 GpWrapMode wrap;
107 BOOL gamma;
108 GpPointF center;
109 GpPointF focus;
110 REAL* blendfac; /* blend factors */
111 REAL* blendpos; /* blend positions */
112 INT blendcount;
113 };
114
115 struct GpLineGradient{
116 GpBrush brush;
117 GpPointF startpoint;
118 GpPointF endpoint;
119 ARGB startcolor;
120 ARGB endcolor;
121 GpWrapMode wrap;
122 BOOL gamma;
123 };
124
125 struct GpTexture{
126 GpBrush brush;
127 };
128
129 struct GpPath{
130 GpFillMode fill;
131 GpPathData pathdata;
132 BOOL newfigure; /* whether the next drawing action starts a new figure */
133 INT datalen; /* size of the arrays in pathdata */
134 };
135
136 struct GpMatrix{
137 REAL matrix[6];
138 };
139
140 struct GpPathIterator{
141 GpPathData pathdata;
142 INT subpath_pos; /* for NextSubpath methods */
143 INT marker_pos; /* for NextMarker methods */
144 INT pathtype_pos; /* for NextPathType methods */
145 };
146
147 struct GpCustomLineCap{
148 GpPathData pathdata;
149 BOOL fill; /* TRUE for fill, FALSE for stroke */
150 GpLineCap cap; /* as far as I can tell, this value is ignored */
151 REAL inset; /* how much to adjust the end of the line */
152 };
153
154 struct GpImage{
155 IPicture* picture;
156 ImageType type;
157 UINT flags;
158 };
159
160 struct GpMetafile{
161 GpImage image;
162 GpRectF bounds;
163 GpUnit unit;
164 };
165
166 struct GpBitmap{
167 GpImage image;
168 INT width;
169 INT height;
170 PixelFormat format;
171 ImageLockMode lockmode;
172 INT numlocks;
173 BYTE *bitmapbits; /* pointer to the buffer we passed in BitmapLockBits */
174 };
175
176 struct GpImageAttributes{
177 WrapMode wrap;
178 };
179
180 struct GpFont{
181 LOGFONTW lfw;
182 REAL emSize;
183 Unit unit;
184 };
185
186 struct GpStringFormat{
187 INT attr;
188 LANGID lang;
189 StringAlignment align;
190 StringTrimming trimming;
191 HotkeyPrefix hkprefix;
192 StringAlignment vertalign;
193 };
194
195 struct GpFontCollection{
196 GpFontFamily* FontFamilies;
197 };
198
199 struct GpFontFamily{
200 NEWTEXTMETRICW tmw;
201 WCHAR FamilyName[LF_FACESIZE];
202 };
203
204 typedef struct region_element
205 {
206 DWORD type; /* Rectangle, Path, SpecialRectangle, or CombineMode */
207 union
208 {
209 GpRectF rect;
210 struct
211 {
212 GpPath* path;
213 struct
214 {
215 DWORD size;
216 DWORD magic;
217 DWORD count;
218 DWORD flags;
219 } pathheader;
220 } pathdata;
221 struct
222 {
223 struct region_element *left; /* the original region */
224 struct region_element *right; /* what *left was combined with */
225 } combine;
226 } elementdata;
227 } region_element;
228
229 struct GpRegion{
230 struct
231 {
232 DWORD size;
233 DWORD checksum;
234 DWORD magic;
235 DWORD num_children;
236 } header;
237 region_element node;
238 };
239
240 #endif
241
This page was automatically generated by the
LXR engine.
Visit the LXR main site for more
information.