ReactOS 0.4.15-dev-8235-gcd88a97
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 void unstretch_angle (REAL *angle, REAL rad_x, REAL rad_y)
 
INT arc2polybezier (GpPointF *points, REAL x1, REAL y1, REAL x2, REAL y2, REAL startAngle, REAL sweepAngle)
 
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)
 
REAL pixels_to_units (REAL pixels, GpUnit unit, REAL dpi)
 
REAL units_scale (GpUnit from, GpUnit to, REAL dpi)
 
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)
 

Variables

static const REAL mm_per_inch = 25.4
 
static const REAL point_per_inch = 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 162 of file gdiplus.c.

164{
165 REAL center_x, center_y, rad_x, rad_y, cos_start, cos_end,
166 sin_start, sin_end, a, half;
167 INT i;
168
169 rad_x = x2 / 2.0;
170 rad_y = y2 / 2.0;
171 center_x = x1 + rad_x;
172 center_y = y1 + rad_y;
173
174 cos_start = cos(start);
175 cos_end = cos(end);
176 sin_start = sin(start);
177 sin_end = sin(end);
178
179 half = (end - start) / 2.0;
180 a = 4.0 / 3.0 * (1 - cos(half)) / sin(half);
181
182 if(write_first){
183 pt[0].X = cos_start;
184 pt[0].Y = sin_start;
185 }
186 pt[1].X = cos_start - a * sin_start;
187 pt[1].Y = sin_start + a * cos_start;
188
189 pt[3].X = cos_end;
190 pt[3].Y = sin_end;
191 pt[2].X = cos_end + a * sin_end;
192 pt[2].Y = sin_end - a * cos_end;
193
194 /* expand the points back from the unit circle to the ellipse */
195 for(i = (write_first ? 0 : 1); i < 4; i ++){
196 pt[i].X = pt[i].X * rad_x + center_x;
197 pt[i].Y = pt[i].Y * rad_y + center_y;
198 }
199}
_STLP_DECLSPEC complex< float > _STLP_CALL cos(const complex< float > &)
_STLP_DECLSPEC complex< float > _STLP_CALL sin(const complex< float > &)
float REAL
Definition: types.h:41
#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 _In_ LONG _In_ LONG x2
Definition: winddi.h:3710
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG _In_ LONG y1
Definition: winddi.h:3709
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG x1
Definition: winddi.h:3708
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG _In_ LONG _In_ LONG _In_ LONG y2
Definition: winddi.h:3711

Referenced by arc2polybezier().

◆ arc2polybezier()

INT arc2polybezier ( GpPointF points,
REAL  x1,
REAL  y1,
REAL  x2,
REAL  y2,
REAL  startAngle,
REAL  sweepAngle 
)

Definition at line 223 of file gdiplus.c.

225{
226 INT i;
227 REAL end_angle, start_angle, endAngle;
228
229 endAngle = startAngle + sweepAngle;
230 unstretch_angle(&startAngle, x2 / 2.0, y2 / 2.0);
231 unstretch_angle(&endAngle, x2 / 2.0, y2 / 2.0);
232
233 /* start_angle and end_angle are the iterative variables */
234 start_angle = startAngle;
235
236 for(i = 0; i < MAX_ARC_PTS - 1; i += 3){
237 /* check if we've overshot the end angle */
238 if( sweepAngle > 0.0 )
239 {
240 if (start_angle >= endAngle) break;
241 end_angle = min(start_angle + M_PI_2, endAngle);
242 }
243 else
244 {
245 if (start_angle <= endAngle) break;
246 end_angle = max(start_angle - M_PI_2, endAngle);
247 }
248
249 if (points)
250 add_arc_part(&points[i], x1, y1, x2, y2, start_angle, end_angle, i == 0);
251
252 start_angle += M_PI_2 * (sweepAngle < 0.0 ? -1.0 : 1.0);
253 }
254
255 if (i == 0) return 0;
256 else return i+1;
257}
static void unstretch_angle(REAL *angle, REAL rad_x, REAL rad_y)
Definition: gdiplus.c:205
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:162
#define MAX_ARC_PTS
GLsizei const GLfloat * points
Definition: glext.h:8112
#define M_PI_2
Definition: port.h:185
#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 272 of file gdiplus.c.

273{
274 BITMAPINFO bi;
276 RGBQUAD *bits;
277 int alpha;
278
279 if ((color & 0xff000000) == 0xff000000) return 0;
280
281 bi.bmiHeader.biSize = sizeof(bi.bmiHeader);
282 bi.bmiHeader.biWidth = 1;
283 bi.bmiHeader.biHeight = 1;
284 bi.bmiHeader.biPlanes = 1;
285 bi.bmiHeader.biBitCount = 32;
287 bi.bmiHeader.biSizeImage = 0;
290 bi.bmiHeader.biClrUsed = 0;
292
293 result = CreateDIBSection(0, &bi, DIB_RGB_COLORS, (void*)&bits, NULL, 0);
294
295 bits[0].rgbReserved = alpha = (color>>24)&0xff;
296 bits[0].rgbRed = ((color>>16)&0xff)*alpha/255;
297 bits[0].rgbGreen = ((color>>8)&0xff)*alpha/255;
298 bits[0].rgbBlue = (color&0xff)*alpha/255;
299
300 return result;
301}
#define NULL
Definition: types.h:112
#define BI_RGB
Definition: precomp.h:56
ULONG RGBQUAD
Definition: precomp.h:59
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:52
USHORT biBitCount
Definition: precomp.h:46
LONG biYPelsPerMeter
Definition: precomp.h:50
ULONG biCompression
Definition: precomp.h:47
LONG biXPelsPerMeter
Definition: precomp.h:49
BITMAPINFOHEADER bmiHeader
Definition: wingdi.h:1476
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 259 of file gdiplus.c.

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

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 379 of file gdiplus.c.

381{
382 REAL xdiff, ydiff;
383
384 /* calculate tangent */
385 xdiff = pts[2].X - pts[0].X;
386 ydiff = pts[2].Y - pts[0].Y;
387
388 /* apply tangent to get control points */
389 *x1 = pts[1].X - tension * xdiff;
390 *y1 = pts[1].Y - tension * ydiff;
391 *x2 = pts[1].X + tension * xdiff;
392 *y2 = pts[1].Y + tension * ydiff;
393}
REAL Y
Definition: gdiplustypes.h:649
REAL X
Definition: gdiplustypes.h:648

Referenced by GdipAddPathClosedCurve2(), and GdipAddPathCurve2().

◆ 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 396 of file gdiplus.c.

398{
399 /* tangent at endpoints is the line from the endpoint to the adjacent point */
400 *x = gdip_round(tension * (xadj - xend) + xend);
401 *y = gdip_round(tension * (yadj - yend) + yend);
402}
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 GdipAddPathCurve2().

◆ 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 435 of file gdiplus.c.

437{
438 INT x, y;
439 for (y=0; y<height; y++)
440 {
441 const BYTE *src=src_bits+y*src_stride;
442 BYTE *dst=dst_bits+y*dst_stride;
443 for (x=0; x<width; x++)
444 {
445 BYTE alpha=src[3];
446 *dst++ = (*src++ * alpha + 127) / 255;
447 *dst++ = (*src++ * alpha + 127) / 255;
448 *dst++ = (*src++ * alpha + 127) / 255;
449 *dst++ = *src++;
450 }
451 }
452}
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
GLint GLint GLsizei width
Definition: gl.h:1546
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_pointf()

const char * debugstr_pointf ( const PointF pt)

Definition at line 482 of file gdiplus.c.

483{
484 if (!pt) return "(null)";
485 return wine_dbg_sprintf("(%0.2f,%0.2f)", pt->X, pt->Y);
486}
const char * wine_dbg_sprintf(const char *format,...)
Definition: compat.c:296

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

◆ debugstr_rectf()

const char * debugstr_rectf ( const RectF rc)

Definition at line 476 of file gdiplus.c.

477{
478 if (!rc) return "(null)";
479 return wine_dbg_sprintf("(%0.2f,%0.2f,%0.2f,%0.2f)", rc->X, rc->Y, rc->Width, rc->Height);
480}
REAL Height
Definition: gdiplustypes.h:664
REAL X
Definition: gdiplustypes.h:661
REAL Width
Definition: gdiplustypes.h:663
REAL Y
Definition: gdiplustypes.h:662

Referenced by GdipBeginContainer(), GdipCombineRegionRect(), GdipDrawString(), GdipEnumerateMetafileSrcRectDestPoints(), GdipGetRegionBounds(), GdipMeasureCharacterRanges(), and GdipMeasureString().

◆ delete_element()

void delete_element ( region_element element)

Definition at line 455 of file gdiplus.c.

456{
457 switch(element->type)
458 {
459 case RegionDataRect:
460 break;
461 case RegionDataPath:
462 GdipDeletePath(element->elementdata.path);
463 break;
466 break;
467 default:
468 delete_element(element->elementdata.combine.left);
469 delete_element(element->elementdata.combine.right);
470 heap_free(element->elementdata.combine.left);
471 heap_free(element->elementdata.combine.right);
472 break;
473 }
474}
static BOOL heap_free(void *mem)
Definition: appwiz.h:76
GpStatus WINGDIPAPI GdipDeletePath(GpPath *path)
void delete_element(region_element *element)
Definition: gdiplus.c:455
@ 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 58 of file gdiplus.c.

59{
60 TRACE("(%p, %d, %p)\n", hinst, reason, reserved);
61
62 switch(reason)
63 {
67 break;
68
70 if (reserved) break;
73 break;
74 }
75 return TRUE;
76}
#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:1608
BOOL WINAPI DisableThreadLibraryCalls(IN HMODULE hLibModule)
Definition: loader.c:85
r reserved
Definition: btrfs.c:3006
void init_generic_string_formats(void) DECLSPEC_HIDDEN
Definition: stringformat.c:56
void free_generic_string_formats(void) DECLSPEC_HIDDEN
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 304 of file gdiplus.c.

305{
306 if((dx == 0.0) && (dy != 0.0))
307 return dy > 0.0 ? M_PI_2 : -M_PI_2;
308
309 return atan2(dy, dx);
310}
valarray< _Tp > atan2(const valarray< _Tp > &__x, const valarray< _Tp > &__y)
Definition: _valarray.h:928
GLint dy
Definition: linetemp.h:97
GLint dx
Definition: linetemp.h:97

Referenced by draw_cap(), GdipGetLogFontW(), get_font_hfont(), shorten_line_percent(), and unstretch_angle().

◆ GdiplusNotificationHook()

GpStatus WINAPI GdiplusNotificationHook ( ULONG_PTR token)

Definition at line 110 of file gdiplus.c.

111{
112 FIXME("%p\n", token);
113 return NotificationHook(token);
114}
#define FIXME(fmt,...)
Definition: debug.h:114
static Status WINAPI NotificationHook(ULONG_PTR *token)
Definition: gdiplus.c:41
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 116 of file gdiplus.c.

117{
118 FIXME("%ld\n", token);
120}
static void WINAPI NotificationUnhook(ULONG_PTR token)
Definition: gdiplus.c:50

◆ GdiplusShutdown_wrapper()

ULONG WINAPI GdiplusShutdown_wrapper ( ULONG_PTR  token)

Definition at line 125 of file gdiplus.c.

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

◆ GdiplusStartup()

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

Definition at line 81 of file gdiplus.c.

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

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 405 of file gdiplus.c.

406{
407 /* initial allocation */
408 if(path->datalen == 0){
409 path->datalen = len * 2;
410
411 path->pathdata.Points = heap_alloc_zero(path->datalen * sizeof(PointF));
412 if(!path->pathdata.Points) return FALSE;
413
414 path->pathdata.Types = heap_alloc_zero(path->datalen);
415 if(!path->pathdata.Types){
416 heap_free(path->pathdata.Points);
417 return FALSE;
418 }
419 }
420 /* reallocation, double size of arrays */
421 else if(path->datalen - path->pathdata.Count < len){
422 while(path->datalen - path->pathdata.Count < len)
423 path->datalen *= 2;
424
425 path->pathdata.Points = heap_realloc(path->pathdata.Points, path->datalen * sizeof(PointF));
426 if(!path->pathdata.Points) return FALSE;
427
428 path->pathdata.Types = heap_realloc(path->pathdata.Types, path->datalen);
429 if(!path->pathdata.Types) return FALSE;
430 }
431
432 return TRUE;
433}
static void * heap_realloc(void *mem, size_t len)
Definition: appwiz.h:71
#define FALSE
Definition: types.h:117
GLenum GLsizei len
Definition: glext.h:6722

Referenced by format_string_callback(), GdipAddPathArc(), GdipAddPathBezier(), GdipAddPathBeziers(), GdipAddPathEllipse(), GdipAddPathLine(), GdipAddPathLine2(), GdipAddPathPath(), GdipAddPathPie(), GdipAddPathPolygon(), GdipFlattenPath(), GdipPathIterNextMarkerPath(), GdipPathIterNextSubpathPath(), GdipWidenPath(), and read_element().

◆ NotificationHook()

static Status WINAPI NotificationHook ( ULONG_PTR token)
static

Definition at line 41 of file gdiplus.c.

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

Referenced by GdiplusNotificationHook(), and GdiplusStartup().

◆ NotificationUnhook()

static void WINAPI NotificationUnhook ( ULONG_PTR  token)
static

Definition at line 50 of file gdiplus.c.

51{
52 TRACE("%ld\n", token);
53}

Referenced by GdiplusNotificationUnhook(), and GdiplusStartup().

◆ pixels_to_units()

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

Definition at line 350 of file gdiplus.c.

351{
352 switch (unit)
353 {
354 case UnitPixel:
355 case UnitWorld:
356 case UnitDisplay:
357 return pixels;
358 case UnitPoint:
359 return pixels * point_per_inch / dpi;
360 case UnitInch:
361 return pixels / dpi;
362 case UnitDocument:
363 return pixels * 300.0 / dpi;
364 case UnitMillimeter:
365 return pixels * mm_per_inch / dpi;
366 default:
367 FIXME("Unhandled unit type: %d\n", unit);
368 return 0;
369 }
370}
static const REAL mm_per_inch
Definition: gdiplus.c:38
static const REAL point_per_inch
Definition: gdiplus.c:39
@ 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:2159
#define dpi
Definition: sysparams.c:23

Referenced by GdipGetFontHeight(), and units_scale().

◆ units_scale()

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

Definition at line 372 of file gdiplus.c.

373{
375 return pixels_to_units(pixels, to, dpi);
376}
REAL pixels_to_units(REAL pixels, GpUnit unit, REAL dpi)
Definition: gdiplus.c:350
REAL units_to_pixels(REAL units, GpUnit unit, REAL dpi)
Definition: gdiplus.c:327
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 
)

◆ unstretch_angle()

static void unstretch_angle ( REAL angle,
REAL  rad_x,
REAL  rad_y 
)
static

Definition at line 205 of file gdiplus.c.

206{
207 REAL stretched;
208 INT revs_off;
209
210 *angle = deg2rad(*angle);
211
212 if(fabs(cos(*angle)) < 0.00001 || fabs(sin(*angle)) < 0.00001)
213 return;
214
215 stretched = gdiplus_atan2(sin(*angle) / fabs(rad_y), cos(*angle) / fabs(rad_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 *angle = stretched;
219}
REAL gdiplus_atan2(REAL dy, REAL dx)
Definition: gdiplus.c:304
static REAL deg2rad(REAL degrees)
GLfloat angle
Definition: glext.h:10853
_Check_return_ _CRT_JIT_INTRINSIC double __cdecl fabs(_In_ double x)
Definition: fabs.c:17
#define M_PI
Definition: macros.h:263

Referenced by arc2polybezier().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( gdiplus  )

Variable Documentation

◆ mm_per_inch

const REAL mm_per_inch = 25.4
static

Definition at line 38 of file gdiplus.c.

Referenced by pixels_to_units(), and units_to_pixels().

◆ point_per_inch

const REAL point_per_inch = 72.0
static

Definition at line 39 of file gdiplus.c.

Referenced by pixels_to_units(), and units_to_pixels().