widl: Always check the runtimeclass interfaces presence.
[wine/zf.git] / dlls / gdiplus / gdiplus_private.h
blob4bca5b13be920b35d6540420b4f2ea2766ee6399
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 "wincodecsdk.h"
33 #include "wine/heap.h"
34 #include "wine/list.h"
36 #include "gdiplus.h"
38 #define GP_DEFAULT_PENSTYLE (PS_GEOMETRIC | PS_SOLID | PS_ENDCAP_FLAT | PS_JOIN_MITER)
39 #define MAX_ARC_PTS (13)
40 #define MAX_DASHLEN (16) /* this is a limitation of gdi */
41 #define INCH_HIMETRIC (2540)
43 #define VERSION_MAGIC 0xdbc01001
44 #define VERSION_MAGIC2 0xdbc01002
45 #define VALID_MAGIC(x) (((x) & 0xfffff000) == 0xdbc01000)
46 #define TENSION_CONST (0.3)
48 #define GIF_DISPOSE_UNSPECIFIED 0
49 #define GIF_DISPOSE_DO_NOT_DISPOSE 1
50 #define GIF_DISPOSE_RESTORE_TO_BKGND 2
51 #define GIF_DISPOSE_RESTORE_TO_PREV 3
54 COLORREF ARGB2COLORREF(ARGB color) DECLSPEC_HIDDEN;
55 HBITMAP ARGB2BMP(ARGB color) DECLSPEC_HIDDEN;
56 extern INT arc2polybezier(GpPointF * points, REAL x1, REAL y1, REAL x2, REAL y2,
57 REAL startAngle, REAL sweepAngle) DECLSPEC_HIDDEN;
58 extern REAL gdiplus_atan2(REAL dy, REAL dx) DECLSPEC_HIDDEN;
59 extern GpStatus hresult_to_status(HRESULT res) DECLSPEC_HIDDEN;
60 extern REAL units_to_pixels(REAL units, GpUnit unit, REAL dpi, BOOL printer_display) DECLSPEC_HIDDEN;
61 extern REAL pixels_to_units(REAL pixels, GpUnit unit, REAL dpi, BOOL printer_display) DECLSPEC_HIDDEN;
62 extern REAL units_scale(GpUnit from, GpUnit to, REAL dpi, BOOL printer_display) DECLSPEC_HIDDEN;
64 #define WineCoordinateSpaceGdiDevice ((GpCoordinateSpace)4)
66 extern GpStatus gdi_transform_acquire(GpGraphics *graphics);
67 extern GpStatus gdi_transform_release(GpGraphics *graphics);
68 extern GpStatus get_graphics_transform(GpGraphics *graphics, GpCoordinateSpace dst_space,
69 GpCoordinateSpace src_space, GpMatrix *matrix) DECLSPEC_HIDDEN;
70 extern GpStatus gdip_transform_points(GpGraphics *graphics, GpCoordinateSpace dst_space,
71 GpCoordinateSpace src_space, GpPointF *points, INT count) DECLSPEC_HIDDEN;
73 extern GpStatus graphics_from_image(GpImage *image, GpGraphics **graphics) DECLSPEC_HIDDEN;
74 extern GpStatus encode_image_png(GpImage *image, IStream* stream, GDIPCONST EncoderParameters* params) DECLSPEC_HIDDEN;
75 extern GpStatus terminate_encoder_wic(GpImage *image) DECLSPEC_HIDDEN;
77 extern GpStatus METAFILE_GetGraphicsContext(GpMetafile* metafile, GpGraphics **result) DECLSPEC_HIDDEN;
78 extern GpStatus METAFILE_GetDC(GpMetafile* metafile, HDC *hdc) DECLSPEC_HIDDEN;
79 extern GpStatus METAFILE_ReleaseDC(GpMetafile* metafile, HDC hdc) DECLSPEC_HIDDEN;
80 extern GpStatus METAFILE_GraphicsClear(GpMetafile* metafile, ARGB color) DECLSPEC_HIDDEN;
81 extern GpStatus METAFILE_FillRectangles(GpMetafile* metafile, GpBrush* brush,
82 GDIPCONST GpRectF* rects, INT count) DECLSPEC_HIDDEN;
83 extern GpStatus METAFILE_SetClipRect(GpMetafile* metafile,
84 REAL x, REAL y, REAL width, REAL height, CombineMode mode) DECLSPEC_HIDDEN;
85 extern GpStatus METAFILE_SetClipRegion(GpMetafile* metafile, GpRegion* region, CombineMode mode) DECLSPEC_HIDDEN;
86 extern GpStatus METAFILE_SetPageTransform(GpMetafile* metafile, GpUnit unit, REAL scale) DECLSPEC_HIDDEN;
87 extern GpStatus METAFILE_SetWorldTransform(GpMetafile* metafile, GDIPCONST GpMatrix* transform) DECLSPEC_HIDDEN;
88 extern GpStatus METAFILE_ScaleWorldTransform(GpMetafile* metafile, REAL sx, REAL sy, MatrixOrder order) DECLSPEC_HIDDEN;
89 extern GpStatus METAFILE_MultiplyWorldTransform(GpMetafile* metafile, GDIPCONST GpMatrix* matrix, MatrixOrder order) DECLSPEC_HIDDEN;
90 extern GpStatus METAFILE_RotateWorldTransform(GpMetafile* metafile, REAL angle, MatrixOrder order) DECLSPEC_HIDDEN;
91 extern GpStatus METAFILE_TranslateWorldTransform(GpMetafile* metafile, REAL dx, REAL dy, MatrixOrder order) DECLSPEC_HIDDEN;
92 extern GpStatus METAFILE_ResetWorldTransform(GpMetafile* metafile) DECLSPEC_HIDDEN;
93 extern GpStatus METAFILE_BeginContainer(GpMetafile* metafile, GDIPCONST GpRectF *dstrect,
94 GDIPCONST GpRectF *srcrect, GpUnit unit, DWORD StackIndex) DECLSPEC_HIDDEN;
95 extern GpStatus METAFILE_BeginContainerNoParams(GpMetafile* metafile, DWORD StackIndex) DECLSPEC_HIDDEN;
96 extern GpStatus METAFILE_EndContainer(GpMetafile* metafile, DWORD StackIndex) DECLSPEC_HIDDEN;
97 extern GpStatus METAFILE_SaveGraphics(GpMetafile* metafile, DWORD StackIndex) DECLSPEC_HIDDEN;
98 extern GpStatus METAFILE_RestoreGraphics(GpMetafile* metafile, DWORD StackIndex) DECLSPEC_HIDDEN;
99 extern GpStatus METAFILE_GraphicsDeleted(GpMetafile* metafile) DECLSPEC_HIDDEN;
100 extern GpStatus METAFILE_DrawImagePointsRect(GpMetafile* metafile, GpImage *image,
101 GDIPCONST GpPointF *points, INT count, REAL srcx, REAL srcy, REAL srcwidth,
102 REAL srcheight, GpUnit srcUnit, GDIPCONST GpImageAttributes* imageAttributes,
103 DrawImageAbort callback, VOID *callbackData) DECLSPEC_HIDDEN;
104 extern GpStatus METAFILE_AddSimpleProperty(GpMetafile *metafile, SHORT prop, SHORT val) DECLSPEC_HIDDEN;
105 extern GpStatus METAFILE_DrawPath(GpMetafile *metafile, GpPen *pen, GpPath *path) DECLSPEC_HIDDEN;
106 extern GpStatus METAFILE_FillPath(GpMetafile *metafile, GpBrush *brush, GpPath *path) DECLSPEC_HIDDEN;
107 extern GpStatus METAFILE_DrawDriverString(GpMetafile *metafile, GDIPCONST UINT16 *text, INT length,
108 GDIPCONST GpFont *font, GDIPCONST GpStringFormat *format, GDIPCONST GpBrush *brush,
109 GDIPCONST PointF *positions, INT flags, GDIPCONST GpMatrix *matrix) DECLSPEC_HIDDEN;
110 extern GpStatus METAFILE_FillRegion(GpMetafile* metafile, GpBrush* brush,
111 GpRegion* region) DECLSPEC_HIDDEN;
112 extern void METAFILE_Free(GpMetafile *metafile) DECLSPEC_HIDDEN;
114 extern void calc_curve_bezier(const GpPointF *pts, REAL tension, REAL *x1,
115 REAL *y1, REAL *x2, REAL *y2) DECLSPEC_HIDDEN;
116 extern void calc_curve_bezier_endp(REAL xend, REAL yend, REAL xadj, REAL yadj,
117 REAL tension, REAL *x, REAL *y) DECLSPEC_HIDDEN;
119 extern void free_installed_fonts(void) DECLSPEC_HIDDEN;
121 extern BOOL lengthen_path(GpPath *path, INT len) DECLSPEC_HIDDEN;
123 extern DWORD write_region_data(const GpRegion *region, void *data) DECLSPEC_HIDDEN;
124 extern DWORD write_path_data(GpPath *path, void *data) DECLSPEC_HIDDEN;
126 extern GpStatus trace_path(GpGraphics *graphics, GpPath *path) DECLSPEC_HIDDEN;
128 typedef struct region_element region_element;
129 extern void delete_element(region_element *element) DECLSPEC_HIDDEN;
131 extern GpStatus get_hatch_data(GpHatchStyle hatchstyle, const unsigned char **result) DECLSPEC_HIDDEN;
133 static inline INT gdip_round(REAL x)
135 return (INT) floorf(x + 0.5);
138 static inline INT ceilr(REAL x)
140 return (INT) ceilf(x);
143 static inline REAL deg2rad(REAL degrees)
145 return M_PI * degrees / 180.0;
148 static inline ARGB color_over(ARGB bg, ARGB fg)
150 BYTE b, g, r, a;
151 BYTE bg_alpha, fg_alpha;
153 fg_alpha = (fg>>24)&0xff;
155 if (fg_alpha == 0xff) return fg;
157 if (fg_alpha == 0) return bg;
159 bg_alpha = (((bg>>24)&0xff) * (0xff-fg_alpha)) / 0xff;
161 if (bg_alpha == 0) return fg;
163 a = bg_alpha + fg_alpha;
164 b = ((bg&0xff)*bg_alpha + (fg&0xff)*fg_alpha)/a;
165 g = (((bg>>8)&0xff)*bg_alpha + ((fg>>8)&0xff)*fg_alpha)/a;
166 r = (((bg>>16)&0xff)*bg_alpha + ((fg>>16)&0xff)*fg_alpha)/a;
168 return (a<<24)|(r<<16)|(g<<8)|b;
171 /* fg is premult, bg and return value are not */
172 static inline ARGB color_over_fgpremult(ARGB bg, ARGB fg)
174 BYTE b, g, r, a;
175 BYTE bg_alpha, fg_alpha;
177 fg_alpha = (fg>>24)&0xff;
179 if (fg_alpha == 0) return bg;
181 bg_alpha = (((bg>>24)&0xff) * (0xff-fg_alpha)) / 0xff;
183 a = bg_alpha + fg_alpha;
184 b = ((bg&0xff)*bg_alpha + (fg&0xff)*0xff)/a;
185 g = (((bg>>8)&0xff)*bg_alpha + ((fg>>8)&0xff)*0xff)/a;
186 r = (((bg>>16)&0xff)*bg_alpha + ((fg>>16)&0xff)*0xff)/a;
188 return (a<<24)|(r<<16)|(g<<8)|b;
191 extern const char *debugstr_rectf(const RectF* rc) DECLSPEC_HIDDEN;
193 extern const char *debugstr_pointf(const PointF* pt) DECLSPEC_HIDDEN;
195 extern void convert_32bppARGB_to_32bppPARGB(UINT width, UINT height,
196 BYTE *dst_bits, INT dst_stride, const BYTE *src_bits, INT src_stride) DECLSPEC_HIDDEN;
198 extern GpStatus convert_pixels(INT width, INT height,
199 INT dst_stride, BYTE *dst_bits, PixelFormat dst_format,
200 INT src_stride, const BYTE *src_bits, PixelFormat src_format, ColorPalette *palette) DECLSPEC_HIDDEN;
202 extern PixelFormat apply_image_attributes(const GpImageAttributes *attributes, LPBYTE data,
203 UINT width, UINT height, INT stride, ColorAdjustType type, PixelFormat fmt) DECLSPEC_HIDDEN;
205 struct GpMatrix{
206 REAL matrix[6];
209 struct GpPen{
210 UINT style;
211 GpUnit unit;
212 REAL width;
213 GpLineCap endcap;
214 GpLineCap startcap;
215 GpDashCap dashcap;
216 GpCustomLineCap *customstart;
217 GpCustomLineCap *customend;
218 GpLineJoin join;
219 REAL miterlimit;
220 GpDashStyle dash;
221 REAL *dashes;
222 INT numdashes;
223 REAL offset; /* dash offset */
224 GpBrush *brush;
225 GpPenAlignment align;
226 GpMatrix transform;
229 struct GpGraphics{
230 HDC hdc;
231 HWND hwnd;
232 BOOL owndc;
233 BOOL alpha_hdc;
234 BOOL printer_display;
235 GpImage *image;
236 ImageType image_type;
237 SmoothingMode smoothing;
238 CompositingQuality compqual;
239 InterpolationMode interpolation;
240 PixelOffsetMode pixeloffset;
241 CompositingMode compmode;
242 TextRenderingHint texthint;
243 GpUnit unit; /* page unit */
244 REAL scale; /* page scale */
245 REAL xres, yres;
246 GpMatrix worldtrans; /* world transform */
247 BOOL busy; /* hdc handle obtained by GdipGetDC */
248 GpRegion *clip; /* in device coords */
249 UINT textcontrast; /* not used yet. get/set only */
250 struct list containers;
251 GraphicsContainer contid; /* last-issued container ID */
252 INT origin_x, origin_y;
253 INT gdi_transform_acquire_count, gdi_transform_save;
254 GpMatrix gdi_transform;
255 HRGN gdi_clip;
256 /* For giving the caller an HDC when we technically can't: */
257 HBITMAP temp_hbitmap;
258 int temp_hbitmap_width;
259 int temp_hbitmap_height;
260 BYTE *temp_bits;
261 HDC temp_hdc;
264 struct GpBrush{
265 GpBrushType bt;
268 struct GpHatch{
269 GpBrush brush;
270 GpHatchStyle hatchstyle;
271 ARGB forecol;
272 ARGB backcol;
275 struct GpSolidFill{
276 GpBrush brush;
277 ARGB color;
280 struct GpPathGradient{
281 GpBrush brush;
282 GpPath* path;
283 ARGB centercolor;
284 GpWrapMode wrap;
285 BOOL gamma;
286 GpPointF center;
287 GpPointF focus;
288 REAL* blendfac; /* blend factors */
289 REAL* blendpos; /* blend positions */
290 INT blendcount;
291 ARGB *surroundcolors;
292 INT surroundcolorcount;
293 ARGB* pblendcolor; /* preset blend colors */
294 REAL* pblendpos; /* preset blend positions */
295 INT pblendcount;
296 GpMatrix transform;
299 struct GpLineGradient{
300 GpBrush brush;
301 ARGB startcolor;
302 ARGB endcolor;
303 RectF rect;
304 GpWrapMode wrap;
305 BOOL gamma;
306 REAL* blendfac; /* blend factors */
307 REAL* blendpos; /* blend positions */
308 INT blendcount;
309 ARGB* pblendcolor; /* preset blend colors */
310 REAL* pblendpos; /* preset blend positions */
311 INT pblendcount;
312 GpMatrix transform;
315 struct GpTexture{
316 GpBrush brush;
317 GpMatrix transform;
318 GpImage *image;
319 GpImageAttributes *imageattributes;
320 BYTE *bitmap_bits; /* image bits converted to ARGB and run through imageattributes */
323 struct GpPath{
324 GpFillMode fill;
325 GpPathData pathdata;
326 BOOL newfigure; /* whether the next drawing action starts a new figure */
327 INT datalen; /* size of the arrays in pathdata */
330 struct GpPathIterator{
331 GpPathData pathdata;
332 INT subpath_pos; /* for NextSubpath methods */
333 INT marker_pos; /* for NextMarker methods */
334 INT pathtype_pos; /* for NextPathType methods */
337 struct GpCustomLineCap{
338 CustomLineCapType type;
339 GpPathData pathdata;
340 BOOL fill; /* TRUE for fill, FALSE for stroke */
341 GpLineCap cap; /* as far as I can tell, this value is ignored */
342 REAL inset; /* how much to adjust the end of the line */
343 GpLineJoin join;
344 REAL scale;
347 struct GpAdjustableArrowCap{
348 GpCustomLineCap cap;
349 REAL middle_inset;
350 REAL height;
351 REAL width;
354 struct GpImage{
355 IWICBitmapDecoder *decoder;
356 IWICBitmapEncoder *encoder;
357 ImageType type;
358 GUID format;
359 UINT flags;
360 UINT frame_count, current_frame;
361 ColorPalette *palette;
362 REAL xres, yres;
363 LONG busy;
366 #define EmfPlusObjectTableSize 64
368 typedef enum EmfPlusObjectType
370 ObjectTypeInvalid,
371 ObjectTypeBrush,
372 ObjectTypePen,
373 ObjectTypePath,
374 ObjectTypeRegion,
375 ObjectTypeImage,
376 ObjectTypeFont,
377 ObjectTypeStringFormat,
378 ObjectTypeImageAttributes,
379 ObjectTypeCustomLineCap,
380 ObjectTypeMax = ObjectTypeCustomLineCap,
381 } EmfPlusObjectType;
383 /* Deserialized EmfPlusObject record. */
384 struct emfplus_object {
385 EmfPlusObjectType type;
386 union {
387 GpBrush *brush;
388 GpPen *pen;
389 GpPath *path;
390 GpRegion *region;
391 GpImage *image;
392 GpFont *font;
393 GpImageAttributes *image_attributes;
394 void *object;
395 } u;
398 struct GpMetafile{
399 GpImage image;
400 GpRectF bounds;
401 GpUnit unit;
402 MetafileType metafile_type;
403 HENHMETAFILE hemf;
404 int preserve_hemf; /* if true, hemf belongs to the app and should not be deleted */
406 /* recording */
407 HDC record_dc;
408 GpGraphics *record_graphics;
409 BYTE *comment_data;
410 DWORD comment_data_size;
411 DWORD comment_data_length;
412 IStream *record_stream;
413 BOOL auto_frame; /* If true, determine the frame automatically */
414 GpPointF auto_frame_min, auto_frame_max;
415 DWORD next_object_id;
416 UINT limit_dpi;
417 BOOL printer_display;
418 REAL logical_dpix;
419 REAL logical_dpiy;
421 /* playback */
422 GpGraphics *playback_graphics;
423 HDC playback_dc;
424 GpPointF playback_points[3];
425 GpRectF src_rect;
426 HANDLETABLE *handle_table;
427 int handle_count;
428 GpMatrix *world_transform;
429 GpUnit page_unit;
430 REAL page_scale;
431 GpRegion *base_clip; /* clip region in device space for all metafile output */
432 GpRegion *clip; /* clip region within the metafile */
433 struct list containers;
434 struct emfplus_object objtable[EmfPlusObjectTableSize];
437 struct GpBitmap{
438 GpImage image;
439 INT width;
440 INT height;
441 PixelFormat format;
442 ImageLockMode lockmode;
443 BYTE *bitmapbits; /* pointer to the buffer we passed in BitmapLockBits */
444 HBITMAP hbitmap;
445 HDC hdc;
446 BYTE *bits; /* actual image bits if this is a DIB */
447 INT stride; /* stride of bits if this is a DIB */
448 BYTE *own_bits; /* image bits that need to be freed with this object */
449 INT lockx, locky; /* X and Y coordinates of the rect when a bitmap is locked for writing. */
450 IWICMetadataReader *metadata_reader; /* NULL if there is no metadata */
451 UINT prop_count;
452 PropertyItem *prop_item; /* cached image properties */
455 struct GpCachedBitmap{
456 GpImage *image;
459 struct color_key{
460 BOOL enabled;
461 ARGB low;
462 ARGB high;
465 struct color_matrix{
466 BOOL enabled;
467 ColorMatrixFlags flags;
468 ColorMatrix colormatrix;
469 ColorMatrix graymatrix;
472 struct color_remap_table{
473 BOOL enabled;
474 INT mapsize;
475 ColorMap *colormap;
478 enum imageattr_noop{
479 IMAGEATTR_NOOP_UNDEFINED,
480 IMAGEATTR_NOOP_SET,
481 IMAGEATTR_NOOP_CLEAR,
484 struct GpImageAttributes{
485 WrapMode wrap;
486 ARGB outside_color;
487 BOOL clamp;
488 struct color_key colorkeys[ColorAdjustTypeCount];
489 struct color_matrix colormatrices[ColorAdjustTypeCount];
490 struct color_remap_table colorremaptables[ColorAdjustTypeCount];
491 BOOL gamma_enabled[ColorAdjustTypeCount];
492 REAL gamma[ColorAdjustTypeCount];
493 enum imageattr_noop noop[ColorAdjustTypeCount];
496 struct GpFont{
497 GpFontFamily *family;
498 OUTLINETEXTMETRICW otm;
499 REAL emSize; /* in font units */
500 Unit unit;
503 extern const struct GpStringFormat default_drawstring_format DECLSPEC_HIDDEN;
505 struct GpStringFormat{
506 INT attr;
507 LANGID lang;
508 LANGID digitlang;
509 StringAlignment align;
510 StringTrimming trimming;
511 HotkeyPrefix hkprefix;
512 StringAlignment line_align;
513 StringDigitSubstitute digitsub;
514 INT tabcount;
515 REAL firsttab;
516 REAL *tabs;
517 CharacterRange *character_ranges;
518 INT range_count;
519 BOOL generic_typographic;
522 extern void init_generic_string_formats(void) DECLSPEC_HIDDEN;
523 extern void free_generic_string_formats(void) DECLSPEC_HIDDEN;
525 struct GpFontCollection{
526 GpFontFamily **FontFamilies;
527 INT count;
528 INT allocated;
531 struct GpFontFamily{
532 WCHAR FamilyName[LF_FACESIZE];
533 UINT16 em_height, ascent, descent, line_spacing; /* in font units */
534 int dpi;
537 /* internal use */
538 typedef enum RegionType
540 RegionDataRect = 0x10000000,
541 RegionDataPath = 0x10000001,
542 RegionDataEmptyRect = 0x10000002,
543 RegionDataInfiniteRect = 0x10000003,
544 } RegionType;
546 struct region_element
548 DWORD type; /* Rectangle, Path, SpecialRectangle, or CombineMode */
549 union
551 GpRectF rect;
552 GpPath *path;
553 struct
555 struct region_element *left; /* the original region */
556 struct region_element *right; /* what *left was combined with */
557 } combine;
558 } elementdata;
561 struct GpRegion{
562 DWORD num_children;
563 region_element node;
566 struct memory_buffer
568 const BYTE *buffer;
569 INT size, pos;
572 static inline void init_memory_buffer(struct memory_buffer *mbuf, const BYTE *buffer, INT size)
574 mbuf->buffer = buffer;
575 mbuf->size = size;
576 mbuf->pos = 0;
579 static inline const void *buffer_read(struct memory_buffer *mbuf, INT size)
581 if (mbuf->size - mbuf->pos >= size)
583 const void *data = mbuf->buffer + mbuf->pos;
584 mbuf->pos += size;
585 return data;
587 return NULL;
590 typedef GpStatus (*gdip_format_string_callback)(HDC hdc,
591 GDIPCONST WCHAR *string, INT index, INT length, GDIPCONST GpFont *font,
592 GDIPCONST RectF *rect, GDIPCONST GpStringFormat *format,
593 INT lineno, const RectF *bounds, INT *underlined_indexes,
594 INT underlined_index_count, void *user_data);
596 GpStatus gdip_format_string(HDC hdc,
597 GDIPCONST WCHAR *string, INT length, GDIPCONST GpFont *font,
598 GDIPCONST RectF *rect, GDIPCONST GpStringFormat *format, int ignore_empty_clip,
599 gdip_format_string_callback callback, void *user_data) DECLSPEC_HIDDEN;
601 void get_log_fontW(const GpFont *, GpGraphics *, LOGFONTW *) DECLSPEC_HIDDEN;
603 static inline BOOL image_lock(GpImage *image, BOOL *unlock)
605 LONG tid = GetCurrentThreadId(), owner_tid;
606 owner_tid = InterlockedCompareExchange(&image->busy, tid, 0);
607 *unlock = !owner_tid;
608 return !owner_tid || owner_tid==tid;
611 static inline void image_unlock(GpImage *image, BOOL unlock)
613 if (unlock) image->busy = 0;
616 #endif