2 * Copyright (C) 2007 Google (Evan Stade)
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.
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.
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
32 #include "gdiplus_private.h"
33 #include "wine/debug.h"
35 WINE_DEFAULT_DEBUG_CHANNEL(gdiplus);
37 /******************************************************************************
38 * GdipCloneBrush [GDIPLUS.@]
40 GpStatus WINGDIPAPI GdipCloneBrush(GpBrush *brush, GpBrush **clone)
42 TRACE("(%p, %p)\n", brush, clone);
45 return InvalidParameter;
48 case BrushTypeSolidColor:
50 *clone = GdipAlloc(sizeof(GpSolidFill));
51 if (!*clone) return OutOfMemory;
52 memcpy(*clone, brush, sizeof(GpSolidFill));
55 case BrushTypeHatchFill:
57 GpHatch *hatch = (GpHatch*)brush;
59 return GdipCreateHatchBrush(hatch->hatchstyle, hatch->forecol, hatch->backcol, (GpHatch**)clone);
61 case BrushTypePathGradient:{
62 GpPathGradient *src, *dest;
66 *clone = GdipAlloc(sizeof(GpPathGradient));
67 if (!*clone) return OutOfMemory;
69 src = (GpPathGradient*) brush,
70 dest = (GpPathGradient*) *clone;
72 memcpy(dest, src, sizeof(GpPathGradient));
74 stat = GdipClonePath(src->path, &dest->path);
82 count = src->blendcount;
83 dest->blendcount = count;
84 dest->blendfac = GdipAlloc(count * sizeof(REAL));
85 dest->blendpos = GdipAlloc(count * sizeof(REAL));
87 if(!dest->blendfac || !dest->blendpos){
88 GdipDeletePath(dest->path);
89 GdipFree(dest->blendfac);
90 GdipFree(dest->blendpos);
95 memcpy(dest->blendfac, src->blendfac, count * sizeof(REAL));
96 memcpy(dest->blendpos, src->blendpos, count * sizeof(REAL));
100 case BrushTypeLinearGradient:{
101 GpLineGradient *dest, *src;
104 dest = GdipAlloc(sizeof(GpLineGradient));
105 if(!dest) return OutOfMemory;
107 src = (GpLineGradient*)brush;
109 memcpy(dest, src, sizeof(GpLineGradient));
111 count = dest->blendcount;
112 dest->blendfac = GdipAlloc(count * sizeof(REAL));
113 dest->blendpos = GdipAlloc(count * sizeof(REAL));
114 pcount = dest->pblendcount;
117 dest->pblendcolor = GdipAlloc(pcount * sizeof(ARGB));
118 dest->pblendpos = GdipAlloc(pcount * sizeof(REAL));
121 if (!dest->blendfac || !dest->blendpos ||
122 (pcount && (!dest->pblendcolor || !dest->pblendpos)))
124 GdipFree(dest->blendfac);
125 GdipFree(dest->blendpos);
126 GdipFree(dest->pblendcolor);
127 GdipFree(dest->pblendpos);
132 memcpy(dest->blendfac, src->blendfac, count * sizeof(REAL));
133 memcpy(dest->blendpos, src->blendpos, count * sizeof(REAL));
137 memcpy(dest->pblendcolor, src->pblendcolor, pcount * sizeof(ARGB));
138 memcpy(dest->pblendpos, src->pblendpos, pcount * sizeof(REAL));
141 *clone = &dest->brush;
144 case BrushTypeTextureFill:
147 GpTexture *texture = (GpTexture*)brush;
148 GpTexture *new_texture;
151 stat = GdipGetImageWidth(texture->image, &width);
152 if (stat != Ok) return stat;
153 stat = GdipGetImageHeight(texture->image, &height);
154 if (stat != Ok) return stat;
156 stat = GdipCreateTextureIA(texture->image, texture->imageattributes, 0, 0, width, height, &new_texture);
160 memcpy(new_texture->transform, texture->transform, sizeof(GpMatrix));
161 *clone = (GpBrush*)new_texture;
169 ERR("not implemented for brush type %d\n", brush->bt);
170 return NotImplemented;
173 TRACE("<-- %p\n", *clone);
177 static const char HatchBrushes[][8] = {
178 { 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00 }, /* HatchStyleHorizontal */
179 { 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08 }, /* HatchStyleVertical */
180 { 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80 }, /* HatchStyleForwardDiagonal */
181 { 0x80, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x01 }, /* HatchStyleBackwardDiagonal */
182 { 0x08, 0x08, 0x08, 0xff, 0x08, 0x08, 0x08, 0x08 }, /* HatchStyleCross */
183 { 0x81, 0x42, 0x24, 0x18, 0x18, 0x24, 0x42, 0x81 }, /* HatchStyleDiagonalCross */
184 { 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x80 }, /* HatchStyle05Percent */
185 { 0x00, 0x02, 0x00, 0x88, 0x00, 0x20, 0x00, 0x88 }, /* HatchStyle10Percent */
186 { 0x00, 0x22, 0x00, 0xcc, 0x00, 0x22, 0x00, 0xcc }, /* HatchStyle20Percent */
187 { 0x00, 0xcc, 0x00, 0xcc, 0x00, 0xcc, 0x00, 0xcc }, /* HatchStyle25Percent */
188 { 0x00, 0xcc, 0x04, 0xcc, 0x00, 0xcc, 0x40, 0xcc }, /* HatchStyle30Percent */
189 { 0x44, 0xcc, 0x22, 0xcc, 0x44, 0xcc, 0x22, 0xcc }, /* HatchStyle40Percent */
190 { 0x55, 0xcc, 0x55, 0xcc, 0x55, 0xcc, 0x55, 0xcc }, /* HatchStyle50Percent */
191 { 0x55, 0xcd, 0x55, 0xee, 0x55, 0xdc, 0x55, 0xee }, /* HatchStyle60Percent */
192 { 0x55, 0xdd, 0x55, 0xff, 0x55, 0xdd, 0x55, 0xff }, /* HatchStyle70Percent */
193 { 0x55, 0xff, 0x55, 0xff, 0x55, 0xff, 0x55, 0xff }, /* HatchStyle75Percent */
194 { 0x55, 0xff, 0x59, 0xff, 0x55, 0xff, 0x99, 0xff }, /* HatchStyle80Percent */
195 { 0x77, 0xff, 0xdd, 0xff, 0x77, 0xff, 0xfd, 0xff }, /* HatchStyle90Percent */
196 { 0x11, 0x22, 0x44, 0x88, 0x11, 0x22, 0x44, 0x88 }, /* HatchStyleLightDownwardDiagonal */
197 { 0x88, 0x44, 0x22, 0x11, 0x88, 0x44, 0x22, 0x11 }, /* HatchStyleLightUpwardDiagonal */
198 { 0x99, 0x33, 0x66, 0xcc, 0x99, 0x33, 0x66, 0xcc }, /* HatchStyleDarkDownwardDiagonal */
199 { 0xcc, 0x66, 0x33, 0x99, 0xcc, 0x66, 0x33, 0x99 }, /* HatchStyleDarkUpwardDiagonal */
200 { 0xc1, 0x83, 0x07, 0x0e, 0x1c, 0x38, 0x70, 0xe0 }, /* HatchStyleWideDownwardDiagonal */
201 { 0xe0, 0x70, 0x38, 0x1c, 0x0e, 0x07, 0x83, 0xc1 }, /* HatchStyleWideUpwardDiagonal */
202 { 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88 }, /* HatchStyleLightVertical */
203 { 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff }, /* HatchStyleLightHorizontal */
204 { 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa }, /* HatchStyleNarrowVertical */
205 { 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff }, /* HatchStyleNarrowHorizontal */
206 { 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc }, /* HatchStyleDarkVertical */
207 { 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0xff, 0xff }, /* HatchStyleDarkHorizontal */
210 GpStatus get_hatch_data(HatchStyle hatchstyle, const char **result)
212 if (hatchstyle < sizeof(HatchBrushes) / sizeof(HatchBrushes[0]))
214 *result = HatchBrushes[hatchstyle];
218 return NotImplemented;
221 /******************************************************************************
222 * GdipCreateHatchBrush [GDIPLUS.@]
224 GpStatus WINGDIPAPI GdipCreateHatchBrush(HatchStyle hatchstyle, ARGB forecol, ARGB backcol, GpHatch **brush)
226 TRACE("(%d, %d, %d, %p)\n", hatchstyle, forecol, backcol, brush);
228 if(!brush) return InvalidParameter;
230 *brush = GdipAlloc(sizeof(GpHatch));
231 if (!*brush) return OutOfMemory;
233 (*brush)->brush.bt = BrushTypeHatchFill;
234 (*brush)->forecol = forecol;
235 (*brush)->backcol = backcol;
236 (*brush)->hatchstyle = hatchstyle;
237 TRACE("<-- %p\n", *brush);
242 /******************************************************************************
243 * GdipCreateLineBrush [GDIPLUS.@]
245 GpStatus WINGDIPAPI GdipCreateLineBrush(GDIPCONST GpPointF* startpoint,
246 GDIPCONST GpPointF* endpoint, ARGB startcolor, ARGB endcolor,
247 GpWrapMode wrap, GpLineGradient **line)
249 TRACE("(%s, %s, %x, %x, %d, %p)\n", debugstr_pointf(startpoint),
250 debugstr_pointf(endpoint), startcolor, endcolor, wrap, line);
252 if(!line || !startpoint || !endpoint || wrap == WrapModeClamp)
253 return InvalidParameter;
255 if (startpoint->X == endpoint->X && startpoint->Y == endpoint->Y)
258 *line = GdipAlloc(sizeof(GpLineGradient));
259 if(!*line) return OutOfMemory;
261 (*line)->brush.bt = BrushTypeLinearGradient;
263 (*line)->startpoint.X = startpoint->X;
264 (*line)->startpoint.Y = startpoint->Y;
265 (*line)->endpoint.X = endpoint->X;
266 (*line)->endpoint.Y = endpoint->Y;
267 (*line)->startcolor = startcolor;
268 (*line)->endcolor = endcolor;
269 (*line)->wrap = wrap;
270 (*line)->gamma = FALSE;
272 (*line)->rect.X = (startpoint->X < endpoint->X ? startpoint->X: endpoint->X);
273 (*line)->rect.Y = (startpoint->Y < endpoint->Y ? startpoint->Y: endpoint->Y);
274 (*line)->rect.Width = fabs(startpoint->X - endpoint->X);
275 (*line)->rect.Height = fabs(startpoint->Y - endpoint->Y);
277 if ((*line)->rect.Width == 0)
279 (*line)->rect.X -= (*line)->rect.Height / 2.0f;
280 (*line)->rect.Width = (*line)->rect.Height;
282 else if ((*line)->rect.Height == 0)
284 (*line)->rect.Y -= (*line)->rect.Width / 2.0f;
285 (*line)->rect.Height = (*line)->rect.Width;
288 (*line)->blendcount = 1;
289 (*line)->blendfac = GdipAlloc(sizeof(REAL));
290 (*line)->blendpos = GdipAlloc(sizeof(REAL));
292 if (!(*line)->blendfac || !(*line)->blendpos)
294 GdipFree((*line)->blendfac);
295 GdipFree((*line)->blendpos);
301 (*line)->blendfac[0] = 1.0f;
302 (*line)->blendpos[0] = 1.0f;
304 (*line)->pblendcolor = NULL;
305 (*line)->pblendpos = NULL;
306 (*line)->pblendcount = 0;
308 TRACE("<-- %p\n", *line);
313 GpStatus WINGDIPAPI GdipCreateLineBrushI(GDIPCONST GpPoint* startpoint,
314 GDIPCONST GpPoint* endpoint, ARGB startcolor, ARGB endcolor,
315 GpWrapMode wrap, GpLineGradient **line)
320 TRACE("(%p, %p, %x, %x, %d, %p)\n", startpoint, endpoint,
321 startcolor, endcolor, wrap, line);
323 if(!startpoint || !endpoint)
324 return InvalidParameter;
326 stF.X = (REAL)startpoint->X;
327 stF.Y = (REAL)startpoint->Y;
328 endF.X = (REAL)endpoint->X;
329 endF.Y = (REAL)endpoint->Y;
331 return GdipCreateLineBrush(&stF, &endF, startcolor, endcolor, wrap, line);
334 GpStatus WINGDIPAPI GdipCreateLineBrushFromRect(GDIPCONST GpRectF* rect,
335 ARGB startcolor, ARGB endcolor, LinearGradientMode mode, GpWrapMode wrap,
336 GpLineGradient **line)
341 TRACE("(%p, %x, %x, %d, %d, %p)\n", rect, startcolor, endcolor, mode,
345 return InvalidParameter;
349 case LinearGradientModeHorizontal:
352 end.X = rect->X + rect->Width;
355 case LinearGradientModeVertical:
359 end.Y = rect->Y + rect->Height;
361 case LinearGradientModeForwardDiagonal:
364 end.X = rect->X + rect->Width;
365 end.Y = rect->Y + rect->Height;
367 case LinearGradientModeBackwardDiagonal:
368 start.X = rect->X + rect->Width;
371 end.Y = rect->Y + rect->Height;
374 return InvalidParameter;
377 stat = GdipCreateLineBrush(&start, &end, startcolor, endcolor, wrap, line);
380 (*line)->rect = *rect;
385 GpStatus WINGDIPAPI GdipCreateLineBrushFromRectI(GDIPCONST GpRect* rect,
386 ARGB startcolor, ARGB endcolor, LinearGradientMode mode, GpWrapMode wrap,
387 GpLineGradient **line)
391 TRACE("(%p, %x, %x, %d, %d, %p)\n", rect, startcolor, endcolor, mode,
394 rectF.X = (REAL) rect->X;
395 rectF.Y = (REAL) rect->Y;
396 rectF.Width = (REAL) rect->Width;
397 rectF.Height = (REAL) rect->Height;
399 return GdipCreateLineBrushFromRect(&rectF, startcolor, endcolor, mode, wrap, line);
402 /******************************************************************************
403 * GdipCreateLineBrushFromRectWithAngle [GDIPLUS.@]
405 GpStatus WINGDIPAPI GdipCreateLineBrushFromRectWithAngle(GDIPCONST GpRectF* rect,
406 ARGB startcolor, ARGB endcolor, REAL angle, BOOL isAngleScalable, GpWrapMode wrap,
407 GpLineGradient **line)
410 LinearGradientMode mode;
411 REAL width, height, exofs, eyofs;
412 REAL sin_angle, cos_angle, sin_cos_angle;
414 TRACE("(%p, %x, %x, %.2f, %d, %d, %p)\n", rect, startcolor, endcolor, angle, isAngleScalable,
417 sin_angle = sinf(deg2rad(angle));
418 cos_angle = cosf(deg2rad(angle));
419 sin_cos_angle = sin_angle * cos_angle;
423 width = height = 1.0;
428 height = rect->Height;
431 if (sin_cos_angle >= 0)
432 mode = LinearGradientModeForwardDiagonal;
434 mode = LinearGradientModeBackwardDiagonal;
436 stat = GdipCreateLineBrushFromRect(rect, startcolor, endcolor, mode, wrap, line);
440 if (sin_cos_angle >= 0)
442 exofs = width * sin_cos_angle + height * cos_angle * cos_angle;
443 eyofs = width * sin_angle * sin_angle + height * sin_cos_angle;
447 exofs = width * sin_angle * sin_angle + height * sin_cos_angle;
448 eyofs = -width * sin_cos_angle + height * sin_angle * sin_angle;
453 exofs = exofs * rect->Width;
454 eyofs = eyofs * rect->Height;
459 (*line)->endpoint.X = rect->X + exofs;
460 (*line)->endpoint.Y = rect->Y + eyofs;
464 (*line)->endpoint.X = (*line)->startpoint.X;
465 (*line)->endpoint.Y = (*line)->startpoint.Y;
466 (*line)->startpoint.X = rect->X + exofs;
467 (*line)->startpoint.Y = rect->Y + eyofs;
474 GpStatus WINGDIPAPI GdipCreateLineBrushFromRectWithAngleI(GDIPCONST GpRect* rect,
475 ARGB startcolor, ARGB endcolor, REAL angle, BOOL isAngleScalable, GpWrapMode wrap,
476 GpLineGradient **line)
478 TRACE("(%p, %x, %x, %.2f, %d, %d, %p)\n", rect, startcolor, endcolor, angle, isAngleScalable,
481 return GdipCreateLineBrushFromRectI(rect, startcolor, endcolor, LinearGradientModeForwardDiagonal,
485 static GpStatus create_path_gradient(GpPath *path, GpPathGradient **grad)
490 return InvalidParameter;
492 GdipGetPathWorldBounds(path, &bounds, NULL, NULL);
494 *grad = GdipAlloc(sizeof(GpPathGradient));
500 (*grad)->blendfac = GdipAlloc(sizeof(REAL));
501 (*grad)->blendpos = GdipAlloc(sizeof(REAL));
502 if(!(*grad)->blendfac || !(*grad)->blendpos){
503 GdipFree((*grad)->blendfac);
504 GdipFree((*grad)->blendpos);
509 (*grad)->blendfac[0] = 1.0;
510 (*grad)->blendpos[0] = 1.0;
511 (*grad)->blendcount = 1;
513 (*grad)->path = path;
515 (*grad)->brush.bt = BrushTypePathGradient;
516 (*grad)->centercolor = 0xffffffff;
517 (*grad)->wrap = WrapModeClamp;
518 (*grad)->gamma = FALSE;
519 /* FIXME: this should be set to the "centroid" of the path by default */
520 (*grad)->center.X = bounds.X + bounds.Width / 2;
521 (*grad)->center.Y = bounds.Y + bounds.Height / 2;
522 (*grad)->focus.X = 0.0;
523 (*grad)->focus.Y = 0.0;
525 TRACE("<-- %p\n", *grad);
530 GpStatus WINGDIPAPI GdipCreatePathGradient(GDIPCONST GpPointF* points,
531 INT count, GpWrapMode wrap, GpPathGradient **grad)
536 TRACE("(%p, %d, %d, %p)\n", points, count, wrap, grad);
539 return InvalidParameter;
544 stat = GdipCreatePath(FillModeAlternate, &path);
548 stat = GdipAddPathLine2(path, points, count);
551 stat = create_path_gradient(path, grad);
554 GdipDeletePath(path);
560 GpStatus WINGDIPAPI GdipCreatePathGradientI(GDIPCONST GpPoint* points,
561 INT count, GpWrapMode wrap, GpPathGradient **grad)
566 TRACE("(%p, %d, %d, %p)\n", points, count, wrap, grad);
569 return InvalidParameter;
574 stat = GdipCreatePath(FillModeAlternate, &path);
578 stat = GdipAddPathLine2I(path, points, count);
581 stat = create_path_gradient(path, grad);
584 GdipDeletePath(path);
590 /******************************************************************************
591 * GdipCreatePathGradientFromPath [GDIPLUS.@]
593 GpStatus WINGDIPAPI GdipCreatePathGradientFromPath(GDIPCONST GpPath* path,
594 GpPathGradient **grad)
599 TRACE("(%p, %p)\n", path, grad);
602 return InvalidParameter;
604 stat = GdipClonePath((GpPath*)path, &new_path);
608 stat = create_path_gradient(new_path, grad);
611 GdipDeletePath(new_path);
617 /******************************************************************************
618 * GdipCreateSolidFill [GDIPLUS.@]
620 GpStatus WINGDIPAPI GdipCreateSolidFill(ARGB color, GpSolidFill **sf)
622 TRACE("(%x, %p)\n", color, sf);
624 if(!sf) return InvalidParameter;
626 *sf = GdipAlloc(sizeof(GpSolidFill));
627 if (!*sf) return OutOfMemory;
629 (*sf)->brush.bt = BrushTypeSolidColor;
630 (*sf)->color = color;
632 TRACE("<-- %p\n", *sf);
637 /******************************************************************************
638 * GdipCreateTexture [GDIPLUS.@]
641 * image [I] image to use
642 * wrapmode [I] optional
643 * texture [O] pointer to the resulting texturebrush
647 * FAILURE: element of GpStatus
649 GpStatus WINGDIPAPI GdipCreateTexture(GpImage *image, GpWrapMode wrapmode,
653 GpImageAttributes *attributes;
656 TRACE("%p, %d %p\n", image, wrapmode, texture);
658 if (!(image && texture))
659 return InvalidParameter;
661 stat = GdipGetImageWidth(image, &width);
662 if (stat != Ok) return stat;
663 stat = GdipGetImageHeight(image, &height);
664 if (stat != Ok) return stat;
666 stat = GdipCreateImageAttributes(&attributes);
670 attributes->wrap = wrapmode;
672 stat = GdipCreateTextureIA(image, attributes, 0, 0, width, height,
675 GdipDisposeImageAttributes(attributes);
681 /******************************************************************************
682 * GdipCreateTexture2 [GDIPLUS.@]
684 GpStatus WINGDIPAPI GdipCreateTexture2(GpImage *image, GpWrapMode wrapmode,
685 REAL x, REAL y, REAL width, REAL height, GpTexture **texture)
687 GpImageAttributes *attributes;
690 TRACE("%p %d %f %f %f %f %p\n", image, wrapmode,
691 x, y, width, height, texture);
693 stat = GdipCreateImageAttributes(&attributes);
697 attributes->wrap = wrapmode;
699 stat = GdipCreateTextureIA(image, attributes, x, y, width, height,
702 GdipDisposeImageAttributes(attributes);
708 /******************************************************************************
709 * GdipCreateTextureIA [GDIPLUS.@]
711 * FIXME: imageattr ignored
713 GpStatus WINGDIPAPI GdipCreateTextureIA(GpImage *image,
714 GDIPCONST GpImageAttributes *imageattr, REAL x, REAL y, REAL width,
715 REAL height, GpTexture **texture)
718 GpImage *new_image=NULL;
720 TRACE("(%p, %p, %.2f, %.2f, %.2f, %.2f, %p)\n", image, imageattr, x, y, width, height,
723 if(!image || !texture || x < 0.0 || y < 0.0 || width < 0.0 || height < 0.0)
724 return InvalidParameter;
728 if(image->type != ImageTypeBitmap){
729 FIXME("not implemented for image type %d\n", image->type);
730 return NotImplemented;
733 status = GdipCloneBitmapArea(x, y, width, height, PixelFormatDontCare, (GpBitmap*)image, (GpBitmap**)&new_image);
737 *texture = GdipAlloc(sizeof(GpTexture));
739 status = OutOfMemory;
743 if((status = GdipCreateMatrix(&(*texture)->transform)) != Ok){
749 status = GdipCloneImageAttributes(imageattr, &(*texture)->imageattributes);
753 status = GdipCreateImageAttributes(&(*texture)->imageattributes);
755 (*texture)->imageattributes->wrap = WrapModeTile;
759 (*texture)->brush.bt = BrushTypeTextureFill;
760 (*texture)->image = new_image;
766 TRACE("<-- %p\n", *texture);
772 GdipDeleteMatrix((*texture)->transform);
773 GdipDisposeImageAttributes((*texture)->imageattributes);
777 GdipDisposeImage(new_image);
778 TRACE("<-- error %u\n", status);
784 /******************************************************************************
785 * GdipCreateTextureIAI [GDIPLUS.@]
787 GpStatus WINGDIPAPI GdipCreateTextureIAI(GpImage *image, GDIPCONST GpImageAttributes *imageattr,
788 INT x, INT y, INT width, INT height, GpTexture **texture)
790 TRACE("(%p, %p, %d, %d, %d, %d, %p)\n", image, imageattr, x, y, width, height,
793 return GdipCreateTextureIA(image,imageattr,(REAL)x,(REAL)y,(REAL)width,(REAL)height,texture);
796 GpStatus WINGDIPAPI GdipCreateTexture2I(GpImage *image, GpWrapMode wrapmode,
797 INT x, INT y, INT width, INT height, GpTexture **texture)
799 GpImageAttributes *imageattr;
802 TRACE("%p %d %d %d %d %d %p\n", image, wrapmode, x, y, width, height,
805 stat = GdipCreateImageAttributes(&imageattr);
809 imageattr->wrap = wrapmode;
811 stat = GdipCreateTextureIA(image, imageattr, x, y, width, height, texture);
817 GpStatus WINGDIPAPI GdipGetBrushType(GpBrush *brush, GpBrushType *type)
819 TRACE("(%p, %p)\n", brush, type);
821 if(!brush || !type) return InvalidParameter;
828 GpStatus WINGDIPAPI GdipGetHatchBackgroundColor(GpHatch *brush, ARGB *backcol)
830 TRACE("(%p, %p)\n", brush, backcol);
832 if(!brush || !backcol) return InvalidParameter;
834 *backcol = brush->backcol;
839 GpStatus WINGDIPAPI GdipGetHatchForegroundColor(GpHatch *brush, ARGB *forecol)
841 TRACE("(%p, %p)\n", brush, forecol);
843 if(!brush || !forecol) return InvalidParameter;
845 *forecol = brush->forecol;
850 GpStatus WINGDIPAPI GdipGetHatchStyle(GpHatch *brush, HatchStyle *hatchstyle)
852 TRACE("(%p, %p)\n", brush, hatchstyle);
854 if(!brush || !hatchstyle) return InvalidParameter;
856 *hatchstyle = brush->hatchstyle;
861 GpStatus WINGDIPAPI GdipDeleteBrush(GpBrush *brush)
863 TRACE("(%p)\n", brush);
865 if(!brush) return InvalidParameter;
869 case BrushTypePathGradient:
870 GdipDeletePath(((GpPathGradient*) brush)->path);
871 GdipFree(((GpPathGradient*) brush)->blendfac);
872 GdipFree(((GpPathGradient*) brush)->blendpos);
874 case BrushTypeLinearGradient:
875 GdipFree(((GpLineGradient*)brush)->blendfac);
876 GdipFree(((GpLineGradient*)brush)->blendpos);
877 GdipFree(((GpLineGradient*)brush)->pblendcolor);
878 GdipFree(((GpLineGradient*)brush)->pblendpos);
880 case BrushTypeTextureFill:
881 GdipDeleteMatrix(((GpTexture*)brush)->transform);
882 GdipDisposeImage(((GpTexture*)brush)->image);
883 GdipDisposeImageAttributes(((GpTexture*)brush)->imageattributes);
884 GdipFree(((GpTexture*)brush)->bitmap_bits);
895 GpStatus WINGDIPAPI GdipGetLineGammaCorrection(GpLineGradient *line,
898 TRACE("(%p, %p)\n", line, usinggamma);
900 if(!line || !usinggamma)
901 return InvalidParameter;
903 *usinggamma = line->gamma;
908 GpStatus WINGDIPAPI GdipGetLineWrapMode(GpLineGradient *brush, GpWrapMode *wrapmode)
910 TRACE("(%p, %p)\n", brush, wrapmode);
912 if(!brush || !wrapmode)
913 return InvalidParameter;
915 *wrapmode = brush->wrap;
920 GpStatus WINGDIPAPI GdipGetPathGradientBlend(GpPathGradient *brush, REAL *blend,
921 REAL *positions, INT count)
923 TRACE("(%p, %p, %p, %d)\n", brush, blend, positions, count);
925 if(!brush || !blend || !positions || count <= 0)
926 return InvalidParameter;
928 if(count < brush->blendcount)
929 return InsufficientBuffer;
931 memcpy(blend, brush->blendfac, count*sizeof(REAL));
932 if(brush->blendcount > 1){
933 memcpy(positions, brush->blendpos, count*sizeof(REAL));
939 GpStatus WINGDIPAPI GdipGetPathGradientBlendCount(GpPathGradient *brush, INT *count)
941 TRACE("(%p, %p)\n", brush, count);
944 return InvalidParameter;
946 *count = brush->blendcount;
951 GpStatus WINGDIPAPI GdipGetPathGradientCenterPoint(GpPathGradient *grad,
954 TRACE("(%p, %p)\n", grad, point);
957 return InvalidParameter;
959 point->X = grad->center.X;
960 point->Y = grad->center.Y;
965 GpStatus WINGDIPAPI GdipGetPathGradientCenterPointI(GpPathGradient *grad,
971 TRACE("(%p, %p)\n", grad, point);
974 return InvalidParameter;
976 ret = GdipGetPathGradientCenterPoint(grad,&ptf);
979 point->X = roundr(ptf.X);
980 point->Y = roundr(ptf.Y);
986 GpStatus WINGDIPAPI GdipGetPathGradientCenterColor(GpPathGradient *grad,
991 TRACE("(%p,%p)\n", grad, colors);
994 FIXME("not implemented\n");
996 return NotImplemented;
999 GpStatus WINGDIPAPI GdipGetPathGradientFocusScales(GpPathGradient *grad,
1002 TRACE("(%p, %p, %p)\n", grad, x, y);
1004 if(!grad || !x || !y)
1005 return InvalidParameter;
1013 GpStatus WINGDIPAPI GdipGetPathGradientGammaCorrection(GpPathGradient *grad,
1016 TRACE("(%p, %p)\n", grad, gamma);
1019 return InvalidParameter;
1021 *gamma = grad->gamma;
1026 GpStatus WINGDIPAPI GdipGetPathGradientPath(GpPathGradient *grad, GpPath *path)
1030 TRACE("(%p, %p)\n", grad, path);
1033 FIXME("not implemented\n");
1035 return NotImplemented;
1038 GpStatus WINGDIPAPI GdipGetPathGradientPointCount(GpPathGradient *grad,
1041 TRACE("(%p, %p)\n", grad, count);
1044 return InvalidParameter;
1046 *count = grad->path->pathdata.Count;
1051 GpStatus WINGDIPAPI GdipGetPathGradientRect(GpPathGradient *brush, GpRectF *rect)
1055 TRACE("(%p, %p)\n", brush, rect);
1058 return InvalidParameter;
1060 stat = GdipGetPathWorldBounds(brush->path, rect, NULL, NULL);
1065 GpStatus WINGDIPAPI GdipGetPathGradientRectI(GpPathGradient *brush, GpRect *rect)
1070 TRACE("(%p, %p)\n", brush, rect);
1073 return InvalidParameter;
1075 stat = GdipGetPathGradientRect(brush, &rectf);
1076 if(stat != Ok) return stat;
1078 rect->X = roundr(rectf.X);
1079 rect->Y = roundr(rectf.Y);
1080 rect->Width = roundr(rectf.Width);
1081 rect->Height = roundr(rectf.Height);
1086 GpStatus WINGDIPAPI GdipGetPathGradientSurroundColorsWithCount(GpPathGradient
1087 *grad, ARGB *argb, INT *count)
1091 TRACE("(%p,%p,%p)\n", grad, argb, count);
1093 if(!grad || !argb || !count || (*count < grad->path->pathdata.Count))
1094 return InvalidParameter;
1097 FIXME("not implemented\n");
1099 return NotImplemented;
1102 GpStatus WINGDIPAPI GdipGetPathGradientSurroundColorCount(GpPathGradient *brush, INT *count)
1106 TRACE("(%p, %p)\n", brush, count);
1108 if (!brush || !count)
1109 return InvalidParameter;
1112 FIXME("not implemented\n");
1114 return NotImplemented;
1117 GpStatus WINGDIPAPI GdipGetPathGradientWrapMode(GpPathGradient *brush,
1118 GpWrapMode *wrapmode)
1120 TRACE("(%p, %p)\n", brush, wrapmode);
1122 if(!brush || !wrapmode)
1123 return InvalidParameter;
1125 *wrapmode = brush->wrap;
1130 GpStatus WINGDIPAPI GdipGetSolidFillColor(GpSolidFill *sf, ARGB *argb)
1132 TRACE("(%p, %p)\n", sf, argb);
1135 return InvalidParameter;
1142 /******************************************************************************
1143 * GdipGetTextureImage [GDIPLUS.@]
1145 GpStatus WINGDIPAPI GdipGetTextureImage(GpTexture *brush, GpImage **image)
1147 TRACE("(%p, %p)\n", brush, image);
1149 if(!brush || !image)
1150 return InvalidParameter;
1152 return GdipCloneImage(brush->image, image);
1155 /******************************************************************************
1156 * GdipGetTextureTransform [GDIPLUS.@]
1158 GpStatus WINGDIPAPI GdipGetTextureTransform(GpTexture *brush, GpMatrix *matrix)
1160 TRACE("(%p, %p)\n", brush, matrix);
1162 if(!brush || !matrix)
1163 return InvalidParameter;
1165 memcpy(matrix, brush->transform, sizeof(GpMatrix));
1170 /******************************************************************************
1171 * GdipGetTextureWrapMode [GDIPLUS.@]
1173 GpStatus WINGDIPAPI GdipGetTextureWrapMode(GpTexture *brush, GpWrapMode *wrapmode)
1175 TRACE("(%p, %p)\n", brush, wrapmode);
1177 if(!brush || !wrapmode)
1178 return InvalidParameter;
1180 *wrapmode = brush->imageattributes->wrap;
1185 /******************************************************************************
1186 * GdipMultiplyTextureTransform [GDIPLUS.@]
1188 GpStatus WINGDIPAPI GdipMultiplyTextureTransform(GpTexture* brush,
1189 GDIPCONST GpMatrix *matrix, GpMatrixOrder order)
1191 TRACE("(%p, %p, %d)\n", brush, matrix, order);
1193 if(!brush || !matrix)
1194 return InvalidParameter;
1196 return GdipMultiplyMatrix(brush->transform, matrix, order);
1199 /******************************************************************************
1200 * GdipResetTextureTransform [GDIPLUS.@]
1202 GpStatus WINGDIPAPI GdipResetTextureTransform(GpTexture* brush)
1204 TRACE("(%p)\n", brush);
1207 return InvalidParameter;
1209 return GdipSetMatrixElements(brush->transform, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0);
1212 /******************************************************************************
1213 * GdipScaleTextureTransform [GDIPLUS.@]
1215 GpStatus WINGDIPAPI GdipScaleTextureTransform(GpTexture* brush,
1216 REAL sx, REAL sy, GpMatrixOrder order)
1218 TRACE("(%p, %.2f, %.2f, %d)\n", brush, sx, sy, order);
1221 return InvalidParameter;
1223 return GdipScaleMatrix(brush->transform, sx, sy, order);
1226 GpStatus WINGDIPAPI GdipSetLineBlend(GpLineGradient *brush,
1227 GDIPCONST REAL *factors, GDIPCONST REAL* positions, INT count)
1229 REAL *new_blendfac, *new_blendpos;
1231 TRACE("(%p, %p, %p, %i)\n", brush, factors, positions, count);
1233 if(!brush || !factors || !positions || count <= 0 ||
1234 (count >= 2 && (positions[0] != 0.0f || positions[count-1] != 1.0f)))
1235 return InvalidParameter;
1237 new_blendfac = GdipAlloc(count * sizeof(REAL));
1238 new_blendpos = GdipAlloc(count * sizeof(REAL));
1240 if (!new_blendfac || !new_blendpos)
1242 GdipFree(new_blendfac);
1243 GdipFree(new_blendpos);
1247 memcpy(new_blendfac, factors, count * sizeof(REAL));
1248 memcpy(new_blendpos, positions, count * sizeof(REAL));
1250 GdipFree(brush->blendfac);
1251 GdipFree(brush->blendpos);
1253 brush->blendcount = count;
1254 brush->blendfac = new_blendfac;
1255 brush->blendpos = new_blendpos;
1260 GpStatus WINGDIPAPI GdipGetLineBlend(GpLineGradient *brush, REAL *factors,
1261 REAL *positions, INT count)
1263 TRACE("(%p, %p, %p, %i)\n", brush, factors, positions, count);
1265 if (!brush || !factors || !positions || count <= 0)
1266 return InvalidParameter;
1268 if (count < brush->blendcount)
1269 return InsufficientBuffer;
1271 memcpy(factors, brush->blendfac, brush->blendcount * sizeof(REAL));
1272 memcpy(positions, brush->blendpos, brush->blendcount * sizeof(REAL));
1277 GpStatus WINGDIPAPI GdipGetLineBlendCount(GpLineGradient *brush, INT *count)
1279 TRACE("(%p, %p)\n", brush, count);
1281 if (!brush || !count)
1282 return InvalidParameter;
1284 *count = brush->blendcount;
1289 GpStatus WINGDIPAPI GdipSetLineGammaCorrection(GpLineGradient *line,
1292 TRACE("(%p, %d)\n", line, usegamma);
1295 return InvalidParameter;
1297 line->gamma = usegamma;
1302 GpStatus WINGDIPAPI GdipSetLineSigmaBlend(GpLineGradient *line, REAL focus,
1309 const int precision = 16;
1310 REAL erf_range; /* we use values erf(-erf_range) through erf(+erf_range) */
1314 TRACE("(%p, %0.2f, %0.2f)\n", line, focus, scale);
1316 if(!line || focus < 0.0 || focus > 1.0 || scale < 0.0 || scale > 1.0)
1317 return InvalidParameter;
1319 /* we want 2 standard deviations */
1320 erf_range = 2.0 / sqrt(2);
1322 /* calculate the constants we need to normalize the error function to be
1323 between 0.0 and scale over the range we need */
1324 min_erf = erf(-erf_range);
1325 scale_erf = scale / (-2.0 * min_erf);
1331 for (i=1; i<precision; i++)
1333 positions[i] = focus * i / precision;
1334 factors[i] = scale_erf * (erf(2 * erf_range * i / precision - erf_range) - min_erf);
1336 num_points += precision;
1339 positions[num_points] = focus;
1340 factors[num_points] = scale;
1345 for (i=1; i<precision; i++)
1347 positions[i+num_points-1] = (focus + ((1.0-focus) * i / precision));
1348 factors[i+num_points-1] = scale_erf * (erf(erf_range - 2 * erf_range * i / precision) - min_erf);
1350 num_points += precision;
1351 positions[num_points-1] = 1.0;
1352 factors[num_points-1] = 0.0;
1355 return GdipSetLineBlend(line, factors, positions, num_points);
1358 GpStatus WINGDIPAPI GdipSetLineWrapMode(GpLineGradient *line,
1361 TRACE("(%p, %d)\n", line, wrap);
1363 if(!line || wrap == WrapModeClamp)
1364 return InvalidParameter;
1371 GpStatus WINGDIPAPI GdipSetPathGradientBlend(GpPathGradient *brush, GDIPCONST REAL *blend,
1372 GDIPCONST REAL *pos, INT count)
1376 TRACE("(%p,%p,%p,%i)\n", brush, blend, pos, count);
1379 FIXME("not implemented\n");
1381 return NotImplemented;
1384 GpStatus WINGDIPAPI GdipSetPathGradientLinearBlend(GpPathGradient *brush,
1385 REAL focus, REAL scale)
1389 TRACE("(%p,%0.2f,%0.2f)\n", brush, focus, scale);
1392 FIXME("not implemented\n");
1394 return NotImplemented;
1397 GpStatus WINGDIPAPI GdipSetPathGradientPresetBlend(GpPathGradient *brush,
1398 GDIPCONST ARGB *blend, GDIPCONST REAL *pos, INT count)
1400 FIXME("(%p,%p,%p,%i): stub\n", brush, blend, pos, count);
1401 return NotImplemented;
1404 GpStatus WINGDIPAPI GdipGetPathGradientPresetBlend(GpPathGradient *brush,
1405 ARGB *blend, REAL *pos, INT count)
1407 FIXME("(%p,%p,%p,%i): stub\n", brush, blend, pos, count);
1408 return NotImplemented;
1411 GpStatus WINGDIPAPI GdipGetPathGradientPresetBlendCount(GpPathGradient *brush,
1414 FIXME("(%p,%p): stub\n", brush, count);
1415 return NotImplemented;
1418 GpStatus WINGDIPAPI GdipSetPathGradientCenterColor(GpPathGradient *grad,
1421 TRACE("(%p, %x)\n", grad, argb);
1424 return InvalidParameter;
1426 grad->centercolor = argb;
1430 GpStatus WINGDIPAPI GdipSetPathGradientCenterPoint(GpPathGradient *grad,
1433 TRACE("(%p, %s)\n", grad, debugstr_pointf(point));
1436 return InvalidParameter;
1438 grad->center.X = point->X;
1439 grad->center.Y = point->Y;
1444 GpStatus WINGDIPAPI GdipSetPathGradientCenterPointI(GpPathGradient *grad,
1449 TRACE("(%p, %p)\n", grad, point);
1452 return InvalidParameter;
1454 ptf.X = (REAL)point->X;
1455 ptf.Y = (REAL)point->Y;
1457 return GdipSetPathGradientCenterPoint(grad,&ptf);
1460 GpStatus WINGDIPAPI GdipSetPathGradientFocusScales(GpPathGradient *grad,
1463 TRACE("(%p, %.2f, %.2f)\n", grad, x, y);
1466 return InvalidParameter;
1474 GpStatus WINGDIPAPI GdipSetPathGradientGammaCorrection(GpPathGradient *grad,
1477 TRACE("(%p, %d)\n", grad, gamma);
1480 return InvalidParameter;
1482 grad->gamma = gamma;
1487 GpStatus WINGDIPAPI GdipSetPathGradientSigmaBlend(GpPathGradient *grad,
1488 REAL focus, REAL scale)
1492 TRACE("(%p,%0.2f,%0.2f)\n", grad, focus, scale);
1494 if(!grad || focus < 0.0 || focus > 1.0 || scale < 0.0 || scale > 1.0)
1495 return InvalidParameter;
1498 FIXME("not implemented\n");
1500 return NotImplemented;
1503 GpStatus WINGDIPAPI GdipSetPathGradientSurroundColorsWithCount(GpPathGradient
1504 *grad, GDIPCONST ARGB *argb, INT *count)
1508 TRACE("(%p,%p,%p)\n", grad, argb, count);
1510 if(!grad || !argb || !count || (*count <= 0) ||
1511 (*count > grad->path->pathdata.Count))
1512 return InvalidParameter;
1515 FIXME("not implemented\n");
1517 return NotImplemented;
1520 GpStatus WINGDIPAPI GdipSetPathGradientWrapMode(GpPathGradient *grad,
1523 TRACE("(%p, %d)\n", grad, wrap);
1526 return InvalidParameter;
1533 GpStatus WINGDIPAPI GdipSetPathGradientTransform(GpPathGradient *grad,
1538 TRACE("(%p,%p)\n", grad, matrix);
1541 FIXME("not implemented\n");
1543 return NotImplemented;
1546 GpStatus WINGDIPAPI GdipGetPathGradientTransform(GpPathGradient *grad,
1551 TRACE("(%p,%p)\n", grad, matrix);
1554 FIXME("not implemented\n");
1556 return NotImplemented;
1559 GpStatus WINGDIPAPI GdipMultiplyPathGradientTransform(GpPathGradient *grad,
1560 GDIPCONST GpMatrix *matrix, GpMatrixOrder order)
1564 TRACE("(%p,%p,%i)\n", grad, matrix, order);
1567 FIXME("not implemented\n");
1569 return NotImplemented;
1572 GpStatus WINGDIPAPI GdipRotatePathGradientTransform(GpPathGradient *grad,
1573 REAL angle, GpMatrixOrder order)
1577 TRACE("(%p,%0.2f,%i)\n", grad, angle, order);
1580 FIXME("not implemented\n");
1582 return NotImplemented;
1585 GpStatus WINGDIPAPI GdipScalePathGradientTransform(GpPathGradient *grad,
1586 REAL sx, REAL sy, GpMatrixOrder order)
1590 TRACE("(%p,%0.2f,%0.2f,%i)\n", grad, sx, sy, order);
1593 FIXME("not implemented\n");
1595 return NotImplemented;
1598 GpStatus WINGDIPAPI GdipTranslatePathGradientTransform(GpPathGradient *grad,
1599 REAL dx, REAL dy, GpMatrixOrder order)
1603 TRACE("(%p,%0.2f,%0.2f,%i)\n", grad, dx, dy, order);
1606 FIXME("not implemented\n");
1608 return NotImplemented;
1611 GpStatus WINGDIPAPI GdipSetSolidFillColor(GpSolidFill *sf, ARGB argb)
1613 TRACE("(%p, %x)\n", sf, argb);
1616 return InvalidParameter;
1622 /******************************************************************************
1623 * GdipSetTextureTransform [GDIPLUS.@]
1625 GpStatus WINGDIPAPI GdipSetTextureTransform(GpTexture *texture,
1626 GDIPCONST GpMatrix *matrix)
1628 TRACE("(%p, %p)\n", texture, matrix);
1630 if(!texture || !matrix)
1631 return InvalidParameter;
1633 memcpy(texture->transform, matrix, sizeof(GpMatrix));
1638 /******************************************************************************
1639 * GdipSetTextureWrapMode [GDIPLUS.@]
1641 * WrapMode not used, only stored
1643 GpStatus WINGDIPAPI GdipSetTextureWrapMode(GpTexture *brush, GpWrapMode wrapmode)
1645 TRACE("(%p, %d)\n", brush, wrapmode);
1648 return InvalidParameter;
1650 brush->imageattributes->wrap = wrapmode;
1655 GpStatus WINGDIPAPI GdipSetLineColors(GpLineGradient *brush, ARGB color1,
1658 TRACE("(%p, %x, %x)\n", brush, color1, color2);
1661 return InvalidParameter;
1663 brush->startcolor = color1;
1664 brush->endcolor = color2;
1669 GpStatus WINGDIPAPI GdipGetLineColors(GpLineGradient *brush, ARGB *colors)
1671 TRACE("(%p, %p)\n", brush, colors);
1673 if(!brush || !colors)
1674 return InvalidParameter;
1676 colors[0] = brush->startcolor;
1677 colors[1] = brush->endcolor;
1682 /******************************************************************************
1683 * GdipRotateTextureTransform [GDIPLUS.@]
1685 GpStatus WINGDIPAPI GdipRotateTextureTransform(GpTexture* brush, REAL angle,
1686 GpMatrixOrder order)
1688 TRACE("(%p, %.2f, %d)\n", brush, angle, order);
1691 return InvalidParameter;
1693 return GdipRotateMatrix(brush->transform, angle, order);
1696 GpStatus WINGDIPAPI GdipSetLineLinearBlend(GpLineGradient *brush, REAL focus,
1703 TRACE("(%p,%.2f,%.2f)\n", brush, focus, scale);
1705 if (!brush) return InvalidParameter;
1709 factors[num_points] = 0.0;
1710 positions[num_points] = 0.0;
1714 factors[num_points] = scale;
1715 positions[num_points] = focus;
1720 factors[num_points] = 0.0;
1721 positions[num_points] = 1.0;
1725 return GdipSetLineBlend(brush, factors, positions, num_points);
1728 GpStatus WINGDIPAPI GdipSetLinePresetBlend(GpLineGradient *brush,
1729 GDIPCONST ARGB *blend, GDIPCONST REAL* positions, INT count)
1733 TRACE("(%p,%p,%p,%i)\n", brush, blend, positions, count);
1735 if (!brush || !blend || !positions || count < 2 ||
1736 positions[0] != 0.0f || positions[count-1] != 1.0f)
1738 return InvalidParameter;
1741 new_color = GdipAlloc(count * sizeof(ARGB));
1742 new_pos = GdipAlloc(count * sizeof(REAL));
1743 if (!new_color || !new_pos)
1745 GdipFree(new_color);
1750 memcpy(new_color, blend, sizeof(ARGB) * count);
1751 memcpy(new_pos, positions, sizeof(REAL) * count);
1753 GdipFree(brush->pblendcolor);
1754 GdipFree(brush->pblendpos);
1756 brush->pblendcolor = new_color;
1757 brush->pblendpos = new_pos;
1758 brush->pblendcount = count;
1763 GpStatus WINGDIPAPI GdipGetLinePresetBlend(GpLineGradient *brush,
1764 ARGB *blend, REAL* positions, INT count)
1766 if (!brush || !blend || !positions || count < 2)
1767 return InvalidParameter;
1769 if (brush->pblendcount == 0)
1770 return GenericError;
1772 if (count < brush->pblendcount)
1773 return InsufficientBuffer;
1775 memcpy(blend, brush->pblendcolor, sizeof(ARGB) * brush->pblendcount);
1776 memcpy(positions, brush->pblendpos, sizeof(REAL) * brush->pblendcount);
1781 GpStatus WINGDIPAPI GdipGetLinePresetBlendCount(GpLineGradient *brush,
1784 if (!brush || !count)
1785 return InvalidParameter;
1787 *count = brush->pblendcount;
1792 GpStatus WINGDIPAPI GdipResetLineTransform(GpLineGradient *brush)
1796 TRACE("(%p)\n", brush);
1799 FIXME("not implemented\n");
1801 return NotImplemented;
1804 GpStatus WINGDIPAPI GdipSetLineTransform(GpLineGradient *brush,
1805 GDIPCONST GpMatrix *matrix)
1809 TRACE("(%p,%p)\n", brush, matrix);
1812 FIXME("not implemented\n");
1814 return NotImplemented;
1817 GpStatus WINGDIPAPI GdipGetLineTransform(GpLineGradient *brush, GpMatrix *matrix)
1821 TRACE("(%p,%p)\n", brush, matrix);
1824 FIXME("not implemented\n");
1826 return NotImplemented;
1829 GpStatus WINGDIPAPI GdipScaleLineTransform(GpLineGradient *brush, REAL sx, REAL sy,
1830 GpMatrixOrder order)
1834 TRACE("(%p,%0.2f,%0.2f,%u)\n", brush, sx, sy, order);
1837 FIXME("not implemented\n");
1839 return NotImplemented;
1842 GpStatus WINGDIPAPI GdipMultiplyLineTransform(GpLineGradient *brush,
1843 GDIPCONST GpMatrix *matrix, GpMatrixOrder order)
1847 TRACE("(%p,%p,%u)\n", brush, matrix, order);
1850 FIXME("not implemented\n");
1852 return NotImplemented;
1855 GpStatus WINGDIPAPI GdipTranslateLineTransform(GpLineGradient* brush,
1856 REAL dx, REAL dy, GpMatrixOrder order)
1860 TRACE("(%p,%f,%f,%d)\n", brush, dx, dy, order);
1863 FIXME("not implemented\n");
1868 /******************************************************************************
1869 * GdipTranslateTextureTransform [GDIPLUS.@]
1871 GpStatus WINGDIPAPI GdipTranslateTextureTransform(GpTexture* brush, REAL dx, REAL dy,
1872 GpMatrixOrder order)
1874 TRACE("(%p, %.2f, %.2f, %d)\n", brush, dx, dy, order);
1877 return InvalidParameter;
1879 return GdipTranslateMatrix(brush->transform, dx, dy, order);
1882 GpStatus WINGDIPAPI GdipGetLineRect(GpLineGradient *brush, GpRectF *rect)
1884 TRACE("(%p, %p)\n", brush, rect);
1887 return InvalidParameter;
1889 *rect = brush->rect;
1894 GpStatus WINGDIPAPI GdipGetLineRectI(GpLineGradient *brush, GpRect *rect)
1899 TRACE("(%p, %p)\n", brush, rect);
1902 return InvalidParameter;
1904 ret = GdipGetLineRect(brush, &rectF);
1907 rect->X = roundr(rectF.X);
1908 rect->Y = roundr(rectF.Y);
1909 rect->Width = roundr(rectF.Width);
1910 rect->Height = roundr(rectF.Height);
1916 GpStatus WINGDIPAPI GdipRotateLineTransform(GpLineGradient* brush,
1917 REAL angle, GpMatrixOrder order)
1921 TRACE("(%p,%0.2f,%u)\n", brush, angle, order);
1924 return InvalidParameter;
1927 FIXME("(%p, %.2f, %d) stub\n", brush, angle, order);
1929 return NotImplemented;