[CMAKE]
[reactos.git] / dll / win32 / gdiplus / brush.c
1 /*
2 * Copyright (C) 2007 Google (Evan Stade)
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
17 */
18
19 #include <stdarg.h>
20
21 #include "windef.h"
22 #include "winbase.h"
23 #include "winuser.h"
24 #include "wingdi.h"
25
26 #define COBJMACROS
27 #include "objbase.h"
28 #include "olectl.h"
29 #include "ole2.h"
30
31 #include "gdiplus.h"
32 #include "gdiplus_private.h"
33 #include "wine/debug.h"
34
35 WINE_DEFAULT_DEBUG_CHANNEL(gdiplus);
36
37 /*
38 Unix stuff
39 Code from http://www.johndcook.com/blog/2009/01/19/stand-alone-error-function-erf/
40 */
41 double erf(double x)
42 {
43 const float a1 = 0.254829592;
44 const float a2 = -0.284496736;
45 const float a3 = 1.421413741;
46 const float a4 = -1.453152027;
47 const float a5 = 1.061405429;
48 const float p = 0.3275911;
49 float t, y, sign;
50
51 /* Save the sign of x */
52 sign = 1;
53 if (x < 0)
54 sign = -1;
55 x = abs(x);
56
57 /* A & S 7.1.26 */
58 t = 1.0/(1.0 + p*x);
59 y = 1.0 - (((((a5*t + a4)*t) + a3)*t + a2)*t + a1)*t*exp(-x*x);
60
61 return sign*y;
62 }
63
64 /******************************************************************************
65 * GdipCloneBrush [GDIPLUS.@]
66 */
67 GpStatus WINGDIPAPI GdipCloneBrush(GpBrush *brush, GpBrush **clone)
68 {
69 TRACE("(%p, %p)\n", brush, clone);
70
71 if(!brush || !clone)
72 return InvalidParameter;
73
74 switch(brush->bt){
75 case BrushTypeSolidColor:
76 {
77 GpSolidFill *fill;
78 *clone = GdipAlloc(sizeof(GpSolidFill));
79 if (!*clone) return OutOfMemory;
80
81 fill = (GpSolidFill*)*clone;
82
83 memcpy(*clone, brush, sizeof(GpSolidFill));
84
85 (*clone)->gdibrush = CreateBrushIndirect(&(*clone)->lb);
86 fill->bmp = ARGB2BMP(fill->color);
87 break;
88 }
89 case BrushTypeHatchFill:
90 {
91 GpHatch *hatch = (GpHatch*)brush;
92
93 return GdipCreateHatchBrush(hatch->hatchstyle, hatch->forecol, hatch->backcol, (GpHatch**)clone);
94 }
95 case BrushTypePathGradient:{
96 GpPathGradient *src, *dest;
97 INT count;
98
99 *clone = GdipAlloc(sizeof(GpPathGradient));
100 if (!*clone) return OutOfMemory;
101
102 src = (GpPathGradient*) brush,
103 dest = (GpPathGradient*) *clone;
104 count = src->pathdata.Count;
105
106 memcpy(dest, src, sizeof(GpPathGradient));
107
108 dest->pathdata.Count = count;
109 dest->pathdata.Points = GdipAlloc(count * sizeof(PointF));
110 dest->pathdata.Types = GdipAlloc(count);
111
112 if(!dest->pathdata.Points || !dest->pathdata.Types){
113 GdipFree(dest->pathdata.Points);
114 GdipFree(dest->pathdata.Types);
115 GdipFree(dest);
116 return OutOfMemory;
117 }
118
119 memcpy(dest->pathdata.Points, src->pathdata.Points, count * sizeof(PointF));
120 memcpy(dest->pathdata.Types, src->pathdata.Types, count);
121
122 /* blending */
123 count = src->blendcount;
124 dest->blendcount = count;
125 dest->blendfac = GdipAlloc(count * sizeof(REAL));
126 dest->blendpos = GdipAlloc(count * sizeof(REAL));
127
128 if(!dest->blendfac || !dest->blendpos){
129 GdipFree(dest->pathdata.Points);
130 GdipFree(dest->pathdata.Types);
131 GdipFree(dest->blendfac);
132 GdipFree(dest->blendpos);
133 GdipFree(dest);
134 return OutOfMemory;
135 }
136
137 memcpy(dest->blendfac, src->blendfac, count * sizeof(REAL));
138 memcpy(dest->blendpos, src->blendpos, count * sizeof(REAL));
139
140 break;
141 }
142 case BrushTypeLinearGradient:{
143 GpLineGradient *dest, *src;
144 INT count, pcount;
145
146 dest = GdipAlloc(sizeof(GpLineGradient));
147 if(!dest) return OutOfMemory;
148
149 src = (GpLineGradient*)brush;
150
151 memcpy(dest, src, sizeof(GpLineGradient));
152
153 dest->brush.gdibrush = CreateSolidBrush(dest->brush.lb.lbColor);
154
155 count = dest->blendcount;
156 dest->blendfac = GdipAlloc(count * sizeof(REAL));
157 dest->blendpos = GdipAlloc(count * sizeof(REAL));
158 pcount = dest->pblendcount;
159 if (pcount)
160 {
161 dest->pblendcolor = GdipAlloc(pcount * sizeof(ARGB));
162 dest->pblendpos = GdipAlloc(pcount * sizeof(REAL));
163 }
164
165 if (!dest->blendfac || !dest->blendpos ||
166 (pcount && (!dest->pblendcolor || !dest->pblendpos)))
167 {
168 GdipFree(dest->blendfac);
169 GdipFree(dest->blendpos);
170 GdipFree(dest->pblendcolor);
171 GdipFree(dest->pblendpos);
172 DeleteObject(dest->brush.gdibrush);
173 GdipFree(dest);
174 return OutOfMemory;
175 }
176
177 memcpy(dest->blendfac, src->blendfac, count * sizeof(REAL));
178 memcpy(dest->blendpos, src->blendpos, count * sizeof(REAL));
179
180 if (pcount)
181 {
182 memcpy(dest->pblendcolor, src->pblendcolor, pcount * sizeof(ARGB));
183 memcpy(dest->pblendpos, src->pblendpos, pcount * sizeof(REAL));
184 }
185
186 *clone = &dest->brush;
187 break;
188 }
189 case BrushTypeTextureFill:
190 {
191 GpStatus stat;
192 GpTexture *texture = (GpTexture*)brush;
193 GpTexture *new_texture;
194
195 stat = GdipCreateTexture(texture->image, texture->wrap, &new_texture);
196
197 if (stat == Ok)
198 {
199 memcpy(new_texture->transform, texture->transform, sizeof(GpMatrix));
200 *clone = (GpBrush*)new_texture;
201 }
202 else
203 *clone = NULL;
204
205 return stat;
206 }
207 default:
208 ERR("not implemented for brush type %d\n", brush->bt);
209 return NotImplemented;
210 }
211
212 TRACE("<-- %p\n", *clone);
213 return Ok;
214 }
215
216 static const char HatchBrushes[][8] = {
217 { 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00 }, /* HatchStyleHorizontal */
218 { 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08 }, /* HatchStyleVertical */
219 { 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80 }, /* HatchStyleForwardDiagonal */
220 { 0x80, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x01 }, /* HatchStyleBackwardDiagonal */
221 { 0x08, 0x08, 0x08, 0xff, 0x08, 0x08, 0x08, 0x08 }, /* HatchStyleCross */
222 { 0x81, 0x42, 0x24, 0x18, 0x18, 0x24, 0x42, 0x81 }, /* HatchStyleDiagonalCross */
223 { 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x80 }, /* HatchStyle05Percent */
224 { 0x00, 0x02, 0x00, 0x88, 0x00, 0x20, 0x00, 0x88 }, /* HatchStyle10Percent */
225 { 0x00, 0x22, 0x00, 0xcc, 0x00, 0x22, 0x00, 0xcc }, /* HatchStyle20Percent */
226 { 0x00, 0xcc, 0x00, 0xcc, 0x00, 0xcc, 0x00, 0xcc }, /* HatchStyle25Percent */
227 { 0x00, 0xcc, 0x04, 0xcc, 0x00, 0xcc, 0x40, 0xcc }, /* HatchStyle30Percent */
228 { 0x44, 0xcc, 0x22, 0xcc, 0x44, 0xcc, 0x22, 0xcc }, /* HatchStyle40Percent */
229 { 0x55, 0xcc, 0x55, 0xcc, 0x55, 0xcc, 0x55, 0xcc }, /* HatchStyle50Percent */
230 { 0x55, 0xcd, 0x55, 0xee, 0x55, 0xdc, 0x55, 0xee }, /* HatchStyle60Percent */
231 { 0x55, 0xdd, 0x55, 0xff, 0x55, 0xdd, 0x55, 0xff }, /* HatchStyle70Percent */
232 { 0x55, 0xff, 0x55, 0xff, 0x55, 0xff, 0x55, 0xff }, /* HatchStyle75Percent */
233 { 0x55, 0xff, 0x59, 0xff, 0x55, 0xff, 0x99, 0xff }, /* HatchStyle80Percent */
234 { 0x77, 0xff, 0xdd, 0xff, 0x77, 0xff, 0xfd, 0xff }, /* HatchStyle90Percent */
235 { 0x11, 0x22, 0x44, 0x88, 0x11, 0x22, 0x44, 0x88 }, /* HatchStyleLightDownwardDiagonal */
236 { 0x88, 0x44, 0x22, 0x11, 0x88, 0x44, 0x22, 0x11 }, /* HatchStyleLightUpwardDiagonal */
237 { 0x99, 0x33, 0x66, 0xcc, 0x99, 0x33, 0x66, 0xcc }, /* HatchStyleDarkDownwardDiagonal */
238 { 0xcc, 0x66, 0x33, 0x99, 0xcc, 0x66, 0x33, 0x99 }, /* HatchStyleDarkUpwardDiagonal */
239 { 0xc1, 0x83, 0x07, 0x0e, 0x1c, 0x38, 0x70, 0xe0 }, /* HatchStyleWideDownwardDiagonal */
240 { 0xe0, 0x70, 0x38, 0x1c, 0x0e, 0x07, 0x83, 0xc1 }, /* HatchStyleWideUpwardDiagonal */
241 { 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88 }, /* HatchStyleLightVertical */
242 { 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff }, /* HatchStyleLightHorizontal */
243 { 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa }, /* HatchStyleNarrowVertical */
244 { 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff }, /* HatchStyleNarrowHorizontal */
245 { 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc }, /* HatchStyleDarkVertical */
246 { 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0xff, 0xff }, /* HatchStyleDarkHorizontal */
247 };
248
249 /******************************************************************************
250 * GdipCreateHatchBrush [GDIPLUS.@]
251 */
252 GpStatus WINGDIPAPI GdipCreateHatchBrush(HatchStyle hatchstyle, ARGB forecol, ARGB backcol, GpHatch **brush)
253 {
254 COLORREF fgcol = ARGB2COLORREF(forecol);
255 GpStatus stat = Ok;
256
257 TRACE("(%d, %d, %d, %p)\n", hatchstyle, forecol, backcol, brush);
258
259 if(!brush) return InvalidParameter;
260
261 *brush = GdipAlloc(sizeof(GpHatch));
262 if (!*brush) return OutOfMemory;
263
264 if (hatchstyle < sizeof(HatchBrushes) / sizeof(HatchBrushes[0]))
265 {
266 HBITMAP hbmp;
267 HDC hdc;
268 BITMAPINFOHEADER bmih;
269 DWORD* bits;
270 int x, y;
271
272 hdc = CreateCompatibleDC(0);
273
274 if (hdc)
275 {
276 bmih.biSize = sizeof(bmih);
277 bmih.biWidth = 8;
278 bmih.biHeight = 8;
279 bmih.biPlanes = 1;
280 bmih.biBitCount = 32;
281 bmih.biCompression = BI_RGB;
282 bmih.biSizeImage = 0;
283
284 hbmp = CreateDIBSection(hdc, (BITMAPINFO*)&bmih, DIB_RGB_COLORS, (void**)&bits, NULL, 0);
285
286 if (hbmp)
287 {
288 for (y=0; y<8; y++)
289 for (x=0; x<8; x++)
290 if ((HatchBrushes[hatchstyle][y] & (0x80 >> x)) != 0)
291 bits[y*8+x] = forecol;
292 else
293 bits[y*8+x] = backcol;
294 }
295 else
296 stat = GenericError;
297
298 DeleteDC(hdc);
299 }
300 else
301 stat = GenericError;
302
303 if (stat == Ok)
304 {
305 (*brush)->brush.lb.lbStyle = BS_PATTERN;
306 (*brush)->brush.lb.lbColor = 0;
307 (*brush)->brush.lb.lbHatch = (ULONG_PTR)hbmp;
308 (*brush)->brush.gdibrush = CreateBrushIndirect(&(*brush)->brush.lb);
309
310 DeleteObject(hbmp);
311 }
312 }
313 else
314 {
315 FIXME("Unimplemented hatch style %d\n", hatchstyle);
316
317 (*brush)->brush.lb.lbStyle = BS_SOLID;
318 (*brush)->brush.lb.lbColor = fgcol;
319 (*brush)->brush.lb.lbHatch = 0;
320 (*brush)->brush.gdibrush = CreateBrushIndirect(&(*brush)->brush.lb);
321 }
322
323 if (stat == Ok)
324 {
325 (*brush)->brush.bt = BrushTypeHatchFill;
326 (*brush)->forecol = forecol;
327 (*brush)->backcol = backcol;
328 (*brush)->hatchstyle = hatchstyle;
329 TRACE("<-- %p\n", *brush);
330 }
331 else
332 {
333 GdipFree(*brush);
334 *brush = NULL;
335 }
336
337 return stat;
338 }
339
340 /******************************************************************************
341 * GdipCreateLineBrush [GDIPLUS.@]
342 */
343 GpStatus WINGDIPAPI GdipCreateLineBrush(GDIPCONST GpPointF* startpoint,
344 GDIPCONST GpPointF* endpoint, ARGB startcolor, ARGB endcolor,
345 GpWrapMode wrap, GpLineGradient **line)
346 {
347 COLORREF col = ARGB2COLORREF(startcolor);
348
349 TRACE("(%s, %s, %x, %x, %d, %p)\n", debugstr_pointf(startpoint),
350 debugstr_pointf(endpoint), startcolor, endcolor, wrap, line);
351
352 if(!line || !startpoint || !endpoint || wrap == WrapModeClamp)
353 return InvalidParameter;
354
355 if (startpoint->X == endpoint->X && startpoint->Y == endpoint->Y)
356 return OutOfMemory;
357
358 *line = GdipAlloc(sizeof(GpLineGradient));
359 if(!*line) return OutOfMemory;
360
361 (*line)->brush.lb.lbStyle = BS_SOLID;
362 (*line)->brush.lb.lbColor = col;
363 (*line)->brush.lb.lbHatch = 0;
364 (*line)->brush.gdibrush = CreateSolidBrush(col);
365 (*line)->brush.bt = BrushTypeLinearGradient;
366
367 (*line)->startpoint.X = startpoint->X;
368 (*line)->startpoint.Y = startpoint->Y;
369 (*line)->endpoint.X = endpoint->X;
370 (*line)->endpoint.Y = endpoint->Y;
371 (*line)->startcolor = startcolor;
372 (*line)->endcolor = endcolor;
373 (*line)->wrap = wrap;
374 (*line)->gamma = FALSE;
375
376 (*line)->rect.X = (startpoint->X < endpoint->X ? startpoint->X: endpoint->X);
377 (*line)->rect.Y = (startpoint->Y < endpoint->Y ? startpoint->Y: endpoint->Y);
378 (*line)->rect.Width = fabs(startpoint->X - endpoint->X);
379 (*line)->rect.Height = fabs(startpoint->Y - endpoint->Y);
380
381 if ((*line)->rect.Width == 0)
382 {
383 (*line)->rect.X -= (*line)->rect.Height / 2.0f;
384 (*line)->rect.Width = (*line)->rect.Height;
385 }
386 else if ((*line)->rect.Height == 0)
387 {
388 (*line)->rect.Y -= (*line)->rect.Width / 2.0f;
389 (*line)->rect.Height = (*line)->rect.Width;
390 }
391
392 (*line)->blendcount = 1;
393 (*line)->blendfac = GdipAlloc(sizeof(REAL));
394 (*line)->blendpos = GdipAlloc(sizeof(REAL));
395
396 if (!(*line)->blendfac || !(*line)->blendpos)
397 {
398 GdipFree((*line)->blendfac);
399 GdipFree((*line)->blendpos);
400 DeleteObject((*line)->brush.gdibrush);
401 GdipFree(*line);
402 *line = NULL;
403 return OutOfMemory;
404 }
405
406 (*line)->blendfac[0] = 1.0f;
407 (*line)->blendpos[0] = 1.0f;
408
409 (*line)->pblendcolor = NULL;
410 (*line)->pblendpos = NULL;
411 (*line)->pblendcount = 0;
412
413 TRACE("<-- %p\n", *line);
414
415 return Ok;
416 }
417
418 GpStatus WINGDIPAPI GdipCreateLineBrushI(GDIPCONST GpPoint* startpoint,
419 GDIPCONST GpPoint* endpoint, ARGB startcolor, ARGB endcolor,
420 GpWrapMode wrap, GpLineGradient **line)
421 {
422 GpPointF stF;
423 GpPointF endF;
424
425 TRACE("(%p, %p, %x, %x, %d, %p)\n", startpoint, endpoint,
426 startcolor, endcolor, wrap, line);
427
428 if(!startpoint || !endpoint)
429 return InvalidParameter;
430
431 stF.X = (REAL)startpoint->X;
432 stF.Y = (REAL)startpoint->Y;
433 endF.X = (REAL)endpoint->X;
434 endF.Y = (REAL)endpoint->Y;
435
436 return GdipCreateLineBrush(&stF, &endF, startcolor, endcolor, wrap, line);
437 }
438
439 GpStatus WINGDIPAPI GdipCreateLineBrushFromRect(GDIPCONST GpRectF* rect,
440 ARGB startcolor, ARGB endcolor, LinearGradientMode mode, GpWrapMode wrap,
441 GpLineGradient **line)
442 {
443 GpPointF start, end;
444 GpStatus stat;
445
446 TRACE("(%p, %x, %x, %d, %d, %p)\n", rect, startcolor, endcolor, mode,
447 wrap, line);
448
449 if(!line || !rect)
450 return InvalidParameter;
451
452 switch (mode)
453 {
454 case LinearGradientModeHorizontal:
455 start.X = rect->X;
456 start.Y = rect->Y;
457 end.X = rect->X + rect->Width;
458 end.Y = rect->Y;
459 break;
460 case LinearGradientModeVertical:
461 start.X = rect->X;
462 start.Y = rect->Y;
463 end.X = rect->X;
464 end.Y = rect->Y + rect->Height;
465 break;
466 case LinearGradientModeForwardDiagonal:
467 start.X = rect->X;
468 start.Y = rect->Y;
469 end.X = rect->X + rect->Width;
470 end.Y = rect->Y + rect->Height;
471 break;
472 case LinearGradientModeBackwardDiagonal:
473 start.X = rect->X + rect->Width;
474 start.Y = rect->Y;
475 end.X = rect->X;
476 end.Y = rect->Y + rect->Height;
477 break;
478 default:
479 return InvalidParameter;
480 }
481
482 stat = GdipCreateLineBrush(&start, &end, startcolor, endcolor, wrap, line);
483
484 if (stat == Ok)
485 (*line)->rect = *rect;
486
487 return stat;
488 }
489
490 GpStatus WINGDIPAPI GdipCreateLineBrushFromRectI(GDIPCONST GpRect* rect,
491 ARGB startcolor, ARGB endcolor, LinearGradientMode mode, GpWrapMode wrap,
492 GpLineGradient **line)
493 {
494 GpRectF rectF;
495
496 TRACE("(%p, %x, %x, %d, %d, %p)\n", rect, startcolor, endcolor, mode,
497 wrap, line);
498
499 rectF.X = (REAL) rect->X;
500 rectF.Y = (REAL) rect->Y;
501 rectF.Width = (REAL) rect->Width;
502 rectF.Height = (REAL) rect->Height;
503
504 return GdipCreateLineBrushFromRect(&rectF, startcolor, endcolor, mode, wrap, line);
505 }
506
507 /******************************************************************************
508 * GdipCreateLineBrushFromRectWithAngle [GDIPLUS.@]
509 */
510 GpStatus WINGDIPAPI GdipCreateLineBrushFromRectWithAngle(GDIPCONST GpRectF* rect,
511 ARGB startcolor, ARGB endcolor, REAL angle, BOOL isAngleScalable, GpWrapMode wrap,
512 GpLineGradient **line)
513 {
514 GpStatus stat;
515 LinearGradientMode mode;
516 REAL width, height, exofs, eyofs;
517 REAL sin_angle, cos_angle, sin_cos_angle;
518
519 TRACE("(%p, %x, %x, %.2f, %d, %d, %p)\n", rect, startcolor, endcolor, angle, isAngleScalable,
520 wrap, line);
521
522 sin_angle = sinf(deg2rad(angle));
523 cos_angle = cosf(deg2rad(angle));
524 sin_cos_angle = sin_angle * cos_angle;
525
526 if (isAngleScalable)
527 {
528 width = height = 1.0;
529 }
530 else
531 {
532 width = rect->Width;
533 height = rect->Height;
534 }
535
536 if (sin_cos_angle >= 0)
537 mode = LinearGradientModeForwardDiagonal;
538 else
539 mode = LinearGradientModeBackwardDiagonal;
540
541 stat = GdipCreateLineBrushFromRect(rect, startcolor, endcolor, mode, wrap, line);
542
543 if (stat == Ok)
544 {
545 if (sin_cos_angle >= 0)
546 {
547 exofs = width * sin_cos_angle + height * cos_angle * cos_angle;
548 eyofs = width * sin_angle * sin_angle + height * sin_cos_angle;
549 }
550 else
551 {
552 exofs = width * sin_angle * sin_angle + height * sin_cos_angle;
553 eyofs = -width * sin_cos_angle + height * sin_angle * sin_angle;
554 }
555
556 if (isAngleScalable)
557 {
558 exofs = exofs * rect->Width;
559 eyofs = eyofs * rect->Height;
560 }
561
562 if (sin_angle >= 0)
563 {
564 (*line)->endpoint.X = rect->X + exofs;
565 (*line)->endpoint.Y = rect->Y + eyofs;
566 }
567 else
568 {
569 (*line)->endpoint.X = (*line)->startpoint.X;
570 (*line)->endpoint.Y = (*line)->startpoint.Y;
571 (*line)->startpoint.X = rect->X + exofs;
572 (*line)->startpoint.Y = rect->Y + eyofs;
573 }
574 }
575
576 return stat;
577 }
578
579 GpStatus WINGDIPAPI GdipCreateLineBrushFromRectWithAngleI(GDIPCONST GpRect* rect,
580 ARGB startcolor, ARGB endcolor, REAL angle, BOOL isAngleScalable, GpWrapMode wrap,
581 GpLineGradient **line)
582 {
583 TRACE("(%p, %x, %x, %.2f, %d, %d, %p)\n", rect, startcolor, endcolor, angle, isAngleScalable,
584 wrap, line);
585
586 return GdipCreateLineBrushFromRectI(rect, startcolor, endcolor, LinearGradientModeForwardDiagonal,
587 wrap, line);
588 }
589
590 GpStatus WINGDIPAPI GdipCreatePathGradient(GDIPCONST GpPointF* points,
591 INT count, GpWrapMode wrap, GpPathGradient **grad)
592 {
593 COLORREF col = ARGB2COLORREF(0xffffffff);
594
595 TRACE("(%p, %d, %d, %p)\n", points, count, wrap, grad);
596
597 if(!points || !grad)
598 return InvalidParameter;
599
600 if(count <= 0)
601 return OutOfMemory;
602
603 *grad = GdipAlloc(sizeof(GpPathGradient));
604 if (!*grad) return OutOfMemory;
605
606 (*grad)->blendfac = GdipAlloc(sizeof(REAL));
607 (*grad)->blendpos = GdipAlloc(sizeof(REAL));
608 if(!(*grad)->blendfac || !(*grad)->blendpos){
609 GdipFree((*grad)->blendfac);
610 GdipFree((*grad)->blendpos);
611 GdipFree(*grad);
612 *grad = NULL;
613 return OutOfMemory;
614 }
615 (*grad)->blendfac[0] = 1.0;
616 (*grad)->blendpos[0] = 1.0;
617 (*grad)->blendcount = 1;
618
619 (*grad)->pathdata.Count = count;
620 (*grad)->pathdata.Points = GdipAlloc(count * sizeof(PointF));
621 (*grad)->pathdata.Types = GdipAlloc(count);
622
623 if(!(*grad)->pathdata.Points || !(*grad)->pathdata.Types){
624 GdipFree((*grad)->pathdata.Points);
625 GdipFree((*grad)->pathdata.Types);
626 GdipFree(*grad);
627 return OutOfMemory;
628 }
629
630 memcpy((*grad)->pathdata.Points, points, count * sizeof(PointF));
631 memset((*grad)->pathdata.Types, PathPointTypeLine, count);
632
633 (*grad)->brush.lb.lbStyle = BS_SOLID;
634 (*grad)->brush.lb.lbColor = col;
635 (*grad)->brush.lb.lbHatch = 0;
636
637 (*grad)->brush.gdibrush = CreateSolidBrush(col);
638 (*grad)->brush.bt = BrushTypePathGradient;
639 (*grad)->centercolor = 0xffffffff;
640 (*grad)->wrap = wrap;
641 (*grad)->gamma = FALSE;
642 (*grad)->center.X = 0.0;
643 (*grad)->center.Y = 0.0;
644 (*grad)->focus.X = 0.0;
645 (*grad)->focus.Y = 0.0;
646
647 TRACE("<-- %p\n", *grad);
648
649 return Ok;
650 }
651
652 GpStatus WINGDIPAPI GdipCreatePathGradientI(GDIPCONST GpPoint* points,
653 INT count, GpWrapMode wrap, GpPathGradient **grad)
654 {
655 GpPointF *pointsF;
656 GpStatus ret;
657 INT i;
658
659 TRACE("(%p, %d, %d, %p)\n", points, count, wrap, grad);
660
661 if(!points || !grad)
662 return InvalidParameter;
663
664 if(count <= 0)
665 return OutOfMemory;
666
667 pointsF = GdipAlloc(sizeof(GpPointF) * count);
668 if(!pointsF)
669 return OutOfMemory;
670
671 for(i = 0; i < count; i++){
672 pointsF[i].X = (REAL)points[i].X;
673 pointsF[i].Y = (REAL)points[i].Y;
674 }
675
676 ret = GdipCreatePathGradient(pointsF, count, wrap, grad);
677 GdipFree(pointsF);
678
679 return ret;
680 }
681
682 /******************************************************************************
683 * GdipCreatePathGradientFromPath [GDIPLUS.@]
684 *
685 * FIXME: path gradient brushes not truly supported (drawn as solid brushes)
686 */
687 GpStatus WINGDIPAPI GdipCreatePathGradientFromPath(GDIPCONST GpPath* path,
688 GpPathGradient **grad)
689 {
690 COLORREF col = ARGB2COLORREF(0xffffffff);
691
692 TRACE("(%p, %p)\n", path, grad);
693
694 if(!path || !grad)
695 return InvalidParameter;
696
697 *grad = GdipAlloc(sizeof(GpPathGradient));
698 if (!*grad) return OutOfMemory;
699
700 (*grad)->blendfac = GdipAlloc(sizeof(REAL));
701 (*grad)->blendpos = GdipAlloc(sizeof(REAL));
702 if(!(*grad)->blendfac || !(*grad)->blendpos){
703 GdipFree((*grad)->blendfac);
704 GdipFree((*grad)->blendpos);
705 GdipFree(*grad);
706 *grad = NULL;
707 return OutOfMemory;
708 }
709 (*grad)->blendfac[0] = 1.0;
710 (*grad)->blendpos[0] = 1.0;
711 (*grad)->blendcount = 1;
712
713 (*grad)->pathdata.Count = path->pathdata.Count;
714 (*grad)->pathdata.Points = GdipAlloc(path->pathdata.Count * sizeof(PointF));
715 (*grad)->pathdata.Types = GdipAlloc(path->pathdata.Count);
716
717 if(!(*grad)->pathdata.Points || !(*grad)->pathdata.Types){
718 GdipFree((*grad)->pathdata.Points);
719 GdipFree((*grad)->pathdata.Types);
720 GdipFree(*grad);
721 return OutOfMemory;
722 }
723
724 memcpy((*grad)->pathdata.Points, path->pathdata.Points,
725 path->pathdata.Count * sizeof(PointF));
726 memcpy((*grad)->pathdata.Types, path->pathdata.Types, path->pathdata.Count);
727
728 (*grad)->brush.lb.lbStyle = BS_SOLID;
729 (*grad)->brush.lb.lbColor = col;
730 (*grad)->brush.lb.lbHatch = 0;
731
732 (*grad)->brush.gdibrush = CreateSolidBrush(col);
733 (*grad)->brush.bt = BrushTypePathGradient;
734 (*grad)->centercolor = 0xffffffff;
735 (*grad)->wrap = WrapModeClamp;
736 (*grad)->gamma = FALSE;
737 /* FIXME: this should be set to the "centroid" of the path by default */
738 (*grad)->center.X = 0.0;
739 (*grad)->center.Y = 0.0;
740 (*grad)->focus.X = 0.0;
741 (*grad)->focus.Y = 0.0;
742
743 TRACE("<-- %p\n", *grad);
744
745 return Ok;
746 }
747
748 /******************************************************************************
749 * GdipCreateSolidFill [GDIPLUS.@]
750 */
751 GpStatus WINGDIPAPI GdipCreateSolidFill(ARGB color, GpSolidFill **sf)
752 {
753 COLORREF col = ARGB2COLORREF(color);
754
755 TRACE("(%x, %p)\n", color, sf);
756
757 if(!sf) return InvalidParameter;
758
759 *sf = GdipAlloc(sizeof(GpSolidFill));
760 if (!*sf) return OutOfMemory;
761
762 (*sf)->brush.lb.lbStyle = BS_SOLID;
763 (*sf)->brush.lb.lbColor = col;
764 (*sf)->brush.lb.lbHatch = 0;
765
766 (*sf)->brush.gdibrush = CreateSolidBrush(col);
767 (*sf)->brush.bt = BrushTypeSolidColor;
768 (*sf)->color = color;
769 (*sf)->bmp = ARGB2BMP(color);
770
771 TRACE("<-- %p\n", *sf);
772
773 return Ok;
774 }
775
776 /******************************************************************************
777 * GdipCreateTexture [GDIPLUS.@]
778 *
779 * PARAMS
780 * image [I] image to use
781 * wrapmode [I] optional
782 * texture [O] pointer to the resulting texturebrush
783 *
784 * RETURNS
785 * SUCCESS: Ok
786 * FAILURE: element of GpStatus
787 */
788 GpStatus WINGDIPAPI GdipCreateTexture(GpImage *image, GpWrapMode wrapmode,
789 GpTexture **texture)
790 {
791 UINT width, height;
792 GpImageAttributes attributes;
793 GpStatus stat;
794
795 TRACE("%p, %d %p\n", image, wrapmode, texture);
796
797 if (!(image && texture))
798 return InvalidParameter;
799
800 stat = GdipGetImageWidth(image, &width);
801 if (stat != Ok) return stat;
802 stat = GdipGetImageHeight(image, &height);
803 if (stat != Ok) return stat;
804 attributes.wrap = wrapmode;
805
806 return GdipCreateTextureIA(image, &attributes, 0, 0, width, height,
807 texture);
808 }
809
810 /******************************************************************************
811 * GdipCreateTexture2 [GDIPLUS.@]
812 */
813 GpStatus WINGDIPAPI GdipCreateTexture2(GpImage *image, GpWrapMode wrapmode,
814 REAL x, REAL y, REAL width, REAL height, GpTexture **texture)
815 {
816 GpImageAttributes attributes;
817
818 TRACE("%p %d %f %f %f %f %p\n", image, wrapmode,
819 x, y, width, height, texture);
820
821 attributes.wrap = wrapmode;
822 return GdipCreateTextureIA(image, &attributes, x, y, width, height,
823 texture);
824 }
825
826 /******************************************************************************
827 * GdipCreateTextureIA [GDIPLUS.@]
828 *
829 * FIXME: imageattr ignored
830 */
831 GpStatus WINGDIPAPI GdipCreateTextureIA(GpImage *image,
832 GDIPCONST GpImageAttributes *imageattr, REAL x, REAL y, REAL width,
833 REAL height, GpTexture **texture)
834 {
835 HBITMAP hbm=NULL;
836 GpStatus status;
837 GpImage *new_image=NULL;
838
839 TRACE("(%p, %p, %.2f, %.2f, %.2f, %.2f, %p)\n", image, imageattr, x, y, width, height,
840 texture);
841
842 if(!image || !texture || x < 0.0 || y < 0.0 || width < 0.0 || height < 0.0)
843 return InvalidParameter;
844
845 *texture = NULL;
846
847 if(image->type != ImageTypeBitmap){
848 FIXME("not implemented for image type %d\n", image->type);
849 return NotImplemented;
850 }
851
852 status = GdipCloneBitmapArea(x, y, width, height, PixelFormatDontCare, (GpBitmap*)image, (GpBitmap**)&new_image);
853 if (status != Ok)
854 return status;
855
856 status = GdipCreateHBITMAPFromBitmap((GpBitmap*)new_image, &hbm, 0);
857 if(!hbm)
858 {
859 status = GenericError;
860 goto exit;
861 }
862
863 *texture = GdipAlloc(sizeof(GpTexture));
864 if (!*texture){
865 status = OutOfMemory;
866 goto exit;
867 }
868
869 if((status = GdipCreateMatrix(&(*texture)->transform)) != Ok){
870 goto exit;
871 }
872
873 (*texture)->brush.lb.lbStyle = BS_PATTERN;
874 (*texture)->brush.lb.lbColor = 0;
875 (*texture)->brush.lb.lbHatch = (ULONG_PTR)hbm;
876
877 (*texture)->brush.gdibrush = CreateBrushIndirect(&(*texture)->brush.lb);
878 (*texture)->brush.bt = BrushTypeTextureFill;
879 if (imageattr)
880 (*texture)->wrap = imageattr->wrap;
881 else
882 (*texture)->wrap = WrapModeTile;
883 (*texture)->image = new_image;
884
885 exit:
886 if (status == Ok)
887 {
888 TRACE("<-- %p\n", *texture);
889 }
890 else
891 {
892 if (*texture)
893 {
894 GdipDeleteMatrix((*texture)->transform);
895 GdipFree(*texture);
896 *texture = NULL;
897 }
898 GdipDisposeImage(new_image);
899 TRACE("<-- error %u\n", status);
900 }
901
902 DeleteObject(hbm);
903
904 return status;
905 }
906
907 /******************************************************************************
908 * GdipCreateTextureIAI [GDIPLUS.@]
909 */
910 GpStatus WINGDIPAPI GdipCreateTextureIAI(GpImage *image, GDIPCONST GpImageAttributes *imageattr,
911 INT x, INT y, INT width, INT height, GpTexture **texture)
912 {
913 TRACE("(%p, %p, %d, %d, %d, %d, %p)\n", image, imageattr, x, y, width, height,
914 texture);
915
916 return GdipCreateTextureIA(image,imageattr,(REAL)x,(REAL)y,(REAL)width,(REAL)height,texture);
917 }
918
919 GpStatus WINGDIPAPI GdipCreateTexture2I(GpImage *image, GpWrapMode wrapmode,
920 INT x, INT y, INT width, INT height, GpTexture **texture)
921 {
922 GpImageAttributes imageattr;
923
924 TRACE("%p %d %d %d %d %d %p\n", image, wrapmode, x, y, width, height,
925 texture);
926
927 imageattr.wrap = wrapmode;
928
929 return GdipCreateTextureIA(image, &imageattr, x, y, width, height, texture);
930 }
931
932 GpStatus WINGDIPAPI GdipGetBrushType(GpBrush *brush, GpBrushType *type)
933 {
934 TRACE("(%p, %p)\n", brush, type);
935
936 if(!brush || !type) return InvalidParameter;
937
938 *type = brush->bt;
939
940 return Ok;
941 }
942
943 GpStatus WINGDIPAPI GdipGetHatchBackgroundColor(GpHatch *brush, ARGB *backcol)
944 {
945 TRACE("(%p, %p)\n", brush, backcol);
946
947 if(!brush || !backcol) return InvalidParameter;
948
949 *backcol = brush->backcol;
950
951 return Ok;
952 }
953
954 GpStatus WINGDIPAPI GdipGetHatchForegroundColor(GpHatch *brush, ARGB *forecol)
955 {
956 TRACE("(%p, %p)\n", brush, forecol);
957
958 if(!brush || !forecol) return InvalidParameter;
959
960 *forecol = brush->forecol;
961
962 return Ok;
963 }
964
965 GpStatus WINGDIPAPI GdipGetHatchStyle(GpHatch *brush, HatchStyle *hatchstyle)
966 {
967 TRACE("(%p, %p)\n", brush, hatchstyle);
968
969 if(!brush || !hatchstyle) return InvalidParameter;
970
971 *hatchstyle = brush->hatchstyle;
972
973 return Ok;
974 }
975
976 GpStatus WINGDIPAPI GdipDeleteBrush(GpBrush *brush)
977 {
978 TRACE("(%p)\n", brush);
979
980 if(!brush) return InvalidParameter;
981
982 switch(brush->bt)
983 {
984 case BrushTypePathGradient:
985 GdipFree(((GpPathGradient*) brush)->pathdata.Points);
986 GdipFree(((GpPathGradient*) brush)->pathdata.Types);
987 GdipFree(((GpPathGradient*) brush)->blendfac);
988 GdipFree(((GpPathGradient*) brush)->blendpos);
989 break;
990 case BrushTypeSolidColor:
991 if (((GpSolidFill*)brush)->bmp)
992 DeleteObject(((GpSolidFill*)brush)->bmp);
993 break;
994 case BrushTypeLinearGradient:
995 GdipFree(((GpLineGradient*)brush)->blendfac);
996 GdipFree(((GpLineGradient*)brush)->blendpos);
997 GdipFree(((GpLineGradient*)brush)->pblendcolor);
998 GdipFree(((GpLineGradient*)brush)->pblendpos);
999 break;
1000 case BrushTypeTextureFill:
1001 GdipDeleteMatrix(((GpTexture*)brush)->transform);
1002 GdipDisposeImage(((GpTexture*)brush)->image);
1003 break;
1004 default:
1005 break;
1006 }
1007
1008 DeleteObject(brush->gdibrush);
1009 GdipFree(brush);
1010
1011 return Ok;
1012 }
1013
1014 GpStatus WINGDIPAPI GdipGetLineGammaCorrection(GpLineGradient *line,
1015 BOOL *usinggamma)
1016 {
1017 TRACE("(%p, %p)\n", line, usinggamma);
1018
1019 if(!line || !usinggamma)
1020 return InvalidParameter;
1021
1022 *usinggamma = line->gamma;
1023
1024 return Ok;
1025 }
1026
1027 GpStatus WINGDIPAPI GdipGetLineWrapMode(GpLineGradient *brush, GpWrapMode *wrapmode)
1028 {
1029 TRACE("(%p, %p)\n", brush, wrapmode);
1030
1031 if(!brush || !wrapmode)
1032 return InvalidParameter;
1033
1034 *wrapmode = brush->wrap;
1035
1036 return Ok;
1037 }
1038
1039 GpStatus WINGDIPAPI GdipGetPathGradientBlend(GpPathGradient *brush, REAL *blend,
1040 REAL *positions, INT count)
1041 {
1042 TRACE("(%p, %p, %p, %d)\n", brush, blend, positions, count);
1043
1044 if(!brush || !blend || !positions || count <= 0)
1045 return InvalidParameter;
1046
1047 if(count < brush->blendcount)
1048 return InsufficientBuffer;
1049
1050 memcpy(blend, brush->blendfac, count*sizeof(REAL));
1051 if(brush->blendcount > 1){
1052 memcpy(positions, brush->blendpos, count*sizeof(REAL));
1053 }
1054
1055 return Ok;
1056 }
1057
1058 GpStatus WINGDIPAPI GdipGetPathGradientBlendCount(GpPathGradient *brush, INT *count)
1059 {
1060 TRACE("(%p, %p)\n", brush, count);
1061
1062 if(!brush || !count)
1063 return InvalidParameter;
1064
1065 *count = brush->blendcount;
1066
1067 return Ok;
1068 }
1069
1070 GpStatus WINGDIPAPI GdipGetPathGradientCenterPoint(GpPathGradient *grad,
1071 GpPointF *point)
1072 {
1073 TRACE("(%p, %p)\n", grad, point);
1074
1075 if(!grad || !point)
1076 return InvalidParameter;
1077
1078 point->X = grad->center.X;
1079 point->Y = grad->center.Y;
1080
1081 return Ok;
1082 }
1083
1084 GpStatus WINGDIPAPI GdipGetPathGradientCenterPointI(GpPathGradient *grad,
1085 GpPoint *point)
1086 {
1087 GpStatus ret;
1088 GpPointF ptf;
1089
1090 TRACE("(%p, %p)\n", grad, point);
1091
1092 if(!point)
1093 return InvalidParameter;
1094
1095 ret = GdipGetPathGradientCenterPoint(grad,&ptf);
1096
1097 if(ret == Ok){
1098 point->X = roundr(ptf.X);
1099 point->Y = roundr(ptf.Y);
1100 }
1101
1102 return ret;
1103 }
1104
1105 GpStatus WINGDIPAPI GdipGetPathGradientCenterColor(GpPathGradient *grad,
1106 ARGB *colors)
1107 {
1108 static int calls;
1109
1110 TRACE("(%p,%p)\n", grad, colors);
1111
1112 if(!(calls++))
1113 FIXME("not implemented\n");
1114
1115 return NotImplemented;
1116 }
1117
1118 GpStatus WINGDIPAPI GdipGetPathGradientFocusScales(GpPathGradient *grad,
1119 REAL *x, REAL *y)
1120 {
1121 TRACE("(%p, %p, %p)\n", grad, x, y);
1122
1123 if(!grad || !x || !y)
1124 return InvalidParameter;
1125
1126 *x = grad->focus.X;
1127 *y = grad->focus.Y;
1128
1129 return Ok;
1130 }
1131
1132 GpStatus WINGDIPAPI GdipGetPathGradientGammaCorrection(GpPathGradient *grad,
1133 BOOL *gamma)
1134 {
1135 TRACE("(%p, %p)\n", grad, gamma);
1136
1137 if(!grad || !gamma)
1138 return InvalidParameter;
1139
1140 *gamma = grad->gamma;
1141
1142 return Ok;
1143 }
1144
1145 GpStatus WINGDIPAPI GdipGetPathGradientPointCount(GpPathGradient *grad,
1146 INT *count)
1147 {
1148 TRACE("(%p, %p)\n", grad, count);
1149
1150 if(!grad || !count)
1151 return InvalidParameter;
1152
1153 *count = grad->pathdata.Count;
1154
1155 return Ok;
1156 }
1157
1158 GpStatus WINGDIPAPI GdipGetPathGradientRect(GpPathGradient *brush, GpRectF *rect)
1159 {
1160 GpRectF r;
1161 GpPath* path;
1162 GpStatus stat;
1163
1164 TRACE("(%p, %p)\n", brush, rect);
1165
1166 if(!brush || !rect)
1167 return InvalidParameter;
1168
1169 stat = GdipCreatePath2(brush->pathdata.Points, brush->pathdata.Types,
1170 brush->pathdata.Count, FillModeAlternate, &path);
1171 if(stat != Ok) return stat;
1172
1173 stat = GdipGetPathWorldBounds(path, &r, NULL, NULL);
1174 if(stat != Ok){
1175 GdipDeletePath(path);
1176 return stat;
1177 }
1178
1179 memcpy(rect, &r, sizeof(GpRectF));
1180
1181 GdipDeletePath(path);
1182
1183 return Ok;
1184 }
1185
1186 GpStatus WINGDIPAPI GdipGetPathGradientRectI(GpPathGradient *brush, GpRect *rect)
1187 {
1188 GpRectF rectf;
1189 GpStatus stat;
1190
1191 TRACE("(%p, %p)\n", brush, rect);
1192
1193 if(!brush || !rect)
1194 return InvalidParameter;
1195
1196 stat = GdipGetPathGradientRect(brush, &rectf);
1197 if(stat != Ok) return stat;
1198
1199 rect->X = roundr(rectf.X);
1200 rect->Y = roundr(rectf.Y);
1201 rect->Width = roundr(rectf.Width);
1202 rect->Height = roundr(rectf.Height);
1203
1204 return Ok;
1205 }
1206
1207 GpStatus WINGDIPAPI GdipGetPathGradientSurroundColorsWithCount(GpPathGradient
1208 *grad, ARGB *argb, INT *count)
1209 {
1210 static int calls;
1211
1212 TRACE("(%p,%p,%p)\n", grad, argb, count);
1213
1214 if(!grad || !argb || !count || (*count < grad->pathdata.Count))
1215 return InvalidParameter;
1216
1217 if(!(calls++))
1218 FIXME("not implemented\n");
1219
1220 return NotImplemented;
1221 }
1222
1223 GpStatus WINGDIPAPI GdipGetPathGradientSurroundColorCount(GpPathGradient *brush, INT *count)
1224 {
1225 TRACE("(%p, %p)\n", brush, count);
1226
1227 if (!brush || !count)
1228 return InvalidParameter;
1229
1230 return NotImplemented;
1231 }
1232
1233 GpStatus WINGDIPAPI GdipGetPathGradientWrapMode(GpPathGradient *brush,
1234 GpWrapMode *wrapmode)
1235 {
1236 TRACE("(%p, %p)\n", brush, wrapmode);
1237
1238 if(!brush || !wrapmode)
1239 return InvalidParameter;
1240
1241 *wrapmode = brush->wrap;
1242
1243 return Ok;
1244 }
1245
1246 GpStatus WINGDIPAPI GdipGetSolidFillColor(GpSolidFill *sf, ARGB *argb)
1247 {
1248 TRACE("(%p, %p)\n", sf, argb);
1249
1250 if(!sf || !argb)
1251 return InvalidParameter;
1252
1253 *argb = sf->color;
1254
1255 return Ok;
1256 }
1257
1258 /******************************************************************************
1259 * GdipGetTextureImage [GDIPLUS.@]
1260 */
1261 GpStatus WINGDIPAPI GdipGetTextureImage(GpTexture *brush, GpImage **image)
1262 {
1263 TRACE("(%p, %p)\n", brush, image);
1264
1265 if(!brush || !image)
1266 return InvalidParameter;
1267
1268 return GdipCloneImage(brush->image, image);
1269 }
1270
1271 /******************************************************************************
1272 * GdipGetTextureTransform [GDIPLUS.@]
1273 */
1274 GpStatus WINGDIPAPI GdipGetTextureTransform(GpTexture *brush, GpMatrix *matrix)
1275 {
1276 TRACE("(%p, %p)\n", brush, matrix);
1277
1278 if(!brush || !matrix)
1279 return InvalidParameter;
1280
1281 memcpy(matrix, brush->transform, sizeof(GpMatrix));
1282
1283 return Ok;
1284 }
1285
1286 /******************************************************************************
1287 * GdipGetTextureWrapMode [GDIPLUS.@]
1288 */
1289 GpStatus WINGDIPAPI GdipGetTextureWrapMode(GpTexture *brush, GpWrapMode *wrapmode)
1290 {
1291 TRACE("(%p, %p)\n", brush, wrapmode);
1292
1293 if(!brush || !wrapmode)
1294 return InvalidParameter;
1295
1296 *wrapmode = brush->wrap;
1297
1298 return Ok;
1299 }
1300
1301 /******************************************************************************
1302 * GdipMultiplyTextureTransform [GDIPLUS.@]
1303 */
1304 GpStatus WINGDIPAPI GdipMultiplyTextureTransform(GpTexture* brush,
1305 GDIPCONST GpMatrix *matrix, GpMatrixOrder order)
1306 {
1307 TRACE("(%p, %p, %d)\n", brush, matrix, order);
1308
1309 if(!brush || !matrix)
1310 return InvalidParameter;
1311
1312 return GdipMultiplyMatrix(brush->transform, matrix, order);
1313 }
1314
1315 /******************************************************************************
1316 * GdipResetTextureTransform [GDIPLUS.@]
1317 */
1318 GpStatus WINGDIPAPI GdipResetTextureTransform(GpTexture* brush)
1319 {
1320 TRACE("(%p)\n", brush);
1321
1322 if(!brush)
1323 return InvalidParameter;
1324
1325 return GdipSetMatrixElements(brush->transform, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0);
1326 }
1327
1328 /******************************************************************************
1329 * GdipScaleTextureTransform [GDIPLUS.@]
1330 */
1331 GpStatus WINGDIPAPI GdipScaleTextureTransform(GpTexture* brush,
1332 REAL sx, REAL sy, GpMatrixOrder order)
1333 {
1334 TRACE("(%p, %.2f, %.2f, %d)\n", brush, sx, sy, order);
1335
1336 if(!brush)
1337 return InvalidParameter;
1338
1339 return GdipScaleMatrix(brush->transform, sx, sy, order);
1340 }
1341
1342 GpStatus WINGDIPAPI GdipSetLineBlend(GpLineGradient *brush,
1343 GDIPCONST REAL *factors, GDIPCONST REAL* positions, INT count)
1344 {
1345 REAL *new_blendfac, *new_blendpos;
1346
1347 TRACE("(%p, %p, %p, %i)\n", brush, factors, positions, count);
1348
1349 if(!brush || !factors || !positions || count <= 0 ||
1350 (count >= 2 && (positions[0] != 0.0f || positions[count-1] != 1.0f)))
1351 return InvalidParameter;
1352
1353 new_blendfac = GdipAlloc(count * sizeof(REAL));
1354 new_blendpos = GdipAlloc(count * sizeof(REAL));
1355
1356 if (!new_blendfac || !new_blendpos)
1357 {
1358 GdipFree(new_blendfac);
1359 GdipFree(new_blendpos);
1360 return OutOfMemory;
1361 }
1362
1363 memcpy(new_blendfac, factors, count * sizeof(REAL));
1364 memcpy(new_blendpos, positions, count * sizeof(REAL));
1365
1366 GdipFree(brush->blendfac);
1367 GdipFree(brush->blendpos);
1368
1369 brush->blendcount = count;
1370 brush->blendfac = new_blendfac;
1371 brush->blendpos = new_blendpos;
1372
1373 return Ok;
1374 }
1375
1376 GpStatus WINGDIPAPI GdipGetLineBlend(GpLineGradient *brush, REAL *factors,
1377 REAL *positions, INT count)
1378 {
1379 TRACE("(%p, %p, %p, %i)\n", brush, factors, positions, count);
1380
1381 if (!brush || !factors || !positions || count <= 0)
1382 return InvalidParameter;
1383
1384 if (count < brush->blendcount)
1385 return InsufficientBuffer;
1386
1387 memcpy(factors, brush->blendfac, brush->blendcount * sizeof(REAL));
1388 memcpy(positions, brush->blendpos, brush->blendcount * sizeof(REAL));
1389
1390 return Ok;
1391 }
1392
1393 GpStatus WINGDIPAPI GdipGetLineBlendCount(GpLineGradient *brush, INT *count)
1394 {
1395 TRACE("(%p, %p)\n", brush, count);
1396
1397 if (!brush || !count)
1398 return InvalidParameter;
1399
1400 *count = brush->blendcount;
1401
1402 return Ok;
1403 }
1404
1405 GpStatus WINGDIPAPI GdipSetLineGammaCorrection(GpLineGradient *line,
1406 BOOL usegamma)
1407 {
1408 TRACE("(%p, %d)\n", line, usegamma);
1409
1410 if(!line)
1411 return InvalidParameter;
1412
1413 line->gamma = usegamma;
1414
1415 return Ok;
1416 }
1417
1418 GpStatus WINGDIPAPI GdipSetLineSigmaBlend(GpLineGradient *line, REAL focus,
1419 REAL scale)
1420 {
1421 REAL factors[33];
1422 REAL positions[33];
1423 int num_points = 0;
1424 int i;
1425 const int precision = 16;
1426 REAL erf_range; /* we use values erf(-erf_range) through erf(+erf_range) */
1427 REAL min_erf;
1428 REAL scale_erf;
1429
1430 TRACE("(%p, %0.2f, %0.2f)\n", line, focus, scale);
1431
1432 if(!line || focus < 0.0 || focus > 1.0 || scale < 0.0 || scale > 1.0)
1433 return InvalidParameter;
1434
1435 /* we want 2 standard deviations */
1436 erf_range = 2.0 / sqrt(2);
1437
1438 /* calculate the constants we need to normalize the error function to be
1439 between 0.0 and scale over the range we need */
1440 min_erf = erf(-erf_range);
1441 scale_erf = scale / (-2.0 * min_erf);
1442
1443 if (focus != 0.0)
1444 {
1445 positions[0] = 0.0;
1446 factors[0] = 0.0;
1447 for (i=1; i<precision; i++)
1448 {
1449 positions[i] = focus * i / precision;
1450 factors[i] = scale_erf * (erf(2 * erf_range * i / precision - erf_range) - min_erf);
1451 }
1452 num_points += precision;
1453 }
1454
1455 positions[num_points] = focus;
1456 factors[num_points] = scale;
1457 num_points += 1;
1458
1459 if (focus != 1.0)
1460 {
1461 for (i=1; i<precision; i++)
1462 {
1463 positions[i+num_points-1] = (focus + ((1.0-focus) * i / precision));
1464 factors[i+num_points-1] = scale_erf * (erf(erf_range - 2 * erf_range * i / precision) - min_erf);
1465 }
1466 num_points += precision;
1467 positions[num_points-1] = 1.0;
1468 factors[num_points-1] = 0.0;
1469 }
1470
1471 return GdipSetLineBlend(line, factors, positions, num_points);
1472 }
1473
1474 GpStatus WINGDIPAPI GdipSetLineWrapMode(GpLineGradient *line,
1475 GpWrapMode wrap)
1476 {
1477 TRACE("(%p, %d)\n", line, wrap);
1478
1479 if(!line || wrap == WrapModeClamp)
1480 return InvalidParameter;
1481
1482 line->wrap = wrap;
1483
1484 return Ok;
1485 }
1486
1487 GpStatus WINGDIPAPI GdipSetPathGradientBlend(GpPathGradient *brush, GDIPCONST REAL *blend,
1488 GDIPCONST REAL *pos, INT count)
1489 {
1490 static int calls;
1491
1492 TRACE("(%p,%p,%p,%i)\n", brush, blend, pos, count);
1493
1494 if(!(calls++))
1495 FIXME("not implemented\n");
1496
1497 return NotImplemented;
1498 }
1499
1500 GpStatus WINGDIPAPI GdipSetPathGradientLinearBlend(GpPathGradient *brush,
1501 REAL focus, REAL scale)
1502 {
1503 static int calls;
1504
1505 TRACE("(%p,%0.2f,%0.2f)\n", brush, focus, scale);
1506
1507 if(!(calls++))
1508 FIXME("not implemented\n");
1509
1510 return NotImplemented;
1511 }
1512
1513 GpStatus WINGDIPAPI GdipSetPathGradientPresetBlend(GpPathGradient *brush,
1514 GDIPCONST ARGB *blend, GDIPCONST REAL *pos, INT count)
1515 {
1516 FIXME("(%p,%p,%p,%i): stub\n", brush, blend, pos, count);
1517 return NotImplemented;
1518 }
1519
1520 GpStatus WINGDIPAPI GdipGetPathGradientPresetBlend(GpPathGradient *brush,
1521 ARGB *blend, REAL *pos, INT count)
1522 {
1523 FIXME("(%p,%p,%p,%i): stub\n", brush, blend, pos, count);
1524 return NotImplemented;
1525 }
1526
1527 GpStatus WINGDIPAPI GdipGetPathGradientPresetBlendCount(GpPathGradient *brush,
1528 INT *count)
1529 {
1530 FIXME("(%p,%p): stub\n", brush, count);
1531 return NotImplemented;
1532 }
1533
1534 GpStatus WINGDIPAPI GdipSetPathGradientCenterColor(GpPathGradient *grad,
1535 ARGB argb)
1536 {
1537 TRACE("(%p, %x)\n", grad, argb);
1538
1539 if(!grad)
1540 return InvalidParameter;
1541
1542 grad->centercolor = argb;
1543 grad->brush.lb.lbColor = ARGB2COLORREF(argb);
1544
1545 DeleteObject(grad->brush.gdibrush);
1546 grad->brush.gdibrush = CreateSolidBrush(grad->brush.lb.lbColor);
1547
1548 return Ok;
1549 }
1550
1551 GpStatus WINGDIPAPI GdipSetPathGradientCenterPoint(GpPathGradient *grad,
1552 GpPointF *point)
1553 {
1554 TRACE("(%p, %s)\n", grad, debugstr_pointf(point));
1555
1556 if(!grad || !point)
1557 return InvalidParameter;
1558
1559 grad->center.X = point->X;
1560 grad->center.Y = point->Y;
1561
1562 return Ok;
1563 }
1564
1565 GpStatus WINGDIPAPI GdipSetPathGradientCenterPointI(GpPathGradient *grad,
1566 GpPoint *point)
1567 {
1568 GpPointF ptf;
1569
1570 TRACE("(%p, %p)\n", grad, point);
1571
1572 if(!point)
1573 return InvalidParameter;
1574
1575 ptf.X = (REAL)point->X;
1576 ptf.Y = (REAL)point->Y;
1577
1578 return GdipSetPathGradientCenterPoint(grad,&ptf);
1579 }
1580
1581 GpStatus WINGDIPAPI GdipSetPathGradientFocusScales(GpPathGradient *grad,
1582 REAL x, REAL y)
1583 {
1584 TRACE("(%p, %.2f, %.2f)\n", grad, x, y);
1585
1586 if(!grad)
1587 return InvalidParameter;
1588
1589 grad->focus.X = x;
1590 grad->focus.Y = y;
1591
1592 return Ok;
1593 }
1594
1595 GpStatus WINGDIPAPI GdipSetPathGradientGammaCorrection(GpPathGradient *grad,
1596 BOOL gamma)
1597 {
1598 TRACE("(%p, %d)\n", grad, gamma);
1599
1600 if(!grad)
1601 return InvalidParameter;
1602
1603 grad->gamma = gamma;
1604
1605 return Ok;
1606 }
1607
1608 GpStatus WINGDIPAPI GdipSetPathGradientSigmaBlend(GpPathGradient *grad,
1609 REAL focus, REAL scale)
1610 {
1611 static int calls;
1612
1613 TRACE("(%p,%0.2f,%0.2f)\n", grad, focus, scale);
1614
1615 if(!grad || focus < 0.0 || focus > 1.0 || scale < 0.0 || scale > 1.0)
1616 return InvalidParameter;
1617
1618 if(!(calls++))
1619 FIXME("not implemented\n");
1620
1621 return NotImplemented;
1622 }
1623
1624 GpStatus WINGDIPAPI GdipSetPathGradientSurroundColorsWithCount(GpPathGradient
1625 *grad, GDIPCONST ARGB *argb, INT *count)
1626 {
1627 static int calls;
1628
1629 TRACE("(%p,%p,%p)\n", grad, argb, count);
1630
1631 if(!grad || !argb || !count || (*count <= 0) ||
1632 (*count > grad->pathdata.Count))
1633 return InvalidParameter;
1634
1635 if(!(calls++))
1636 FIXME("not implemented\n");
1637
1638 return NotImplemented;
1639 }
1640
1641 GpStatus WINGDIPAPI GdipSetPathGradientWrapMode(GpPathGradient *grad,
1642 GpWrapMode wrap)
1643 {
1644 TRACE("(%p, %d)\n", grad, wrap);
1645
1646 if(!grad)
1647 return InvalidParameter;
1648
1649 grad->wrap = wrap;
1650
1651 return Ok;
1652 }
1653
1654 GpStatus WINGDIPAPI GdipSetPathGradientTransform(GpPathGradient *grad,
1655 GpMatrix *matrix)
1656 {
1657 static int calls;
1658
1659 TRACE("(%p,%p)\n", grad, matrix);
1660
1661 if(!(calls++))
1662 FIXME("not implemented\n");
1663
1664 return NotImplemented;
1665 }
1666
1667 GpStatus WINGDIPAPI GdipGetPathGradientTransform(GpPathGradient *grad,
1668 GpMatrix *matrix)
1669 {
1670 static int calls;
1671
1672 TRACE("(%p,%p)\n", grad, matrix);
1673
1674 if(!(calls++))
1675 FIXME("not implemented\n");
1676
1677 return NotImplemented;
1678 }
1679
1680 GpStatus WINGDIPAPI GdipMultiplyPathGradientTransform(GpPathGradient *grad,
1681 GDIPCONST GpMatrix *matrix, GpMatrixOrder order)
1682 {
1683 static int calls;
1684
1685 TRACE("(%p,%p,%i)\n", grad, matrix, order);
1686
1687 if(!(calls++))
1688 FIXME("not implemented\n");
1689
1690 return NotImplemented;
1691 }
1692
1693 GpStatus WINGDIPAPI GdipRotatePathGradientTransform(GpPathGradient *grad,
1694 REAL angle, GpMatrixOrder order)
1695 {
1696 static int calls;
1697
1698 TRACE("(%p,%0.2f,%i)\n", grad, angle, order);
1699
1700 if(!(calls++))
1701 FIXME("not implemented\n");
1702
1703 return NotImplemented;
1704 }
1705
1706 GpStatus WINGDIPAPI GdipScalePathGradientTransform(GpPathGradient *grad,
1707 REAL sx, REAL sy, GpMatrixOrder order)
1708 {
1709 static int calls;
1710
1711 TRACE("(%p,%0.2f,%0.2f,%i)\n", grad, sx, sy, order);
1712
1713 if(!(calls++))
1714 FIXME("not implemented\n");
1715
1716 return NotImplemented;
1717 }
1718
1719 GpStatus WINGDIPAPI GdipTranslatePathGradientTransform(GpPathGradient *grad,
1720 REAL dx, REAL dy, GpMatrixOrder order)
1721 {
1722 static int calls;
1723
1724 TRACE("(%p,%0.2f,%0.2f,%i)\n", grad, dx, dy, order);
1725
1726 if(!(calls++))
1727 FIXME("not implemented\n");
1728
1729 return NotImplemented;
1730 }
1731
1732 GpStatus WINGDIPAPI GdipSetSolidFillColor(GpSolidFill *sf, ARGB argb)
1733 {
1734 TRACE("(%p, %x)\n", sf, argb);
1735
1736 if(!sf)
1737 return InvalidParameter;
1738
1739 sf->color = argb;
1740 sf->brush.lb.lbColor = ARGB2COLORREF(argb);
1741
1742 DeleteObject(sf->brush.gdibrush);
1743 sf->brush.gdibrush = CreateSolidBrush(sf->brush.lb.lbColor);
1744
1745 return Ok;
1746 }
1747
1748 /******************************************************************************
1749 * GdipSetTextureTransform [GDIPLUS.@]
1750 */
1751 GpStatus WINGDIPAPI GdipSetTextureTransform(GpTexture *texture,
1752 GDIPCONST GpMatrix *matrix)
1753 {
1754 TRACE("(%p, %p)\n", texture, matrix);
1755
1756 if(!texture || !matrix)
1757 return InvalidParameter;
1758
1759 memcpy(texture->transform, matrix, sizeof(GpMatrix));
1760
1761 return Ok;
1762 }
1763
1764 /******************************************************************************
1765 * GdipSetTextureWrapMode [GDIPLUS.@]
1766 *
1767 * WrapMode not used, only stored
1768 */
1769 GpStatus WINGDIPAPI GdipSetTextureWrapMode(GpTexture *brush, GpWrapMode wrapmode)
1770 {
1771 TRACE("(%p, %d)\n", brush, wrapmode);
1772
1773 if(!brush)
1774 return InvalidParameter;
1775
1776 brush->wrap = wrapmode;
1777
1778 return Ok;
1779 }
1780
1781 GpStatus WINGDIPAPI GdipSetLineColors(GpLineGradient *brush, ARGB color1,
1782 ARGB color2)
1783 {
1784 TRACE("(%p, %x, %x)\n", brush, color1, color2);
1785
1786 if(!brush)
1787 return InvalidParameter;
1788
1789 brush->startcolor = color1;
1790 brush->endcolor = color2;
1791
1792 return Ok;
1793 }
1794
1795 GpStatus WINGDIPAPI GdipGetLineColors(GpLineGradient *brush, ARGB *colors)
1796 {
1797 TRACE("(%p, %p)\n", brush, colors);
1798
1799 if(!brush || !colors)
1800 return InvalidParameter;
1801
1802 colors[0] = brush->startcolor;
1803 colors[1] = brush->endcolor;
1804
1805 return Ok;
1806 }
1807
1808 /******************************************************************************
1809 * GdipRotateTextureTransform [GDIPLUS.@]
1810 */
1811 GpStatus WINGDIPAPI GdipRotateTextureTransform(GpTexture* brush, REAL angle,
1812 GpMatrixOrder order)
1813 {
1814 TRACE("(%p, %.2f, %d)\n", brush, angle, order);
1815
1816 if(!brush)
1817 return InvalidParameter;
1818
1819 return GdipRotateMatrix(brush->transform, angle, order);
1820 }
1821
1822 GpStatus WINGDIPAPI GdipSetLineLinearBlend(GpLineGradient *brush, REAL focus,
1823 REAL scale)
1824 {
1825 REAL factors[3];
1826 REAL positions[3];
1827 int num_points = 0;
1828
1829 TRACE("(%p,%.2f,%.2f)\n", brush, focus, scale);
1830
1831 if (!brush) return InvalidParameter;
1832
1833 if (focus != 0.0)
1834 {
1835 factors[num_points] = 0.0;
1836 positions[num_points] = 0.0;
1837 num_points++;
1838 }
1839
1840 factors[num_points] = scale;
1841 positions[num_points] = focus;
1842 num_points++;
1843
1844 if (focus != 1.0)
1845 {
1846 factors[num_points] = 0.0;
1847 positions[num_points] = 1.0;
1848 num_points++;
1849 }
1850
1851 return GdipSetLineBlend(brush, factors, positions, num_points);
1852 }
1853
1854 GpStatus WINGDIPAPI GdipSetLinePresetBlend(GpLineGradient *brush,
1855 GDIPCONST ARGB *blend, GDIPCONST REAL* positions, INT count)
1856 {
1857 ARGB *new_color;
1858 REAL *new_pos;
1859 TRACE("(%p,%p,%p,%i)\n", brush, blend, positions, count);
1860
1861 if (!brush || !blend || !positions || count < 2 ||
1862 positions[0] != 0.0f || positions[count-1] != 1.0f)
1863 {
1864 return InvalidParameter;
1865 }
1866
1867 new_color = GdipAlloc(count * sizeof(ARGB));
1868 new_pos = GdipAlloc(count * sizeof(REAL));
1869 if (!new_color || !new_pos)
1870 {
1871 GdipFree(new_color);
1872 GdipFree(new_pos);
1873 return OutOfMemory;
1874 }
1875
1876 memcpy(new_color, blend, sizeof(ARGB) * count);
1877 memcpy(new_pos, positions, sizeof(REAL) * count);
1878
1879 GdipFree(brush->pblendcolor);
1880 GdipFree(brush->pblendpos);
1881
1882 brush->pblendcolor = new_color;
1883 brush->pblendpos = new_pos;
1884 brush->pblendcount = count;
1885
1886 return Ok;
1887 }
1888
1889 GpStatus WINGDIPAPI GdipGetLinePresetBlend(GpLineGradient *brush,
1890 ARGB *blend, REAL* positions, INT count)
1891 {
1892 if (!brush || !blend || !positions || count < 2)
1893 return InvalidParameter;
1894
1895 if (brush->pblendcount == 0)
1896 return GenericError;
1897
1898 if (count < brush->pblendcount)
1899 return InsufficientBuffer;
1900
1901 memcpy(blend, brush->pblendcolor, sizeof(ARGB) * brush->pblendcount);
1902 memcpy(positions, brush->pblendpos, sizeof(REAL) * brush->pblendcount);
1903
1904 return Ok;
1905 }
1906
1907 GpStatus WINGDIPAPI GdipGetLinePresetBlendCount(GpLineGradient *brush,
1908 INT *count)
1909 {
1910 if (!brush || !count)
1911 return InvalidParameter;
1912
1913 *count = brush->pblendcount;
1914
1915 return Ok;
1916 }
1917
1918 GpStatus WINGDIPAPI GdipResetLineTransform(GpLineGradient *brush)
1919 {
1920 static int calls;
1921
1922 TRACE("(%p)\n", brush);
1923
1924 if(!(calls++))
1925 FIXME("not implemented\n");
1926
1927 return NotImplemented;
1928 }
1929
1930 GpStatus WINGDIPAPI GdipSetLineTransform(GpLineGradient *brush,
1931 GDIPCONST GpMatrix *matrix)
1932 {
1933 static int calls;
1934
1935 TRACE("(%p,%p)\n", brush, matrix);
1936
1937 if(!(calls++))
1938 FIXME("not implemented\n");
1939
1940 return NotImplemented;
1941 }
1942
1943 GpStatus WINGDIPAPI GdipGetLineTransform(GpLineGradient *brush, GpMatrix *matrix)
1944 {
1945 static int calls;
1946
1947 TRACE("(%p,%p)\n", brush, matrix);
1948
1949 if(!(calls++))
1950 FIXME("not implemented\n");
1951
1952 return NotImplemented;
1953 }
1954
1955 GpStatus WINGDIPAPI GdipScaleLineTransform(GpLineGradient *brush, REAL sx, REAL sy,
1956 GpMatrixOrder order)
1957 {
1958 static int calls;
1959
1960 TRACE("(%p,%0.2f,%0.2f,%u)\n", brush, sx, sy, order);
1961
1962 if(!(calls++))
1963 FIXME("not implemented\n");
1964
1965 return NotImplemented;
1966 }
1967
1968 GpStatus WINGDIPAPI GdipMultiplyLineTransform(GpLineGradient *brush,
1969 GDIPCONST GpMatrix *matrix, GpMatrixOrder order)
1970 {
1971 static int calls;
1972
1973 TRACE("(%p,%p,%u)\n", brush, matrix, order);
1974
1975 if(!(calls++))
1976 FIXME("not implemented\n");
1977
1978 return NotImplemented;
1979 }
1980
1981 GpStatus WINGDIPAPI GdipTranslateLineTransform(GpLineGradient* brush,
1982 REAL dx, REAL dy, GpMatrixOrder order)
1983 {
1984 FIXME("stub: %p %f %f %d\n", brush, dx, dy, order);
1985
1986 return NotImplemented;
1987 }
1988
1989 /******************************************************************************
1990 * GdipTranslateTextureTransform [GDIPLUS.@]
1991 */
1992 GpStatus WINGDIPAPI GdipTranslateTextureTransform(GpTexture* brush, REAL dx, REAL dy,
1993 GpMatrixOrder order)
1994 {
1995 TRACE("(%p, %.2f, %.2f, %d)\n", brush, dx, dy, order);
1996
1997 if(!brush)
1998 return InvalidParameter;
1999
2000 return GdipTranslateMatrix(brush->transform, dx, dy, order);
2001 }
2002
2003 GpStatus WINGDIPAPI GdipGetLineRect(GpLineGradient *brush, GpRectF *rect)
2004 {
2005 TRACE("(%p, %p)\n", brush, rect);
2006
2007 if(!brush || !rect)
2008 return InvalidParameter;
2009
2010 *rect = brush->rect;
2011
2012 return Ok;
2013 }
2014
2015 GpStatus WINGDIPAPI GdipGetLineRectI(GpLineGradient *brush, GpRect *rect)
2016 {
2017 GpRectF rectF;
2018 GpStatus ret;
2019
2020 TRACE("(%p, %p)\n", brush, rect);
2021
2022 if(!rect)
2023 return InvalidParameter;
2024
2025 ret = GdipGetLineRect(brush, &rectF);
2026
2027 if(ret == Ok){
2028 rect->X = roundr(rectF.X);
2029 rect->Y = roundr(rectF.Y);
2030 rect->Width = roundr(rectF.Width);
2031 rect->Height = roundr(rectF.Height);
2032 }
2033
2034 return ret;
2035 }
2036
2037 GpStatus WINGDIPAPI GdipRotateLineTransform(GpLineGradient* brush,
2038 REAL angle, GpMatrixOrder order)
2039 {
2040 static int calls;
2041
2042 TRACE("(%p,%0.2f,%u)\n", brush, angle, order);
2043
2044 if(!brush)
2045 return InvalidParameter;
2046
2047 if(!(calls++))
2048 FIXME("(%p, %.2f, %d) stub\n", brush, angle, order);
2049
2050 return NotImplemented;
2051 }