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
:
51 *clone
= GdipAlloc(sizeof(GpSolidFill
));
52 if (!*clone
) return OutOfMemory
;
54 fill
= (GpSolidFill
*)*clone
;
56 memcpy(*clone
, brush
, sizeof(GpSolidFill
));
58 (*clone
)->gdibrush
= CreateBrushIndirect(&(*clone
)->lb
);
59 fill
->bmp
= ARGB2BMP(fill
->color
);
62 case BrushTypeHatchFill
:
63 *clone
= GdipAlloc(sizeof(GpHatch
));
64 if (!*clone
) return OutOfMemory
;
66 memcpy(*clone
, brush
, sizeof(GpHatch
));
68 (*clone
)->gdibrush
= CreateBrushIndirect(&(*clone
)->lb
);
70 case BrushTypePathGradient
:{
71 GpPathGradient
*src
, *dest
;
74 *clone
= GdipAlloc(sizeof(GpPathGradient
));
75 if (!*clone
) return OutOfMemory
;
77 src
= (GpPathGradient
*) brush
,
78 dest
= (GpPathGradient
*) *clone
;
79 count
= src
->pathdata
.Count
;
81 memcpy(dest
, src
, sizeof(GpPathGradient
));
83 dest
->pathdata
.Count
= count
;
84 dest
->pathdata
.Points
= GdipAlloc(count
* sizeof(PointF
));
85 dest
->pathdata
.Types
= GdipAlloc(count
);
87 if(!dest
->pathdata
.Points
|| !dest
->pathdata
.Types
){
88 GdipFree(dest
->pathdata
.Points
);
89 GdipFree(dest
->pathdata
.Types
);
94 memcpy(dest
->pathdata
.Points
, src
->pathdata
.Points
, count
* sizeof(PointF
));
95 memcpy(dest
->pathdata
.Types
, src
->pathdata
.Types
, count
);
98 count
= src
->blendcount
;
99 dest
->blendcount
= count
;
100 dest
->blendfac
= GdipAlloc(count
* sizeof(REAL
));
101 dest
->blendpos
= GdipAlloc(count
* sizeof(REAL
));
103 if(!dest
->blendfac
|| !dest
->blendpos
){
104 GdipFree(dest
->pathdata
.Points
);
105 GdipFree(dest
->pathdata
.Types
);
106 GdipFree(dest
->blendfac
);
107 GdipFree(dest
->blendpos
);
112 memcpy(dest
->blendfac
, src
->blendfac
, count
* sizeof(REAL
));
113 memcpy(dest
->blendpos
, src
->blendpos
, count
* sizeof(REAL
));
117 case BrushTypeLinearGradient
:{
118 GpLineGradient
*dest
, *src
;
121 dest
= GdipAlloc(sizeof(GpLineGradient
));
122 if(!dest
) return OutOfMemory
;
124 src
= (GpLineGradient
*)brush
;
126 memcpy(dest
, src
, sizeof(GpLineGradient
));
128 dest
->brush
.gdibrush
= CreateSolidBrush(dest
->brush
.lb
.lbColor
);
130 count
= dest
->blendcount
;
131 dest
->blendfac
= GdipAlloc(count
* sizeof(REAL
));
132 dest
->blendpos
= GdipAlloc(count
* sizeof(REAL
));
134 if (!dest
->blendfac
|| !dest
->blendpos
)
136 GdipFree(dest
->blendfac
);
137 GdipFree(dest
->blendpos
);
138 DeleteObject(dest
->brush
.gdibrush
);
143 memcpy(dest
->blendfac
, src
->blendfac
, count
* sizeof(REAL
));
144 memcpy(dest
->blendpos
, src
->blendpos
, count
* sizeof(REAL
));
146 *clone
= &dest
->brush
;
149 case BrushTypeTextureFill
:
150 *clone
= GdipAlloc(sizeof(GpTexture
));
151 if(!*clone
) return OutOfMemory
;
153 memcpy(*clone
, brush
, sizeof(GpTexture
));
155 (*clone
)->gdibrush
= CreateBrushIndirect(&(*clone
)->lb
);
158 ERR("not implemented for brush type %d\n", brush
->bt
);
159 return NotImplemented
;
165 static LONG
HatchStyleToHatch(HatchStyle hatchstyle
)
169 case HatchStyleHorizontal
: return HS_HORIZONTAL
;
170 case HatchStyleVertical
: return HS_VERTICAL
;
171 case HatchStyleForwardDiagonal
: return HS_FDIAGONAL
;
172 case HatchStyleBackwardDiagonal
: return HS_BDIAGONAL
;
173 case HatchStyleCross
: return HS_CROSS
;
174 case HatchStyleDiagonalCross
: return HS_DIAGCROSS
;
179 /******************************************************************************
180 * GdipCreateHatchBrush [GDIPLUS.@]
182 GpStatus WINGDIPAPI
GdipCreateHatchBrush(HatchStyle hatchstyle
, ARGB forecol
, ARGB backcol
, GpHatch
**brush
)
184 COLORREF fgcol
= ARGB2COLORREF(forecol
);
186 TRACE("(%d, %d, %d, %p)\n", hatchstyle
, forecol
, backcol
, brush
);
188 if(!brush
) return InvalidParameter
;
190 *brush
= GdipAlloc(sizeof(GpHatch
));
191 if (!*brush
) return OutOfMemory
;
195 case HatchStyleHorizontal
:
196 case HatchStyleVertical
:
197 case HatchStyleForwardDiagonal
:
198 case HatchStyleBackwardDiagonal
:
199 case HatchStyleCross
:
200 case HatchStyleDiagonalCross
:
201 /* Brushes that map to BS_HATCHED */
202 (*brush
)->brush
.lb
.lbStyle
= BS_HATCHED
;
203 (*brush
)->brush
.lb
.lbColor
= fgcol
;
204 (*brush
)->brush
.lb
.lbHatch
= HatchStyleToHatch(hatchstyle
);
208 FIXME("Unimplemented hatch style %d\n", hatchstyle
);
210 (*brush
)->brush
.lb
.lbStyle
= BS_SOLID
;
211 (*brush
)->brush
.lb
.lbColor
= fgcol
;
212 (*brush
)->brush
.lb
.lbHatch
= 0;
217 (*brush
)->brush
.gdibrush
= CreateBrushIndirect(&(*brush
)->brush
.lb
);
218 (*brush
)->brush
.bt
= BrushTypeHatchFill
;
219 (*brush
)->forecol
= forecol
;
220 (*brush
)->backcol
= backcol
;
221 (*brush
)->hatchstyle
= hatchstyle
;
226 /******************************************************************************
227 * GdipCreateLineBrush [GDIPLUS.@]
229 GpStatus WINGDIPAPI
GdipCreateLineBrush(GDIPCONST GpPointF
* startpoint
,
230 GDIPCONST GpPointF
* endpoint
, ARGB startcolor
, ARGB endcolor
,
231 GpWrapMode wrap
, GpLineGradient
**line
)
233 COLORREF col
= ARGB2COLORREF(startcolor
);
235 TRACE("(%p, %p, %x, %x, %d, %p)\n", startpoint
, endpoint
,
236 startcolor
, endcolor
, wrap
, line
);
238 if(!line
|| !startpoint
|| !endpoint
|| wrap
== WrapModeClamp
)
239 return InvalidParameter
;
241 *line
= GdipAlloc(sizeof(GpLineGradient
));
242 if(!*line
) return OutOfMemory
;
244 (*line
)->brush
.lb
.lbStyle
= BS_SOLID
;
245 (*line
)->brush
.lb
.lbColor
= col
;
246 (*line
)->brush
.lb
.lbHatch
= 0;
247 (*line
)->brush
.gdibrush
= CreateSolidBrush(col
);
248 (*line
)->brush
.bt
= BrushTypeLinearGradient
;
250 (*line
)->startpoint
.X
= startpoint
->X
;
251 (*line
)->startpoint
.Y
= startpoint
->Y
;
252 (*line
)->endpoint
.X
= endpoint
->X
;
253 (*line
)->endpoint
.Y
= endpoint
->Y
;
254 (*line
)->startcolor
= startcolor
;
255 (*line
)->endcolor
= endcolor
;
256 (*line
)->wrap
= wrap
;
257 (*line
)->gamma
= FALSE
;
259 (*line
)->rect
.X
= (startpoint
->X
< endpoint
->X
? startpoint
->X
: endpoint
->X
);
260 (*line
)->rect
.Y
= (startpoint
->Y
< endpoint
->Y
? startpoint
->Y
: endpoint
->Y
);
261 (*line
)->rect
.Width
= fabs(startpoint
->X
- endpoint
->X
);
262 (*line
)->rect
.Height
= fabs(startpoint
->Y
- endpoint
->Y
);
264 if ((*line
)->rect
.Width
== 0)
266 (*line
)->rect
.X
-= (*line
)->rect
.Height
/ 2.0f
;
267 (*line
)->rect
.Width
= (*line
)->rect
.Height
;
269 else if ((*line
)->rect
.Height
== 0)
271 (*line
)->rect
.Y
-= (*line
)->rect
.Width
/ 2.0f
;
272 (*line
)->rect
.Height
= (*line
)->rect
.Width
;
275 (*line
)->blendcount
= 1;
276 (*line
)->blendfac
= GdipAlloc(sizeof(REAL
));
277 (*line
)->blendpos
= GdipAlloc(sizeof(REAL
));
279 if (!(*line
)->blendfac
|| !(*line
)->blendpos
)
281 GdipFree((*line
)->blendfac
);
282 GdipFree((*line
)->blendpos
);
283 DeleteObject((*line
)->brush
.gdibrush
);
289 (*line
)->blendfac
[0] = 1.0f
;
290 (*line
)->blendpos
[0] = 1.0f
;
295 GpStatus WINGDIPAPI
GdipCreateLineBrushI(GDIPCONST GpPoint
* startpoint
,
296 GDIPCONST GpPoint
* endpoint
, ARGB startcolor
, ARGB endcolor
,
297 GpWrapMode wrap
, GpLineGradient
**line
)
302 TRACE("(%p, %p, %x, %x, %d, %p)\n", startpoint
, endpoint
,
303 startcolor
, endcolor
, wrap
, line
);
305 if(!startpoint
|| !endpoint
)
306 return InvalidParameter
;
308 stF
.X
= (REAL
)startpoint
->X
;
309 stF
.Y
= (REAL
)startpoint
->Y
;
310 endF
.X
= (REAL
)endpoint
->X
;
311 endF
.X
= (REAL
)endpoint
->Y
;
313 return GdipCreateLineBrush(&stF
, &endF
, startcolor
, endcolor
, wrap
, line
);
316 GpStatus WINGDIPAPI
GdipCreateLineBrushFromRect(GDIPCONST GpRectF
* rect
,
317 ARGB startcolor
, ARGB endcolor
, LinearGradientMode mode
, GpWrapMode wrap
,
318 GpLineGradient
**line
)
323 TRACE("(%p, %x, %x, %d, %d, %p)\n", rect
, startcolor
, endcolor
, mode
,
327 return InvalidParameter
;
331 case LinearGradientModeHorizontal
:
334 end
.X
= rect
->X
+ rect
->Width
;
337 case LinearGradientModeVertical
:
341 end
.Y
= rect
->Y
+ rect
->Height
;
343 case LinearGradientModeForwardDiagonal
:
346 end
.X
= rect
->X
+ rect
->Width
;
347 end
.Y
= rect
->Y
+ rect
->Height
;
349 case LinearGradientModeBackwardDiagonal
:
350 start
.X
= rect
->X
+ rect
->Width
;
353 end
.Y
= rect
->Y
+ rect
->Height
;
356 return InvalidParameter
;
359 stat
= GdipCreateLineBrush(&start
, &end
, startcolor
, endcolor
, wrap
, line
);
362 (*line
)->rect
= *rect
;
367 GpStatus WINGDIPAPI
GdipCreateLineBrushFromRectI(GDIPCONST GpRect
* rect
,
368 ARGB startcolor
, ARGB endcolor
, LinearGradientMode mode
, GpWrapMode wrap
,
369 GpLineGradient
**line
)
373 TRACE("(%p, %x, %x, %d, %d, %p)\n", rect
, startcolor
, endcolor
, mode
,
376 rectF
.X
= (REAL
) rect
->X
;
377 rectF
.Y
= (REAL
) rect
->Y
;
378 rectF
.Width
= (REAL
) rect
->Width
;
379 rectF
.Height
= (REAL
) rect
->Height
;
381 return GdipCreateLineBrushFromRect(&rectF
, startcolor
, endcolor
, mode
, wrap
, line
);
384 /******************************************************************************
385 * GdipCreateLineBrushFromRectWithAngle [GDIPLUS.@]
387 * FIXME: angle value completely ignored. Don't know how to use it since native
388 * always set Brush rectangle to rect (independetly of this angle).
389 * Maybe it's used only on drawing.
391 GpStatus WINGDIPAPI
GdipCreateLineBrushFromRectWithAngle(GDIPCONST GpRectF
* rect
,
392 ARGB startcolor
, ARGB endcolor
, REAL angle
, BOOL isAngleScalable
, GpWrapMode wrap
,
393 GpLineGradient
**line
)
395 TRACE("(%p, %x, %x, %.2f, %d, %d, %p)\n", rect
, startcolor
, endcolor
, angle
, isAngleScalable
,
398 return GdipCreateLineBrushFromRect(rect
, startcolor
, endcolor
, LinearGradientModeForwardDiagonal
,
402 GpStatus WINGDIPAPI
GdipCreateLineBrushFromRectWithAngleI(GDIPCONST GpRect
* rect
,
403 ARGB startcolor
, ARGB endcolor
, REAL angle
, BOOL isAngleScalable
, GpWrapMode wrap
,
404 GpLineGradient
**line
)
406 TRACE("(%p, %x, %x, %.2f, %d, %d, %p)\n", rect
, startcolor
, endcolor
, angle
, isAngleScalable
,
409 return GdipCreateLineBrushFromRectI(rect
, startcolor
, endcolor
, LinearGradientModeForwardDiagonal
,
413 GpStatus WINGDIPAPI
GdipCreatePathGradient(GDIPCONST GpPointF
* points
,
414 INT count
, GpWrapMode wrap
, GpPathGradient
**grad
)
416 COLORREF col
= ARGB2COLORREF(0xffffffff);
418 TRACE("(%p, %d, %d, %p)\n", points
, count
, wrap
, grad
);
421 return InvalidParameter
;
426 *grad
= GdipAlloc(sizeof(GpPathGradient
));
427 if (!*grad
) return OutOfMemory
;
429 (*grad
)->blendfac
= GdipAlloc(sizeof(REAL
));
430 if(!(*grad
)->blendfac
){
434 (*grad
)->blendfac
[0] = 1.0;
435 (*grad
)->blendpos
= NULL
;
436 (*grad
)->blendcount
= 1;
438 (*grad
)->pathdata
.Count
= count
;
439 (*grad
)->pathdata
.Points
= GdipAlloc(count
* sizeof(PointF
));
440 (*grad
)->pathdata
.Types
= GdipAlloc(count
);
442 if(!(*grad
)->pathdata
.Points
|| !(*grad
)->pathdata
.Types
){
443 GdipFree((*grad
)->pathdata
.Points
);
444 GdipFree((*grad
)->pathdata
.Types
);
449 memcpy((*grad
)->pathdata
.Points
, points
, count
* sizeof(PointF
));
450 memset((*grad
)->pathdata
.Types
, PathPointTypeLine
, count
);
452 (*grad
)->brush
.lb
.lbStyle
= BS_SOLID
;
453 (*grad
)->brush
.lb
.lbColor
= col
;
454 (*grad
)->brush
.lb
.lbHatch
= 0;
456 (*grad
)->brush
.gdibrush
= CreateSolidBrush(col
);
457 (*grad
)->brush
.bt
= BrushTypePathGradient
;
458 (*grad
)->centercolor
= 0xffffffff;
459 (*grad
)->wrap
= wrap
;
460 (*grad
)->gamma
= FALSE
;
461 (*grad
)->center
.X
= 0.0;
462 (*grad
)->center
.Y
= 0.0;
463 (*grad
)->focus
.X
= 0.0;
464 (*grad
)->focus
.Y
= 0.0;
469 GpStatus WINGDIPAPI
GdipCreatePathGradientI(GDIPCONST GpPoint
* points
,
470 INT count
, GpWrapMode wrap
, GpPathGradient
**grad
)
476 TRACE("(%p, %d, %d, %p)\n", points
, count
, wrap
, grad
);
479 return InvalidParameter
;
484 pointsF
= GdipAlloc(sizeof(GpPointF
) * count
);
488 for(i
= 0; i
< count
; i
++){
489 pointsF
[i
].X
= (REAL
)points
[i
].X
;
490 pointsF
[i
].Y
= (REAL
)points
[i
].Y
;
493 ret
= GdipCreatePathGradient(pointsF
, count
, wrap
, grad
);
499 /******************************************************************************
500 * GdipCreatePathGradientFromPath [GDIPLUS.@]
502 * FIXME: path gradient brushes not truly supported (drawn as solid brushes)
504 GpStatus WINGDIPAPI
GdipCreatePathGradientFromPath(GDIPCONST GpPath
* path
,
505 GpPathGradient
**grad
)
507 COLORREF col
= ARGB2COLORREF(0xffffffff);
509 TRACE("(%p, %p)\n", path
, grad
);
512 return InvalidParameter
;
514 *grad
= GdipAlloc(sizeof(GpPathGradient
));
515 if (!*grad
) return OutOfMemory
;
517 (*grad
)->blendfac
= GdipAlloc(sizeof(REAL
));
518 if(!(*grad
)->blendfac
){
522 (*grad
)->blendfac
[0] = 1.0;
523 (*grad
)->blendpos
= NULL
;
524 (*grad
)->blendcount
= 1;
526 (*grad
)->pathdata
.Count
= path
->pathdata
.Count
;
527 (*grad
)->pathdata
.Points
= GdipAlloc(path
->pathdata
.Count
* sizeof(PointF
));
528 (*grad
)->pathdata
.Types
= GdipAlloc(path
->pathdata
.Count
);
530 if(!(*grad
)->pathdata
.Points
|| !(*grad
)->pathdata
.Types
){
531 GdipFree((*grad
)->pathdata
.Points
);
532 GdipFree((*grad
)->pathdata
.Types
);
537 memcpy((*grad
)->pathdata
.Points
, path
->pathdata
.Points
,
538 path
->pathdata
.Count
* sizeof(PointF
));
539 memcpy((*grad
)->pathdata
.Types
, path
->pathdata
.Types
, path
->pathdata
.Count
);
541 (*grad
)->brush
.lb
.lbStyle
= BS_SOLID
;
542 (*grad
)->brush
.lb
.lbColor
= col
;
543 (*grad
)->brush
.lb
.lbHatch
= 0;
545 (*grad
)->brush
.gdibrush
= CreateSolidBrush(col
);
546 (*grad
)->brush
.bt
= BrushTypePathGradient
;
547 (*grad
)->centercolor
= 0xffffffff;
548 (*grad
)->wrap
= WrapModeClamp
;
549 (*grad
)->gamma
= FALSE
;
550 /* FIXME: this should be set to the "centroid" of the path by default */
551 (*grad
)->center
.X
= 0.0;
552 (*grad
)->center
.Y
= 0.0;
553 (*grad
)->focus
.X
= 0.0;
554 (*grad
)->focus
.Y
= 0.0;
559 /******************************************************************************
560 * GdipCreateSolidFill [GDIPLUS.@]
562 GpStatus WINGDIPAPI
GdipCreateSolidFill(ARGB color
, GpSolidFill
**sf
)
564 COLORREF col
= ARGB2COLORREF(color
);
566 TRACE("(%x, %p)\n", color
, sf
);
568 if(!sf
) return InvalidParameter
;
570 *sf
= GdipAlloc(sizeof(GpSolidFill
));
571 if (!*sf
) return OutOfMemory
;
573 (*sf
)->brush
.lb
.lbStyle
= BS_SOLID
;
574 (*sf
)->brush
.lb
.lbColor
= col
;
575 (*sf
)->brush
.lb
.lbHatch
= 0;
577 (*sf
)->brush
.gdibrush
= CreateSolidBrush(col
);
578 (*sf
)->brush
.bt
= BrushTypeSolidColor
;
579 (*sf
)->color
= color
;
580 (*sf
)->bmp
= ARGB2BMP(color
);
585 /******************************************************************************
586 * GdipCreateTexture [GDIPLUS.@]
589 * image [I] image to use
590 * wrapmode [I] optional
591 * texture [O] pointer to the resulting texturebrush
595 * FAILURE: element of GpStatus
597 GpStatus WINGDIPAPI
GdipCreateTexture(GpImage
*image
, GpWrapMode wrapmode
,
601 GpImageAttributes attributes
;
604 TRACE("%p, %d %p\n", image
, wrapmode
, texture
);
606 if (!(image
&& texture
))
607 return InvalidParameter
;
609 stat
= GdipGetImageWidth(image
, &width
);
610 if (stat
!= Ok
) return stat
;
611 stat
= GdipGetImageHeight(image
, &height
);
612 if (stat
!= Ok
) return stat
;
613 attributes
.wrap
= wrapmode
;
615 return GdipCreateTextureIA(image
, &attributes
, 0, 0, width
, height
,
619 /******************************************************************************
620 * GdipCreateTexture2 [GDIPLUS.@]
622 GpStatus WINGDIPAPI
GdipCreateTexture2(GpImage
*image
, GpWrapMode wrapmode
,
623 REAL x
, REAL y
, REAL width
, REAL height
, GpTexture
**texture
)
625 GpImageAttributes attributes
;
627 TRACE("%p %d %f %f %f %f %p\n", image
, wrapmode
,
628 x
, y
, width
, height
, texture
);
630 attributes
.wrap
= wrapmode
;
631 return GdipCreateTextureIA(image
, &attributes
, x
, y
, width
, height
,
635 /******************************************************************************
636 * GdipCreateTextureIA [GDIPLUS.@]
638 * FIXME: imageattr ignored
640 GpStatus WINGDIPAPI
GdipCreateTextureIA(GpImage
*image
,
641 GDIPCONST GpImageAttributes
*imageattr
, REAL x
, REAL y
, REAL width
,
642 REAL height
, GpTexture
**texture
)
645 HBITMAP hbm
, old
= NULL
;
647 BITMAPINFOHEADER
*bmih
;
648 INT n_x
, n_y
, n_width
, n_height
, abs_height
, stride
, image_stride
, i
, bytespp
;
650 BYTE
*dibits
, *buff
, *textbits
;
653 TRACE("(%p, %p, %.2f, %.2f, %.2f, %.2f, %p)\n", image
, imageattr
, x
, y
, width
, height
,
656 if(!image
|| !texture
|| x
< 0.0 || y
< 0.0 || width
< 0.0 || height
< 0.0)
657 return InvalidParameter
;
659 if(image
->type
!= ImageTypeBitmap
){
660 FIXME("not implemented for image type %d\n", image
->type
);
661 return NotImplemented
;
666 n_width
= roundr(width
);
667 n_height
= roundr(height
);
669 if(n_x
+ n_width
> ((GpBitmap
*)image
)->width
||
670 n_y
+ n_height
> ((GpBitmap
*)image
)->height
)
671 return InvalidParameter
;
673 hbm
= ((GpBitmap
*)image
)->hbitmap
;
674 if(!hbm
) return GenericError
;
675 hdc
= ((GpBitmap
*)image
)->hdc
;
676 bm_is_selected
= (hdc
!= 0);
678 pbmi
= GdipAlloc(sizeof(BITMAPINFOHEADER
) + 256 * sizeof(RGBQUAD
));
681 pbmi
->bmiHeader
.biSize
= sizeof(BITMAPINFOHEADER
);
682 pbmi
->bmiHeader
.biBitCount
= 0;
685 hdc
= CreateCompatibleDC(0);
686 old
= SelectObject(hdc
, hbm
);
690 GetDIBits(hdc
, hbm
, 0, 0, NULL
, pbmi
, DIB_RGB_COLORS
);
692 bytespp
= pbmi
->bmiHeader
.biBitCount
/ 8;
693 abs_height
= abs(pbmi
->bmiHeader
.biHeight
);
695 if(n_x
> pbmi
->bmiHeader
.biWidth
|| n_x
+ n_width
> pbmi
->bmiHeader
.biWidth
||
696 n_y
> abs_height
|| n_y
+ n_height
> abs_height
){
698 return InvalidParameter
;
701 dibits
= GdipAlloc(pbmi
->bmiHeader
.biSizeImage
);
703 if(dibits
) /* this is not a good place to error out */
704 GetDIBits(hdc
, hbm
, 0, abs_height
, dibits
, pbmi
, DIB_RGB_COLORS
);
707 SelectObject(hdc
, old
);
716 image_stride
= (pbmi
->bmiHeader
.biWidth
* bytespp
+ 3) & ~3;
717 stride
= (n_width
* bytespp
+ 3) & ~3;
718 buff
= GdipAlloc(sizeof(BITMAPINFOHEADER
) + stride
* n_height
);
725 bmih
= (BITMAPINFOHEADER
*)buff
;
726 textbits
= (BYTE
*) (bmih
+ 1);
727 bmih
->biSize
= sizeof(BITMAPINFOHEADER
);
728 bmih
->biWidth
= n_width
;
729 bmih
->biHeight
= n_height
;
730 bmih
->biCompression
= BI_RGB
;
731 bmih
->biSizeImage
= stride
* n_height
;
732 bmih
->biBitCount
= pbmi
->bmiHeader
.biBitCount
;
736 /* image is flipped */
737 if(pbmi
->bmiHeader
.biHeight
> 0){
738 dibits
+= pbmi
->bmiHeader
.biSizeImage
;
740 textbits
+= stride
* (n_height
- 1);
746 for(i
= 0; i
< n_height
; i
++)
747 memcpy(&textbits
[i
* stride
],
748 &dibits
[n_x
* bytespp
+ (n_y
+ i
) * image_stride
],
751 *texture
= GdipAlloc(sizeof(GpTexture
));
758 if((status
= GdipCreateMatrix(&(*texture
)->transform
)) != Ok
){
765 (*texture
)->brush
.lb
.lbStyle
= BS_DIBPATTERNPT
;
766 (*texture
)->brush
.lb
.lbColor
= DIB_RGB_COLORS
;
767 (*texture
)->brush
.lb
.lbHatch
= (ULONG_PTR
)buff
;
769 (*texture
)->brush
.gdibrush
= CreateBrushIndirect(&(*texture
)->brush
.lb
);
770 (*texture
)->brush
.bt
= BrushTypeTextureFill
;
771 (*texture
)->wrap
= imageattr
->wrap
;
779 /******************************************************************************
780 * GdipCreateTextureIAI [GDIPLUS.@]
782 GpStatus WINGDIPAPI
GdipCreateTextureIAI(GpImage
*image
, GDIPCONST GpImageAttributes
*imageattr
,
783 INT x
, INT y
, INT width
, INT height
, GpTexture
**texture
)
785 TRACE("(%p, %p, %d, %d, %d, %d, %p)\n", image
, imageattr
, x
, y
, width
, height
,
788 return GdipCreateTextureIA(image
,imageattr
,(REAL
)x
,(REAL
)y
,(REAL
)width
,(REAL
)height
,texture
);
791 GpStatus WINGDIPAPI
GdipCreateTexture2I(GpImage
*image
, GpWrapMode wrapmode
,
792 INT x
, INT y
, INT width
, INT height
, GpTexture
**texture
)
794 GpImageAttributes imageattr
;
796 TRACE("%p %d %d %d %d %d %p\n", image
, wrapmode
, x
, y
, width
, height
,
799 imageattr
.wrap
= wrapmode
;
801 return GdipCreateTextureIA(image
, &imageattr
, x
, y
, width
, height
, texture
);
804 GpStatus WINGDIPAPI
GdipGetBrushType(GpBrush
*brush
, GpBrushType
*type
)
806 TRACE("(%p, %p)\n", brush
, type
);
808 if(!brush
|| !type
) return InvalidParameter
;
815 GpStatus WINGDIPAPI
GdipGetHatchBackgroundColor(GpHatch
*brush
, ARGB
*backcol
)
817 TRACE("(%p, %p)\n", brush
, backcol
);
819 if(!brush
|| !backcol
) return InvalidParameter
;
821 *backcol
= brush
->backcol
;
826 GpStatus WINGDIPAPI
GdipGetHatchForegroundColor(GpHatch
*brush
, ARGB
*forecol
)
828 TRACE("(%p, %p)\n", brush
, forecol
);
830 if(!brush
|| !forecol
) return InvalidParameter
;
832 *forecol
= brush
->forecol
;
837 GpStatus WINGDIPAPI
GdipGetHatchStyle(GpHatch
*brush
, HatchStyle
*hatchstyle
)
839 TRACE("(%p, %p)\n", brush
, hatchstyle
);
841 if(!brush
|| !hatchstyle
) return InvalidParameter
;
843 *hatchstyle
= brush
->hatchstyle
;
848 GpStatus WINGDIPAPI
GdipDeleteBrush(GpBrush
*brush
)
850 TRACE("(%p)\n", brush
);
852 if(!brush
) return InvalidParameter
;
856 case BrushTypePathGradient
:
857 GdipFree(((GpPathGradient
*) brush
)->pathdata
.Points
);
858 GdipFree(((GpPathGradient
*) brush
)->pathdata
.Types
);
859 GdipFree(((GpPathGradient
*) brush
)->blendfac
);
860 GdipFree(((GpPathGradient
*) brush
)->blendpos
);
862 case BrushTypeSolidColor
:
863 if (((GpSolidFill
*)brush
)->bmp
)
864 DeleteObject(((GpSolidFill
*)brush
)->bmp
);
866 case BrushTypeLinearGradient
:
867 GdipFree(((GpLineGradient
*)brush
)->blendfac
);
868 GdipFree(((GpLineGradient
*)brush
)->blendpos
);
870 case BrushTypeTextureFill
:
871 GdipDeleteMatrix(((GpTexture
*)brush
)->transform
);
877 DeleteObject(brush
->gdibrush
);
883 GpStatus WINGDIPAPI
GdipGetLineGammaCorrection(GpLineGradient
*line
,
886 TRACE("(%p, %p)\n", line
, usinggamma
);
888 if(!line
|| !usinggamma
)
889 return InvalidParameter
;
891 *usinggamma
= line
->gamma
;
896 GpStatus WINGDIPAPI
GdipGetLineWrapMode(GpLineGradient
*brush
, GpWrapMode
*wrapmode
)
898 TRACE("(%p, %p)\n", brush
, wrapmode
);
900 if(!brush
|| !wrapmode
)
901 return InvalidParameter
;
903 *wrapmode
= brush
->wrap
;
908 GpStatus WINGDIPAPI
GdipGetPathGradientBlend(GpPathGradient
*brush
, REAL
*blend
,
909 REAL
*positions
, INT count
)
911 TRACE("(%p, %p, %p, %d)\n", brush
, blend
, positions
, count
);
913 if(!brush
|| !blend
|| !positions
|| count
<= 0)
914 return InvalidParameter
;
916 if(count
< brush
->blendcount
)
917 return InsufficientBuffer
;
919 memcpy(blend
, brush
->blendfac
, count
*sizeof(REAL
));
920 if(brush
->blendcount
> 1){
921 memcpy(positions
, brush
->blendpos
, count
*sizeof(REAL
));
927 GpStatus WINGDIPAPI
GdipGetPathGradientBlendCount(GpPathGradient
*brush
, INT
*count
)
929 TRACE("(%p, %p)\n", brush
, count
);
932 return InvalidParameter
;
934 *count
= brush
->blendcount
;
939 GpStatus WINGDIPAPI
GdipGetPathGradientCenterPoint(GpPathGradient
*grad
,
942 TRACE("(%p, %p)\n", grad
, point
);
945 return InvalidParameter
;
947 point
->X
= grad
->center
.X
;
948 point
->Y
= grad
->center
.Y
;
953 GpStatus WINGDIPAPI
GdipGetPathGradientCenterPointI(GpPathGradient
*grad
,
959 TRACE("(%p, %p)\n", grad
, point
);
962 return InvalidParameter
;
964 ret
= GdipGetPathGradientCenterPoint(grad
,&ptf
);
967 point
->X
= roundr(ptf
.X
);
968 point
->Y
= roundr(ptf
.Y
);
974 GpStatus WINGDIPAPI
GdipGetPathGradientFocusScales(GpPathGradient
*grad
,
977 TRACE("(%p, %p, %p)\n", grad
, x
, y
);
979 if(!grad
|| !x
|| !y
)
980 return InvalidParameter
;
988 GpStatus WINGDIPAPI
GdipGetPathGradientGammaCorrection(GpPathGradient
*grad
,
991 TRACE("(%p, %p)\n", grad
, gamma
);
994 return InvalidParameter
;
996 *gamma
= grad
->gamma
;
1001 GpStatus WINGDIPAPI
GdipGetPathGradientPointCount(GpPathGradient
*grad
,
1004 TRACE("(%p, %p)\n", grad
, count
);
1007 return InvalidParameter
;
1009 *count
= grad
->pathdata
.Count
;
1014 GpStatus WINGDIPAPI
GdipGetPathGradientRect(GpPathGradient
*brush
, GpRectF
*rect
)
1020 TRACE("(%p, %p)\n", brush
, rect
);
1023 return InvalidParameter
;
1025 stat
= GdipCreatePath2(brush
->pathdata
.Points
, brush
->pathdata
.Types
,
1026 brush
->pathdata
.Count
, FillModeAlternate
, &path
);
1027 if(stat
!= Ok
) return stat
;
1029 stat
= GdipGetPathWorldBounds(path
, &r
, NULL
, NULL
);
1031 GdipDeletePath(path
);
1035 memcpy(rect
, &r
, sizeof(GpRectF
));
1037 GdipDeletePath(path
);
1042 GpStatus WINGDIPAPI
GdipGetPathGradientRectI(GpPathGradient
*brush
, GpRect
*rect
)
1047 TRACE("(%p, %p)\n", brush
, rect
);
1050 return InvalidParameter
;
1052 stat
= GdipGetPathGradientRect(brush
, &rectf
);
1053 if(stat
!= Ok
) return stat
;
1055 rect
->X
= roundr(rectf
.X
);
1056 rect
->Y
= roundr(rectf
.Y
);
1057 rect
->Width
= roundr(rectf
.Width
);
1058 rect
->Height
= roundr(rectf
.Height
);
1063 GpStatus WINGDIPAPI
GdipGetPathGradientSurroundColorsWithCount(GpPathGradient
1064 *grad
, ARGB
*argb
, INT
*count
)
1068 if(!grad
|| !argb
|| !count
|| (*count
< grad
->pathdata
.Count
))
1069 return InvalidParameter
;
1072 FIXME("not implemented\n");
1074 return NotImplemented
;
1077 GpStatus WINGDIPAPI
GdipGetPathGradientWrapMode(GpPathGradient
*brush
,
1078 GpWrapMode
*wrapmode
)
1080 TRACE("(%p, %p)\n", brush
, wrapmode
);
1082 if(!brush
|| !wrapmode
)
1083 return InvalidParameter
;
1085 *wrapmode
= brush
->wrap
;
1090 GpStatus WINGDIPAPI
GdipGetSolidFillColor(GpSolidFill
*sf
, ARGB
*argb
)
1092 TRACE("(%p, %p)\n", sf
, argb
);
1095 return InvalidParameter
;
1102 /******************************************************************************
1103 * GdipGetTextureTransform [GDIPLUS.@]
1105 GpStatus WINGDIPAPI
GdipGetTextureTransform(GpTexture
*brush
, GpMatrix
*matrix
)
1107 TRACE("(%p, %p)\n", brush
, matrix
);
1109 if(!brush
|| !matrix
)
1110 return InvalidParameter
;
1112 memcpy(matrix
, brush
->transform
, sizeof(GpMatrix
));
1117 /******************************************************************************
1118 * GdipGetTextureWrapMode [GDIPLUS.@]
1120 GpStatus WINGDIPAPI
GdipGetTextureWrapMode(GpTexture
*brush
, GpWrapMode
*wrapmode
)
1122 TRACE("(%p, %p)\n", brush
, wrapmode
);
1124 if(!brush
|| !wrapmode
)
1125 return InvalidParameter
;
1127 *wrapmode
= brush
->wrap
;
1132 /******************************************************************************
1133 * GdipMultiplyTextureTransform [GDIPLUS.@]
1135 GpStatus WINGDIPAPI
GdipMultiplyTextureTransform(GpTexture
* brush
,
1136 GDIPCONST GpMatrix
*matrix
, GpMatrixOrder order
)
1138 TRACE("(%p, %p, %d)\n", brush
, matrix
, order
);
1140 if(!brush
|| !matrix
)
1141 return InvalidParameter
;
1143 return GdipMultiplyMatrix(brush
->transform
, matrix
, order
);
1146 /******************************************************************************
1147 * GdipResetTextureTransform [GDIPLUS.@]
1149 GpStatus WINGDIPAPI
GdipResetTextureTransform(GpTexture
* brush
)
1151 TRACE("(%p)\n", brush
);
1154 return InvalidParameter
;
1156 return GdipSetMatrixElements(brush
->transform
, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0);
1159 /******************************************************************************
1160 * GdipScaleTextureTransform [GDIPLUS.@]
1162 GpStatus WINGDIPAPI
GdipScaleTextureTransform(GpTexture
* brush
,
1163 REAL sx
, REAL sy
, GpMatrixOrder order
)
1165 TRACE("(%p, %.2f, %.2f, %d)\n", brush
, sx
, sy
, order
);
1168 return InvalidParameter
;
1170 return GdipScaleMatrix(brush
->transform
, sx
, sy
, order
);
1173 GpStatus WINGDIPAPI
GdipSetLineBlend(GpLineGradient
*brush
,
1174 GDIPCONST REAL
*factors
, GDIPCONST REAL
* positions
, INT count
)
1176 REAL
*new_blendfac
, *new_blendpos
;
1178 TRACE("(%p, %p, %p, %i)\n", brush
, factors
, positions
, count
);
1180 if(!brush
|| !factors
|| !positions
|| count
<= 0 ||
1181 (count
>= 2 && (positions
[0] != 0.0f
|| positions
[count
-1] != 1.0f
)))
1182 return InvalidParameter
;
1184 new_blendfac
= GdipAlloc(count
* sizeof(REAL
));
1185 new_blendpos
= GdipAlloc(count
* sizeof(REAL
));
1187 if (!new_blendfac
|| !new_blendpos
)
1189 GdipFree(new_blendfac
);
1190 GdipFree(new_blendpos
);
1194 memcpy(new_blendfac
, factors
, count
* sizeof(REAL
));
1195 memcpy(new_blendpos
, positions
, count
* sizeof(REAL
));
1197 GdipFree(brush
->blendfac
);
1198 GdipFree(brush
->blendpos
);
1200 brush
->blendcount
= count
;
1201 brush
->blendfac
= new_blendfac
;
1202 brush
->blendpos
= new_blendpos
;
1207 GpStatus WINGDIPAPI
GdipGetLineBlend(GpLineGradient
*brush
, REAL
*factors
,
1208 REAL
*positions
, INT count
)
1210 TRACE("(%p, %p, %p, %i)\n", brush
, factors
, positions
, count
);
1212 if (!brush
|| !factors
|| !positions
|| count
<= 0)
1213 return InvalidParameter
;
1215 if (count
< brush
->blendcount
)
1216 return InsufficientBuffer
;
1218 memcpy(factors
, brush
->blendfac
, brush
->blendcount
* sizeof(REAL
));
1219 memcpy(positions
, brush
->blendpos
, brush
->blendcount
* sizeof(REAL
));
1224 GpStatus WINGDIPAPI
GdipGetLineBlendCount(GpLineGradient
*brush
, INT
*count
)
1226 TRACE("(%p, %p)\n", brush
, count
);
1228 if (!brush
|| !count
)
1229 return InvalidParameter
;
1231 *count
= brush
->blendcount
;
1236 GpStatus WINGDIPAPI
GdipSetLineGammaCorrection(GpLineGradient
*line
,
1239 TRACE("(%p, %d)\n", line
, usegamma
);
1242 return InvalidParameter
;
1244 line
->gamma
= usegamma
;
1249 GpStatus WINGDIPAPI
GdipSetLineSigmaBlend(GpLineGradient
*line
, REAL focus
,
1256 const int precision
= 16;
1257 REAL erf_range
; /* we use values erf(-erf_range) through erf(+erf_range) */
1261 TRACE("(%p, %0.2f, %0.2f)\n", line
, focus
, scale
);
1263 if(!line
|| focus
< 0.0 || focus
> 1.0 || scale
< 0.0 || scale
> 1.0)
1264 return InvalidParameter
;
1266 /* we want 2 standard deviations */
1267 erf_range
= 2.0 / sqrt(2);
1269 /* calculate the constants we need to normalize the error function to be
1270 between 0.0 and scale over the range we need */
1271 min_erf
= erf(-erf_range
);
1272 scale_erf
= scale
/ (-2.0 * min_erf
);
1278 for (i
=1; i
<precision
; i
++)
1280 positions
[i
] = focus
* i
/ precision
;
1281 factors
[i
] = scale_erf
* (erf(2 * erf_range
* i
/ precision
- erf_range
) - min_erf
);
1283 num_points
+= precision
;
1286 positions
[num_points
] = focus
;
1287 factors
[num_points
] = scale
;
1292 for (i
=1; i
<precision
; i
++)
1294 positions
[i
+num_points
-1] = (focus
+ ((1.0-focus
) * i
/ precision
));
1295 factors
[i
+num_points
-1] = scale_erf
* (erf(erf_range
- 2 * erf_range
* i
/ precision
) - min_erf
);
1297 num_points
+= precision
;
1298 positions
[num_points
-1] = 1.0;
1299 factors
[num_points
-1] = 0.0;
1302 return GdipSetLineBlend(line
, factors
, positions
, num_points
);
1305 GpStatus WINGDIPAPI
GdipSetLineWrapMode(GpLineGradient
*line
,
1308 TRACE("(%p, %d)\n", line
, wrap
);
1310 if(!line
|| wrap
== WrapModeClamp
)
1311 return InvalidParameter
;
1318 GpStatus WINGDIPAPI
GdipSetPathGradientBlend(GpPathGradient
*brush
, GDIPCONST REAL
*blend
,
1319 GDIPCONST REAL
*pos
, INT count
)
1324 FIXME("not implemented\n");
1326 return NotImplemented
;
1329 GpStatus WINGDIPAPI
GdipSetPathGradientPresetBlend(GpPathGradient
*brush
,
1330 GDIPCONST ARGB
*blend
, GDIPCONST REAL
*pos
, INT count
)
1332 FIXME("(%p,%p,%p,%i): stub\n", brush
, blend
, pos
, count
);
1333 return NotImplemented
;
1336 GpStatus WINGDIPAPI
GdipSetPathGradientCenterColor(GpPathGradient
*grad
,
1339 TRACE("(%p, %x)\n", grad
, argb
);
1342 return InvalidParameter
;
1344 grad
->centercolor
= argb
;
1345 grad
->brush
.lb
.lbColor
= ARGB2COLORREF(argb
);
1347 DeleteObject(grad
->brush
.gdibrush
);
1348 grad
->brush
.gdibrush
= CreateSolidBrush(grad
->brush
.lb
.lbColor
);
1353 GpStatus WINGDIPAPI
GdipSetPathGradientCenterPoint(GpPathGradient
*grad
,
1356 TRACE("(%p, %p)\n", grad
, point
);
1359 return InvalidParameter
;
1361 grad
->center
.X
= point
->X
;
1362 grad
->center
.Y
= point
->Y
;
1367 GpStatus WINGDIPAPI
GdipSetPathGradientCenterPointI(GpPathGradient
*grad
,
1372 TRACE("(%p, %p)\n", grad
, point
);
1375 return InvalidParameter
;
1377 ptf
.X
= (REAL
)point
->X
;
1378 ptf
.Y
= (REAL
)point
->Y
;
1380 return GdipSetPathGradientCenterPoint(grad
,&ptf
);
1383 GpStatus WINGDIPAPI
GdipSetPathGradientFocusScales(GpPathGradient
*grad
,
1386 TRACE("(%p, %.2f, %.2f)\n", grad
, x
, y
);
1389 return InvalidParameter
;
1397 GpStatus WINGDIPAPI
GdipSetPathGradientGammaCorrection(GpPathGradient
*grad
,
1400 TRACE("(%p, %d)\n", grad
, gamma
);
1403 return InvalidParameter
;
1405 grad
->gamma
= gamma
;
1410 GpStatus WINGDIPAPI
GdipSetPathGradientSigmaBlend(GpPathGradient
*grad
,
1411 REAL focus
, REAL scale
)
1415 if(!grad
|| focus
< 0.0 || focus
> 1.0 || scale
< 0.0 || scale
> 1.0)
1416 return InvalidParameter
;
1419 FIXME("not implemented\n");
1421 return NotImplemented
;
1424 GpStatus WINGDIPAPI
GdipSetPathGradientSurroundColorsWithCount(GpPathGradient
1425 *grad
, ARGB
*argb
, INT
*count
)
1429 if(!grad
|| !argb
|| !count
|| (*count
<= 0) ||
1430 (*count
> grad
->pathdata
.Count
))
1431 return InvalidParameter
;
1434 FIXME("not implemented\n");
1436 return NotImplemented
;
1439 GpStatus WINGDIPAPI
GdipSetPathGradientWrapMode(GpPathGradient
*grad
,
1442 TRACE("(%p, %d)\n", grad
, wrap
);
1445 return InvalidParameter
;
1452 GpStatus WINGDIPAPI
GdipSetSolidFillColor(GpSolidFill
*sf
, ARGB argb
)
1454 TRACE("(%p, %x)\n", sf
, argb
);
1457 return InvalidParameter
;
1460 sf
->brush
.lb
.lbColor
= ARGB2COLORREF(argb
);
1462 DeleteObject(sf
->brush
.gdibrush
);
1463 sf
->brush
.gdibrush
= CreateSolidBrush(sf
->brush
.lb
.lbColor
);
1468 /******************************************************************************
1469 * GdipSetTextureTransform [GDIPLUS.@]
1471 GpStatus WINGDIPAPI
GdipSetTextureTransform(GpTexture
*texture
,
1472 GDIPCONST GpMatrix
*matrix
)
1474 TRACE("(%p, %p)\n", texture
, matrix
);
1476 if(!texture
|| !matrix
)
1477 return InvalidParameter
;
1479 memcpy(texture
->transform
, matrix
, sizeof(GpMatrix
));
1484 /******************************************************************************
1485 * GdipSetTextureWrapMode [GDIPLUS.@]
1487 * WrapMode not used, only stored
1489 GpStatus WINGDIPAPI
GdipSetTextureWrapMode(GpTexture
*brush
, GpWrapMode wrapmode
)
1491 TRACE("(%p, %d)\n", brush
, wrapmode
);
1494 return InvalidParameter
;
1496 brush
->wrap
= wrapmode
;
1501 GpStatus WINGDIPAPI
GdipSetLineColors(GpLineGradient
*brush
, ARGB color1
,
1504 TRACE("(%p, %x, %x)\n", brush
, color1
, color2
);
1507 return InvalidParameter
;
1509 brush
->startcolor
= color1
;
1510 brush
->endcolor
= color2
;
1515 GpStatus WINGDIPAPI
GdipGetLineColors(GpLineGradient
*brush
, ARGB
*colors
)
1517 TRACE("(%p, %p)\n", brush
, colors
);
1519 if(!brush
|| !colors
)
1520 return InvalidParameter
;
1522 colors
[0] = brush
->startcolor
;
1523 colors
[1] = brush
->endcolor
;
1528 /******************************************************************************
1529 * GdipRotateTextureTransform [GDIPLUS.@]
1531 GpStatus WINGDIPAPI
GdipRotateTextureTransform(GpTexture
* brush
, REAL angle
,
1532 GpMatrixOrder order
)
1534 TRACE("(%p, %.2f, %d)\n", brush
, angle
, order
);
1537 return InvalidParameter
;
1539 return GdipRotateMatrix(brush
->transform
, angle
, order
);
1542 GpStatus WINGDIPAPI
GdipSetLineLinearBlend(GpLineGradient
*brush
, REAL focus
,
1549 TRACE("(%p,%.2f,%.2f)\n", brush
, focus
, scale
);
1551 if (!brush
) return InvalidParameter
;
1555 factors
[num_points
] = 0.0;
1556 positions
[num_points
] = 0.0;
1560 factors
[num_points
] = scale
;
1561 positions
[num_points
] = focus
;
1566 factors
[num_points
] = 0.0;
1567 positions
[num_points
] = 1.0;
1571 return GdipSetLineBlend(brush
, factors
, positions
, num_points
);
1574 GpStatus WINGDIPAPI
GdipSetLinePresetBlend(GpLineGradient
*brush
,
1575 GDIPCONST ARGB
*blend
, GDIPCONST REAL
* positions
, INT count
)
1580 FIXME("not implemented\n");
1582 return NotImplemented
;
1585 GpStatus WINGDIPAPI
GdipSetLineTransform(GpLineGradient
*brush
,
1586 GDIPCONST GpMatrix
*matrix
)
1591 FIXME("not implemented\n");
1593 return NotImplemented
;
1596 GpStatus WINGDIPAPI
GdipTranslateLineTransform(GpLineGradient
* brush
,
1597 REAL dx
, REAL dy
, GpMatrixOrder order
)
1599 FIXME("stub: %p %f %f %d\n", brush
, dx
, dy
, order
);
1601 return NotImplemented
;
1604 /******************************************************************************
1605 * GdipTranslateTextureTransform [GDIPLUS.@]
1607 GpStatus WINGDIPAPI
GdipTranslateTextureTransform(GpTexture
* brush
, REAL dx
, REAL dy
,
1608 GpMatrixOrder order
)
1610 TRACE("(%p, %.2f, %.2f, %d)\n", brush
, dx
, dy
, order
);
1613 return InvalidParameter
;
1615 return GdipTranslateMatrix(brush
->transform
, dx
, dy
, order
);
1618 GpStatus WINGDIPAPI
GdipGetLineRect(GpLineGradient
*brush
, GpRectF
*rect
)
1620 TRACE("(%p, %p)\n", brush
, rect
);
1623 return InvalidParameter
;
1625 *rect
= brush
->rect
;
1630 GpStatus WINGDIPAPI
GdipGetLineRectI(GpLineGradient
*brush
, GpRect
*rect
)
1635 TRACE("(%p, %p)\n", brush
, rect
);
1638 return InvalidParameter
;
1640 ret
= GdipGetLineRect(brush
, &rectF
);
1643 rect
->X
= roundr(rectF
.X
);
1644 rect
->Y
= roundr(rectF
.Y
);
1645 rect
->Width
= roundr(rectF
.Width
);
1646 rect
->Height
= roundr(rectF
.Height
);
1652 GpStatus WINGDIPAPI
GdipRotateLineTransform(GpLineGradient
* brush
,
1653 REAL angle
, GpMatrixOrder order
)
1658 return InvalidParameter
;
1661 FIXME("(%p, %.2f, %d) stub\n", brush
, angle
, order
);
1663 return NotImplemented
;