ReactOS 0.4.17-dev-243-g1369312
brush.c File Reference
#include <stdarg.h>
#include "windef.h"
#include "winbase.h"
#include "winuser.h"
#include "wingdi.h"
#include "objbase.h"
#include "olectl.h"
#include "ole2.h"
#include "gdiplus.h"
#include "gdiplus_private.h"
#include "wine/debug.h"
Include dependency graph for brush.c:

Go to the source code of this file.

Macros

#define COBJMACROS
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (gdiplus)
 
GpStatus WINGDIPAPI GdipCloneBrush (GpBrush *brush, GpBrush **clone)
 
GpStatus get_hatch_data (GpHatchStyle hatchstyle, const unsigned char **result)
 
GpStatus WINGDIPAPI GdipCreateHatchBrush (GpHatchStyle hatchstyle, ARGB forecol, ARGB backcol, GpHatch **brush)
 
static GpStatus create_line_brush (const GpRectF *rect, ARGB startcolor, ARGB endcolor, GpWrapMode wrap, GpLineGradient **line)
 
static void linegradient_init_transform (const GpPointF *startpoint, const GpPointF *endpoint, GpLineGradient *line)
 
GpStatus WINGDIPAPI GdipCreateLineBrush (GDIPCONST GpPointF *startpoint, GDIPCONST GpPointF *endpoint, ARGB startcolor, ARGB endcolor, GpWrapMode wrap, GpLineGradient **line)
 
GpStatus WINGDIPAPI GdipCreateLineBrushI (GDIPCONST GpPoint *startpoint, GDIPCONST GpPoint *endpoint, ARGB startcolor, ARGB endcolor, GpWrapMode wrap, GpLineGradient **line)
 
GpStatus WINGDIPAPI GdipCreateLineBrushFromRect (GDIPCONST GpRectF *rect, ARGB startcolor, ARGB endcolor, LinearGradientMode mode, GpWrapMode wrap, GpLineGradient **line)
 
GpStatus WINGDIPAPI GdipCreateLineBrushFromRectI (GDIPCONST GpRect *rect, ARGB startcolor, ARGB endcolor, LinearGradientMode mode, GpWrapMode wrap, GpLineGradient **line)
 
GpStatus WINGDIPAPI GdipCreateLineBrushFromRectWithAngle (GDIPCONST GpRectF *rect, ARGB startcolor, ARGB endcolor, REAL angle, BOOL isAngleScalable, GpWrapMode wrap, GpLineGradient **line)
 
GpStatus WINGDIPAPI GdipCreateLineBrushFromRectWithAngleI (GDIPCONST GpRect *rect, ARGB startcolor, ARGB endcolor, REAL angle, BOOL isAngleScalable, GpWrapMode wrap, GpLineGradient **line)
 
static GpStatus create_path_gradient (GpPath *path, ARGB centercolor, GpPathGradient **grad)
 
GpStatus WINGDIPAPI GdipCreatePathGradient (GDIPCONST GpPointF *points, INT count, GpWrapMode wrap, GpPathGradient **grad)
 
GpStatus WINGDIPAPI GdipCreatePathGradientI (GDIPCONST GpPoint *points, INT count, GpWrapMode wrap, GpPathGradient **grad)
 
GpStatus WINGDIPAPI GdipCreatePathGradientFromPath (GDIPCONST GpPath *path, GpPathGradient **grad)
 
GpStatus WINGDIPAPI GdipCreateSolidFill (ARGB color, GpSolidFill **sf)
 
GpStatus WINGDIPAPI GdipCreateTexture (GpImage *image, GpWrapMode wrapmode, GpTexture **texture)
 
GpStatus WINGDIPAPI GdipCreateTexture2 (GpImage *image, GpWrapMode wrapmode, REAL x, REAL y, REAL width, REAL height, GpTexture **texture)
 
GpStatus WINGDIPAPI GdipCreateTextureIA (GpImage *image, GDIPCONST GpImageAttributes *imageattr, REAL x, REAL y, REAL width, REAL height, GpTexture **texture)
 
GpStatus WINGDIPAPI GdipCreateTextureIAI (GpImage *image, GDIPCONST GpImageAttributes *imageattr, INT x, INT y, INT width, INT height, GpTexture **texture)
 
GpStatus WINGDIPAPI GdipCreateTexture2I (GpImage *image, GpWrapMode wrapmode, INT x, INT y, INT width, INT height, GpTexture **texture)
 
GpStatus WINGDIPAPI GdipGetBrushType (GpBrush *brush, GpBrushType *type)
 
GpStatus WINGDIPAPI GdipGetHatchBackgroundColor (GpHatch *brush, ARGB *backcol)
 
GpStatus WINGDIPAPI GdipGetHatchForegroundColor (GpHatch *brush, ARGB *forecol)
 
GpStatus WINGDIPAPI GdipGetHatchStyle (GpHatch *brush, GpHatchStyle *hatchstyle)
 
GpStatus WINGDIPAPI GdipDeleteBrush (GpBrush *brush)
 
GpStatus WINGDIPAPI GdipGetLineGammaCorrection (GpLineGradient *line, BOOL *usinggamma)
 
GpStatus WINGDIPAPI GdipGetLineWrapMode (GpLineGradient *brush, GpWrapMode *wrapmode)
 
GpStatus WINGDIPAPI GdipGetPathGradientBlend (GpPathGradient *brush, REAL *blend, REAL *positions, INT count)
 
GpStatus WINGDIPAPI GdipGetPathGradientBlendCount (GpPathGradient *brush, INT *count)
 
GpStatus WINGDIPAPI GdipGetPathGradientCenterPoint (GpPathGradient *grad, GpPointF *point)
 
GpStatus WINGDIPAPI GdipGetPathGradientCenterPointI (GpPathGradient *grad, GpPoint *point)
 
GpStatus WINGDIPAPI GdipGetPathGradientCenterColor (GpPathGradient *grad, ARGB *colors)
 
GpStatus WINGDIPAPI GdipGetPathGradientFocusScales (GpPathGradient *grad, REAL *x, REAL *y)
 
GpStatus WINGDIPAPI GdipGetPathGradientGammaCorrection (GpPathGradient *grad, BOOL *gamma)
 
GpStatus WINGDIPAPI GdipGetPathGradientPath (GpPathGradient *grad, GpPath *path)
 
GpStatus WINGDIPAPI GdipGetPathGradientPointCount (GpPathGradient *grad, INT *count)
 
GpStatus WINGDIPAPI GdipGetPathGradientRect (GpPathGradient *brush, GpRectF *rect)
 
GpStatus WINGDIPAPI GdipGetPathGradientRectI (GpPathGradient *brush, GpRect *rect)
 
GpStatus WINGDIPAPI GdipGetPathGradientSurroundColorsWithCount (GpPathGradient *grad, ARGB *argb, INT *count)
 
GpStatus WINGDIPAPI GdipGetPathGradientSurroundColorCount (GpPathGradient *brush, INT *count)
 
GpStatus WINGDIPAPI GdipGetPathGradientWrapMode (GpPathGradient *brush, GpWrapMode *wrapmode)
 
GpStatus WINGDIPAPI GdipGetSolidFillColor (GpSolidFill *sf, ARGB *argb)
 
GpStatus WINGDIPAPI GdipGetTextureImage (GpTexture *brush, GpImage **image)
 
GpStatus WINGDIPAPI GdipGetTextureTransform (GpTexture *brush, GpMatrix *matrix)
 
GpStatus WINGDIPAPI GdipGetTextureWrapMode (GpTexture *brush, GpWrapMode *wrapmode)
 
GpStatus WINGDIPAPI GdipMultiplyTextureTransform (GpTexture *brush, GDIPCONST GpMatrix *matrix, GpMatrixOrder order)
 
GpStatus WINGDIPAPI GdipResetTextureTransform (GpTexture *brush)
 
GpStatus WINGDIPAPI GdipScaleTextureTransform (GpTexture *brush, REAL sx, REAL sy, GpMatrixOrder order)
 
GpStatus WINGDIPAPI GdipSetLineBlend (GpLineGradient *brush, GDIPCONST REAL *factors, GDIPCONST REAL *positions, INT count)
 
GpStatus WINGDIPAPI GdipGetLineBlend (GpLineGradient *brush, REAL *factors, REAL *positions, INT count)
 
GpStatus WINGDIPAPI GdipGetLineBlendCount (GpLineGradient *brush, INT *count)
 
GpStatus WINGDIPAPI GdipSetLineGammaCorrection (GpLineGradient *line, BOOL usegamma)
 
GpStatus WINGDIPAPI GdipSetLineSigmaBlend (GpLineGradient *line, REAL focus, REAL scale)
 
GpStatus WINGDIPAPI GdipSetLineWrapMode (GpLineGradient *line, GpWrapMode wrap)
 
GpStatus WINGDIPAPI GdipSetPathGradientBlend (GpPathGradient *brush, GDIPCONST REAL *blend, GDIPCONST REAL *pos, INT count)
 
GpStatus WINGDIPAPI GdipSetPathGradientLinearBlend (GpPathGradient *brush, REAL focus, REAL scale)
 
GpStatus WINGDIPAPI GdipSetPathGradientPresetBlend (GpPathGradient *brush, GDIPCONST ARGB *blend, GDIPCONST REAL *pos, INT count)
 
GpStatus WINGDIPAPI GdipGetPathGradientPresetBlend (GpPathGradient *brush, ARGB *blend, REAL *pos, INT count)
 
GpStatus WINGDIPAPI GdipGetPathGradientPresetBlendCount (GpPathGradient *brush, INT *count)
 
GpStatus WINGDIPAPI GdipSetPathGradientCenterColor (GpPathGradient *grad, ARGB argb)
 
GpStatus WINGDIPAPI GdipSetPathGradientCenterPoint (GpPathGradient *grad, GpPointF *point)
 
GpStatus WINGDIPAPI GdipSetPathGradientCenterPointI (GpPathGradient *grad, GpPoint *point)
 
GpStatus WINGDIPAPI GdipSetPathGradientFocusScales (GpPathGradient *grad, REAL x, REAL y)
 
GpStatus WINGDIPAPI GdipSetPathGradientGammaCorrection (GpPathGradient *grad, BOOL gamma)
 
GpStatus WINGDIPAPI GdipSetPathGradientPath (GpPathGradient *grad, GDIPCONST GpPath *path)
 
GpStatus WINGDIPAPI GdipSetPathGradientSigmaBlend (GpPathGradient *grad, REAL focus, REAL scale)
 
GpStatus WINGDIPAPI GdipSetPathGradientSurroundColorsWithCount (GpPathGradient *grad, GDIPCONST ARGB *argb, INT *count)
 
GpStatus WINGDIPAPI GdipSetPathGradientWrapMode (GpPathGradient *grad, GpWrapMode wrap)
 
GpStatus WINGDIPAPI GdipSetPathGradientTransform (GpPathGradient *grad, GpMatrix *matrix)
 
GpStatus WINGDIPAPI GdipGetPathGradientTransform (GpPathGradient *grad, GpMatrix *matrix)
 
GpStatus WINGDIPAPI GdipMultiplyPathGradientTransform (GpPathGradient *grad, GDIPCONST GpMatrix *matrix, GpMatrixOrder order)
 
GpStatus WINGDIPAPI GdipResetPathGradientTransform (GpPathGradient *grad)
 
GpStatus WINGDIPAPI GdipRotatePathGradientTransform (GpPathGradient *grad, REAL angle, GpMatrixOrder order)
 
GpStatus WINGDIPAPI GdipScalePathGradientTransform (GpPathGradient *grad, REAL sx, REAL sy, GpMatrixOrder order)
 
GpStatus WINGDIPAPI GdipTranslatePathGradientTransform (GpPathGradient *grad, REAL dx, REAL dy, GpMatrixOrder order)
 
GpStatus WINGDIPAPI GdipSetSolidFillColor (GpSolidFill *sf, ARGB argb)
 
GpStatus WINGDIPAPI GdipSetTextureTransform (GpTexture *texture, GDIPCONST GpMatrix *matrix)
 
GpStatus WINGDIPAPI GdipSetTextureWrapMode (GpTexture *brush, GpWrapMode wrapmode)
 
GpStatus WINGDIPAPI GdipSetLineColors (GpLineGradient *brush, ARGB color1, ARGB color2)
 
GpStatus WINGDIPAPI GdipGetLineColors (GpLineGradient *brush, ARGB *colors)
 
GpStatus WINGDIPAPI GdipRotateTextureTransform (GpTexture *brush, REAL angle, GpMatrixOrder order)
 
GpStatus WINGDIPAPI GdipSetLineLinearBlend (GpLineGradient *brush, REAL focus, REAL scale)
 
GpStatus WINGDIPAPI GdipSetLinePresetBlend (GpLineGradient *brush, GDIPCONST ARGB *blend, GDIPCONST REAL *positions, INT count)
 
GpStatus WINGDIPAPI GdipGetLinePresetBlend (GpLineGradient *brush, ARGB *blend, REAL *positions, INT count)
 
GpStatus WINGDIPAPI GdipGetLinePresetBlendCount (GpLineGradient *brush, INT *count)
 
GpStatus WINGDIPAPI GdipResetLineTransform (GpLineGradient *brush)
 
GpStatus WINGDIPAPI GdipSetLineTransform (GpLineGradient *brush, GDIPCONST GpMatrix *matrix)
 
GpStatus WINGDIPAPI GdipGetLineTransform (GpLineGradient *brush, GpMatrix *matrix)
 
GpStatus WINGDIPAPI GdipScaleLineTransform (GpLineGradient *brush, REAL sx, REAL sy, GpMatrixOrder order)
 
GpStatus WINGDIPAPI GdipMultiplyLineTransform (GpLineGradient *brush, GDIPCONST GpMatrix *matrix, GpMatrixOrder order)
 
GpStatus WINGDIPAPI GdipTranslateLineTransform (GpLineGradient *brush, REAL dx, REAL dy, GpMatrixOrder order)
 
GpStatus WINGDIPAPI GdipTranslateTextureTransform (GpTexture *brush, REAL dx, REAL dy, GpMatrixOrder order)
 
GpStatus WINGDIPAPI GdipGetLineRect (GpLineGradient *brush, GpRectF *rect)
 
GpStatus WINGDIPAPI GdipGetLineRectI (GpLineGradient *brush, GpRect *rect)
 
GpStatus WINGDIPAPI GdipRotateLineTransform (GpLineGradient *brush, REAL angle, GpMatrixOrder order)
 

Variables

static const unsigned char HatchBrushes [][9]
 

Macro Definition Documentation

◆ COBJMACROS

#define COBJMACROS

Definition at line 27 of file brush.c.

Function Documentation

◆ create_line_brush()

static GpStatus create_line_brush ( const GpRectF rect,
ARGB  startcolor,
ARGB  endcolor,
GpWrapMode  wrap,
GpLineGradient **  line 
)
static

Definition at line 323 of file brush.c.

325{
326 *line = calloc(1, sizeof(GpLineGradient));
327 if(!*line) return OutOfMemory;
328
329 (*line)->brush.bt = BrushTypeLinearGradient;
330 (*line)->startcolor = startcolor;
331 (*line)->endcolor = endcolor;
332 (*line)->wrap = wrap;
333 (*line)->gamma = FALSE;
334 (*line)->rect = *rect;
335 (*line)->blendcount = 1;
336 (*line)->blendfac = malloc(sizeof(REAL));
337 (*line)->blendpos = malloc(sizeof(REAL));
338
339 if (!(*line)->blendfac || !(*line)->blendpos)
340 {
341 free((*line)->blendfac);
342 free((*line)->blendpos);
343 free(*line);
344 *line = NULL;
345 return OutOfMemory;
346 }
347
348 (*line)->blendfac[0] = 1.0f;
349 (*line)->blendpos[0] = 1.0f;
350
351 (*line)->pblendcolor = NULL;
352 (*line)->pblendpos = NULL;
353 (*line)->pblendcount = 0;
354
355 GdipSetMatrixElements(&(*line)->transform, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f);
356
357 return Ok;
358}
RECT rect
Definition: combotst.c:67
#define free
Definition: debug_ros.c:5
#define malloc
Definition: debug_ros.c:4
#define NULL
Definition: types.h:112
#define FALSE
Definition: types.h:117
float REAL
Definition: types.h:41
GpStatus WINGDIPAPI GdipSetMatrixElements(GpMatrix *matrix, REAL m11, REAL m12, REAL m21, REAL m22, REAL dx, REAL dy)
Definition: matrix.c:318
#define wrap(journal, var)
Definition: recovery.c:207
@ BrushTypeLinearGradient
Definition: gdiplusenums.h:42
@ Ok
Definition: gdiplustypes.h:25
@ OutOfMemory
Definition: gdiplustypes.h:28
#define calloc
Definition: rosglue.h:14
Definition: parser.c:49

Referenced by GdipCreateLineBrush(), and GdipCreateLineBrushFromRectWithAngle().

◆ create_path_gradient()

static GpStatus create_path_gradient ( GpPath path,
ARGB  centercolor,
GpPathGradient **  grad 
)
static

Definition at line 626 of file brush.c.

627{
628 INT i;
629 REAL sum_x = 0, sum_y = 0;
630
631 if(!path || !grad)
632 return InvalidParameter;
633
634 if (path->pathdata.Count < 2)
635 return OutOfMemory;
636
637 *grad = calloc(1, sizeof(GpPathGradient));
638 if (!*grad)
639 {
640 return OutOfMemory;
641 }
642
643 GdipSetMatrixElements(&(*grad)->transform, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0);
644
645 (*grad)->blendfac = malloc(sizeof(REAL));
646 (*grad)->blendpos = malloc(sizeof(REAL));
647 (*grad)->surroundcolors = malloc(sizeof(ARGB));
648 if(!(*grad)->blendfac || !(*grad)->blendpos || !(*grad)->surroundcolors){
649 free((*grad)->blendfac);
650 free((*grad)->blendpos);
651 free((*grad)->surroundcolors);
652 free(*grad);
653 *grad = NULL;
654 return OutOfMemory;
655 }
656 (*grad)->blendfac[0] = 1.0;
657 (*grad)->blendpos[0] = 1.0;
658 (*grad)->blendcount = 1;
659
660 (*grad)->path = path;
661
662 (*grad)->brush.bt = BrushTypePathGradient;
663 (*grad)->centercolor = centercolor;
664 (*grad)->wrap = WrapModeClamp;
665 (*grad)->gamma = FALSE;
666 for (i=0; i<path->pathdata.Count; i++)
667 {
668 sum_x += path->pathdata.Points[i].X;
669 sum_y += path->pathdata.Points[i].Y;
670 }
671 (*grad)->center.X = sum_x / path->pathdata.Count;
672 (*grad)->center.Y = sum_y / path->pathdata.Count;
673
674 (*grad)->focus.X = 0.0;
675 (*grad)->focus.Y = 0.0;
676 (*grad)->surroundcolors[0] = 0xffffffff;
677 (*grad)->surroundcolorcount = 1;
678
679 TRACE("<-- %p\n", *grad);
680
681 return Ok;
682}
@ WrapModeClamp
Definition: gdiplusenums.h:209
@ BrushTypePathGradient
Definition: gdiplusenums.h:41
DWORD ARGB
@ InvalidParameter
Definition: gdiplustypes.h:27
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 TRACE(s)
Definition: solgame.cpp:4
int32_t INT
Definition: typedefs.h:58

Referenced by GdipCreatePathGradient(), GdipCreatePathGradientFromPath(), and GdipCreatePathGradientI().

◆ GdipCloneBrush()

GpStatus WINGDIPAPI GdipCloneBrush ( GpBrush brush,
GpBrush **  clone 
)

Definition at line 70 of file brush.c.

71{
72 TRACE("(%p, %p)\n", brush, clone);
73
74 if(!brush || !clone)
75 return InvalidParameter;
76
77 switch(brush->bt){
79 {
80 GpSolidFill *dest = malloc(sizeof(*dest));
81 if (!dest) return OutOfMemory;
82 memcpy(dest, brush, sizeof(*dest));
83 *clone = &dest->brush;
84 break;
85 }
87 {
88 GpHatch *hatch = (GpHatch*)brush;
89
90 return GdipCreateHatchBrush(hatch->hatchstyle, hatch->forecol, hatch->backcol, (GpHatch**)clone);
91 }
94 INT count, pcount;
96
97 dest = malloc(sizeof(*dest));
98 if (!dest) return OutOfMemory;
99
100 src = (GpPathGradient*) brush;
101
102 memcpy(dest, src, sizeof(GpPathGradient));
103
104 stat = GdipClonePath(src->path, &dest->path);
105
106 if(stat != Ok){
107 free(dest);
108 return stat;
109 }
110
111 dest->transform = src->transform;
112
113 /* blending */
114 count = src->blendcount;
115 dest->blendcount = count;
116 dest->blendfac = malloc(count * sizeof(REAL));
117 dest->blendpos = malloc(count * sizeof(REAL));
118 dest->surroundcolors = malloc(dest->surroundcolorcount * sizeof(ARGB));
119 pcount = dest->pblendcount;
120 if (pcount)
121 {
122 dest->pblendcolor = malloc(pcount * sizeof(ARGB));
123 dest->pblendpos = malloc(pcount * sizeof(REAL));
124 }
125
126 if(!dest->blendfac || !dest->blendpos || !dest->surroundcolors ||
127 (pcount && (!dest->pblendcolor || !dest->pblendpos))){
128 GdipDeletePath(dest->path);
129 free(dest->blendfac);
130 free(dest->blendpos);
131 free(dest->surroundcolors);
132 free(dest->pblendcolor);
133 free(dest->pblendpos);
134 free(dest);
135 return OutOfMemory;
136 }
137
138 memcpy(dest->blendfac, src->blendfac, count * sizeof(REAL));
139 memcpy(dest->blendpos, src->blendpos, count * sizeof(REAL));
140 memcpy(dest->surroundcolors, src->surroundcolors, dest->surroundcolorcount * sizeof(ARGB));
141
142 if (pcount)
143 {
144 memcpy(dest->pblendcolor, src->pblendcolor, pcount * sizeof(ARGB));
145 memcpy(dest->pblendpos, src->pblendpos, pcount * sizeof(REAL));
146 }
147
148 *clone = &dest->brush;
149 break;
150 }
153 INT count, pcount;
154
155 dest = malloc(sizeof(GpLineGradient));
156 if(!dest) return OutOfMemory;
157
158 src = (GpLineGradient*)brush;
159
160 memcpy(dest, src, sizeof(GpLineGradient));
161
162 count = dest->blendcount;
163 dest->blendfac = malloc(count * sizeof(REAL));
164 dest->blendpos = malloc(count * sizeof(REAL));
165 pcount = dest->pblendcount;
166 if (pcount)
167 {
168 dest->pblendcolor = malloc(pcount * sizeof(ARGB));
169 dest->pblendpos = malloc(pcount * sizeof(REAL));
170 }
171
172 if (!dest->blendfac || !dest->blendpos ||
173 (pcount && (!dest->pblendcolor || !dest->pblendpos)))
174 {
175 free(dest->blendfac);
176 free(dest->blendpos);
177 free(dest->pblendcolor);
178 free(dest->pblendpos);
179 free(dest);
180 return OutOfMemory;
181 }
182
183 dest->transform = src->transform;
184
185 memcpy(dest->blendfac, src->blendfac, count * sizeof(REAL));
186 memcpy(dest->blendpos, src->blendpos, count * sizeof(REAL));
187
188 if (pcount)
189 {
190 memcpy(dest->pblendcolor, src->pblendcolor, pcount * sizeof(ARGB));
191 memcpy(dest->pblendpos, src->pblendpos, pcount * sizeof(REAL));
192 }
193
194 *clone = &dest->brush;
195 break;
196 }
198 {
200 GpTexture *texture = (GpTexture*)brush;
201 GpTexture *new_texture;
203
205 if (stat != Ok) return stat;
207 if (stat != Ok) return stat;
208
209 stat = GdipCreateTextureIA(texture->image, texture->imageattributes, 0, 0, width, height, &new_texture);
210
211 if (stat == Ok)
212 {
213 new_texture->transform = texture->transform;
214 *clone = &new_texture->brush;
215 }
216 else
217 *clone = NULL;
218
219 return stat;
220 }
221 default:
222 ERR("not implemented for brush type %d\n", brush->bt);
223 return NotImplemented;
224 }
225
226 TRACE("<-- %p\n", *clone);
227 return Ok;
228}
#define stat
Definition: acwin.h:100
#define ERR(fmt,...)
Definition: precomp.h:57
GpStatus WINGDIPAPI GdipCreateHatchBrush(GpHatchStyle hatchstyle, ARGB forecol, ARGB backcol, GpHatch **brush)
Definition: brush.c:302
GpStatus WINGDIPAPI GdipCreateTextureIA(GpImage *image, GDIPCONST GpImageAttributes *imageattr, REAL x, REAL y, REAL width, REAL height, GpTexture **texture)
Definition: brush.c:874
GpStatus WINGDIPAPI GdipDeletePath(GpPath *path)
GpStatus WINGDIPAPI GdipClonePath(GpPath *path, GpPath **clone)
GpStatus WINGDIPAPI GdipGetImageWidth(GpImage *image, UINT *width)
Definition: image.c:2323
GpStatus WINGDIPAPI GdipGetImageHeight(GpImage *image, UINT *height)
Definition: image.c:2213
@ BrushTypeHatchFill
Definition: gdiplusenums.h:39
@ BrushTypeTextureFill
Definition: gdiplusenums.h:40
@ BrushTypeSolidColor
Definition: gdiplusenums.h:38
Status
Definition: gdiplustypes.h:24
@ NotImplemented
Definition: gdiplustypes.h:31
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
GLint GLint GLsizei width
Definition: gl.h:1546
GLenum GLuint texture
Definition: glext.h:6295
GLenum src
Definition: glext.h:6340
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
static char * dest
Definition: rtl.c:149
unsigned int UINT
Definition: ndis.h:50
GpBrushType bt
GpHatchStyle hatchstyle
GpBrush brush
GpMatrix transform
Definition: stat.h:66

Referenced by GdipClonePen(), GdipCreatePen2(), GdipGetPenBrushFill(), and GdipSetPenBrushFill().

◆ GdipCreateHatchBrush()

GpStatus WINGDIPAPI GdipCreateHatchBrush ( GpHatchStyle  hatchstyle,
ARGB  forecol,
ARGB  backcol,
GpHatch **  brush 
)

Definition at line 302 of file brush.c.

303{
304 TRACE("(%d, %ld, %ld, %p)\n", hatchstyle, forecol, backcol, brush);
305
306 if(!brush) return InvalidParameter;
307
308 if(hatchstyle < HatchStyleMin || hatchstyle > HatchStyleMax)
309 return InvalidParameter;
310
311 *brush = calloc(1, sizeof(GpHatch));
312 if (!*brush) return OutOfMemory;
313
314 (*brush)->brush.bt = BrushTypeHatchFill;
315 (*brush)->forecol = forecol;
316 (*brush)->backcol = backcol;
317 (*brush)->hatchstyle = hatchstyle;
318 TRACE("<-- %p\n", *brush);
319
320 return Ok;
321}
@ HatchStyleMax
Definition: gdiplusenums.h:484

Referenced by GdipCloneBrush(), metafile_deserialize_brush(), test_createHatchBrush(), test_drawdriverstring(), test_fillregion(), test_getHatchStyle(), test_hatchBrushStyles(), and test_renderingOrigin().

◆ GdipCreateLineBrush()

GpStatus WINGDIPAPI GdipCreateLineBrush ( GDIPCONST GpPointF startpoint,
GDIPCONST GpPointF endpoint,
ARGB  startcolor,
ARGB  endcolor,
GpWrapMode  wrap,
GpLineGradient **  line 
)

Definition at line 398 of file brush.c.

401{
404
405 TRACE("(%s, %s, %lx, %lx, %d, %p)\n", debugstr_pointf(startpoint),
406 debugstr_pointf(endpoint), startcolor, endcolor, wrap, line);
407
408 if(!line || !startpoint || !endpoint || wrap == WrapModeClamp)
409 return InvalidParameter;
410
411 if (startpoint->X == endpoint->X && startpoint->Y == endpoint->Y)
412 return OutOfMemory;
413
414 rect.X = startpoint->X < endpoint->X ? startpoint->X : endpoint->X;
415 rect.Y = startpoint->Y < endpoint->Y ? startpoint->Y : endpoint->Y;
416 rect.Width = fabs(startpoint->X - endpoint->X);
417 rect.Height = fabs(startpoint->Y - endpoint->Y);
418
419 if (rect.Width == 0.0f)
420 {
421 rect.X -= rect.Height / 2.0f;
422 rect.Width = rect.Height;
423 }
424 else if (rect.Height == 0.0f)
425 {
426 rect.Y -= rect.Width / 2.0f;
427 rect.Height = rect.Width;
428 }
429
430 stat = create_line_brush(&rect, startcolor, endcolor, wrap, line);
431 if (stat != Ok)
432 return stat;
433
435
436 TRACE("<-- %p\n", *line);
437
438 return Ok;
439}
static void linegradient_init_transform(const GpPointF *startpoint, const GpPointF *endpoint, GpLineGradient *line)
Definition: brush.c:360
static GpStatus create_line_brush(const GpRectF *rect, ARGB startcolor, ARGB endcolor, GpWrapMode wrap, GpLineGradient **line)
Definition: brush.c:323
_ACRTIMP double __cdecl fabs(double)
const char * debugstr_pointf(const PointF *pt)
Definition: gdiplus.c:492
Definition: nis.h:10

Referenced by GdipCreateLineBrushI(), test_constructor_destructor2(), test_getgamma(), test_gradientgetrect(), test_lineblend(), test_linelinearblend(), test_penfilltype(), and test_transform().

◆ GdipCreateLineBrushFromRect()

GpStatus WINGDIPAPI GdipCreateLineBrushFromRect ( GDIPCONST GpRectF rect,
ARGB  startcolor,
ARGB  endcolor,
LinearGradientMode  mode,
GpWrapMode  wrap,
GpLineGradient **  line 
)

Definition at line 462 of file brush.c.

465{
466 float angle;
467
468 TRACE("(%s, %lx, %lx, %d, %d, %p)\n", debugstr_rectf(rect), startcolor, endcolor, mode,
469 wrap, line);
470
471 if(!line || !rect)
472 return InvalidParameter;
473
474 switch (mode)
475 {
477 angle = 0.0f;
478 break;
480 angle = 90.0f;
481 break;
483 angle = 45.0f;
484 break;
486 angle = 135.0f;
487 break;
488 default:
489 return InvalidParameter;
490 }
491
492 return GdipCreateLineBrushFromRectWithAngle(rect, startcolor, endcolor, angle, TRUE, wrap, line);
493}
#define TRUE
Definition: types.h:120
GpStatus WINGDIPAPI GdipCreateLineBrushFromRectWithAngle(GDIPCONST GpRectF *rect, ARGB startcolor, ARGB endcolor, REAL angle, BOOL isAngleScalable, GpWrapMode wrap, GpLineGradient **line)
Definition: brush.c:511
const char * debugstr_rectf(const RectF *rc)
Definition: gdiplus.c:486
@ LinearGradientModeForwardDiagonal
Definition: gdiplusenums.h:226
@ LinearGradientModeBackwardDiagonal
Definition: gdiplusenums.h:227
@ LinearGradientModeHorizontal
Definition: gdiplusenums.h:224
@ LinearGradientModeVertical
Definition: gdiplusenums.h:225
GLenum mode
Definition: glext.h:6217
GLfloat angle
Definition: glext.h:10853

Referenced by GdipCreateLineBrushFromRectI(), metafile_deserialize_brush(), test_gradientgetrect(), test_lineargradient(), and test_transform().

◆ GdipCreateLineBrushFromRectI()

GpStatus WINGDIPAPI GdipCreateLineBrushFromRectI ( GDIPCONST GpRect rect,
ARGB  startcolor,
ARGB  endcolor,
LinearGradientMode  mode,
GpWrapMode  wrap,
GpLineGradient **  line 
)

Definition at line 495 of file brush.c.

498{
499 GpRectF rectF;
500
501 TRACE("(%p, %lx, %lx, %d, %d, %p)\n", rect, startcolor, endcolor, mode,
502 wrap, line);
503
504 set_rect(&rectF, rect->X, rect->Y, rect->Width, rect->Height);
505 return GdipCreateLineBrushFromRect(&rectF, startcolor, endcolor, mode, wrap, line);
506}
GpStatus WINGDIPAPI GdipCreateLineBrushFromRect(GDIPCONST GpRectF *rect, ARGB startcolor, ARGB endcolor, LinearGradientMode mode, GpWrapMode wrap, GpLineGradient **line)
Definition: brush.c:462
static void set_rect(GpRectF *rect, REAL x, REAL y, REAL width, REAL height)

Referenced by GdipCreateLineBrushFromRectWithAngleI().

◆ GdipCreateLineBrushFromRectWithAngle()

GpStatus WINGDIPAPI GdipCreateLineBrushFromRectWithAngle ( GDIPCONST GpRectF rect,
ARGB  startcolor,
ARGB  endcolor,
REAL  angle,
BOOL  isAngleScalable,
GpWrapMode  wrap,
GpLineGradient **  line 
)

Definition at line 511 of file brush.c.

514{
516 REAL exofs, eyofs, far_x, far_y;
517 REAL sin_angle, cos_angle, sin_cos_angle;
519
520 TRACE("(%s, %lx, %lx, %.2f, %d, %d, %p)\n", debugstr_rectf(rect), startcolor, endcolor, angle, isAngleScalable,
521 wrap, line);
522
523 if (!rect || !line || wrap == WrapModeClamp)
524 return InvalidParameter;
525
526 if (!rect->Width || !rect->Height)
527 return OutOfMemory;
528
529 angle = fmodf(angle, 360);
530 if (angle < 0)
531 angle += 360;
532
533 if (isAngleScalable)
534 {
535 float add_angle = 0;
536
537 while(angle >= 90) {
538 angle -= 180;
539 add_angle += M_PI;
540 }
541
542 if (angle != 90 && angle != -90)
543 angle = atan((rect->Width / rect->Height) * tan(deg2rad(angle)));
544 else
546 angle += add_angle;
547 }
548 else
549 {
551 }
552
553 sin_angle = sinf(angle);
554 cos_angle = cosf(angle);
555 sin_cos_angle = sin_angle * cos_angle;
556
557 far_x = rect->X + rect->Width;
558 far_y = rect->Y + rect->Height;
559
560 if (angle == 0.0f)
561 {
562 start.X = min(rect->X, far_x);
563 start.Y = rect->Y;
564 end.X = max(rect->X, far_x);
565 end.Y = rect->Y;
566 }
567 else if (sin_cos_angle >= 0)
568 {
569 start.X = min(rect->X, far_x);
570 start.Y = min(rect->Y, far_y);
571 end.X = max(rect->X, far_x);
572 end.Y = max(rect->Y, far_y);
573 }
574 else
575 {
576 start.X = max(rect->X, far_x);
577 start.Y = min(rect->Y, far_y);
578 end.X = min(rect->X, far_x);
579 end.Y = max(rect->Y, far_y);
580 }
581
582 stat = create_line_brush(rect, startcolor, endcolor, wrap, line);
583 if (stat != Ok || angle == 0.0f)
584 return stat;
585
586 if (sin_cos_angle >= 0)
587 {
588 exofs = rect->Height * sin_cos_angle + rect->Width * cos_angle * cos_angle;
589 eyofs = rect->Height * sin_angle * sin_angle + rect->Width * sin_cos_angle;
590 }
591 else
592 {
593 exofs = rect->Width * sin_angle * sin_angle + rect->Height * sin_cos_angle;
594 eyofs = -rect->Width * sin_cos_angle + rect->Height * sin_angle * sin_angle;
595 }
596
597 if (sin_angle >= 0)
598 {
599 end.X = rect->X + exofs;
600 end.Y = rect->Y + eyofs;
601 }
602 else
603 {
604 end.X = start.X;
605 end.Y = start.Y;
606 start.X = rect->X + exofs;
607 start.Y = rect->Y + eyofs;
608 }
609
611
612 return stat;
613}
_ACRTIMP double __cdecl atan(double)
Definition: atan.c:44
_ACRTIMP float __cdecl cosf(float)
Definition: cosf.c:13
_ACRTIMP float __cdecl sinf(float)
Definition: sinf.c:13
_ACRTIMP double __cdecl tan(double)
Definition: tan.c:122
_ACRTIMP float __cdecl fmodf(float, float)
static REAL deg2rad(REAL degrees)
GLuint start
Definition: gl.h:1545
GLuint GLuint end
Definition: gl.h:1545
#define M_PI
Definition: macros.h:263
#define min(a, b)
Definition: monoChain.cc:55
#define max(a, b)
Definition: svc.c:63

Referenced by GdipCreateLineBrushFromRect(), test_createLineBrushFromRectWithAngle(), and test_gradientgetrect().

◆ GdipCreateLineBrushFromRectWithAngleI()

GpStatus WINGDIPAPI GdipCreateLineBrushFromRectWithAngleI ( GDIPCONST GpRect rect,
ARGB  startcolor,
ARGB  endcolor,
REAL  angle,
BOOL  isAngleScalable,
GpWrapMode  wrap,
GpLineGradient **  line 
)

Definition at line 615 of file brush.c.

618{
619 TRACE("(%p, %lx, %lx, %.2f, %d, %d, %p)\n", rect, startcolor, endcolor, angle, isAngleScalable,
620 wrap, line);
621
623 wrap, line);
624}
GpStatus WINGDIPAPI GdipCreateLineBrushFromRectI(GDIPCONST GpRect *rect, ARGB startcolor, ARGB endcolor, LinearGradientMode mode, GpWrapMode wrap, GpLineGradient **line)
Definition: brush.c:495

◆ GdipCreateLineBrushI()

GpStatus WINGDIPAPI GdipCreateLineBrushI ( GDIPCONST GpPoint startpoint,
GDIPCONST GpPoint endpoint,
ARGB  startcolor,
ARGB  endcolor,
GpWrapMode  wrap,
GpLineGradient **  line 
)

Definition at line 441 of file brush.c.

444{
445 GpPointF stF;
446 GpPointF endF;
447
448 TRACE("(%p, %p, %lx, %lx, %d, %p)\n", startpoint, endpoint,
449 startcolor, endcolor, wrap, line);
450
451 if(!startpoint || !endpoint)
452 return InvalidParameter;
453
454 stF.X = (REAL)startpoint->X;
455 stF.Y = (REAL)startpoint->Y;
456 endF.X = (REAL)endpoint->X;
457 endF.Y = (REAL)endpoint->Y;
458
459 return GdipCreateLineBrush(&stF, &endF, startcolor, endcolor, wrap, line);
460}
GpStatus WINGDIPAPI GdipCreateLineBrush(GDIPCONST GpPointF *startpoint, GDIPCONST GpPointF *endpoint, ARGB startcolor, ARGB endcolor, GpWrapMode wrap, GpLineGradient **line)
Definition: brush.c:398
REAL Y
Definition: gdiplustypes.h:644
REAL X
Definition: gdiplustypes.h:643

◆ GdipCreatePathGradient()

GpStatus WINGDIPAPI GdipCreatePathGradient ( GDIPCONST GpPointF points,
INT  count,
GpWrapMode  wrap,
GpPathGradient **  grad 
)

Definition at line 684 of file brush.c.

686{
688 GpPath *path;
689
690 TRACE("(%p, %d, %d, %p)\n", points, count, wrap, grad);
691
692 if(!grad)
693 return InvalidParameter;
694
695 if(!points || count <= 0)
696 return OutOfMemory;
697
699
700 if (stat == Ok)
701 {
703
704 if (stat == Ok)
705 stat = create_path_gradient(path, 0xff000000, grad);
706
707 if (stat != Ok)
709 }
710
711 if (stat == Ok)
712 (*grad)->wrap = wrap;
713
714 return stat;
715}
static GpStatus create_path_gradient(GpPath *path, ARGB centercolor, GpPathGradient **grad)
Definition: brush.c:626
GpStatus WINGDIPAPI GdipCreatePath(GpFillMode fill, GpPath **path)
GpStatus WINGDIPAPI GdipAddPathLine2(GpPath *path, GDIPCONST GpPointF *points, INT count)
Definition: graphicspath.c:743
@ FillModeAlternate
Definition: gdiplusenums.h:55
GLsizei const GLfloat * points
Definition: glext.h:8112

Referenced by test_getblend(), test_getbounds(), test_gradientblendcount(), test_gradientsurroundcolorcount(), test_pathgradientblend(), test_pathgradientcenterpoint(), test_pathgradientpath(), and test_pathgradientpresetblend().

◆ GdipCreatePathGradientFromPath()

GpStatus WINGDIPAPI GdipCreatePathGradientFromPath ( GDIPCONST GpPath path,
GpPathGradient **  grad 
)

Definition at line 753 of file brush.c.

755{
757 GpPath *new_path;
758
759 TRACE("(%p, %p)\n", path, grad);
760
761 if(!grad)
762 return InvalidParameter;
763
764 if (!path)
765 return OutOfMemory;
766
767 stat = GdipClonePath((GpPath*)path, &new_path);
768
769 if (stat == Ok)
770 {
771 stat = create_path_gradient(new_path, 0xffffffff, grad);
772
773 if (stat != Ok)
774 GdipDeletePath(new_path);
775 }
776
777 return stat;
778}

Referenced by test_pathgradientcenterpoint().

◆ GdipCreatePathGradientI()

GpStatus WINGDIPAPI GdipCreatePathGradientI ( GDIPCONST GpPoint points,
INT  count,
GpWrapMode  wrap,
GpPathGradient **  grad 
)

Definition at line 717 of file brush.c.

719{
721 GpPath *path;
722
723 TRACE("(%p, %d, %d, %p)\n", points, count, wrap, grad);
724
725 if(!grad)
726 return InvalidParameter;
727
728 if(!points || count <= 0)
729 return OutOfMemory;
730
732
733 if (stat == Ok)
734 {
736
737 if (stat == Ok)
738 stat = create_path_gradient(path, 0xff000000, grad);
739
740 if (stat != Ok)
742 }
743
744 if (stat == Ok)
745 (*grad)->wrap = wrap;
746
747 return stat;
748}
GpStatus WINGDIPAPI GdipAddPathLine2I(GpPath *path, GDIPCONST GpPoint *points, INT count)
Definition: graphicspath.c:754

◆ GdipCreateSolidFill()

◆ GdipCreateTexture()

GpStatus WINGDIPAPI GdipCreateTexture ( GpImage image,
GpWrapMode  wrapmode,
GpTexture **  texture 
)

Definition at line 812 of file brush.c.

814{
818
819 TRACE("%p, %d %p\n", image, wrapmode, texture);
820
821 if (!(image && texture))
822 return InvalidParameter;
823
825 if (stat != Ok) return stat;
827 if (stat != Ok) return stat;
828
830
831 if (stat == Ok)
832 {
833 attributes->wrap = wrapmode;
834
836 texture);
837
839 }
840
841 return stat;
842}
GpStatus WINGDIPAPI GdipCreateImageAttributes(GpImageAttributes **imageattr)
GpStatus WINGDIPAPI GdipDisposeImageAttributes(GpImageAttributes *imageattr)
static HANDLE ACCESS_MASK ULONG attributes
Definition: om.c:94

Referenced by metafile_deserialize_brush(), test_GdipFillRectanglesOnBitmapTextureBrush(), test_GdipFillRectanglesOnMemoryDCTextureBrush(), test_texturewrap(), and test_transform().

◆ GdipCreateTexture2()

GpStatus WINGDIPAPI GdipCreateTexture2 ( GpImage image,
GpWrapMode  wrapmode,
REAL  x,
REAL  y,
REAL  width,
REAL  height,
GpTexture **  texture 
)

Definition at line 847 of file brush.c.

849{
852
853 TRACE("%p %d %f %f %f %f %p\n", image, wrapmode,
854 x, y, width, height, texture);
855
857
858 if (stat == Ok)
859 {
860 attributes->wrap = wrapmode;
861
863 texture);
864
866 }
867
868 return stat;
869}
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548

◆ GdipCreateTexture2I()

GpStatus WINGDIPAPI GdipCreateTexture2I ( GpImage image,
GpWrapMode  wrapmode,
INT  x,
INT  y,
INT  width,
INT  height,
GpTexture **  texture 
)

Definition at line 954 of file brush.c.

956{
957 GpImageAttributes *imageattr;
959
960 TRACE("%p %d %d %d %d %d %p\n", image, wrapmode, x, y, width, height,
961 texture);
962
963 stat = GdipCreateImageAttributes(&imageattr);
964
965 if (stat == Ok)
966 {
967 imageattr->wrap = wrapmode;
968
969 stat = GdipCreateTextureIA(image, imageattr, x, y, width, height, texture);
971 }
972
973 return stat;
974}

◆ GdipCreateTextureIA()

GpStatus WINGDIPAPI GdipCreateTextureIA ( GpImage image,
GDIPCONST GpImageAttributes imageattr,
REAL  x,
REAL  y,
REAL  width,
REAL  height,
GpTexture **  texture 
)

Definition at line 874 of file brush.c.

877{
879 GpImage *new_image=NULL;
880
881 TRACE("(%p, %p, %.2f, %.2f, %.2f, %.2f, %p)\n", image, imageattr, x, y, width, height,
882 texture);
883
884 if(!image || !texture || x < 0.0 || y < 0.0 || width < 0.0 || height < 0.0)
885 return InvalidParameter;
886
887 *texture = NULL;
888
889 if(image->type != ImageTypeBitmap){
890 FIXME("not implemented for image type %d\n", image->type);
891 return NotImplemented;
892 }
893
895 if (status != Ok)
896 return status;
897
898 *texture = calloc(1, sizeof(GpTexture));
899 if (!*texture){
901 goto exit;
902 }
903
904 GdipSetMatrixElements(&(*texture)->transform, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0);
905
906 if (imageattr)
907 {
908 status = GdipCloneImageAttributes(imageattr, &(*texture)->imageattributes);
909 }
910 else
911 {
912 status = GdipCreateImageAttributes(&(*texture)->imageattributes);
913 if (status == Ok)
914 (*texture)->imageattributes->wrap = WrapModeTile;
915 }
916 if (status == Ok)
917 {
918 (*texture)->brush.bt = BrushTypeTextureFill;
919 (*texture)->image = new_image;
920 }
921
922exit:
923 if (status == Ok)
924 {
925 TRACE("<-- %p\n", *texture);
926 }
927 else
928 {
929 if (*texture)
930 {
931 GdipDisposeImageAttributes((*texture)->imageattributes);
932 free(*texture);
933 *texture = NULL;
934 }
935 GdipDisposeImage(new_image);
936 TRACE("<-- error %u\n", status);
937 }
938
939 return status;
940}
#define FIXME(fmt,...)
Definition: precomp.h:53
GpStatus WINGDIPAPI GdipDisposeImage(GpImage *image)
Definition: image.c:2099
GpStatus WINGDIPAPI GdipCloneBitmapArea(REAL x, REAL y, REAL width, REAL height, PixelFormat format, GpBitmap *srcBitmap, GpBitmap **dstBitmap)
Definition: image.c:1313
@ ImageTypeBitmap
Definition: gdiplusenums.h:194
@ WrapModeTile
Definition: gdiplusenums.h:205
#define PixelFormatDontCare
GpStatus WINGDIPAPI GdipCloneImageAttributes(GDIPCONST GpImageAttributes *imageattr, GpImageAttributes **cloneImageattr)
#define exit(n)
Definition: config.h:202
Definition: ps.c:97

Referenced by GdipCloneBrush(), GdipCreateTexture(), GdipCreateTexture2(), GdipCreateTexture2I(), and GdipCreateTextureIAI().

◆ GdipCreateTextureIAI()

GpStatus WINGDIPAPI GdipCreateTextureIAI ( GpImage image,
GDIPCONST GpImageAttributes imageattr,
INT  x,
INT  y,
INT  width,
INT  height,
GpTexture **  texture 
)

Definition at line 945 of file brush.c.

947{
948 TRACE("(%p, %p, %d, %d, %d, %d, %p)\n", image, imageattr, x, y, width, height,
949 texture);
950
952}

◆ GdipDeleteBrush()

GpStatus WINGDIPAPI GdipDeleteBrush ( GpBrush brush)

Definition at line 1020 of file brush.c.

1021{
1022 TRACE("(%p)\n", brush);
1023
1024 if(!brush) return InvalidParameter;
1025
1026 switch(brush->bt)
1027 {
1030 free(((GpPathGradient*)brush)->blendfac);
1031 free(((GpPathGradient*)brush)->blendpos);
1032 free(((GpPathGradient*)brush)->surroundcolors);
1033 free(((GpPathGradient*)brush)->pblendcolor);
1034 free(((GpPathGradient*)brush)->pblendpos);
1035 break;
1037 free(((GpLineGradient*)brush)->blendfac);
1038 free(((GpLineGradient*)brush)->blendpos);
1039 free(((GpLineGradient*)brush)->pblendcolor);
1040 free(((GpLineGradient*)brush)->pblendpos);
1041 break;
1043 GdipDisposeImage(((GpTexture*)brush)->image);
1044 GdipDisposeImageAttributes(((GpTexture*)brush)->imageattributes);
1045 free(((GpTexture*)brush)->bitmap_bits);
1046 break;
1047 default:
1048 break;
1049 }
1050
1051 free(brush);
1052
1053 return Ok;
1054}
static const BYTE bitmap_bits[48 *48/8]
Definition: imagelist.c:131

Referenced by GdipCreatePen1(), GdipDeletePen(), GdipGraphicsClear(), GdipPlayMetafileRecord(), GdipSetPenBrushFill(), metafile_deserialize_brush(), metafile_free_object_table_entry(), METAFILE_PlaybackObject(), test_brushfill(), test_clipping(), test_constructor_destructor(), test_constructor_destructor2(), test_containers(), test_createHatchBrush(), test_createLineBrushFromRectWithAngle(), test_drawdriverstring(), test_fillellipse(), test_fillpath(), test_fillrect(), test_fillregion(), test_gdi_interop_bitmap(), test_gdi_interop_hdc(), test_GdipDrawString(), test_GdipFillClosedCurve(), test_GdipFillClosedCurve2(), test_GdipFillClosedCurve2I(), test_GdipFillClosedCurveI(), test_GdipFillPath(), test_GdipFillRectangles(), test_GdipFillRectanglesOnBitmapTextureBrush(), test_GdipFillRectanglesOnMemoryDCSolidBrush(), test_GdipFillRectanglesOnMemoryDCTextureBrush(), test_Get_Release_DC(), test_getblend(), test_getbounds(), test_getgamma(), test_getHatchStyle(), test_gradientblendcount(), test_gradientgetrect(), test_gradientsurroundcolorcount(), test_hatchBrushStyles(), test_hdc_caching(), test_lineargradient(), test_lineblend(), test_linelinearblend(), test_nullframerect(), test_pagetransform(), test_pathgradientblend(), test_pathgradientcenterpoint(), test_pathgradientpath(), test_pathgradientpresetblend(), test_penfilltype(), test_printer_dc(), test_renderingOrigin(), test_string_functions(), test_texturewrap(), test_transform(), test_type(), test_unknownfontdecode(), and test_worldtransform().

◆ GdipGetBrushType()

GpStatus WINGDIPAPI GdipGetBrushType ( GpBrush brush,
GpBrushType type 
)

Definition at line 976 of file brush.c.

977{
978 TRACE("(%p, %p)\n", brush, type);
979
980 if(!brush || !type) return InvalidParameter;
981
982 *type = brush->bt;
983
984 return Ok;
985}
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545

Referenced by test_brushfill(), and test_type().

◆ GdipGetHatchBackgroundColor()

GpStatus WINGDIPAPI GdipGetHatchBackgroundColor ( GpHatch brush,
ARGB backcol 
)

Definition at line 987 of file brush.c.

988{
989 TRACE("(%p, %p)\n", brush, backcol);
990
991 if(!brush || !backcol) return InvalidParameter;
992
993 *backcol = brush->backcol;
994
995 return Ok;
996}

◆ GdipGetHatchForegroundColor()

GpStatus WINGDIPAPI GdipGetHatchForegroundColor ( GpHatch brush,
ARGB forecol 
)

Definition at line 998 of file brush.c.

999{
1000 TRACE("(%p, %p)\n", brush, forecol);
1001
1002 if(!brush || !forecol) return InvalidParameter;
1003
1004 *forecol = brush->forecol;
1005
1006 return Ok;
1007}

◆ GdipGetHatchStyle()

GpStatus WINGDIPAPI GdipGetHatchStyle ( GpHatch brush,
GpHatchStyle hatchstyle 
)

Definition at line 1009 of file brush.c.

1010{
1011 TRACE("(%p, %p)\n", brush, hatchstyle);
1012
1013 if(!brush || !hatchstyle) return InvalidParameter;
1014
1015 *hatchstyle = brush->hatchstyle;
1016
1017 return Ok;
1018}

Referenced by test_getHatchStyle().

◆ GdipGetLineBlend()

GpStatus WINGDIPAPI GdipGetLineBlend ( GpLineGradient brush,
REAL factors,
REAL positions,
INT  count 
)

Definition at line 1429 of file brush.c.

1431{
1432 TRACE("(%p, %p, %p, %i)\n", brush, factors, positions, count);
1433
1434 if (!brush || !factors || !positions || count <= 0 || brush->brush.bt != BrushTypeLinearGradient)
1435 return InvalidParameter;
1436
1437 if (count < brush->blendcount)
1438 return InsufficientBuffer;
1439
1440 memcpy(factors, brush->blendfac, brush->blendcount * sizeof(REAL));
1441 memcpy(positions, brush->blendpos, brush->blendcount * sizeof(REAL));
1442
1443 return Ok;
1444}
@ InsufficientBuffer
Definition: gdiplustypes.h:30

Referenced by test_lineblend(), and test_linelinearblend().

◆ GdipGetLineBlendCount()

GpStatus WINGDIPAPI GdipGetLineBlendCount ( GpLineGradient brush,
INT count 
)

Definition at line 1446 of file brush.c.

1447{
1448 TRACE("(%p, %p)\n", brush, count);
1449
1450 if (!brush || !count || brush->brush.bt != BrushTypeLinearGradient)
1451 return InvalidParameter;
1452
1453 *count = brush->blendcount;
1454
1455 return Ok;
1456}

Referenced by test_lineblend(), and test_linelinearblend().

◆ GdipGetLineColors()

GpStatus WINGDIPAPI GdipGetLineColors ( GpLineGradient brush,
ARGB colors 
)

Definition at line 2009 of file brush.c.

2010{
2011 TRACE("(%p, %p)\n", brush, colors);
2012
2013 if(!brush || !colors || brush->brush.bt != BrushTypeLinearGradient)
2014 return InvalidParameter;
2015
2016 colors[0] = brush->startcolor;
2017 colors[1] = brush->endcolor;
2018
2019 return Ok;
2020}

Referenced by test_gradientgetrect().

◆ GdipGetLineGammaCorrection()

GpStatus WINGDIPAPI GdipGetLineGammaCorrection ( GpLineGradient line,
BOOL usinggamma 
)

Definition at line 1056 of file brush.c.

1058{
1059 TRACE("(%p, %p)\n", line, usinggamma);
1060
1061 if(!line || !usinggamma)
1062 return InvalidParameter;
1063
1064 *usinggamma = line->gamma;
1065
1066 return Ok;
1067}

Referenced by test_getgamma().

◆ GdipGetLinePresetBlend()

GpStatus WINGDIPAPI GdipGetLinePresetBlend ( GpLineGradient brush,
ARGB blend,
REAL positions,
INT  count 
)

Definition at line 2103 of file brush.c.

2105{
2106 if (!brush || !blend || !positions || count < 2 || brush->brush.bt != BrushTypeLinearGradient)
2107 return InvalidParameter;
2108
2109 if (brush->pblendcount == 0)
2110 return GenericError;
2111
2112 if (count < brush->pblendcount)
2113 return InsufficientBuffer;
2114
2115 memcpy(blend, brush->pblendcolor, sizeof(ARGB) * brush->pblendcount);
2116 memcpy(positions, brush->pblendpos, sizeof(REAL) * brush->pblendcount);
2117
2118 return Ok;
2119}
@ GenericError
Definition: gdiplustypes.h:26

Referenced by test_lineblend().

◆ GdipGetLinePresetBlendCount()

GpStatus WINGDIPAPI GdipGetLinePresetBlendCount ( GpLineGradient brush,
INT count 
)

Definition at line 2121 of file brush.c.

2123{
2124 if (!brush || !count || brush->brush.bt != BrushTypeLinearGradient)
2125 return InvalidParameter;
2126
2127 *count = brush->pblendcount;
2128
2129 return Ok;
2130}

Referenced by test_lineblend().

◆ GdipGetLineRect()

GpStatus WINGDIPAPI GdipGetLineRect ( GpLineGradient brush,
GpRectF rect 
)

Definition at line 2217 of file brush.c.

2218{
2219 TRACE("(%p, %p)\n", brush, rect);
2220
2221 if(!brush || !rect || brush->brush.bt != BrushTypeLinearGradient)
2222 return InvalidParameter;
2223
2224 *rect = brush->rect;
2225
2226 return Ok;
2227}

Referenced by GdipGetLineRectI(), test_gradientgetrect(), and test_transform().

◆ GdipGetLineRectI()

GpStatus WINGDIPAPI GdipGetLineRectI ( GpLineGradient brush,
GpRect rect 
)

Definition at line 2229 of file brush.c.

2230{
2231 GpRectF rectF;
2232 GpStatus ret;
2233
2234 TRACE("(%p, %p)\n", brush, rect);
2235
2236 if(!rect)
2237 return InvalidParameter;
2238
2239 ret = GdipGetLineRect(brush, &rectF);
2240
2241 if(ret == Ok){
2242 rect->X = gdip_round(rectF.X);
2243 rect->Y = gdip_round(rectF.Y);
2244 rect->Width = gdip_round(rectF.Width);
2245 rect->Height = gdip_round(rectF.Height);
2246 }
2247
2248 return ret;
2249}
GpStatus WINGDIPAPI GdipGetLineRect(GpLineGradient *brush, GpRectF *rect)
Definition: brush.c:2217
return ret
Definition: mutex.c:146
static INT gdip_round(REAL x)
REAL Height
Definition: gdiplustypes.h:659
REAL X
Definition: gdiplustypes.h:656
REAL Width
Definition: gdiplustypes.h:658
REAL Y
Definition: gdiplustypes.h:657

◆ GdipGetLineTransform()

GpStatus WINGDIPAPI GdipGetLineTransform ( GpLineGradient brush,
GpMatrix matrix 
)

Definition at line 2155 of file brush.c.

2156{
2157 TRACE("(%p,%s)\n", brush, debugstr_matrix(matrix));
2158
2159 if(!brush || !matrix)
2160 return InvalidParameter;
2161
2162 *matrix = brush->transform;
2163
2164 return Ok;
2165}
const char * debugstr_matrix(const GpMatrix *matrix)
Definition: gdiplus.c:498
GLuint GLenum matrix
Definition: glext.h:9407

Referenced by test_gradientgetrect(), and test_transform().

◆ GdipGetLineWrapMode()

GpStatus WINGDIPAPI GdipGetLineWrapMode ( GpLineGradient brush,
GpWrapMode wrapmode 
)

Definition at line 1069 of file brush.c.

1070{
1071 TRACE("(%p, %p)\n", brush, wrapmode);
1072
1073 if(!brush || !wrapmode || brush->brush.bt != BrushTypeLinearGradient)
1074 return InvalidParameter;
1075
1076 *wrapmode = brush->wrap;
1077
1078 return Ok;
1079}

◆ GdipGetPathGradientBlend()

GpStatus WINGDIPAPI GdipGetPathGradientBlend ( GpPathGradient brush,
REAL blend,
REAL positions,
INT  count 
)

Definition at line 1081 of file brush.c.

1083{
1084 TRACE("(%p, %p, %p, %d)\n", brush, blend, positions, count);
1085
1086 if(!brush || !blend || !positions || count <= 0 || brush->brush.bt != BrushTypePathGradient)
1087 return InvalidParameter;
1088
1089 if(count < brush->blendcount)
1090 return InsufficientBuffer;
1091
1092 memcpy(blend, brush->blendfac, count*sizeof(REAL));
1093 if(brush->blendcount > 1){
1094 memcpy(positions, brush->blendpos, count*sizeof(REAL));
1095 }
1096
1097 return Ok;
1098}

Referenced by test_getblend(), and test_pathgradientblend().

◆ GdipGetPathGradientBlendCount()

GpStatus WINGDIPAPI GdipGetPathGradientBlendCount ( GpPathGradient brush,
INT count 
)

Definition at line 1100 of file brush.c.

1101{
1102 TRACE("(%p, %p)\n", brush, count);
1103
1104 if(!brush || !count || brush->brush.bt != BrushTypePathGradient)
1105 return InvalidParameter;
1106
1107 *count = brush->blendcount;
1108
1109 return Ok;
1110}

Referenced by test_gradientblendcount(), and test_pathgradientblend().

◆ GdipGetPathGradientCenterColor()

GpStatus WINGDIPAPI GdipGetPathGradientCenterColor ( GpPathGradient grad,
ARGB colors 
)

Definition at line 1147 of file brush.c.

1149{
1150 TRACE("(%p,%p)\n", grad, colors);
1151
1152 if (!grad || !colors || grad->brush.bt != BrushTypePathGradient)
1153 return InvalidParameter;
1154
1155 *colors = grad->centercolor;
1156
1157 return Ok;
1158}

◆ GdipGetPathGradientCenterPoint()

GpStatus WINGDIPAPI GdipGetPathGradientCenterPoint ( GpPathGradient grad,
GpPointF point 
)

Definition at line 1112 of file brush.c.

1114{
1115 TRACE("(%p, %p)\n", grad, point);
1116
1117 if(!grad || !point || grad->brush.bt != BrushTypePathGradient)
1118 return InvalidParameter;
1119
1120 point->X = grad->center.X;
1121 point->Y = grad->center.Y;
1122
1123 return Ok;
1124}
POINTL point
Definition: edittest.c:50

Referenced by GdipGetPathGradientCenterPointI(), and test_pathgradientcenterpoint().

◆ GdipGetPathGradientCenterPointI()

GpStatus WINGDIPAPI GdipGetPathGradientCenterPointI ( GpPathGradient grad,
GpPoint point 
)

Definition at line 1126 of file brush.c.

1128{
1129 GpStatus ret;
1130 GpPointF ptf;
1131
1132 TRACE("(%p, %p)\n", grad, point);
1133
1134 if(!point)
1135 return InvalidParameter;
1136
1138
1139 if(ret == Ok){
1140 point->X = gdip_round(ptf.X);
1141 point->Y = gdip_round(ptf.Y);
1142 }
1143
1144 return ret;
1145}
GpStatus WINGDIPAPI GdipGetPathGradientCenterPoint(GpPathGradient *grad, GpPointF *point)
Definition: brush.c:1112

◆ GdipGetPathGradientFocusScales()

GpStatus WINGDIPAPI GdipGetPathGradientFocusScales ( GpPathGradient grad,
REAL x,
REAL y 
)

Definition at line 1160 of file brush.c.

1162{
1163 TRACE("(%p, %p, %p)\n", grad, x, y);
1164
1165 if(!grad || !x || !y || grad->brush.bt != BrushTypePathGradient)
1166 return InvalidParameter;
1167
1168 *x = grad->focus.X;
1169 *y = grad->focus.Y;
1170
1171 return Ok;
1172}

◆ GdipGetPathGradientGammaCorrection()

GpStatus WINGDIPAPI GdipGetPathGradientGammaCorrection ( GpPathGradient grad,
BOOL gamma 
)

Definition at line 1174 of file brush.c.

1176{
1177 TRACE("(%p, %p)\n", grad, gamma);
1178
1179 if(!grad || !gamma || grad->brush.bt != BrushTypePathGradient)
1180 return InvalidParameter;
1181
1182 *gamma = grad->gamma;
1183
1184 return Ok;
1185}

◆ GdipGetPathGradientPath()

GpStatus WINGDIPAPI GdipGetPathGradientPath ( GpPathGradient grad,
GpPath path 
)

Definition at line 1187 of file brush.c.

1188{
1189 static int calls;
1190
1191 TRACE("(%p, %p)\n", grad, path);
1192
1193 if (!(calls++))
1194 FIXME("not implemented\n");
1195
1196 return NotImplemented;
1197}

Referenced by test_pathgradientpath().

◆ GdipGetPathGradientPointCount()

GpStatus WINGDIPAPI GdipGetPathGradientPointCount ( GpPathGradient grad,
INT count 
)

Definition at line 1199 of file brush.c.

1201{
1202 TRACE("(%p, %p)\n", grad, count);
1203
1204 if(!grad || !count || grad->brush.bt != BrushTypePathGradient)
1205 return InvalidParameter;
1206
1207 *count = grad->path->pathdata.Count;
1208
1209 return Ok;
1210}
GpPathData pathdata

◆ GdipGetPathGradientPresetBlend()

GpStatus WINGDIPAPI GdipGetPathGradientPresetBlend ( GpPathGradient brush,
ARGB blend,
REAL pos,
INT  count 
)

Definition at line 1642 of file brush.c.

1644{
1645 TRACE("(%p,%p,%p,%i)\n", brush, blend, pos, count);
1646
1647 if (count < 0)
1648 return OutOfMemory;
1649
1650 if (!brush || !blend || !pos || count < 2 || brush->brush.bt != BrushTypePathGradient)
1651 return InvalidParameter;
1652
1653 if (brush->pblendcount == 0)
1654 return GenericError;
1655
1656 if (count != brush->pblendcount)
1657 {
1658 /* Native lines up the ends of each array, and copies the destination size. */
1659 FIXME("Braindead behavior on wrong-sized buffer not implemented.\n");
1660 return InvalidParameter;
1661 }
1662
1663 memcpy(blend, brush->pblendcolor, sizeof(ARGB) * brush->pblendcount);
1664 memcpy(pos, brush->pblendpos, sizeof(REAL) * brush->pblendcount);
1665
1666 return Ok;
1667}

Referenced by test_pathgradientpresetblend().

◆ GdipGetPathGradientPresetBlendCount()

GpStatus WINGDIPAPI GdipGetPathGradientPresetBlendCount ( GpPathGradient brush,
INT count 
)

Definition at line 1669 of file brush.c.

1671{
1672 TRACE("(%p,%p)\n", brush, count);
1673
1674 if (!brush || !count || brush->brush.bt != BrushTypePathGradient)
1675 return InvalidParameter;
1676
1677 *count = brush->pblendcount;
1678
1679 return Ok;
1680}

Referenced by test_pathgradientpresetblend().

◆ GdipGetPathGradientRect()

GpStatus WINGDIPAPI GdipGetPathGradientRect ( GpPathGradient brush,
GpRectF rect 
)

Definition at line 1212 of file brush.c.

1213{
1214 GpStatus stat;
1215
1216 TRACE("(%p, %p)\n", brush, rect);
1217
1218 if(!brush || !rect || brush->brush.bt != BrushTypePathGradient)
1219 return InvalidParameter;
1220
1222
1223 return stat;
1224}
GpStatus WINGDIPAPI GdipGetPathWorldBounds(GpPath *path, GpRectF *bounds, GDIPCONST GpMatrix *matrix, GDIPCONST GpPen *pen)

Referenced by GdipGetPathGradientRectI(), and test_getbounds().

◆ GdipGetPathGradientRectI()

GpStatus WINGDIPAPI GdipGetPathGradientRectI ( GpPathGradient brush,
GpRect rect 
)

Definition at line 1226 of file brush.c.

1227{
1228 GpRectF rectf;
1229 GpStatus stat;
1230
1231 TRACE("(%p, %p)\n", brush, rect);
1232
1233 if(!brush || !rect)
1234 return InvalidParameter;
1235
1236 stat = GdipGetPathGradientRect(brush, &rectf);
1237 if(stat != Ok) return stat;
1238
1239 rect->X = gdip_round(rectf.X);
1240 rect->Y = gdip_round(rectf.Y);
1241 rect->Width = gdip_round(rectf.Width);
1242 rect->Height = gdip_round(rectf.Height);
1243
1244 return Ok;
1245}
GpStatus WINGDIPAPI GdipGetPathGradientRect(GpPathGradient *brush, GpRectF *rect)
Definition: brush.c:1212

◆ GdipGetPathGradientSurroundColorCount()

GpStatus WINGDIPAPI GdipGetPathGradientSurroundColorCount ( GpPathGradient brush,
INT count 
)

Definition at line 1270 of file brush.c.

1271{
1272 TRACE("(%p, %p)\n", brush, count);
1273
1274 if (!brush || !count || brush->brush.bt != BrushTypePathGradient)
1275 return InvalidParameter;
1276
1277 /* Yes, this actually returns the number of points in the path (which is the
1278 * required size of a buffer to get the surround colors), rather than the
1279 * number of surround colors. The real count is returned when getting the
1280 * colors. */
1281 *count = brush->path->pathdata.Count;
1282
1283 return Ok;
1284}

Referenced by test_gradientsurroundcolorcount().

◆ GdipGetPathGradientSurroundColorsWithCount()

GpStatus WINGDIPAPI GdipGetPathGradientSurroundColorsWithCount ( GpPathGradient grad,
ARGB argb,
INT count 
)

Definition at line 1247 of file brush.c.

1249{
1250 INT i;
1251
1252 TRACE("(%p,%p,%p)\n", grad, argb, count);
1253
1254 if(!grad || !argb || !count || (*count < grad->path->pathdata.Count) || grad->brush.bt != BrushTypePathGradient)
1255 return InvalidParameter;
1256
1257 for (i=0; i<grad->path->pathdata.Count; i++)
1258 {
1259 if (i < grad->surroundcolorcount)
1260 argb[i] = grad->surroundcolors[i];
1261 else
1262 argb[i] = grad->surroundcolors[grad->surroundcolorcount-1];
1263 }
1264
1265 *count = grad->surroundcolorcount;
1266
1267 return Ok;
1268}

Referenced by test_gradientsurroundcolorcount().

◆ GdipGetPathGradientTransform()

GpStatus WINGDIPAPI GdipGetPathGradientTransform ( GpPathGradient grad,
GpMatrix matrix 
)

Definition at line 1884 of file brush.c.

1886{
1887 TRACE("(%p,%s)\n", grad, debugstr_matrix(matrix));
1888
1889 if (!grad || !matrix || grad->brush.bt != BrushTypePathGradient)
1890 return InvalidParameter;
1891
1892 *matrix = grad->transform;
1893
1894 return Ok;
1895}

◆ GdipGetPathGradientWrapMode()

GpStatus WINGDIPAPI GdipGetPathGradientWrapMode ( GpPathGradient brush,
GpWrapMode wrapmode 
)

Definition at line 1286 of file brush.c.

1288{
1289 TRACE("(%p, %p)\n", brush, wrapmode);
1290
1291 if(!brush || !wrapmode || brush->brush.bt != BrushTypePathGradient)
1292 return InvalidParameter;
1293
1294 *wrapmode = brush->wrap;
1295
1296 return Ok;
1297}

◆ GdipGetSolidFillColor()

GpStatus WINGDIPAPI GdipGetSolidFillColor ( GpSolidFill sf,
ARGB argb 
)

Definition at line 1299 of file brush.c.

1300{
1301 TRACE("(%p, %p)\n", sf, argb);
1302
1303 if(!sf || !argb)
1304 return InvalidParameter;
1305
1306 *argb = sf->color;
1307
1308 return Ok;
1309}

Referenced by GdipGetPenColor(), and test_brushfill().

◆ GdipGetTextureImage()

GpStatus WINGDIPAPI GdipGetTextureImage ( GpTexture brush,
GpImage **  image 
)

Definition at line 1314 of file brush.c.

1315{
1316 TRACE("(%p, %p)\n", brush, image);
1317
1318 if(!brush || !image)
1319 return InvalidParameter;
1320
1321 return GdipCloneImage(brush->image, image);
1322}
GpStatus WINGDIPAPI GdipCloneImage(GpImage *image, GpImage **cloneImage)
Definition: image.c:1385
GpImage * image

◆ GdipGetTextureTransform()

GpStatus WINGDIPAPI GdipGetTextureTransform ( GpTexture brush,
GpMatrix matrix 
)

Definition at line 1327 of file brush.c.

1328{
1329 TRACE("(%p, %s)\n", brush, debugstr_matrix(matrix));
1330
1331 if(!brush || !matrix)
1332 return InvalidParameter;
1333
1334 *matrix = brush->transform;
1335
1336 return Ok;
1337}

Referenced by test_transform().

◆ GdipGetTextureWrapMode()

GpStatus WINGDIPAPI GdipGetTextureWrapMode ( GpTexture brush,
GpWrapMode wrapmode 
)

Definition at line 1342 of file brush.c.

1343{
1344 TRACE("(%p, %p)\n", brush, wrapmode);
1345
1346 if(!brush || !wrapmode)
1347 return InvalidParameter;
1348
1349 *wrapmode = brush->imageattributes->wrap;
1350
1351 return Ok;
1352}
GpImageAttributes * imageattributes

Referenced by test_texturewrap().

◆ GdipMultiplyLineTransform()

GpStatus WINGDIPAPI GdipMultiplyLineTransform ( GpLineGradient brush,
GDIPCONST GpMatrix matrix,
GpMatrixOrder  order 
)

Definition at line 2178 of file brush.c.

2180{
2181 TRACE("(%p,%s,%u)\n", brush, debugstr_matrix(matrix), order);
2182
2183 if(!brush)
2184 return InvalidParameter;
2185
2186 if(!matrix)
2187 return Ok;
2188
2189 return GdipMultiplyMatrix(&brush->transform, matrix, order);
2190}
GpStatus WINGDIPAPI GdipMultiplyMatrix(GpMatrix *matrix, GDIPCONST GpMatrix *matrix2, GpMatrixOrder order)
Definition: matrix.c:239
GLuint GLdouble GLdouble GLint GLint order
Definition: glext.h:11194

Referenced by test_transform().

◆ GdipMultiplyPathGradientTransform()

GpStatus WINGDIPAPI GdipMultiplyPathGradientTransform ( GpPathGradient grad,
GDIPCONST GpMatrix matrix,
GpMatrixOrder  order 
)

Definition at line 1897 of file brush.c.

1899{
1900 TRACE("(%p,%s,%i)\n", grad, debugstr_matrix(matrix), order);
1901
1902 if (!grad || grad->brush.bt != BrushTypePathGradient)
1903 return InvalidParameter;
1904
1905 return GdipMultiplyMatrix(&grad->transform, matrix, order);
1906}

◆ GdipMultiplyTextureTransform()

GpStatus WINGDIPAPI GdipMultiplyTextureTransform ( GpTexture brush,
GDIPCONST GpMatrix matrix,
GpMatrixOrder  order 
)

Definition at line 1357 of file brush.c.

1359{
1360 TRACE("(%p, %s, %d)\n", brush, debugstr_matrix(matrix), order);
1361
1362 if(!brush || !matrix)
1363 return InvalidParameter;
1364
1365 return GdipMultiplyMatrix(&brush->transform, matrix, order);
1366}

◆ GdipResetLineTransform()

GpStatus WINGDIPAPI GdipResetLineTransform ( GpLineGradient brush)

Definition at line 2132 of file brush.c.

2133{
2134 TRACE("(%p)\n", brush);
2135
2136 if(!brush)
2137 return InvalidParameter;
2138
2139 return GdipSetMatrixElements(&brush->transform, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0);
2140}

Referenced by test_transform().

◆ GdipResetPathGradientTransform()

GpStatus WINGDIPAPI GdipResetPathGradientTransform ( GpPathGradient grad)

Definition at line 1908 of file brush.c.

1909{
1910 TRACE("(%p)\n", grad);
1911
1912 if (!grad || grad->brush.bt != BrushTypePathGradient)
1913 return InvalidParameter;
1914
1915 return GdipSetMatrixElements(&grad->transform, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0);
1916}

◆ GdipResetTextureTransform()

GpStatus WINGDIPAPI GdipResetTextureTransform ( GpTexture brush)

Definition at line 1371 of file brush.c.

1372{
1373 TRACE("(%p)\n", brush);
1374
1375 if(!brush)
1376 return InvalidParameter;
1377
1378 return GdipSetMatrixElements(&brush->transform, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0);
1379}

Referenced by test_transform().

◆ GdipRotateLineTransform()

GpStatus WINGDIPAPI GdipRotateLineTransform ( GpLineGradient brush,
REAL  angle,
GpMatrixOrder  order 
)

Definition at line 2251 of file brush.c.

2253{
2254 static int calls;
2255
2256 TRACE("(%p,%0.2f,%u)\n", brush, angle, order);
2257
2258 if(!brush || brush->brush.bt != BrushTypeLinearGradient)
2259 return InvalidParameter;
2260
2261 if(!(calls++))
2262 FIXME("(%p, %.2f, %d) stub\n", brush, angle, order);
2263
2264 return NotImplemented;
2265}

◆ GdipRotatePathGradientTransform()

GpStatus WINGDIPAPI GdipRotatePathGradientTransform ( GpPathGradient grad,
REAL  angle,
GpMatrixOrder  order 
)

Definition at line 1918 of file brush.c.

1920{
1921 TRACE("(%p,%0.2f,%i)\n", grad, angle, order);
1922
1923 if (!grad || grad->brush.bt != BrushTypePathGradient)
1924 return InvalidParameter;
1925
1926 return GdipRotateMatrix(&grad->transform, angle, order);
1927}
GpStatus WINGDIPAPI GdipRotateMatrix(GpMatrix *matrix, REAL angle, GpMatrixOrder order)
Definition: matrix.c:257

◆ GdipRotateTextureTransform()

GpStatus WINGDIPAPI GdipRotateTextureTransform ( GpTexture brush,
REAL  angle,
GpMatrixOrder  order 
)

Definition at line 2025 of file brush.c.

2027{
2028 TRACE("(%p, %.2f, %d)\n", brush, angle, order);
2029
2030 if(!brush)
2031 return InvalidParameter;
2032
2033 return GdipRotateMatrix(&brush->transform, angle, order);
2034}

Referenced by test_transform().

◆ GdipScaleLineTransform()

GpStatus WINGDIPAPI GdipScaleLineTransform ( GpLineGradient brush,
REAL  sx,
REAL  sy,
GpMatrixOrder  order 
)

Definition at line 2167 of file brush.c.

2169{
2170 TRACE("(%p,%0.2f,%0.2f,%u)\n", brush, sx, sy, order);
2171
2172 if(!brush)
2173 return InvalidParameter;
2174
2175 return GdipScaleMatrix(&brush->transform, sx, sy, order);
2176}
GpStatus WINGDIPAPI GdipScaleMatrix(GpMatrix *matrix, REAL scaleX, REAL scaleY, GpMatrixOrder order)
Definition: matrix.c:288

Referenced by test_transform().

◆ GdipScalePathGradientTransform()

GpStatus WINGDIPAPI GdipScalePathGradientTransform ( GpPathGradient grad,
REAL  sx,
REAL  sy,
GpMatrixOrder  order 
)

Definition at line 1929 of file brush.c.

1931{
1932 TRACE("(%p,%0.2f,%0.2f,%i)\n", grad, sx, sy, order);
1933
1934 if (!grad || grad->brush.bt != BrushTypePathGradient)
1935 return InvalidParameter;
1936
1937 return GdipScaleMatrix(&grad->transform, sx, sy, order);
1938}

◆ GdipScaleTextureTransform()

GpStatus WINGDIPAPI GdipScaleTextureTransform ( GpTexture brush,
REAL  sx,
REAL  sy,
GpMatrixOrder  order 
)

Definition at line 1384 of file brush.c.

1386{
1387 TRACE("(%p, %.2f, %.2f, %d)\n", brush, sx, sy, order);
1388
1389 if(!brush)
1390 return InvalidParameter;
1391
1392 return GdipScaleMatrix(&brush->transform, sx, sy, order);
1393}

◆ GdipSetLineBlend()

GpStatus WINGDIPAPI GdipSetLineBlend ( GpLineGradient brush,
GDIPCONST REAL factors,
GDIPCONST REAL positions,
INT  count 
)

Definition at line 1395 of file brush.c.

1397{
1398 REAL *new_blendfac, *new_blendpos;
1399
1400 TRACE("(%p, %p, %p, %i)\n", brush, factors, positions, count);
1401
1402 if(!brush || !factors || !positions || count <= 0 || brush->brush.bt != BrushTypeLinearGradient ||
1403 (count >= 2 && (positions[0] != 0.0f || positions[count-1] != 1.0f)))
1404 return InvalidParameter;
1405
1406 new_blendfac = malloc(count * sizeof(REAL));
1407 new_blendpos = malloc(count * sizeof(REAL));
1408
1409 if (!new_blendfac || !new_blendpos)
1410 {
1411 free(new_blendfac);
1412 free(new_blendpos);
1413 return OutOfMemory;
1414 }
1415
1416 memcpy(new_blendfac, factors, count * sizeof(REAL));
1417 memcpy(new_blendpos, positions, count * sizeof(REAL));
1418
1419 free(brush->blendfac);
1420 free(brush->blendpos);
1421
1422 brush->blendcount = count;
1423 brush->blendfac = new_blendfac;
1424 brush->blendpos = new_blendpos;
1425
1426 return Ok;
1427}

Referenced by GdipSetLineLinearBlend(), GdipSetLineSigmaBlend(), metafile_deserialize_brush(), test_lineargradient(), and test_lineblend().

◆ GdipSetLineColors()

GpStatus WINGDIPAPI GdipSetLineColors ( GpLineGradient brush,
ARGB  color1,
ARGB  color2 
)

Definition at line 1995 of file brush.c.

1997{
1998 TRACE("(%p, %lx, %lx)\n", brush, color1, color2);
1999
2000 if(!brush || brush->brush.bt != BrushTypeLinearGradient)
2001 return InvalidParameter;
2002
2003 brush->startcolor = color1;
2004 brush->endcolor = color2;
2005
2006 return Ok;
2007}

◆ GdipSetLineGammaCorrection()

GpStatus WINGDIPAPI GdipSetLineGammaCorrection ( GpLineGradient line,
BOOL  usegamma 
)

Definition at line 1458 of file brush.c.

1460{
1461 TRACE("(%p, %d)\n", line, usegamma);
1462
1463 if(!line || line->brush.bt != BrushTypeLinearGradient)
1464 return InvalidParameter;
1465
1466 line->gamma = usegamma;
1467
1468 return Ok;
1469}

◆ GdipSetLineLinearBlend()

GpStatus WINGDIPAPI GdipSetLineLinearBlend ( GpLineGradient brush,
REAL  focus,
REAL  scale 
)

Definition at line 2036 of file brush.c.

2038{
2039 REAL factors[3];
2040 REAL positions[3];
2041 int num_points = 0;
2042
2043 TRACE("(%p,%.2f,%.2f)\n", brush, focus, scale);
2044
2045 if (!brush) return InvalidParameter;
2046
2047 if (focus != 0.0)
2048 {
2049 factors[num_points] = 0.0;
2050 positions[num_points] = 0.0;
2051 num_points++;
2052 }
2053
2054 factors[num_points] = scale;
2055 positions[num_points] = focus;
2056 num_points++;
2057
2058 if (focus != 1.0)
2059 {
2060 factors[num_points] = 0.0;
2061 positions[num_points] = 1.0;
2062 num_points++;
2063 }
2064
2065 return GdipSetLineBlend(brush, factors, positions, num_points);
2066}
GpStatus WINGDIPAPI GdipSetLineBlend(GpLineGradient *brush, GDIPCONST REAL *factors, GDIPCONST REAL *positions, INT count)
Definition: brush.c:1395
GLenum GLenum GLenum GLenum GLenum scale
Definition: glext.h:9032

Referenced by test_linelinearblend().

◆ GdipSetLinePresetBlend()

GpStatus WINGDIPAPI GdipSetLinePresetBlend ( GpLineGradient brush,
GDIPCONST ARGB blend,
GDIPCONST REAL positions,
INT  count 
)

Definition at line 2068 of file brush.c.

2070{
2071 ARGB *new_color;
2072 REAL *new_pos;
2073 TRACE("(%p,%p,%p,%i)\n", brush, blend, positions, count);
2074
2075 if (!brush || !blend || !positions || count < 2 || brush->brush.bt != BrushTypeLinearGradient ||
2076 positions[0] != 0.0f || positions[count-1] != 1.0f)
2077 {
2078 return InvalidParameter;
2079 }
2080
2081 new_color = malloc(count * sizeof(ARGB));
2082 new_pos = malloc(count * sizeof(REAL));
2083 if (!new_color || !new_pos)
2084 {
2085 free(new_color);
2086 free(new_pos);
2087 return OutOfMemory;
2088 }
2089
2090 memcpy(new_color, blend, sizeof(ARGB) * count);
2091 memcpy(new_pos, positions, sizeof(REAL) * count);
2092
2093 free(brush->pblendcolor);
2094 free(brush->pblendpos);
2095
2096 brush->pblendcolor = new_color;
2097 brush->pblendpos = new_pos;
2098 brush->pblendcount = count;
2099
2100 return Ok;
2101}

Referenced by metafile_deserialize_brush(), test_lineargradient(), and test_lineblend().

◆ GdipSetLineSigmaBlend()

GpStatus WINGDIPAPI GdipSetLineSigmaBlend ( GpLineGradient line,
REAL  focus,
REAL  scale 
)

Definition at line 1471 of file brush.c.

1473{
1474 REAL factors[33];
1475 REAL positions[33];
1476 int num_points = 0;
1477 int i;
1478 const int precision = 16;
1479 REAL erf_range; /* we use values erf(-erf_range) through erf(+erf_range) */
1480 REAL min_erf;
1481 REAL scale_erf;
1482
1483 TRACE("(%p, %0.2f, %0.2f)\n", line, focus, scale);
1484
1485 if(!line || focus < 0.0 || focus > 1.0 || scale < 0.0 || scale > 1.0 || line->brush.bt != BrushTypeLinearGradient)
1486 return InvalidParameter;
1487
1488 /* we want 2 standard deviations */
1489 erf_range = 2.0 / sqrt(2);
1490
1491 /* calculate the constants we need to normalize the error function to be
1492 between 0.0 and scale over the range we need */
1493 min_erf = erf(-erf_range);
1494 scale_erf = scale / (-2.0 * min_erf);
1495
1496 if (focus != 0.0)
1497 {
1498 positions[0] = 0.0;
1499 factors[0] = 0.0;
1500 for (i=1; i<precision; i++)
1501 {
1502 positions[i] = focus * i / precision;
1503 factors[i] = scale_erf * (erf(2 * erf_range * i / precision - erf_range) - min_erf);
1504 }
1505 num_points += precision;
1506 }
1507
1508 positions[num_points] = focus;
1509 factors[num_points] = scale;
1510 num_points += 1;
1511
1512 if (focus != 1.0)
1513 {
1514 for (i=1; i<precision; i++)
1515 {
1516 positions[i+num_points-1] = (focus + ((1.0-focus) * i / precision));
1517 factors[i+num_points-1] = scale_erf * (erf(erf_range - 2 * erf_range * i / precision) - min_erf);
1518 }
1519 num_points += precision;
1520 positions[num_points-1] = 1.0;
1521 factors[num_points-1] = 0.0;
1522 }
1523
1524 return GdipSetLineBlend(line, factors, positions, num_points);
1525}
_ACRTIMP double __cdecl sqrt(double)
Definition: sqrt.c:5
_ACRTIMP double __cdecl erf(double)
GLenum GLint GLint * precision
Definition: glext.h:7539

◆ GdipSetLineTransform()

GpStatus WINGDIPAPI GdipSetLineTransform ( GpLineGradient brush,
GDIPCONST GpMatrix matrix 
)

Definition at line 2142 of file brush.c.

2144{
2145 TRACE("(%p,%s)\n", brush, debugstr_matrix(matrix));
2146
2147 if(!brush || !matrix)
2148 return InvalidParameter;
2149
2150 brush->transform = *matrix;
2151
2152 return Ok;
2153}

Referenced by metafile_deserialize_brush(), and test_transform().

◆ GdipSetLineWrapMode()

GpStatus WINGDIPAPI GdipSetLineWrapMode ( GpLineGradient line,
GpWrapMode  wrap 
)

Definition at line 1527 of file brush.c.

1529{
1530 TRACE("(%p, %d)\n", line, wrap);
1531
1532 if(!line || wrap == WrapModeClamp || line->brush.bt != BrushTypeLinearGradient)
1533 return InvalidParameter;
1534
1535 line->wrap = wrap;
1536
1537 return Ok;
1538}

◆ GdipSetPathGradientBlend()

GpStatus WINGDIPAPI GdipSetPathGradientBlend ( GpPathGradient brush,
GDIPCONST REAL blend,
GDIPCONST REAL pos,
INT  count 
)

Definition at line 1540 of file brush.c.

1542{
1543 REAL *new_blendfac, *new_blendpos;
1544
1545 TRACE("(%p,%p,%p,%i)\n", brush, blend, pos, count);
1546
1547 if(!brush || !blend || !pos || count <= 0 || brush->brush.bt != BrushTypePathGradient ||
1548 (count >= 2 && (pos[0] != 0.0f || pos[count-1] != 1.0f)))
1549 return InvalidParameter;
1550
1551 new_blendfac = malloc(count * sizeof(REAL));
1552 new_blendpos = malloc(count * sizeof(REAL));
1553
1554 if (!new_blendfac || !new_blendpos)
1555 {
1556 free(new_blendfac);
1557 free(new_blendpos);
1558 return OutOfMemory;
1559 }
1560
1561 memcpy(new_blendfac, blend, count * sizeof(REAL));
1562 memcpy(new_blendpos, pos, count * sizeof(REAL));
1563
1564 free(brush->blendfac);
1565 free(brush->blendpos);
1566
1567 brush->blendcount = count;
1568 brush->blendfac = new_blendfac;
1569 brush->blendpos = new_blendpos;
1570
1571 return Ok;
1572}

Referenced by GdipSetPathGradientLinearBlend(), GdipSetPathGradientSigmaBlend(), and test_pathgradientblend().

◆ GdipSetPathGradientCenterColor()

GpStatus WINGDIPAPI GdipSetPathGradientCenterColor ( GpPathGradient grad,
ARGB  argb 
)

Definition at line 1682 of file brush.c.

1684{
1685 TRACE("(%p, %lx)\n", grad, argb);
1686
1687 if(!grad || grad->brush.bt != BrushTypePathGradient)
1688 return InvalidParameter;
1689
1690 grad->centercolor = argb;
1691 return Ok;
1692}

◆ GdipSetPathGradientCenterPoint()

GpStatus WINGDIPAPI GdipSetPathGradientCenterPoint ( GpPathGradient grad,
GpPointF point 
)

Definition at line 1694 of file brush.c.

1696{
1697 TRACE("(%p, %s)\n", grad, debugstr_pointf(point));
1698
1699 if(!grad || !point || grad->brush.bt != BrushTypePathGradient)
1700 return InvalidParameter;
1701
1702 grad->center.X = point->X;
1703 grad->center.Y = point->Y;
1704
1705 return Ok;
1706}

Referenced by GdipSetPathGradientCenterPointI(), and test_pathgradientcenterpoint().

◆ GdipSetPathGradientCenterPointI()

GpStatus WINGDIPAPI GdipSetPathGradientCenterPointI ( GpPathGradient grad,
GpPoint point 
)

Definition at line 1708 of file brush.c.

1710{
1711 GpPointF ptf;
1712
1713 TRACE("(%p, %p)\n", grad, point);
1714
1715 if(!point)
1716 return InvalidParameter;
1717
1718 ptf.X = (REAL)point->X;
1719 ptf.Y = (REAL)point->Y;
1720
1721 return GdipSetPathGradientCenterPoint(grad,&ptf);
1722}
GpStatus WINGDIPAPI GdipSetPathGradientCenterPoint(GpPathGradient *grad, GpPointF *point)
Definition: brush.c:1694

◆ GdipSetPathGradientFocusScales()

GpStatus WINGDIPAPI GdipSetPathGradientFocusScales ( GpPathGradient grad,
REAL  x,
REAL  y 
)

Definition at line 1724 of file brush.c.

1726{
1727 TRACE("(%p, %.2f, %.2f)\n", grad, x, y);
1728
1729 if(!grad || grad->brush.bt != BrushTypePathGradient)
1730 return InvalidParameter;
1731
1732 grad->focus.X = x;
1733 grad->focus.Y = y;
1734
1735 return Ok;
1736}

◆ GdipSetPathGradientGammaCorrection()

GpStatus WINGDIPAPI GdipSetPathGradientGammaCorrection ( GpPathGradient grad,
BOOL  gamma 
)

Definition at line 1738 of file brush.c.

1740{
1741 TRACE("(%p, %d)\n", grad, gamma);
1742
1743 if(!grad || grad->brush.bt != BrushTypePathGradient)
1744 return InvalidParameter;
1745
1746 grad->gamma = gamma;
1747
1748 return Ok;
1749}

◆ GdipSetPathGradientLinearBlend()

GpStatus WINGDIPAPI GdipSetPathGradientLinearBlend ( GpPathGradient brush,
REAL  focus,
REAL  scale 
)

Definition at line 1574 of file brush.c.

1576{
1577 REAL factors[3];
1578 REAL positions[3];
1579 int num_points = 0;
1580
1581 TRACE("(%p,%0.2f,%0.2f)\n", brush, focus, scale);
1582
1583 if (!brush || brush->brush.bt != BrushTypePathGradient)
1584 return InvalidParameter;
1585
1586 if (focus != 0.0)
1587 {
1588 factors[num_points] = 0.0;
1589 positions[num_points] = 0.0;
1590 num_points++;
1591 }
1592
1593 factors[num_points] = scale;
1594 positions[num_points] = focus;
1595 num_points++;
1596
1597 if (focus != 1.0)
1598 {
1599 factors[num_points] = 0.0;
1600 positions[num_points] = 1.0;
1601 num_points++;
1602 }
1603
1604 return GdipSetPathGradientBlend(brush, factors, positions, num_points);
1605}
GpStatus WINGDIPAPI GdipSetPathGradientBlend(GpPathGradient *brush, GDIPCONST REAL *blend, GDIPCONST REAL *pos, INT count)
Definition: brush.c:1540

◆ GdipSetPathGradientPath()

GpStatus WINGDIPAPI GdipSetPathGradientPath ( GpPathGradient grad,
GDIPCONST GpPath path 
)

Definition at line 1751 of file brush.c.

1752{
1753 static int calls;
1754
1755 TRACE("(%p, %p)\n", grad, path);
1756
1757 if (!(calls++))
1758 FIXME("not implemented\n");
1759
1760 return NotImplemented;
1761}

◆ GdipSetPathGradientPresetBlend()

GpStatus WINGDIPAPI GdipSetPathGradientPresetBlend ( GpPathGradient brush,
GDIPCONST ARGB blend,
GDIPCONST REAL pos,
INT  count 
)

Definition at line 1607 of file brush.c.

1609{
1610 ARGB *new_color;
1611 REAL *new_pos;
1612 TRACE("(%p,%p,%p,%i)\n", brush, blend, pos, count);
1613
1614 if (!brush || !blend || !pos || count < 2 || brush->brush.bt != BrushTypePathGradient ||
1615 pos[0] != 0.0f || pos[count-1] != 1.0f)
1616 {
1617 return InvalidParameter;
1618 }
1619
1620 new_color = malloc(count * sizeof(ARGB));
1621 new_pos = malloc(count * sizeof(REAL));
1622 if (!new_color || !new_pos)
1623 {
1624 free(new_color);
1625 free(new_pos);
1626 return OutOfMemory;
1627 }
1628
1629 memcpy(new_color, blend, sizeof(ARGB) * count);
1630 memcpy(new_pos, pos, sizeof(REAL) * count);
1631
1632 free(brush->pblendcolor);
1633 free(brush->pblendpos);
1634
1635 brush->pblendcolor = new_color;
1636 brush->pblendpos = new_pos;
1637 brush->pblendcount = count;
1638
1639 return Ok;
1640}

Referenced by test_pathgradientpresetblend().

◆ GdipSetPathGradientSigmaBlend()

GpStatus WINGDIPAPI GdipSetPathGradientSigmaBlend ( GpPathGradient grad,
REAL  focus,
REAL  scale 
)

Definition at line 1763 of file brush.c.

1765{
1766 REAL factors[33];
1767 REAL positions[33];
1768 int num_points = 0;
1769 int i;
1770 const int precision = 16;
1771 REAL erf_range; /* we use values erf(-erf_range) through erf(+erf_range) */
1772 REAL min_erf;
1773 REAL scale_erf;
1774
1775 TRACE("(%p,%0.2f,%0.2f)\n", grad, focus, scale);
1776
1777 if(!grad || focus < 0.0 || focus > 1.0 || scale < 0.0 || scale > 1.0 || grad->brush.bt != BrushTypePathGradient)
1778 return InvalidParameter;
1779
1780 /* we want 2 standard deviations */
1781 erf_range = 2.0 / sqrt(2);
1782
1783 /* calculate the constants we need to normalize the error function to be
1784 between 0.0 and scale over the range we need */
1785 min_erf = erf(-erf_range);
1786 scale_erf = scale / (-2.0 * min_erf);
1787
1788 if (focus != 0.0)
1789 {
1790 positions[0] = 0.0;
1791 factors[0] = 0.0;
1792 for (i=1; i<precision; i++)
1793 {
1794 positions[i] = focus * i / precision;
1795 factors[i] = scale_erf * (erf(2 * erf_range * i / precision - erf_range) - min_erf);
1796 }
1797 num_points += precision;
1798 }
1799
1800 positions[num_points] = focus;
1801 factors[num_points] = scale;
1802 num_points += 1;
1803
1804 if (focus != 1.0)
1805 {
1806 for (i=1; i<precision; i++)
1807 {
1808 positions[i+num_points-1] = (focus + ((1.0-focus) * i / precision));
1809 factors[i+num_points-1] = scale_erf * (erf(erf_range - 2 * erf_range * i / precision) - min_erf);
1810 }
1811 num_points += precision;
1812 positions[num_points-1] = 1.0;
1813 factors[num_points-1] = 0.0;
1814 }
1815
1816 return GdipSetPathGradientBlend(grad, factors, positions, num_points);
1817}

◆ GdipSetPathGradientSurroundColorsWithCount()

GpStatus WINGDIPAPI GdipSetPathGradientSurroundColorsWithCount ( GpPathGradient grad,
GDIPCONST ARGB argb,
INT count 
)

Definition at line 1819 of file brush.c.

1821{
1822 ARGB *new_surroundcolors;
1823 INT i, num_colors;
1824
1825 TRACE("(%p,%p,%p)\n", grad, argb, count);
1826
1827 if(!grad || !argb || !count || (*count <= 0) || grad->brush.bt != BrushTypePathGradient ||
1828 (*count > grad->path->pathdata.Count))
1829 return InvalidParameter;
1830
1831 num_colors = *count;
1832
1833 /* If all colors are the same, only store 1 color. */
1834 if (*count > 1)
1835 {
1836 for (i=1; i < num_colors; i++)
1837 if (argb[i] != argb[i-1])
1838 break;
1839
1840 if (i == num_colors)
1841 num_colors = 1;
1842 }
1843
1844 new_surroundcolors = malloc(num_colors * sizeof(ARGB));
1845 if (!new_surroundcolors)
1846 return OutOfMemory;
1847
1848 memcpy(new_surroundcolors, argb, num_colors * sizeof(ARGB));
1849
1850 free(grad->surroundcolors);
1851
1852 grad->surroundcolors = new_surroundcolors;
1853 grad->surroundcolorcount = num_colors;
1854
1855 return Ok;
1856}

Referenced by test_gradientsurroundcolorcount().

◆ GdipSetPathGradientTransform()

GpStatus WINGDIPAPI GdipSetPathGradientTransform ( GpPathGradient grad,
GpMatrix matrix 
)

Definition at line 1871 of file brush.c.

1873{
1874 TRACE("(%p,%s)\n", grad, debugstr_matrix(matrix));
1875
1876 if (!grad || !matrix || grad->brush.bt != BrushTypePathGradient)
1877 return InvalidParameter;
1878
1879 grad->transform = *matrix;
1880
1881 return Ok;
1882}

◆ GdipSetPathGradientWrapMode()

GpStatus WINGDIPAPI GdipSetPathGradientWrapMode ( GpPathGradient grad,
GpWrapMode  wrap 
)

Definition at line 1858 of file brush.c.

1860{
1861 TRACE("(%p, %d)\n", grad, wrap);
1862
1863 if(!grad || grad->brush.bt != BrushTypePathGradient)
1864 return InvalidParameter;
1865
1866 grad->wrap = wrap;
1867
1868 return Ok;
1869}

◆ GdipSetSolidFillColor()

GpStatus WINGDIPAPI GdipSetSolidFillColor ( GpSolidFill sf,
ARGB  argb 
)

Definition at line 1951 of file brush.c.

1952{
1953 TRACE("(%p, %lx)\n", sf, argb);
1954
1955 if(!sf)
1956 return InvalidParameter;
1957
1958 sf->color = argb;
1959 return Ok;
1960}

Referenced by GdipSetPenColor(), and test_brushfill().

◆ GdipSetTextureTransform()

GpStatus WINGDIPAPI GdipSetTextureTransform ( GpTexture texture,
GDIPCONST GpMatrix matrix 
)

Definition at line 1965 of file brush.c.

1967{
1968 TRACE("(%p, %s)\n", texture, debugstr_matrix(matrix));
1969
1970 if(!texture || !matrix)
1971 return InvalidParameter;
1972
1973 texture->transform = *matrix;
1974
1975 return Ok;
1976}

Referenced by metafile_deserialize_brush(), and test_transform().

◆ GdipSetTextureWrapMode()

GpStatus WINGDIPAPI GdipSetTextureWrapMode ( GpTexture brush,
GpWrapMode  wrapmode 
)

Definition at line 1983 of file brush.c.

1984{
1985 TRACE("(%p, %d)\n", brush, wrapmode);
1986
1987 if(!brush)
1988 return InvalidParameter;
1989
1990 brush->imageattributes->wrap = wrapmode;
1991
1992 return Ok;
1993}

Referenced by test_texturewrap().

◆ GdipTranslateLineTransform()

GpStatus WINGDIPAPI GdipTranslateLineTransform ( GpLineGradient brush,
REAL  dx,
REAL  dy,
GpMatrixOrder  order 
)

Definition at line 2192 of file brush.c.

2194{
2195 TRACE("(%p,%f,%f,%d)\n", brush, dx, dy, order);
2196
2197 if(!brush)
2198 return InvalidParameter;
2199
2200 return GdipTranslateMatrix(&brush->transform, dx, dy, order);
2201}
GpStatus WINGDIPAPI GdipTranslateMatrix(GpMatrix *matrix, REAL offsetX, REAL offsetY, GpMatrixOrder order)
Definition: matrix.c:420
GLint dy
Definition: linetemp.h:97
GLint dx
Definition: linetemp.h:97

Referenced by test_transform().

◆ GdipTranslatePathGradientTransform()

GpStatus WINGDIPAPI GdipTranslatePathGradientTransform ( GpPathGradient grad,
REAL  dx,
REAL  dy,
GpMatrixOrder  order 
)

Definition at line 1940 of file brush.c.

1942{
1943 TRACE("(%p,%0.2f,%0.2f,%i)\n", grad, dx, dy, order);
1944
1945 if (!grad || grad->brush.bt != BrushTypePathGradient)
1946 return InvalidParameter;
1947
1948 return GdipTranslateMatrix(&grad->transform, dx, dy, order);
1949}

◆ GdipTranslateTextureTransform()

GpStatus WINGDIPAPI GdipTranslateTextureTransform ( GpTexture brush,
REAL  dx,
REAL  dy,
GpMatrixOrder  order 
)

Definition at line 2206 of file brush.c.

2208{
2209 TRACE("(%p, %.2f, %.2f, %d)\n", brush, dx, dy, order);
2210
2211 if(!brush)
2212 return InvalidParameter;
2213
2214 return GdipTranslateMatrix(&brush->transform, dx, dy, order);
2215}

◆ get_hatch_data()

GpStatus get_hatch_data ( GpHatchStyle  hatchstyle,
const unsigned char **  result 
)

Definition at line 288 of file brush.c.

289{
290 if (hatchstyle < ARRAY_SIZE(HatchBrushes))
291 {
292 *result = HatchBrushes[hatchstyle];
293 return Ok;
294 }
295 else
296 return NotImplemented;
297}
#define ARRAY_SIZE(A)
Definition: main.h:20
static const unsigned char HatchBrushes[][9]
Definition: brush.c:232
GLuint64EXT * result
Definition: glext.h:11304

Referenced by brush_fill_pixels(), and create_hatch_bitmap().

◆ linegradient_init_transform()

static void linegradient_init_transform ( const GpPointF startpoint,
const GpPointF endpoint,
GpLineGradient line 
)
static

Definition at line 360 of file brush.c.

361{
362 float trans_x = line->rect.X + (line->rect.Width / 2.f);
363 float trans_y = line->rect.Y + (line->rect.Height / 2.f);
364 float dx = endpoint->X - startpoint->X;
365 float dy = endpoint->Y - startpoint->Y;
366 float t_cos, t_sin, w_ratio, h_ratio;
367 float h;
369
370 h = sqrtf(dx * dx + dy * dy);
371
372 t_cos = dx / h;
373 t_sin = dy / h;
374
375 w_ratio = (fabs(t_cos) * line->rect.Width + fabs(t_sin) * line->rect.Height) / line->rect.Width;
376 h_ratio = (fabs(t_sin) * line->rect.Width + fabs(t_cos) * line->rect.Height) / line->rect.Height;
377
378 GdipSetMatrixElements(&line->transform, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0);
379
380 GdipSetMatrixElements(&rot, t_cos, t_sin, -1.f * t_sin, t_cos, 0, 0);
381
382 /* center about the origin */
383 GdipTranslateMatrix(&line->transform, -trans_x, -trans_y, MatrixOrderAppend);
384
385 /* scale to normalize gradient along gradient line (?) */
386 GdipScaleMatrix(&line->transform, w_ratio, h_ratio, MatrixOrderAppend);
387
388 /* rotate so the gradient is horizontal */
390
391 /* restore original offset in new coords */
392 GdipTranslateMatrix(&line->transform, trans_x, trans_y, MatrixOrderAppend);
393}
GLfloat rot
Definition: 3dtext.c:36
@ MatrixOrderAppend
Definition: gdiplusenums.h:188
GLfloat GLfloat GLfloat GLfloat h
Definition: glext.h:7723
#define sqrtf(x)
Definition: mymath.h:59

Referenced by GdipCreateLineBrush(), and GdipCreateLineBrushFromRectWithAngle().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( gdiplus  )

Variable Documentation

◆ HatchBrushes

const unsigned char HatchBrushes[][9]
static

Definition at line 232 of file brush.c.

Referenced by get_hatch_data().