ReactOS 0.4.17-dev-218-g5635d24
gdiplus.c File Reference
#include <stdarg.h>
#include <math.h>
#include "windef.h"
#include "winbase.h"
#include "winerror.h"
#include "wine/debug.h"
#include "wingdi.h"
#include "objbase.h"
#include "winreg.h"
#include "shlwapi.h"
#include "gdiplus.h"
#include "gdiplus_private.h"
Include dependency graph for gdiplus.c:

Go to the source code of this file.

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (gdiplus)
 
static Status WINAPI NotificationHook (ULONG_PTR *token)
 
static void WINAPI NotificationUnhook (ULONG_PTR token)
 
BOOL WINAPI DllMain (HINSTANCE hinst, DWORD reason, LPVOID reserved)
 
Status WINAPI GdiplusStartup (ULONG_PTR *token, const struct GdiplusStartupInput *input, struct GdiplusStartupOutput *output)
 
GpStatus WINAPI GdiplusNotificationHook (ULONG_PTR *token)
 
void WINAPI GdiplusNotificationUnhook (ULONG_PTR token)
 
ULONG WINAPI GdiplusShutdown_wrapper (ULONG_PTR token)
 
void *WINGDIPAPI GdipAlloc (SIZE_T size)
 
void WINGDIPAPI GdipFree (void *ptr)
 
static void add_arc_part (GpPointF *pt, REAL x1, REAL y1, REAL x2, REAL y2, REAL start, REAL end, BOOL write_first)
 
static REAL unstretch_angle (REAL angle, REAL dia_x, REAL dia_y)
 
INT arc2polybezier (GpPointF *points, REAL left, REAL top, REAL width, REAL height, REAL start_angle, REAL sweep_angle)
 
COLORREF ARGB2COLORREF (ARGB color)
 
HBITMAP ARGB2BMP (ARGB color)
 
REAL gdiplus_atan2 (REAL dy, REAL dx)
 
GpStatus hresult_to_status (HRESULT res)
 
REAL units_to_pixels (REAL units, GpUnit unit, REAL dpi, BOOL printer_display)
 
REAL pixels_to_units (REAL pixels, GpUnit unit, REAL dpi, BOOL printer_display)
 
REAL units_scale (GpUnit from, GpUnit to, REAL dpi, BOOL printer_display)
 
void calc_curve_bezier (const GpPointF *pts, REAL tension, REAL *x1, REAL *y1, REAL *x2, REAL *y2)
 
void calc_curve_bezier_endp (REAL xend, REAL yend, REAL xadj, REAL yadj, REAL tension, REAL *x, REAL *y)
 
BOOL lengthen_path (GpPath *path, INT len)
 
void convert_32bppARGB_to_32bppPARGB (UINT width, UINT height, BYTE *dst_bits, INT dst_stride, const BYTE *src_bits, INT src_stride)
 
void delete_element (region_element *element)
 
const chardebugstr_rectf (const RectF *rc)
 
const chardebugstr_pointf (const PointF *pt)
 
const chardebugstr_matrix (const GpMatrix *matrix)
 

Variables

static const REAL mm_per_inch = 25.4
 
static const REAL inch_per_mm = 1.0 / 25.4
 
static const REAL point_per_inch = 72.0
 
static const REAL inch_per_point = 1.0 / 72.0
 

Function Documentation

◆ add_arc_part()

static void add_arc_part ( GpPointF pt,
REAL  x1,
REAL  y1,
REAL  x2,
REAL  y2,
REAL  start,
REAL  end,
BOOL  write_first 
)
static

Definition at line 164 of file gdiplus.c.

166{
167 REAL center_x, center_y, rad_x, rad_y, cos_start, cos_end,
168 sin_start, sin_end, a, half;
169 INT i;
170
171 rad_x = x2 / 2.0;
172 rad_y = y2 / 2.0;
173 center_x = x1 + rad_x;
174 center_y = y1 + rad_y;
175
176 cos_start = cos(start);
177 cos_end = cos(end);
178 sin_start = sin(start);
179 sin_end = sin(end);
180
181 half = (end - start) / 2.0;
182 a = 4.0 / 3.0 * (1 - cos(half)) / sin(half);
183
184 if(write_first){
185 pt[0].X = cos_start;
186 pt[0].Y = sin_start;
187 }
188 pt[1].X = cos_start - a * sin_start;
189 pt[1].Y = sin_start + a * cos_start;
190
191 pt[3].X = cos_end;
192 pt[3].Y = sin_end;
193 pt[2].X = cos_end + a * sin_end;
194 pt[2].Y = sin_end - a * cos_end;
195
196 /* expand the points back from the unit circle to the ellipse */
197 for(i = (write_first ? 0 : 1); i < 4; i ++){
198 pt[i].X = pt[i].X * rad_x + center_x;
199 pt[i].Y = pt[i].Y * rad_y + center_y;
200 }
201}
float REAL
Definition: types.h:41
_ACRTIMP double __cdecl sin(double)
Definition: sin.c:21
_ACRTIMP double __cdecl cos(double)
Definition: cos.c:21
#define pt(x, y)
Definition: drawing.c:79
GLuint start
Definition: gl.h:1545
GLuint GLuint end
Definition: gl.h:1545
GLboolean GLboolean GLboolean GLboolean a
Definition: glext.h:6204
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define a
Definition: ke_i.h:78
int32_t INT
Definition: typedefs.h:58
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG x1
Definition: winddi.h:3708
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG _In_ LONG y1
Definition: winddi.h:3709
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG _In_ LONG _In_ LONG _In_ LONG y2
Definition: winddi.h:3711
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG _In_ LONG _In_ LONG x2
Definition: winddi.h:3710

Referenced by arc2polybezier().

◆ arc2polybezier()

INT arc2polybezier ( GpPointF points,
REAL  left,
REAL  top,
REAL  width,
REAL  height,
REAL  start_angle,
REAL  sweep_angle 
)

Definition at line 223 of file gdiplus.c.

225{
226 INT i;
227 REAL partial_end_angle, end_angle;
228
229 end_angle = deg2rad(start_angle + sweep_angle);
230 start_angle = deg2rad(start_angle);
231
232 if (width != height)
233 {
234 start_angle = unstretch_angle(start_angle, width, height);
235 end_angle = unstretch_angle(end_angle, width, height);
236 }
237
238 for(i = 0; i < MAX_ARC_PTS - 1; i += 3){
239 /* check if we've overshot the end angle */
240 if( sweep_angle > 0.0 )
241 {
242 if (start_angle >= end_angle) break;
243 partial_end_angle = min(start_angle + M_PI_2, end_angle);
244 }
245 else
246 {
247 if (start_angle <= end_angle) break;
248 partial_end_angle = max(start_angle - M_PI_2, end_angle);
249 }
250
251 if (points)
252 add_arc_part(&points[i], left, top, width, height, start_angle, partial_end_angle, i == 0);
253
254 start_angle = partial_end_angle;
255 }
256
257 if (i == 0) return 0;
258 else return i+1;
259}
#define M_PI_2
Definition: math.h:410
static void add_arc_part(GpPointF *pt, REAL x1, REAL y1, REAL x2, REAL y2, REAL start, REAL end, BOOL write_first)
Definition: gdiplus.c:164
static REAL unstretch_angle(REAL angle, REAL dia_x, REAL dia_y)
Definition: gdiplus.c:207
#define MAX_ARC_PTS
static REAL deg2rad(REAL degrees)
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
GLint GLint GLsizei width
Definition: gl.h:1546
GLdouble GLdouble GLdouble GLdouble top
Definition: glext.h:10859
GLint left
Definition: glext.h:7726
GLsizei const GLfloat * points
Definition: glext.h:8112
#define min(a, b)
Definition: monoChain.cc:55
#define max(a, b)
Definition: svc.c:63

Referenced by GdipAddPathArc(), GdipAddPathEllipse(), and GdipAddPathPie().

◆ ARGB2BMP()

HBITMAP ARGB2BMP ( ARGB  color)

Definition at line 274 of file gdiplus.c.

275{
276 BITMAPINFO bi;
278 RGBQUAD *bits;
279 int alpha;
280
281 if ((color & 0xff000000) == 0xff000000) return 0;
282
283 bi.bmiHeader.biSize = sizeof(bi.bmiHeader);
284 bi.bmiHeader.biWidth = 1;
285 bi.bmiHeader.biHeight = 1;
286 bi.bmiHeader.biPlanes = 1;
287 bi.bmiHeader.biBitCount = 32;
289 bi.bmiHeader.biSizeImage = 0;
292 bi.bmiHeader.biClrUsed = 0;
294
295 result = CreateDIBSection(0, &bi, DIB_RGB_COLORS, (void*)&bits, NULL, 0);
296
297 bits[0].rgbReserved = alpha = (color>>24)&0xff;
298 bits[0].rgbRed = ((color>>16)&0xff)*alpha/255;
299 bits[0].rgbGreen = ((color>>8)&0xff)*alpha/255;
300 bits[0].rgbBlue = (color&0xff)*alpha/255;
301
302 return result;
303}
#define NULL
Definition: types.h:112
ULONG RGBQUAD
Definition: precomp.h:47
GLclampf GLclampf GLclampf alpha
Definition: gl.h:1740
GLuint color
Definition: glext.h:6243
GLenum GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * bits
Definition: glext.h:10929
GLuint64EXT * result
Definition: glext.h:11304
#define bits
Definition: infblock.c:15
static HBITMAP
Definition: button.c:44
ULONG biClrImportant
Definition: precomp.h:40
USHORT biBitCount
Definition: precomp.h:34
LONG biYPelsPerMeter
Definition: precomp.h:38
ULONG biCompression
Definition: precomp.h:35
LONG biXPelsPerMeter
Definition: precomp.h:37
BITMAPINFOHEADER bmiHeader
Definition: wingdi.h:1922
#define BI_RGB
Definition: uefivid.c:46
HBITMAP WINAPI CreateDIBSection(HDC hDC, CONST BITMAPINFO *BitmapInfo, UINT Usage, VOID **Bits, HANDLE hSection, DWORD dwOffset)
Definition: bitmap.c:245
#define DIB_RGB_COLORS
Definition: wingdi.h:367

Referenced by brush_fill_path().

◆ ARGB2COLORREF()

COLORREF ARGB2COLORREF ( ARGB  color)

Definition at line 261 of file gdiplus.c.

262{
263 /*
264 Packing of these color structures:
265 COLORREF: 00bbggrr
266 ARGB: aarrggbb
267 FIXME:doesn't handle alpha channel
268 */
269 return ((color & 0x0000ff) << 16) +
270 (color & 0x00ff00) +
271 ((color & 0xff0000) >> 16);
272}

Referenced by create_gdi_logbrush(), and get_gdi_brush_color().

◆ calc_curve_bezier()

void calc_curve_bezier ( const GpPointF pts,
REAL  tension,
REAL x1,
REAL y1,
REAL x2,
REAL y2 
)

Definition at line 389 of file gdiplus.c.

391{
392 REAL xdiff, ydiff;
393
394 /* calculate tangent */
395 xdiff = pts[2].X - pts[0].X;
396 ydiff = pts[2].Y - pts[0].Y;
397
398 /* apply tangent to get control points */
399 *x1 = pts[1].X - tension * xdiff;
400 *y1 = pts[1].Y - tension * ydiff;
401 *x2 = pts[1].X + tension * xdiff;
402 *y2 = pts[1].Y + tension * ydiff;
403}
REAL Y
Definition: gdiplustypes.h:644
REAL X
Definition: gdiplustypes.h:643

Referenced by GdipAddPathClosedCurve2(), and GdipAddPathCurve3().

◆ calc_curve_bezier_endp()

void calc_curve_bezier_endp ( REAL  xend,
REAL  yend,
REAL  xadj,
REAL  yadj,
REAL  tension,
REAL x,
REAL y 
)

Definition at line 406 of file gdiplus.c.

408{
409 /* tangent at endpoints is the line from the endpoint to the adjacent point */
410 *x = gdip_round(tension * (xadj - xend) + xend);
411 *y = gdip_round(tension * (yadj - yend) + yend);
412}
static INT gdip_round(REAL x)
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548

Referenced by GdipAddPathCurve3().

◆ convert_32bppARGB_to_32bppPARGB()

void convert_32bppARGB_to_32bppPARGB ( UINT  width,
UINT  height,
BYTE dst_bits,
INT  dst_stride,
const BYTE src_bits,
INT  src_stride 
)

Definition at line 445 of file gdiplus.c.

447{
448 INT x, y;
449 for (y=0; y<height; y++)
450 {
451 const BYTE *src=src_bits+y*src_stride;
452 BYTE *dst=dst_bits+y*dst_stride;
453 for (x=0; x<width; x++)
454 {
455 BYTE alpha=src[3];
456 *dst++ = (*src++ * alpha + 127) / 255;
457 *dst++ = (*src++ * alpha + 127) / 255;
458 *dst++ = (*src++ * alpha + 127) / 255;
459 *dst++ = *src++;
460 }
461 }
462}
GLenum src
Definition: glext.h:6340
GLenum GLenum dst
Definition: glext.h:6340
unsigned char BYTE
Definition: xxhash.c:193

Referenced by alpha_blend_hdc_pixels(), and convert_pixels().

◆ debugstr_matrix()

const char * debugstr_matrix ( const GpMatrix matrix)

◆ debugstr_pointf()

const char * debugstr_pointf ( const PointF pt)

Definition at line 492 of file gdiplus.c.

493{
494 if (!pt) return "(null)";
495 return wine_dbg_sprintf("(%0.2f,%0.2f)", pt->X, pt->Y);
496}

Referenced by GdipCreateLineBrush(), GdipDrawImagePointsRect(), GdipEnumerateMetafileSrcRectDestPoints(), and GdipSetPathGradientCenterPoint().

◆ debugstr_rectf()

◆ delete_element()

void delete_element ( region_element element)

Definition at line 465 of file gdiplus.c.

466{
467 switch(element->type)
468 {
469 case RegionDataRect:
470 break;
471 case RegionDataPath:
472 GdipDeletePath(element->elementdata.path);
473 break;
476 break;
477 default:
478 delete_element(element->elementdata.combine.left);
479 delete_element(element->elementdata.combine.right);
480 free(element->elementdata.combine.left);
481 free(element->elementdata.combine.right);
482 break;
483 }
484}
#define free
Definition: debug_ros.c:5
GpStatus WINGDIPAPI GdipDeletePath(GpPath *path)
void delete_element(region_element *element)
Definition: gdiplus.c:465
@ RegionDataEmptyRect
@ RegionDataRect
@ RegionDataInfiniteRect
@ RegionDataPath

Referenced by clone_element(), delete_element(), GdipCombineRegionPath(), GdipCombineRegionRect(), GdipCombineRegionRegion(), GdipDeleteRegion(), GdipGetClip(), GdipSetEmpty(), and GdipSetInfinite().

◆ DllMain()

BOOL WINAPI DllMain ( HINSTANCE  hinst,
DWORD  reason,
LPVOID  reserved 
)

Definition at line 60 of file gdiplus.c.

61{
62 TRACE("(%p, %ld, %p)\n", hinst, reason, reserved);
63
64 switch(reason)
65 {
69 break;
70
72 if (reserved) break;
75 break;
76 }
77 return TRUE;
78}
#define TRUE
Definition: types.h:120
static WCHAR reason[MAX_STRING_RESOURCE_LEN]
Definition: object.c:1904
#define DLL_PROCESS_ATTACH
Definition: compat.h:131
#define DLL_PROCESS_DETACH
Definition: compat.h:130
void free_installed_fonts(void)
Definition: font.c:1567
BOOL WINAPI DisableThreadLibraryCalls(IN HMODULE hLibModule)
Definition: loader.c:85
r reserved
Definition: btrfs.c:3006
void init_generic_string_formats(void)
Definition: stringformat.c:56
void free_generic_string_formats(void)
Definition: stringformat.c:67
static HINSTANCE hinst
Definition: edit.c:551
#define TRACE(s)
Definition: solgame.cpp:4

◆ GdipAlloc()

◆ GdipFree()

◆ gdiplus_atan2()

REAL gdiplus_atan2 ( REAL  dy,
REAL  dx 
)

Definition at line 306 of file gdiplus.c.

307{
308 if((dx == 0.0) && (dy != 0.0))
309 return dy > 0.0 ? M_PI_2 : -M_PI_2;
310
311 return atan2(dy, dx);
312}
_ACRTIMP double __cdecl atan2(double, double)
Definition: atan2.c:52
GLint dy
Definition: linetemp.h:97
GLint dx
Definition: linetemp.h:97

Referenced by draw_cap(), shorten_line_percent(), transform_properties(), and unstretch_angle().

◆ GdiplusNotificationHook()

GpStatus WINAPI GdiplusNotificationHook ( ULONG_PTR token)

Definition at line 112 of file gdiplus.c.

113{
114 FIXME("%p\n", token);
115 return NotificationHook(token);
116}
#define FIXME(fmt,...)
Definition: precomp.h:53
static Status WINAPI NotificationHook(ULONG_PTR *token)
Definition: gdiplus.c:43
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat token
Definition: glfuncs.h:210

◆ GdiplusNotificationUnhook()

void WINAPI GdiplusNotificationUnhook ( ULONG_PTR  token)

Definition at line 118 of file gdiplus.c.

119{
120 FIXME("%Id\n", token);
122}
static void WINAPI NotificationUnhook(ULONG_PTR token)
Definition: gdiplus.c:52

◆ GdiplusShutdown_wrapper()

ULONG WINAPI GdiplusShutdown_wrapper ( ULONG_PTR  token)

Definition at line 127 of file gdiplus.c.

128{
129 /* Notice the slightly different prototype from the official
130 * signature which forces us to use the _wrapper suffix.
131 */
132
133 /* FIXME: no object tracking */
134
135 /* "bricksntiles" expects a return value of 0, which native
136 * coincidentally gives.
137 */
138 return 0;
139}

◆ GdiplusStartup()

Status WINAPI GdiplusStartup ( ULONG_PTR token,
const struct GdiplusStartupInput input,
struct GdiplusStartupOutput output 
)

Definition at line 83 of file gdiplus.c.

85{
86 if(!token || !input)
87 return InvalidParameter;
88
89 TRACE("%p %p %p\n", token, input, output);
90 TRACE("GdiplusStartupInput %d %p %d %d\n", input->GdiplusVersion,
91 input->DebugEventCallback, input->SuppressBackgroundThread,
92 input->SuppressExternalCodecs);
93
94 if(input->GdiplusVersion < 1 || input->GdiplusVersion > 2)
96
97 if(input->SuppressBackgroundThread){
98 if(!output)
99 return InvalidParameter;
100
103 }
104
105 *token = 0xdeadbeef;
106
107 /* FIXME: DebugEventCallback ignored */
108
109 return Ok;
110}
@ Ok
Definition: gdiplustypes.h:25
@ UnsupportedGdiplusVersion
Definition: gdiplustypes.h:42
@ InvalidParameter
Definition: gdiplustypes.h:27
GLenum GLenum GLenum input
Definition: glext.h:9031
NotificationUnhookProc NotificationUnhook
Definition: gdiplusinit.h:55
NotificationHookProc NotificationHook
Definition: gdiplusinit.h:54

Referenced by BackgroundPageProc(), ImageView_Main(), START_TEST(), and test_startup().

◆ hresult_to_status()

◆ lengthen_path()

BOOL lengthen_path ( GpPath path,
INT  len 
)

Definition at line 415 of file gdiplus.c.

416{
417 /* initial allocation */
418 if(path->datalen == 0){
419 path->datalen = len * 2;
420
421 path->pathdata.Points = calloc(path->datalen, sizeof(PointF));
422 if(!path->pathdata.Points) return FALSE;
423
424 path->pathdata.Types = calloc(1, path->datalen);
425 if(!path->pathdata.Types){
426 free(path->pathdata.Points);
427 return FALSE;
428 }
429 }
430 /* reallocation, double size of arrays */
431 else if(path->datalen - path->pathdata.Count < len){
432 while(path->datalen - path->pathdata.Count < len)
433 path->datalen *= 2;
434
435 path->pathdata.Points = realloc(path->pathdata.Points, path->datalen * sizeof(PointF));
436 if(!path->pathdata.Points) return FALSE;
437
438 path->pathdata.Types = realloc(path->pathdata.Types, path->datalen);
439 if(!path->pathdata.Types) return FALSE;
440 }
441
442 return TRUE;
443}
#define realloc
Definition: debug_ros.c:6
#define FALSE
Definition: types.h:117
GLenum GLsizei len
Definition: glext.h:6722

Referenced by extend_current_figure(), format_string_callback(), GdipAddPathEllipse(), GdipAddPathPath(), GdipAddPathPie(), GdipAddPathPolygon(), GdipPathIterNextMarkerPath(), GdipPathIterNextSubpathPath(), and read_element().

◆ NotificationHook()

static Status WINAPI NotificationHook ( ULONG_PTR token)
static

Definition at line 43 of file gdiplus.c.

44{
45 TRACE("%p\n", token);
46 if(!token)
47 return InvalidParameter;
48
49 return Ok;
50}

Referenced by GdiplusNotificationHook(), and GdiplusStartup().

◆ NotificationUnhook()

static void WINAPI NotificationUnhook ( ULONG_PTR  token)
static

Definition at line 52 of file gdiplus.c.

53{
54 TRACE("%Id\n", token);
55}

Referenced by GdiplusNotificationUnhook(), and GdiplusStartup().

◆ pixels_to_units()

REAL pixels_to_units ( REAL  pixels,
GpUnit  unit,
REAL  dpi,
BOOL  printer_display 
)

Definition at line 356 of file gdiplus.c.

357{
358 switch (unit)
359 {
360 case UnitPixel:
361 case UnitWorld:
362 return pixels;
363 case UnitDisplay:
364 if (printer_display)
365 return pixels * 100.0 / dpi;
366 else
367 return pixels;
368 case UnitPoint:
369 return pixels * point_per_inch / dpi;
370 case UnitInch:
371 return pixels / dpi;
372 case UnitDocument:
373 return pixels * 300.0 / dpi;
374 case UnitMillimeter:
375 return pixels * mm_per_inch / dpi;
376 default:
377 FIXME("Unhandled unit type: %d\n", unit);
378 return 0;
379 }
380}
static const REAL mm_per_inch
Definition: gdiplus.c:38
static const REAL point_per_inch
Definition: gdiplus.c:40
@ UnitDocument
Definition: gdiplusenums.h:32
@ UnitInch
Definition: gdiplusenums.h:31
@ UnitMillimeter
Definition: gdiplusenums.h:33
@ UnitDisplay
Definition: gdiplusenums.h:28
@ UnitWorld
Definition: gdiplusenums.h:27
@ UnitPoint
Definition: gdiplusenums.h:30
@ UnitPixel
Definition: gdiplusenums.h:29
GLint GLint GLsizei GLsizei GLsizei GLint GLenum GLenum const GLvoid * pixels
Definition: gl.h:1546
png_const_structrp png_const_inforp int * unit
Definition: png.h:2392
#define dpi
Definition: sysparams.c:23

Referenced by GdipGetFontHeight(), and units_scale().

◆ units_scale()

REAL units_scale ( GpUnit  from,
GpUnit  to,
REAL  dpi,
BOOL  printer_display 
)

Definition at line 382 of file gdiplus.c.

383{
384 REAL pixels = units_to_pixels(1.0, from, dpi, printer_display);
385 return pixels_to_units(pixels, to, dpi, printer_display);
386}
REAL units_to_pixels(REAL units, GpUnit unit, REAL dpi, BOOL printer_display)
Definition: gdiplus.c:329
REAL pixels_to_units(REAL pixels, GpUnit unit, REAL dpi, BOOL printer_display)
Definition: gdiplus.c:356
CardRegion * from
Definition: spigame.cpp:19

Referenced by GdipDrawImagePointRect(), GdipDrawString(), GdipMeasureCharacterRanges(), GdipMeasureString(), get_font_hfont(), and test_GdipMeasureString().

◆ units_to_pixels()

REAL units_to_pixels ( REAL  units,
GpUnit  unit,
REAL  dpi,
BOOL  printer_display 
)

Definition at line 329 of file gdiplus.c.

330{
331 switch (unit)
332 {
333 case UnitPixel:
334 case UnitWorld:
335 return units;
336 case UnitDisplay:
337 if (printer_display)
338 return units * dpi * 0.01f;
339 else
340 return units;
341 case UnitPoint:
342 return units * dpi * inch_per_point;
343 case UnitInch:
344 return units * dpi;
345 case UnitDocument:
346 return units * dpi * (1.0f / 300.0f); /* Per MSDN */
347 case UnitMillimeter:
348 return units * dpi * inch_per_mm;
349 default:
350 FIXME("Unhandled unit type: %d\n", unit);
351 return 0;
352 }
353}
static const REAL inch_per_mm
Definition: gdiplus.c:39
static const REAL inch_per_point
Definition: gdiplus.c:41
GLfloat units
Definition: glext.h:11727

Referenced by GdipBeginContainer(), GdipCreateFont(), GdipDrawImagePointsRect(), GdipEnumerateMetafileDestPoint(), GdipGetFontHeightGivenDPI(), GdipGetImageDimension(), GdipGetImageHeight(), GdipGetImageWidth(), GdipGetLogFontW(), GdipPlayMetafileRecord(), get_graphics_transform(), get_log_fontW(), METAFILE_DrawImagePointsRect(), METAFILE_PlaybackUpdateWorldTransform(), prepare_dc(), test_font_height_scaling(), test_GdipMeasureString(), test_measured_extra_space(), and units_scale().

◆ unstretch_angle()

static REAL unstretch_angle ( REAL  angle,
REAL  dia_x,
REAL  dia_y 
)
static

Definition at line 207 of file gdiplus.c.

208{
209 REAL stretched;
210 INT revs_off;
211
212 if(fabs(cos(angle)) < 0.00001 || fabs(sin(angle)) < 0.00001)
213 return angle;
214
215 stretched = gdiplus_atan2(sin(angle) / fabs(dia_y), cos(angle) / fabs(dia_x));
216 revs_off = gdip_round(angle / (2.0 * M_PI)) - gdip_round(stretched / (2.0 * M_PI));
217 stretched += ((REAL)revs_off) * M_PI * 2.0;
218 return stretched;
219}
_ACRTIMP double __cdecl fabs(double)
REAL gdiplus_atan2(REAL dy, REAL dx)
Definition: gdiplus.c:306
GLfloat angle
Definition: glext.h:10853
#define M_PI
Definition: macros.h:263

Referenced by arc2polybezier().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( gdiplus  )

Variable Documentation

◆ inch_per_mm

const REAL inch_per_mm = 1.0 / 25.4
static

Definition at line 39 of file gdiplus.c.

Referenced by units_to_pixels().

◆ inch_per_point

const REAL inch_per_point = 1.0 / 72.0
static

Definition at line 41 of file gdiplus.c.

Referenced by units_to_pixels().

◆ mm_per_inch

const REAL mm_per_inch = 25.4
static

Definition at line 38 of file gdiplus.c.

Referenced by pixels_to_units().

◆ point_per_inch

const REAL point_per_inch = 72.0
static

Definition at line 40 of file gdiplus.c.

Referenced by pixels_to_units().