ReactOS 0.4.17-dev-218-g5635d24
brush.c
Go to the documentation of this file.
1/*
2 * Copyright (C) 2007 Google (Evan Stade)
3 * Copyright (C) 2003-2004,2007 Novell, Inc. http://www.novell.com (Ravindra (rkumar@novell.com))
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
18 */
19
20#include <stdarg.h>
21
22#include "windef.h"
23#include "winbase.h"
24#include "winuser.h"
25#include "wingdi.h"
26
27#define COBJMACROS
28#include "objbase.h"
29#include "olectl.h"
30#include "ole2.h"
31
32#include "gdiplus.h"
33#include "gdiplus_private.h"
34#include "wine/debug.h"
35
37
38#ifdef __REACTOS__
39/*
40 Unix stuff
41 Code from http://www.johndcook.com/blog/2009/01/19/stand-alone-error-function-erf/
42*/
43double erf(double x)
44{
45 const float a1 = 0.254829592f;
46 const float a2 = -0.284496736f;
47 const float a3 = 1.421413741f;
48 const float a4 = -1.453152027f;
49 const float a5 = 1.061405429f;
50 const float p = 0.3275911f;
51 float t, y, sign;
52
53 /* Save the sign of x */
54 sign = 1;
55 if (x < 0)
56 sign = -1;
57 x = abs(x);
58
59 /* A & S 7.1.26 */
60 t = 1.0/(1.0 + p*x);
61 y = 1.0 - (((((a5*t + a4)*t) + a3)*t + a2)*t + a1)*t*exp(-x*x);
62
63 return sign*y;
64}
65#endif
66
67/******************************************************************************
68 * GdipCloneBrush [GDIPLUS.@]
69 */
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}
229
230/* The first 8 items per entry are bitmaps for each row of the hatch style.
231 * The 9th item of the entry is a flag indicating anti-aliasing. */
232static const unsigned char HatchBrushes[][9] = {
233 { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff }, /* HatchStyleHorizontal */
234 { 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80 }, /* HatchStyleVertical */
235 { 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, TRUE }, /* HatchStyleForwardDiagonal */
236 { 0x80, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x01, TRUE }, /* HatchStyleBackwardDiagonal */
237 { 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0xff }, /* HatchStyleCross */
238 { 0x81, 0x42, 0x24, 0x18, 0x18, 0x24, 0x42, 0x81, TRUE }, /* HatchStyleDiagonalCross */
239 { 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x80 }, /* HatchStyle05Percent */
240 { 0x00, 0x08, 0x00, 0x80, 0x00, 0x08, 0x00, 0x80 }, /* HatchStyle10Percent */
241 { 0x00, 0x22, 0x00, 0x88, 0x00, 0x22, 0x00, 0x88 }, /* HatchStyle20Percent */
242 { 0x22, 0x88, 0x22, 0x88, 0x22, 0x88, 0x22, 0x88 }, /* HatchStyle25Percent */
243 { 0x11, 0xaa, 0x44, 0xaa, 0x11, 0xaa, 0x44, 0xaa }, /* HatchStyle30Percent */
244 { 0x15, 0xaa, 0x55, 0xaa, 0x51, 0xaa, 0x55, 0xaa }, /* HatchStyle40Percent */
245 { 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa }, /* HatchStyle50Percent */
246 { 0x55, 0xbb, 0x55, 0xee, 0x55, 0xbb, 0x55, 0xee }, /* HatchStyle60Percent */
247 { 0xdd, 0x77, 0xdd, 0x77, 0xdd, 0x77, 0xdd, 0x77 }, /* HatchStyle70Percent */
248 { 0xff, 0xdd, 0xff, 0x77, 0xff, 0xdd, 0xff, 0x77 }, /* HatchStyle75Percent */
249 { 0xff, 0xfe, 0xff, 0xef, 0xff, 0xfe, 0xff, 0xef }, /* HatchStyle80Percent */
250 { 0x7f, 0xff, 0xff, 0xff, 0xf7, 0xff, 0xff, 0xff }, /* HatchStyle90Percent */
251 { 0x11, 0x22, 0x44, 0x88, 0x11, 0x22, 0x44, 0x88 }, /* HatchStyleLightDownwardDiagonal */
252 { 0x88, 0x44, 0x22, 0x11, 0x88, 0x44, 0x22, 0x11 }, /* HatchStyleLightUpwardDiagonal */
253 { 0x99, 0x33, 0x66, 0xcc, 0x99, 0x33, 0x66, 0xcc }, /* HatchStyleDarkDownwardDiagonal */
254 { 0x99, 0xcc, 0x66, 0x33, 0x99, 0xcc, 0x66, 0x33 }, /* HatchStyleDarkUpwardDiagonal */
255 { 0x83, 0x07, 0x0e, 0x1c, 0x38, 0x70, 0xe0, 0xc1 }, /* HatchStyleWideDownwardDiagonal */
256 { 0xc1, 0xe0, 0x70, 0x38, 0x1c, 0x0e, 0x07, 0x83 }, /* HatchStyleWideUpwardDiagonal */
257 { 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88 }, /* HatchStyleLightVertical */
258 { 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff }, /* HatchStyleLightHorizontal */
259 { 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55 }, /* HatchStyleNarrowVertical */
260 { 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff }, /* HatchStyleNarrowHorizontal */
261 { 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc }, /* HatchStyleDarkVertical */
262 { 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0xff, 0xff }, /* HatchStyleDarkHorizontal */
263 { 0x00, 0x00, 0x11, 0x22, 0x44, 0x88, 0x00, 0x00 }, /* HatchStyleDashedDownwardDiagonal */
264 { 0x00, 0x00, 0x88, 0x44, 0x22, 0x11, 0x00, 0x00 }, /* HatchStyleDashedUpwardDiagonal */
265 { 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0xf0 }, /* HatchStyleDashedHorizontal */
266 { 0x08, 0x08, 0x08, 0x08, 0x80, 0x80, 0x80, 0x80 }, /* HatchStyleDashedVertical */
267 { 0x04, 0x20, 0x01, 0x10, 0x02, 0x40, 0x08, 0x80 }, /* HatchStyleSmallConfetti */
268 { 0x8d, 0x0c, 0xc0, 0xd8, 0x1b, 0x03, 0x30, 0xb1 }, /* HatchStyleLargeConfetti */
269 { 0x18, 0x24, 0x42, 0x81, 0x18, 0x24, 0x42, 0x81 }, /* HatchStyleZigZag */
270 { 0xc0, 0x25, 0x18, 0x00, 0xc0, 0x25, 0x18, 0x00 }, /* HatchStyleWave */
271 { 0x81, 0x42, 0x24, 0x18, 0x08, 0x04, 0x02, 0x01 }, /* HatchStyleDiagonalBrick */
272 { 0x08, 0x08, 0x08, 0xff, 0x80, 0x80, 0x80, 0xff }, /* HatchStyleHorizontalBrick */
273 { 0x51, 0x22, 0x14, 0x88, 0x45, 0x22, 0x54, 0x88 }, /* HatchStyleWeave */
274 { 0xf0, 0xf0, 0xf0, 0xf0, 0x55, 0xaa, 0x55, 0xaa }, /* HatchStylePlaid */
275 { 0x80, 0x01, 0x80, 0x00, 0x10, 0x08, 0x10, 0x00 }, /* HatchStyleDivot */
276 { 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0xaa }, /* HatchStyleDottedGrid */
277 { 0x00, 0x22, 0x00, 0x08, 0x00, 0x22, 0x00, 0x80 }, /* HatchStyleDottedDiamond */
278 { 0x01, 0x01, 0x02, 0x0c, 0x30, 0x48, 0x84, 0x03 }, /* HatchStyleShingle */
279 { 0x99, 0xff, 0x66, 0xff, 0x99, 0xff, 0x66, 0xff }, /* HatchStyleTrellis */
280 { 0xf8, 0xf8, 0x98, 0x77, 0x8f, 0x8f, 0x89, 0x77 }, /* HatchStyleSphere */
281 { 0x88, 0x88, 0x88, 0xff, 0x88, 0x88, 0x88, 0xff }, /* HatchStyleSmallGrid */
282 { 0x99, 0x66, 0x66, 0x99, 0x99, 0x66, 0x66, 0x99 }, /* HatchStyleSmallCheckerBoard */
283 { 0x0f, 0x0f, 0x0f, 0x0f, 0xf0, 0xf0, 0xf0, 0xf0 }, /* HatchStyleLargeCheckerBoard */
284 { 0x01, 0x82, 0x44, 0x28, 0x10, 0x28, 0x44, 0x82 }, /* HatchStyleOutlinedDiamond */
285 { 0x00, 0x10, 0x38, 0x7c, 0xfe, 0x7c, 0x38, 0x10 }, /* HatchStyleSolidDiamond */
286};
287
288GpStatus get_hatch_data(GpHatchStyle hatchstyle, const unsigned char **result)
289{
290 if (hatchstyle < ARRAY_SIZE(HatchBrushes))
291 {
292 *result = HatchBrushes[hatchstyle];
293 return Ok;
294 }
295 else
296 return NotImplemented;
297}
298
299/******************************************************************************
300 * GdipCreateHatchBrush [GDIPLUS.@]
301 */
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}
322
323static GpStatus create_line_brush(const GpRectF *rect, ARGB startcolor, ARGB endcolor,
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}
359
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}
394
395/******************************************************************************
396 * GdipCreateLineBrush [GDIPLUS.@]
397 */
399 GDIPCONST GpPointF* endpoint, ARGB startcolor, ARGB endcolor,
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}
440
442 GDIPCONST GpPoint* endpoint, ARGB startcolor, ARGB endcolor,
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}
461
463 ARGB startcolor, ARGB endcolor, LinearGradientMode mode, GpWrapMode wrap,
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}
494
496 ARGB startcolor, ARGB endcolor, LinearGradientMode mode, GpWrapMode wrap,
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}
507
508/******************************************************************************
509 * GdipCreateLineBrushFromRectWithAngle [GDIPLUS.@]
510 */
512 ARGB startcolor, ARGB endcolor, REAL angle, BOOL isAngleScalable, GpWrapMode wrap,
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}
614
616 ARGB startcolor, ARGB endcolor, REAL angle, BOOL isAngleScalable, GpWrapMode wrap,
618{
619 TRACE("(%p, %lx, %lx, %.2f, %d, %d, %p)\n", rect, startcolor, endcolor, angle, isAngleScalable,
620 wrap, line);
621
623 wrap, line);
624}
625
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}
683
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}
716
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}
749
750/******************************************************************************
751 * GdipCreatePathGradientFromPath [GDIPLUS.@]
752 */
754 GpPathGradient **grad)
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}
779
780/******************************************************************************
781 * GdipCreateSolidFill [GDIPLUS.@]
782 */
784{
785 TRACE("(%lx, %p)\n", color, sf);
786
787 if(!sf) return InvalidParameter;
788
789 *sf = calloc(1, sizeof(GpSolidFill));
790 if (!*sf) return OutOfMemory;
791
792 (*sf)->brush.bt = BrushTypeSolidColor;
793 (*sf)->color = color;
794
795 TRACE("<-- %p\n", *sf);
796
797 return Ok;
798}
799
800/******************************************************************************
801 * GdipCreateTexture [GDIPLUS.@]
802 *
803 * PARAMS
804 * image [I] image to use
805 * wrapmode [I] optional
806 * texture [O] pointer to the resulting texturebrush
807 *
808 * RETURNS
809 * SUCCESS: Ok
810 * FAILURE: element of GpStatus
811 */
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}
843
844/******************************************************************************
845 * GdipCreateTexture2 [GDIPLUS.@]
846 */
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}
870
871/******************************************************************************
872 * GdipCreateTextureIA [GDIPLUS.@]
873 */
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}
941
942/******************************************************************************
943 * GdipCreateTextureIAI [GDIPLUS.@]
944 */
947{
948 TRACE("(%p, %p, %d, %d, %d, %d, %p)\n", image, imageattr, x, y, width, height,
949 texture);
950
952}
953
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}
975
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}
986
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}
997
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}
1008
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}
1019
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}
1055
1057 BOOL *usinggamma)
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}
1068
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}
1080
1082 REAL *positions, INT count)
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}
1099
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}
1111
1113 GpPointF *point)
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}
1125
1127 GpPoint *point)
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}
1146
1148 ARGB *colors)
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}
1159
1161 REAL *x, REAL *y)
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}
1173
1175 BOOL *gamma)
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}
1186
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}
1198
1200 INT *count)
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}
1211
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}
1225
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}
1246
1248 *grad, ARGB *argb, INT *count)
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}
1269
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}
1285
1287 GpWrapMode *wrapmode)
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}
1298
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}
1310
1311/******************************************************************************
1312 * GdipGetTextureImage [GDIPLUS.@]
1313 */
1315{
1316 TRACE("(%p, %p)\n", brush, image);
1317
1318 if(!brush || !image)
1319 return InvalidParameter;
1320
1321 return GdipCloneImage(brush->image, image);
1322}
1323
1324/******************************************************************************
1325 * GdipGetTextureTransform [GDIPLUS.@]
1326 */
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}
1338
1339/******************************************************************************
1340 * GdipGetTextureWrapMode [GDIPLUS.@]
1341 */
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}
1353
1354/******************************************************************************
1355 * GdipMultiplyTextureTransform [GDIPLUS.@]
1356 */
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}
1367
1368/******************************************************************************
1369 * GdipResetTextureTransform [GDIPLUS.@]
1370 */
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}
1380
1381/******************************************************************************
1382 * GdipScaleTextureTransform [GDIPLUS.@]
1383 */
1385 REAL sx, REAL sy, GpMatrixOrder order)
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}
1394
1396 GDIPCONST REAL *factors, GDIPCONST REAL* positions, INT count)
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}
1428
1430 REAL *positions, INT count)
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}
1445
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}
1457
1459 BOOL usegamma)
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}
1470
1472 REAL scale)
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}
1526
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}
1539
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}
1573
1575 REAL focus, REAL scale)
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}
1606
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}
1641
1643 ARGB *blend, REAL *pos, INT count)
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}
1668
1670 INT *count)
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}
1681
1683 ARGB argb)
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}
1693
1695 GpPointF *point)
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}
1707
1709 GpPoint *point)
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}
1723
1725 REAL x, REAL y)
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}
1737
1739 BOOL gamma)
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}
1750
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}
1762
1764 REAL focus, REAL scale)
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}
1818
1820 *grad, GDIPCONST ARGB *argb, INT *count)
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}
1857
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}
1870
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}
1883
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}
1896
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}
1907
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}
1917
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}
1928
1930 REAL sx, REAL sy, GpMatrixOrder order)
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}
1939
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}
1950
1952{
1953 TRACE("(%p, %lx)\n", sf, argb);
1954
1955 if(!sf)
1956 return InvalidParameter;
1957
1958 sf->color = argb;
1959 return Ok;
1960}
1961
1962/******************************************************************************
1963 * GdipSetTextureTransform [GDIPLUS.@]
1964 */
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}
1977
1978/******************************************************************************
1979 * GdipSetTextureWrapMode [GDIPLUS.@]
1980 *
1981 * WrapMode not used, only stored
1982 */
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}
1994
1996 ARGB color2)
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}
2008
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}
2021
2022/******************************************************************************
2023 * GdipRotateTextureTransform [GDIPLUS.@]
2024 */
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}
2035
2037 REAL scale)
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}
2067
2069 GDIPCONST ARGB *blend, GDIPCONST REAL* positions, INT count)
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}
2102
2104 ARGB *blend, REAL* positions, INT count)
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}
2120
2122 INT *count)
2123{
2124 if (!brush || !count || brush->brush.bt != BrushTypeLinearGradient)
2125 return InvalidParameter;
2126
2127 *count = brush->pblendcount;
2128
2129 return Ok;
2130}
2131
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}
2141
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}
2154
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}
2166
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}
2177
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}
2191
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}
2202
2203/******************************************************************************
2204 * GdipTranslateTextureTransform [GDIPLUS.@]
2205 */
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}
2216
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}
2228
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}
2250
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}
GLfloat rot
Definition: 3dtext.c:36
#define stat
Definition: acwin.h:100
#define WINE_DEFAULT_DEBUG_CHANNEL(t)
Definition: precomp.h:23
#define ARRAY_SIZE(A)
Definition: main.h:20
#define FIXME(fmt,...)
Definition: precomp.h:53
#define ERR(fmt,...)
Definition: precomp.h:57
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 TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
float REAL
Definition: types.h:41
GpStatus WINGDIPAPI GdipGetPathGradientCenterColor(GpPathGradient *grad, ARGB *colors)
Definition: brush.c:1147
GpStatus WINGDIPAPI GdipSetPathGradientFocusScales(GpPathGradient *grad, REAL x, REAL y)
Definition: brush.c:1724
GpStatus WINGDIPAPI GdipSetPathGradientCenterColor(GpPathGradient *grad, ARGB argb)
Definition: brush.c:1682
GpStatus WINGDIPAPI GdipScaleLineTransform(GpLineGradient *brush, REAL sx, REAL sy, GpMatrixOrder order)
Definition: brush.c:2167
GpStatus WINGDIPAPI GdipSetPathGradientTransform(GpPathGradient *grad, GpMatrix *matrix)
Definition: brush.c:1871
GpStatus WINGDIPAPI GdipGetTextureTransform(GpTexture *brush, GpMatrix *matrix)
Definition: brush.c:1327
GpStatus WINGDIPAPI GdipCreateLineBrushFromRect(GDIPCONST GpRectF *rect, ARGB startcolor, ARGB endcolor, LinearGradientMode mode, GpWrapMode wrap, GpLineGradient **line)
Definition: brush.c:462
GpStatus WINGDIPAPI GdipCreateLineBrushFromRectWithAngleI(GDIPCONST GpRect *rect, ARGB startcolor, ARGB endcolor, REAL angle, BOOL isAngleScalable, GpWrapMode wrap, GpLineGradient **line)
Definition: brush.c:615
GpStatus WINGDIPAPI GdipCreateLineBrushFromRectWithAngle(GDIPCONST GpRectF *rect, ARGB startcolor, ARGB endcolor, REAL angle, BOOL isAngleScalable, GpWrapMode wrap, GpLineGradient **line)
Definition: brush.c:511
GpStatus WINGDIPAPI GdipSetPathGradientGammaCorrection(GpPathGradient *grad, BOOL gamma)
Definition: brush.c:1738
GpStatus WINGDIPAPI GdipSetLineWrapMode(GpLineGradient *line, GpWrapMode wrap)
Definition: brush.c:1527
GpStatus WINGDIPAPI GdipSetLineSigmaBlend(GpLineGradient *line, REAL focus, REAL scale)
Definition: brush.c:1471
static void linegradient_init_transform(const GpPointF *startpoint, const GpPointF *endpoint, GpLineGradient *line)
Definition: brush.c:360
GpStatus WINGDIPAPI GdipMultiplyLineTransform(GpLineGradient *brush, GDIPCONST GpMatrix *matrix, GpMatrixOrder order)
Definition: brush.c:2178
GpStatus WINGDIPAPI GdipGetLineColors(GpLineGradient *brush, ARGB *colors)
Definition: brush.c:2009
GpStatus WINGDIPAPI GdipSetPathGradientSigmaBlend(GpPathGradient *grad, REAL focus, REAL scale)
Definition: brush.c:1763
GpStatus WINGDIPAPI GdipDeleteBrush(GpBrush *brush)
Definition: brush.c:1020
GpStatus WINGDIPAPI GdipGetLineRectI(GpLineGradient *brush, GpRect *rect)
Definition: brush.c:2229
static GpStatus create_path_gradient(GpPath *path, ARGB centercolor, GpPathGradient **grad)
Definition: brush.c:626
GpStatus WINGDIPAPI GdipCreateLineBrushI(GDIPCONST GpPoint *startpoint, GDIPCONST GpPoint *endpoint, ARGB startcolor, ARGB endcolor, GpWrapMode wrap, GpLineGradient **line)
Definition: brush.c:441
GpStatus WINGDIPAPI GdipScalePathGradientTransform(GpPathGradient *grad, REAL sx, REAL sy, GpMatrixOrder order)
Definition: brush.c:1929
GpStatus WINGDIPAPI GdipGetLinePresetBlendCount(GpLineGradient *brush, INT *count)
Definition: brush.c:2121
GpStatus WINGDIPAPI GdipCreateHatchBrush(GpHatchStyle hatchstyle, ARGB forecol, ARGB backcol, GpHatch **brush)
Definition: brush.c:302
GpStatus WINGDIPAPI GdipSetPathGradientLinearBlend(GpPathGradient *brush, REAL focus, REAL scale)
Definition: brush.c:1574
GpStatus WINGDIPAPI GdipGetLineGammaCorrection(GpLineGradient *line, BOOL *usinggamma)
Definition: brush.c:1056
GpStatus WINGDIPAPI GdipGetTextureWrapMode(GpTexture *brush, GpWrapMode *wrapmode)
Definition: brush.c:1342
GpStatus WINGDIPAPI GdipSetSolidFillColor(GpSolidFill *sf, ARGB argb)
Definition: brush.c:1951
GpStatus WINGDIPAPI GdipGetPathGradientTransform(GpPathGradient *grad, GpMatrix *matrix)
Definition: brush.c:1884
GpStatus WINGDIPAPI GdipMultiplyPathGradientTransform(GpPathGradient *grad, GDIPCONST GpMatrix *matrix, GpMatrixOrder order)
Definition: brush.c:1897
GpStatus WINGDIPAPI GdipCreatePathGradientFromPath(GDIPCONST GpPath *path, GpPathGradient **grad)
Definition: brush.c:753
GpStatus WINGDIPAPI GdipSetTextureTransform(GpTexture *texture, GDIPCONST GpMatrix *matrix)
Definition: brush.c:1965
GpStatus WINGDIPAPI GdipCloneBrush(GpBrush *brush, GpBrush **clone)
Definition: brush.c:70
GpStatus WINGDIPAPI GdipGetPathGradientPresetBlend(GpPathGradient *brush, ARGB *blend, REAL *pos, INT count)
Definition: brush.c:1642
GpStatus WINGDIPAPI GdipGetTextureImage(GpTexture *brush, GpImage **image)
Definition: brush.c:1314
GpStatus WINGDIPAPI GdipGetPathGradientBlendCount(GpPathGradient *brush, INT *count)
Definition: brush.c:1100
GpStatus WINGDIPAPI GdipGetPathGradientSurroundColorsWithCount(GpPathGradient *grad, ARGB *argb, INT *count)
Definition: brush.c:1247
GpStatus WINGDIPAPI GdipMultiplyTextureTransform(GpTexture *brush, GDIPCONST GpMatrix *matrix, GpMatrixOrder order)
Definition: brush.c:1357
GpStatus WINGDIPAPI GdipResetLineTransform(GpLineGradient *brush)
Definition: brush.c:2132
GpStatus WINGDIPAPI GdipGetPathGradientRect(GpPathGradient *brush, GpRectF *rect)
Definition: brush.c:1212
GpStatus WINGDIPAPI GdipSetPathGradientBlend(GpPathGradient *brush, GDIPCONST REAL *blend, GDIPCONST REAL *pos, INT count)
Definition: brush.c:1540
GpStatus WINGDIPAPI GdipGetPathGradientGammaCorrection(GpPathGradient *grad, BOOL *gamma)
Definition: brush.c:1174
GpStatus WINGDIPAPI GdipGetPathGradientCenterPoint(GpPathGradient *grad, GpPointF *point)
Definition: brush.c:1112
GpStatus WINGDIPAPI GdipCreateLineBrushFromRectI(GDIPCONST GpRect *rect, ARGB startcolor, ARGB endcolor, LinearGradientMode mode, GpWrapMode wrap, GpLineGradient **line)
Definition: brush.c:495
GpStatus WINGDIPAPI GdipCreatePathGradient(GDIPCONST GpPointF *points, INT count, GpWrapMode wrap, GpPathGradient **grad)
Definition: brush.c:684
static GpStatus create_line_brush(const GpRectF *rect, ARGB startcolor, ARGB endcolor, GpWrapMode wrap, GpLineGradient **line)
Definition: brush.c:323
GpStatus WINGDIPAPI GdipGetPathGradientFocusScales(GpPathGradient *grad, REAL *x, REAL *y)
Definition: brush.c:1160
GpStatus WINGDIPAPI GdipGetLineTransform(GpLineGradient *brush, GpMatrix *matrix)
Definition: brush.c:2155
GpStatus WINGDIPAPI GdipCreateLineBrush(GDIPCONST GpPointF *startpoint, GDIPCONST GpPointF *endpoint, ARGB startcolor, ARGB endcolor, GpWrapMode wrap, GpLineGradient **line)
Definition: brush.c:398
GpStatus get_hatch_data(GpHatchStyle hatchstyle, const unsigned char **result)
Definition: brush.c:288
GpStatus WINGDIPAPI GdipSetLinePresetBlend(GpLineGradient *brush, GDIPCONST ARGB *blend, GDIPCONST REAL *positions, INT count)
Definition: brush.c:2068
GpStatus WINGDIPAPI GdipSetPathGradientPath(GpPathGradient *grad, GDIPCONST GpPath *path)
Definition: brush.c:1751
GpStatus WINGDIPAPI GdipGetPathGradientRectI(GpPathGradient *brush, GpRect *rect)
Definition: brush.c:1226
static const unsigned char HatchBrushes[][9]
Definition: brush.c:232
GpStatus WINGDIPAPI GdipGetPathGradientBlend(GpPathGradient *brush, REAL *blend, REAL *positions, INT count)
Definition: brush.c:1081
GpStatus WINGDIPAPI GdipSetPathGradientCenterPointI(GpPathGradient *grad, GpPoint *point)
Definition: brush.c:1708
GpStatus WINGDIPAPI GdipSetLineTransform(GpLineGradient *brush, GDIPCONST GpMatrix *matrix)
Definition: brush.c:2142
GpStatus WINGDIPAPI GdipResetPathGradientTransform(GpPathGradient *grad)
Definition: brush.c:1908
GpStatus WINGDIPAPI GdipGetHatchStyle(GpHatch *brush, GpHatchStyle *hatchstyle)
Definition: brush.c:1009
GpStatus WINGDIPAPI GdipGetPathGradientPresetBlendCount(GpPathGradient *brush, INT *count)
Definition: brush.c:1669
GpStatus WINGDIPAPI GdipSetLineBlend(GpLineGradient *brush, GDIPCONST REAL *factors, GDIPCONST REAL *positions, INT count)
Definition: brush.c:1395
GpStatus WINGDIPAPI GdipCreatePathGradientI(GDIPCONST GpPoint *points, INT count, GpWrapMode wrap, GpPathGradient **grad)
Definition: brush.c:717
GpStatus WINGDIPAPI GdipGetPathGradientPath(GpPathGradient *grad, GpPath *path)
Definition: brush.c:1187
GpStatus WINGDIPAPI GdipCreateTextureIAI(GpImage *image, GDIPCONST GpImageAttributes *imageattr, INT x, INT y, INT width, INT height, GpTexture **texture)
Definition: brush.c:945
GpStatus WINGDIPAPI GdipGetPathGradientSurroundColorCount(GpPathGradient *brush, INT *count)
Definition: brush.c:1270
GpStatus WINGDIPAPI GdipScaleTextureTransform(GpTexture *brush, REAL sx, REAL sy, GpMatrixOrder order)
Definition: brush.c:1384
GpStatus WINGDIPAPI GdipCreateSolidFill(ARGB color, GpSolidFill **sf)
Definition: brush.c:783
GpStatus WINGDIPAPI GdipSetLineGammaCorrection(GpLineGradient *line, BOOL usegamma)
Definition: brush.c:1458
GpStatus WINGDIPAPI GdipGetHatchForegroundColor(GpHatch *brush, ARGB *forecol)
Definition: brush.c:998
GpStatus WINGDIPAPI GdipCreateTexture2(GpImage *image, GpWrapMode wrapmode, REAL x, REAL y, REAL width, REAL height, GpTexture **texture)
Definition: brush.c:847
GpStatus WINGDIPAPI GdipCreateTextureIA(GpImage *image, GDIPCONST GpImageAttributes *imageattr, REAL x, REAL y, REAL width, REAL height, GpTexture **texture)
Definition: brush.c:874
GpStatus WINGDIPAPI GdipGetPathGradientCenterPointI(GpPathGradient *grad, GpPoint *point)
Definition: brush.c:1126
GpStatus WINGDIPAPI GdipTranslateLineTransform(GpLineGradient *brush, REAL dx, REAL dy, GpMatrixOrder order)
Definition: brush.c:2192
GpStatus WINGDIPAPI GdipSetLineLinearBlend(GpLineGradient *brush, REAL focus, REAL scale)
Definition: brush.c:2036
GpStatus WINGDIPAPI GdipTranslateTextureTransform(GpTexture *brush, REAL dx, REAL dy, GpMatrixOrder order)
Definition: brush.c:2206
GpStatus WINGDIPAPI GdipResetTextureTransform(GpTexture *brush)
Definition: brush.c:1371
GpStatus WINGDIPAPI GdipRotateLineTransform(GpLineGradient *brush, REAL angle, GpMatrixOrder order)
Definition: brush.c:2251
GpStatus WINGDIPAPI GdipGetLineWrapMode(GpLineGradient *brush, GpWrapMode *wrapmode)
Definition: brush.c:1069
GpStatus WINGDIPAPI GdipGetLineRect(GpLineGradient *brush, GpRectF *rect)
Definition: brush.c:2217
GpStatus WINGDIPAPI GdipSetLineColors(GpLineGradient *brush, ARGB color1, ARGB color2)
Definition: brush.c:1995
GpStatus WINGDIPAPI GdipRotateTextureTransform(GpTexture *brush, REAL angle, GpMatrixOrder order)
Definition: brush.c:2025
GpStatus WINGDIPAPI GdipSetPathGradientWrapMode(GpPathGradient *grad, GpWrapMode wrap)
Definition: brush.c:1858
GpStatus WINGDIPAPI GdipSetTextureWrapMode(GpTexture *brush, GpWrapMode wrapmode)
Definition: brush.c:1983
GpStatus WINGDIPAPI GdipGetSolidFillColor(GpSolidFill *sf, ARGB *argb)
Definition: brush.c:1299
GpStatus WINGDIPAPI GdipGetLineBlend(GpLineGradient *brush, REAL *factors, REAL *positions, INT count)
Definition: brush.c:1429
GpStatus WINGDIPAPI GdipSetPathGradientCenterPoint(GpPathGradient *grad, GpPointF *point)
Definition: brush.c:1694
GpStatus WINGDIPAPI GdipGetLinePresetBlend(GpLineGradient *brush, ARGB *blend, REAL *positions, INT count)
Definition: brush.c:2103
GpStatus WINGDIPAPI GdipGetLineBlendCount(GpLineGradient *brush, INT *count)
Definition: brush.c:1446
GpStatus WINGDIPAPI GdipSetPathGradientSurroundColorsWithCount(GpPathGradient *grad, GDIPCONST ARGB *argb, INT *count)
Definition: brush.c:1819
GpStatus WINGDIPAPI GdipGetHatchBackgroundColor(GpHatch *brush, ARGB *backcol)
Definition: brush.c:987
GpStatus WINGDIPAPI GdipGetPathGradientPointCount(GpPathGradient *grad, INT *count)
Definition: brush.c:1199
GpStatus WINGDIPAPI GdipCreateTexture(GpImage *image, GpWrapMode wrapmode, GpTexture **texture)
Definition: brush.c:812
GpStatus WINGDIPAPI GdipTranslatePathGradientTransform(GpPathGradient *grad, REAL dx, REAL dy, GpMatrixOrder order)
Definition: brush.c:1940
GpStatus WINGDIPAPI GdipRotatePathGradientTransform(GpPathGradient *grad, REAL angle, GpMatrixOrder order)
Definition: brush.c:1918
GpStatus WINGDIPAPI GdipCreateTexture2I(GpImage *image, GpWrapMode wrapmode, INT x, INT y, INT width, INT height, GpTexture **texture)
Definition: brush.c:954
GpStatus WINGDIPAPI GdipGetPathGradientWrapMode(GpPathGradient *brush, GpWrapMode *wrapmode)
Definition: brush.c:1286
GpStatus WINGDIPAPI GdipGetBrushType(GpBrush *brush, GpBrushType *type)
Definition: brush.c:976
GpStatus WINGDIPAPI GdipSetPathGradientPresetBlend(GpPathGradient *brush, GDIPCONST ARGB *blend, GDIPCONST REAL *pos, INT count)
Definition: brush.c:1607
GpStatus WINGDIPAPI GdipCreatePath(GpFillMode fill, GpPath **path)
GpStatus WINGDIPAPI GdipDeletePath(GpPath *path)
GpStatus WINGDIPAPI GdipAddPathLine2(GpPath *path, GDIPCONST GpPointF *points, INT count)
Definition: graphicspath.c:743
GpStatus WINGDIPAPI GdipClonePath(GpPath *path, GpPath **clone)
GpStatus WINGDIPAPI GdipAddPathLine2I(GpPath *path, GDIPCONST GpPoint *points, INT count)
Definition: graphicspath.c:754
GpStatus WINGDIPAPI GdipGetPathWorldBounds(GpPath *path, GpRectF *bounds, GDIPCONST GpMatrix *matrix, GDIPCONST GpPen *pen)
GpStatus WINGDIPAPI GdipGetImageWidth(GpImage *image, UINT *width)
Definition: image.c:2323
GpStatus WINGDIPAPI GdipGetImageHeight(GpImage *image, UINT *height)
Definition: image.c:2213
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
GpStatus WINGDIPAPI GdipCloneImage(GpImage *image, GpImage **cloneImage)
Definition: image.c:1385
GpStatus WINGDIPAPI GdipScaleMatrix(GpMatrix *matrix, REAL scaleX, REAL scaleY, GpMatrixOrder order)
Definition: matrix.c:288
GpStatus WINGDIPAPI GdipMultiplyMatrix(GpMatrix *matrix, GDIPCONST GpMatrix *matrix2, GpMatrixOrder order)
Definition: matrix.c:239
GpStatus WINGDIPAPI GdipTranslateMatrix(GpMatrix *matrix, REAL offsetX, REAL offsetY, GpMatrixOrder order)
Definition: matrix.c:420
GpStatus WINGDIPAPI GdipSetMatrixElements(GpMatrix *matrix, REAL m11, REAL m12, REAL m21, REAL m22, REAL dx, REAL dy)
Definition: matrix.c:318
GpStatus WINGDIPAPI GdipRotateMatrix(GpMatrix *matrix, REAL angle, GpMatrixOrder order)
Definition: matrix.c:257
_ACRTIMP double __cdecl sqrt(double)
Definition: sqrt.c:5
_ACRTIMP double __cdecl fabs(double)
_ACRTIMP double __cdecl erf(double)
_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)
return ret
Definition: mutex.c:146
#define wrap(journal, var)
Definition: recovery.c:207
POINTL point
Definition: edittest.c:50
#define abs(i)
Definition: fconv.c:206
unsigned int BOOL
Definition: ntddk_ex.h:94
const char * debugstr_rectf(const RectF *rc)
Definition: gdiplus.c:486
const char * debugstr_pointf(const PointF *pt)
Definition: gdiplus.c:492
const char * debugstr_matrix(const GpMatrix *matrix)
Definition: gdiplus.c:498
static INT gdip_round(REAL x)
static void set_rect(GpRectF *rect, REAL x, REAL y, REAL width, REAL height)
static REAL deg2rad(REAL degrees)
HatchStyle
Definition: gdiplusenums.h:427
@ HatchStyleMax
Definition: gdiplusenums.h:484
@ ImageTypeBitmap
Definition: gdiplusenums.h:194
@ FillModeAlternate
Definition: gdiplusenums.h:55
WrapMode
Definition: gdiplusenums.h:204
@ WrapModeTile
Definition: gdiplusenums.h:205
@ WrapModeClamp
Definition: gdiplusenums.h:209
MatrixOrder
Definition: gdiplusenums.h:186
@ MatrixOrderAppend
Definition: gdiplusenums.h:188
BrushType
Definition: gdiplusenums.h:37
@ BrushTypeHatchFill
Definition: gdiplusenums.h:39
@ BrushTypeLinearGradient
Definition: gdiplusenums.h:42
@ BrushTypeTextureFill
Definition: gdiplusenums.h:40
@ BrushTypeSolidColor
Definition: gdiplusenums.h:38
@ BrushTypePathGradient
Definition: gdiplusenums.h:41
LinearGradientMode
Definition: gdiplusenums.h:223
@ LinearGradientModeForwardDiagonal
Definition: gdiplusenums.h:226
@ LinearGradientModeBackwardDiagonal
Definition: gdiplusenums.h:227
@ LinearGradientModeHorizontal
Definition: gdiplusenums.h:224
@ LinearGradientModeVertical
Definition: gdiplusenums.h:225
#define GDIPCONST
Definition: gdiplusflat.h:24
#define WINGDIPAPI
Definition: gdiplusflat.h:22
DWORD ARGB
#define PixelFormatDontCare
Status
Definition: gdiplustypes.h:24
@ Ok
Definition: gdiplustypes.h:25
@ InvalidParameter
Definition: gdiplustypes.h:27
@ OutOfMemory
Definition: gdiplustypes.h:28
@ InsufficientBuffer
Definition: gdiplustypes.h:30
@ NotImplemented
Definition: gdiplustypes.h:31
@ GenericError
Definition: gdiplustypes.h:26
GLuint start
Definition: gl.h:1545
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
GLuint GLuint end
Definition: gl.h:1545
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
GLdouble GLdouble t
Definition: gl.h:2047
GLint GLint GLsizei width
Definition: gl.h:1546
GLenum GLuint texture
Definition: glext.h:6295
GLenum GLenum GLenum GLenum GLenum scale
Definition: glext.h:9032
GLenum src
Definition: glext.h:6340
GLuint color
Definition: glext.h:6243
GLuint GLenum matrix
Definition: glext.h:9407
GLenum mode
Definition: glext.h:6217
GLfloat angle
Definition: glext.h:10853
GLuint64EXT * result
Definition: glext.h:11304
GLfloat GLfloat p
Definition: glext.h:8902
GLenum GLint GLint * precision
Definition: glext.h:7539
GLuint GLdouble GLdouble GLint GLint order
Definition: glext.h:11194
GLsizei const GLfloat * points
Definition: glext.h:8112
GLfloat GLfloat GLfloat GLfloat h
Definition: glext.h:7723
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
GpStatus WINGDIPAPI GdipCloneImageAttributes(GDIPCONST GpImageAttributes *imageattr, GpImageAttributes **cloneImageattr)
GpStatus WINGDIPAPI GdipCreateImageAttributes(GpImageAttributes **imageattr)
GpStatus WINGDIPAPI GdipDisposeImageAttributes(GpImageAttributes *imageattr)
GLint dy
Definition: linetemp.h:97
GLint dx
Definition: linetemp.h:97
#define M_PI
Definition: macros.h:263
#define sign(x)
Definition: mapdesc.cc:613
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
static const BYTE bitmap_bits[48 *48/8]
Definition: imagelist.c:131
static const struct update_accum a1
Definition: msg.c:534
static const struct update_accum a2
Definition: msg.c:542
static const struct update_accum a3
Definition: msg.c:556
static const struct update_accum a4
Definition: msg.c:2188
static char * dest
Definition: rtl.c:149
DWORD exp
Definition: msg.c:18625
#define min(a, b)
Definition: monoChain.cc:55
#define sqrtf(x)
Definition: mymath.h:59
unsigned int UINT
Definition: ndis.h:50
static HANDLE ACCESS_MASK ULONG attributes
Definition: om.c:94
#define calloc
Definition: rosglue.h:14
#define exit(n)
Definition: config.h:202
#define TRACE(s)
Definition: solgame.cpp:4
GpBrushType bt
GpHatchStyle hatchstyle
GpPathData pathdata
GpBrush brush
GpImageAttributes * imageattributes
GpImage * image
GpMatrix transform
REAL Y
Definition: gdiplustypes.h:644
REAL X
Definition: gdiplustypes.h:643
REAL Height
Definition: gdiplustypes.h:659
REAL X
Definition: gdiplustypes.h:656
REAL Width
Definition: gdiplustypes.h:658
REAL Y
Definition: gdiplustypes.h:657
Definition: nis.h:10
Definition: parser.c:49
Definition: stat.h:66
Definition: ps.c:97
#define max(a, b)
Definition: svc.c:63
int32_t INT
Definition: typedefs.h:58