Home | Info | Community | Development | myReactOS | Contact Us
ReactOS Development > Doxygengdiplus_private.h
Go to the documentation of this file.
00001 /* 00002 * Copyright (C) 2007 Google (Evan Stade) 00003 * 00004 * This library is free software; you can redistribute it and/or 00005 * modify it under the terms of the GNU Lesser General Public 00006 * License as published by the Free Software Foundation; either 00007 * version 2.1 of the License, or (at your option) any later version. 00008 * 00009 * This library is distributed in the hope that it will be useful, 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00012 * Lesser General Public License for more details. 00013 * 00014 * You should have received a copy of the GNU Lesser General Public 00015 * License along with this library; if not, write to the Free Software 00016 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA 00017 */ 00018 00019 #ifndef __WINE_GP_PRIVATE_H_ 00020 #define __WINE_GP_PRIVATE_H_ 00021 00022 #include <math.h> 00023 #include <stdarg.h> 00024 00025 #include "windef.h" 00026 #include "wingdi.h" 00027 #include "winbase.h" 00028 #include "winuser.h" 00029 00030 #include "objbase.h" 00031 #include "ocidl.h" 00032 #include "wine/list.h" 00033 00034 #include "gdiplus.h" 00035 00036 #define GP_DEFAULT_PENSTYLE (PS_GEOMETRIC | PS_SOLID | PS_ENDCAP_FLAT | PS_JOIN_MITER) 00037 #define MAX_ARC_PTS (13) 00038 #define MAX_DASHLEN (16) /* this is a limitation of gdi */ 00039 #define INCH_HIMETRIC (2540) 00040 00041 #define VERSION_MAGIC 0xdbc01001 00042 #define TENSION_CONST (0.3) 00043 00044 COLORREF ARGB2COLORREF(ARGB color) DECLSPEC_HIDDEN; 00045 HBITMAP ARGB2BMP(ARGB color) DECLSPEC_HIDDEN; 00046 extern INT arc2polybezier(GpPointF * points, REAL x1, REAL y1, REAL x2, REAL y2, 00047 REAL startAngle, REAL sweepAngle) DECLSPEC_HIDDEN; 00048 extern REAL gdiplus_atan2(REAL dy, REAL dx) DECLSPEC_HIDDEN; 00049 extern GpStatus hresult_to_status(HRESULT res) DECLSPEC_HIDDEN; 00050 extern REAL convert_unit(REAL logpixels, GpUnit unit) DECLSPEC_HIDDEN; 00051 00052 extern GpStatus graphics_from_image(GpImage *image, GpGraphics **graphics) DECLSPEC_HIDDEN; 00053 00054 extern GpStatus METAFILE_GetGraphicsContext(GpMetafile* metafile, GpGraphics **result) DECLSPEC_HIDDEN; 00055 extern GpStatus METAFILE_GetDC(GpMetafile* metafile, HDC *hdc) DECLSPEC_HIDDEN; 00056 extern GpStatus METAFILE_ReleaseDC(GpMetafile* metafile, HDC hdc) DECLSPEC_HIDDEN; 00057 extern GpStatus METAFILE_GraphicsDeleted(GpMetafile* metafile) DECLSPEC_HIDDEN; 00058 00059 extern void calc_curve_bezier(CONST GpPointF *pts, REAL tension, REAL *x1, 00060 REAL *y1, REAL *x2, REAL *y2) DECLSPEC_HIDDEN; 00061 extern void calc_curve_bezier_endp(REAL xend, REAL yend, REAL xadj, REAL yadj, 00062 REAL tension, REAL *x, REAL *y) DECLSPEC_HIDDEN; 00063 00064 extern void free_installed_fonts(void) DECLSPEC_HIDDEN; 00065 00066 extern void get_font_hfont(GpGraphics *graphics, GDIPCONST GpFont *font, HFONT *hfont) DECLSPEC_HIDDEN; 00067 00068 extern BOOL lengthen_path(GpPath *path, INT len) DECLSPEC_HIDDEN; 00069 00070 extern GpStatus trace_path(GpGraphics *graphics, GpPath *path) DECLSPEC_HIDDEN; 00071 00072 typedef struct region_element region_element; 00073 extern void delete_element(region_element *element) DECLSPEC_HIDDEN; 00074 00075 extern GpStatus get_hatch_data(HatchStyle hatchstyle, const char **result) DECLSPEC_HIDDEN; 00076 00077 static inline INT roundr(REAL x) 00078 { 00079 return (INT) floorf(x + 0.5); 00080 } 00081 00082 static inline INT ceilr(REAL x) 00083 { 00084 return (INT) ceilf(x); 00085 } 00086 00087 static inline REAL deg2rad(REAL degrees) 00088 { 00089 return M_PI * degrees / 180.0; 00090 } 00091 00092 static inline ARGB color_over(ARGB bg, ARGB fg) 00093 { 00094 BYTE b, g, r, a; 00095 BYTE bg_alpha, fg_alpha; 00096 00097 fg_alpha = (fg>>24)&0xff; 00098 00099 if (fg_alpha == 0xff) return fg; 00100 00101 if (fg_alpha == 0) return bg; 00102 00103 bg_alpha = (((bg>>24)&0xff) * (0xff-fg_alpha)) / 0xff; 00104 00105 if (bg_alpha == 0) return fg; 00106 00107 a = bg_alpha + fg_alpha; 00108 b = ((bg&0xff)*bg_alpha + (fg&0xff)*fg_alpha)/a; 00109 g = (((bg>>8)&0xff)*bg_alpha + ((fg>>8)&0xff)*fg_alpha)/a; 00110 r = (((bg>>16)&0xff)*bg_alpha + ((fg>>16)&0xff)*fg_alpha)/a; 00111 00112 return (a<<24)|(r<<16)|(g<<8)|b; 00113 } 00114 00115 extern const char *debugstr_rectf(CONST RectF* rc) DECLSPEC_HIDDEN; 00116 00117 extern const char *debugstr_pointf(CONST PointF* pt) DECLSPEC_HIDDEN; 00118 00119 extern void convert_32bppARGB_to_32bppPARGB(UINT width, UINT height, 00120 BYTE *dst_bits, INT dst_stride, const BYTE *src_bits, INT src_stride) DECLSPEC_HIDDEN; 00121 00122 extern GpStatus convert_pixels(INT width, INT height, 00123 INT dst_stride, BYTE *dst_bits, PixelFormat dst_format, 00124 INT src_stride, const BYTE *src_bits, PixelFormat src_format, ARGB *src_palette) DECLSPEC_HIDDEN; 00125 00126 struct GpPen{ 00127 UINT style; 00128 GpUnit unit; 00129 REAL width; 00130 GpLineCap endcap; 00131 GpLineCap startcap; 00132 GpDashCap dashcap; 00133 GpCustomLineCap *customstart; 00134 GpCustomLineCap *customend; 00135 GpLineJoin join; 00136 REAL miterlimit; 00137 GpDashStyle dash; 00138 REAL *dashes; 00139 INT numdashes; 00140 REAL offset; /* dash offset */ 00141 GpBrush *brush; 00142 GpPenAlignment align; 00143 }; 00144 00145 struct GpGraphics{ 00146 HDC hdc; 00147 HWND hwnd; 00148 BOOL owndc; 00149 GpImage *image; 00150 SmoothingMode smoothing; 00151 CompositingQuality compqual; 00152 InterpolationMode interpolation; 00153 PixelOffsetMode pixeloffset; 00154 CompositingMode compmode; 00155 TextRenderingHint texthint; 00156 GpUnit unit; /* page unit */ 00157 REAL scale; /* page scale */ 00158 GpMatrix * worldtrans; /* world transform */ 00159 BOOL busy; /* hdc handle obtained by GdipGetDC */ 00160 GpRegion *clip; 00161 UINT textcontrast; /* not used yet. get/set only */ 00162 struct list containers; 00163 GraphicsContainer contid; /* last-issued container ID */ 00164 INT origin_x, origin_y; 00165 /* For giving the caller an HDC when we technically can't: */ 00166 HBITMAP temp_hbitmap; 00167 int temp_hbitmap_width; 00168 int temp_hbitmap_height; 00169 BYTE *temp_bits; 00170 HDC temp_hdc; 00171 }; 00172 00173 struct GpBrush{ 00174 GpBrushType bt; 00175 }; 00176 00177 struct GpHatch{ 00178 GpBrush brush; 00179 HatchStyle hatchstyle; 00180 ARGB forecol; 00181 ARGB backcol; 00182 }; 00183 00184 struct GpSolidFill{ 00185 GpBrush brush; 00186 ARGB color; 00187 }; 00188 00189 struct GpPathGradient{ 00190 GpBrush brush; 00191 GpPath* path; 00192 ARGB centercolor; 00193 GpWrapMode wrap; 00194 BOOL gamma; 00195 GpPointF center; 00196 GpPointF focus; 00197 REAL* blendfac; /* blend factors */ 00198 REAL* blendpos; /* blend positions */ 00199 INT blendcount; 00200 ARGB *surroundcolors; 00201 INT surroundcolorcount; 00202 ARGB* pblendcolor; /* preset blend colors */ 00203 REAL* pblendpos; /* preset blend positions */ 00204 INT pblendcount; 00205 GpMatrix *transform; 00206 }; 00207 00208 struct GpLineGradient{ 00209 GpBrush brush; 00210 GpPointF startpoint; 00211 GpPointF endpoint; 00212 ARGB startcolor; 00213 ARGB endcolor; 00214 RectF rect; 00215 GpWrapMode wrap; 00216 BOOL gamma; 00217 REAL* blendfac; /* blend factors */ 00218 REAL* blendpos; /* blend positions */ 00219 INT blendcount; 00220 ARGB* pblendcolor; /* preset blend colors */ 00221 REAL* pblendpos; /* preset blend positions */ 00222 INT pblendcount; 00223 }; 00224 00225 struct GpTexture{ 00226 GpBrush brush; 00227 GpMatrix *transform; 00228 GpImage *image; 00229 GpImageAttributes *imageattributes; 00230 BYTE *bitmap_bits; /* image bits converted to ARGB and run through imageattributes */ 00231 }; 00232 00233 struct GpPath{ 00234 GpFillMode fill; 00235 GpPathData pathdata; 00236 BOOL newfigure; /* whether the next drawing action starts a new figure */ 00237 INT datalen; /* size of the arrays in pathdata */ 00238 }; 00239 00240 struct GpMatrix{ 00241 REAL matrix[6]; 00242 }; 00243 00244 struct GpPathIterator{ 00245 GpPathData pathdata; 00246 INT subpath_pos; /* for NextSubpath methods */ 00247 INT marker_pos; /* for NextMarker methods */ 00248 INT pathtype_pos; /* for NextPathType methods */ 00249 }; 00250 00251 struct GpCustomLineCap{ 00252 GpPathData pathdata; 00253 BOOL fill; /* TRUE for fill, FALSE for stroke */ 00254 GpLineCap cap; /* as far as I can tell, this value is ignored */ 00255 REAL inset; /* how much to adjust the end of the line */ 00256 GpLineJoin join; 00257 REAL scale; 00258 }; 00259 00260 struct GpAdustableArrowCap{ 00261 GpCustomLineCap cap; 00262 }; 00263 00264 struct GpImage{ 00265 IPicture* picture; 00266 ImageType type; 00267 GUID format; 00268 UINT flags; 00269 UINT palette_flags; 00270 UINT palette_count; 00271 UINT palette_size; 00272 ARGB *palette_entries; 00273 REAL xres, yres; 00274 }; 00275 00276 struct GpMetafile{ 00277 GpImage image; 00278 GpRectF bounds; 00279 GpUnit unit; 00280 MetafileType metafile_type; 00281 HENHMETAFILE hemf; 00282 00283 /* recording */ 00284 HDC record_dc; 00285 GpGraphics *record_graphics; 00286 BYTE *comment_data; 00287 DWORD comment_data_size; 00288 DWORD comment_data_length; 00289 00290 /* playback */ 00291 GpGraphics *playback_graphics; 00292 HDC playback_dc; 00293 GpPointF playback_points[3]; 00294 HANDLETABLE *handle_table; 00295 int handle_count; 00296 }; 00297 00298 struct GpBitmap{ 00299 GpImage image; 00300 INT width; 00301 INT height; 00302 PixelFormat format; 00303 ImageLockMode lockmode; 00304 INT numlocks; 00305 BYTE *bitmapbits; /* pointer to the buffer we passed in BitmapLockBits */ 00306 HBITMAP hbitmap; 00307 HDC hdc; 00308 BYTE *bits; /* actual image bits if this is a DIB */ 00309 INT stride; /* stride of bits if this is a DIB */ 00310 BYTE *own_bits; /* image bits that need to be freed with this object */ 00311 INT lockx, locky; /* X and Y coordinates of the rect when a bitmap is locked for writing. */ 00312 }; 00313 00314 struct GpCachedBitmap{ 00315 GpImage *image; 00316 }; 00317 00318 struct color_key{ 00319 BOOL enabled; 00320 ARGB low; 00321 ARGB high; 00322 }; 00323 00324 struct color_matrix{ 00325 BOOL enabled; 00326 ColorMatrixFlags flags; 00327 ColorMatrix colormatrix; 00328 ColorMatrix graymatrix; 00329 }; 00330 00331 struct color_remap_table{ 00332 BOOL enabled; 00333 INT mapsize; 00334 ColorMap *colormap; 00335 }; 00336 00337 struct GpImageAttributes{ 00338 WrapMode wrap; 00339 ARGB outside_color; 00340 BOOL clamp; 00341 struct color_key colorkeys[ColorAdjustTypeCount]; 00342 struct color_matrix colormatrices[ColorAdjustTypeCount]; 00343 struct color_remap_table colorremaptables[ColorAdjustTypeCount]; 00344 BOOL gamma_enabled[ColorAdjustTypeCount]; 00345 REAL gamma[ColorAdjustTypeCount]; 00346 }; 00347 00348 struct GpFont{ 00349 GpFontFamily *family; 00350 OUTLINETEXTMETRICW otm; 00351 REAL emSize; /* in font units */ 00352 Unit unit; 00353 }; 00354 00355 struct GpStringFormat{ 00356 INT attr; 00357 LANGID lang; 00358 LANGID digitlang; 00359 StringAlignment align; 00360 StringTrimming trimming; 00361 HotkeyPrefix hkprefix; 00362 StringAlignment vertalign; 00363 StringDigitSubstitute digitsub; 00364 INT tabcount; 00365 REAL firsttab; 00366 REAL *tabs; 00367 CharacterRange *character_ranges; 00368 INT range_count; 00369 }; 00370 00371 struct GpFontCollection{ 00372 GpFontFamily **FontFamilies; 00373 INT count; 00374 INT allocated; 00375 }; 00376 00377 struct GpFontFamily{ 00378 WCHAR FamilyName[LF_FACESIZE]; 00379 UINT16 em_height, ascent, descent, line_spacing; /* in font units */ 00380 int dpi; 00381 }; 00382 00383 /* internal use */ 00384 typedef enum RegionType 00385 { 00386 RegionDataRect = 0x10000000, 00387 RegionDataPath = 0x10000001, 00388 RegionDataEmptyRect = 0x10000002, 00389 RegionDataInfiniteRect = 0x10000003, 00390 } RegionType; 00391 00392 struct region_element 00393 { 00394 DWORD type; /* Rectangle, Path, SpecialRectangle, or CombineMode */ 00395 union 00396 { 00397 GpRectF rect; 00398 struct 00399 { 00400 GpPath* path; 00401 struct 00402 { 00403 DWORD size; 00404 DWORD magic; 00405 DWORD count; 00406 DWORD flags; 00407 } pathheader; 00408 } pathdata; 00409 struct 00410 { 00411 struct region_element *left; /* the original region */ 00412 struct region_element *right; /* what *left was combined with */ 00413 } combine; 00414 } elementdata; 00415 }; 00416 00417 struct GpRegion{ 00418 struct 00419 { 00420 DWORD size; 00421 DWORD checksum; 00422 DWORD magic; 00423 DWORD num_children; 00424 } header; 00425 region_element node; 00426 }; 00427 00428 typedef GpStatus (*gdip_format_string_callback)(HDC hdc, 00429 GDIPCONST WCHAR *string, INT index, INT length, GDIPCONST GpFont *font, 00430 GDIPCONST RectF *rect, GDIPCONST GpStringFormat *format, 00431 INT lineno, const RectF *bounds, INT *underlined_indexes, 00432 INT underlined_index_count, void *user_data); 00433 00434 GpStatus gdip_format_string(HDC hdc, 00435 GDIPCONST WCHAR *string, INT length, GDIPCONST GpFont *font, 00436 GDIPCONST RectF *rect, GDIPCONST GpStringFormat *format, 00437 gdip_format_string_callback callback, void *user_data) DECLSPEC_HIDDEN; 00438 00439 #endif Generated on Thu May 24 2012 04:23:58 for ReactOS by
1.7.6.1
|