2007-06-15 01:09:07 +02:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2007 Google (Evan Stade)
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*/
|
|
|
|
|
2007-08-10 03:25:14 +02:00
|
|
|
#include <stdarg.h>
|
|
|
|
|
2007-06-15 01:09:07 +02:00
|
|
|
#include "windef.h"
|
2007-08-10 03:25:14 +02:00
|
|
|
#include "winbase.h"
|
|
|
|
#include "winuser.h"
|
2007-06-15 01:09:07 +02:00
|
|
|
#include "wingdi.h"
|
2007-08-01 04:15:48 +02:00
|
|
|
|
2007-08-10 03:25:14 +02:00
|
|
|
#define COBJMACROS
|
2007-08-01 04:15:48 +02:00
|
|
|
#include "objbase.h"
|
2007-08-10 03:25:14 +02:00
|
|
|
#include "olectl.h"
|
|
|
|
#include "ole2.h"
|
2007-08-01 04:15:48 +02:00
|
|
|
|
2007-06-15 01:09:07 +02:00
|
|
|
#include "gdiplus.h"
|
|
|
|
#include "gdiplus_private.h"
|
2007-08-02 02:56:02 +02:00
|
|
|
#include "wine/debug.h"
|
|
|
|
|
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(gdiplus);
|
2007-06-15 01:09:07 +02:00
|
|
|
|
2008-09-14 02:12:25 +02:00
|
|
|
/******************************************************************************
|
|
|
|
* GdipCloneBrush [GDIPLUS.@]
|
|
|
|
*/
|
2007-07-20 03:23:04 +02:00
|
|
|
GpStatus WINGDIPAPI GdipCloneBrush(GpBrush *brush, GpBrush **clone)
|
|
|
|
{
|
2008-09-02 22:13:40 +02:00
|
|
|
TRACE("(%p, %p)\n", brush, clone);
|
|
|
|
|
2007-07-20 03:23:04 +02:00
|
|
|
if(!brush || !clone)
|
|
|
|
return InvalidParameter;
|
|
|
|
|
2007-07-24 05:24:24 +02:00
|
|
|
switch(brush->bt){
|
|
|
|
case BrushTypeSolidColor:
|
2009-05-20 18:24:18 +02:00
|
|
|
{
|
|
|
|
GpSolidFill *fill;
|
2007-07-24 05:24:24 +02:00
|
|
|
*clone = GdipAlloc(sizeof(GpSolidFill));
|
|
|
|
if (!*clone) return OutOfMemory;
|
2007-07-20 03:23:04 +02:00
|
|
|
|
2009-05-20 18:24:18 +02:00
|
|
|
fill = (GpSolidFill*)*clone;
|
|
|
|
|
2007-07-24 05:24:24 +02:00
|
|
|
memcpy(*clone, brush, sizeof(GpSolidFill));
|
2007-07-20 03:23:04 +02:00
|
|
|
|
2009-01-11 00:45:11 +01:00
|
|
|
(*clone)->gdibrush = CreateBrushIndirect(&(*clone)->lb);
|
2009-05-20 18:24:18 +02:00
|
|
|
fill->bmp = ARGB2BMP(fill->color);
|
2009-01-11 00:45:11 +01:00
|
|
|
break;
|
2009-05-20 18:24:18 +02:00
|
|
|
}
|
2009-01-11 00:45:11 +01:00
|
|
|
case BrushTypeHatchFill:
|
2010-02-11 23:01:14 +01:00
|
|
|
{
|
|
|
|
GpHatch *hatch = (GpHatch*)brush;
|
2009-01-11 00:45:11 +01:00
|
|
|
|
2010-02-11 23:01:14 +01:00
|
|
|
return GdipCreateHatchBrush(hatch->hatchstyle, hatch->forecol, hatch->backcol, (GpHatch**)clone);
|
|
|
|
}
|
2007-08-03 02:52:55 +02:00
|
|
|
case BrushTypePathGradient:{
|
|
|
|
GpPathGradient *src, *dest;
|
|
|
|
INT count;
|
|
|
|
|
|
|
|
*clone = GdipAlloc(sizeof(GpPathGradient));
|
|
|
|
if (!*clone) return OutOfMemory;
|
|
|
|
|
|
|
|
src = (GpPathGradient*) brush,
|
|
|
|
dest = (GpPathGradient*) *clone;
|
|
|
|
count = src->pathdata.Count;
|
|
|
|
|
|
|
|
memcpy(dest, src, sizeof(GpPathGradient));
|
|
|
|
|
|
|
|
dest->pathdata.Count = count;
|
|
|
|
dest->pathdata.Points = GdipAlloc(count * sizeof(PointF));
|
|
|
|
dest->pathdata.Types = GdipAlloc(count);
|
|
|
|
|
|
|
|
if(!dest->pathdata.Points || !dest->pathdata.Types){
|
|
|
|
GdipFree(dest->pathdata.Points);
|
|
|
|
GdipFree(dest->pathdata.Types);
|
|
|
|
GdipFree(dest);
|
|
|
|
return OutOfMemory;
|
|
|
|
}
|
|
|
|
|
|
|
|
memcpy(dest->pathdata.Points, src->pathdata.Points, count * sizeof(PointF));
|
|
|
|
memcpy(dest->pathdata.Types, src->pathdata.Types, count);
|
|
|
|
|
2008-07-21 21:30:39 +02:00
|
|
|
/* blending */
|
|
|
|
count = src->blendcount;
|
|
|
|
dest->blendcount = count;
|
|
|
|
dest->blendfac = GdipAlloc(count * sizeof(REAL));
|
|
|
|
dest->blendpos = GdipAlloc(count * sizeof(REAL));
|
|
|
|
|
|
|
|
if(!dest->blendfac || !dest->blendpos){
|
|
|
|
GdipFree(dest->pathdata.Points);
|
|
|
|
GdipFree(dest->pathdata.Types);
|
|
|
|
GdipFree(dest->blendfac);
|
|
|
|
GdipFree(dest->blendpos);
|
|
|
|
GdipFree(dest);
|
|
|
|
return OutOfMemory;
|
|
|
|
}
|
|
|
|
|
|
|
|
memcpy(dest->blendfac, src->blendfac, count * sizeof(REAL));
|
|
|
|
memcpy(dest->blendpos, src->blendpos, count * sizeof(REAL));
|
|
|
|
|
2007-08-03 02:52:55 +02:00
|
|
|
break;
|
|
|
|
}
|
2009-04-29 01:03:41 +02:00
|
|
|
case BrushTypeLinearGradient:{
|
|
|
|
GpLineGradient *dest, *src;
|
2009-09-14 23:21:50 +02:00
|
|
|
INT count, pcount;
|
2009-04-29 01:03:41 +02:00
|
|
|
|
|
|
|
dest = GdipAlloc(sizeof(GpLineGradient));
|
|
|
|
if(!dest) return OutOfMemory;
|
|
|
|
|
|
|
|
src = (GpLineGradient*)brush;
|
|
|
|
|
|
|
|
memcpy(dest, src, sizeof(GpLineGradient));
|
|
|
|
|
|
|
|
dest->brush.gdibrush = CreateSolidBrush(dest->brush.lb.lbColor);
|
|
|
|
|
|
|
|
count = dest->blendcount;
|
|
|
|
dest->blendfac = GdipAlloc(count * sizeof(REAL));
|
|
|
|
dest->blendpos = GdipAlloc(count * sizeof(REAL));
|
2009-09-14 23:21:50 +02:00
|
|
|
pcount = dest->pblendcount;
|
|
|
|
if (pcount)
|
|
|
|
{
|
|
|
|
dest->pblendcolor = GdipAlloc(pcount * sizeof(ARGB));
|
|
|
|
dest->pblendpos = GdipAlloc(pcount * sizeof(REAL));
|
|
|
|
}
|
2009-04-29 01:03:41 +02:00
|
|
|
|
2009-09-14 23:21:50 +02:00
|
|
|
if (!dest->blendfac || !dest->blendpos ||
|
|
|
|
(pcount && (!dest->pblendcolor || !dest->pblendpos)))
|
2009-04-29 01:03:41 +02:00
|
|
|
{
|
|
|
|
GdipFree(dest->blendfac);
|
|
|
|
GdipFree(dest->blendpos);
|
2009-09-14 23:21:50 +02:00
|
|
|
GdipFree(dest->pblendcolor);
|
|
|
|
GdipFree(dest->pblendpos);
|
2009-04-29 01:03:41 +02:00
|
|
|
DeleteObject(dest->brush.gdibrush);
|
|
|
|
GdipFree(dest);
|
|
|
|
return OutOfMemory;
|
|
|
|
}
|
2007-08-08 03:42:56 +02:00
|
|
|
|
2009-04-29 01:03:41 +02:00
|
|
|
memcpy(dest->blendfac, src->blendfac, count * sizeof(REAL));
|
|
|
|
memcpy(dest->blendpos, src->blendpos, count * sizeof(REAL));
|
2007-08-08 03:42:56 +02:00
|
|
|
|
2009-09-14 23:21:50 +02:00
|
|
|
if (pcount)
|
|
|
|
{
|
|
|
|
memcpy(dest->pblendcolor, src->pblendcolor, pcount * sizeof(ARGB));
|
|
|
|
memcpy(dest->pblendpos, src->pblendpos, pcount * sizeof(REAL));
|
|
|
|
}
|
|
|
|
|
2009-04-29 01:03:41 +02:00
|
|
|
*clone = &dest->brush;
|
2007-08-08 03:42:56 +02:00
|
|
|
break;
|
2009-04-29 01:03:41 +02:00
|
|
|
}
|
2007-08-10 03:25:18 +02:00
|
|
|
case BrushTypeTextureFill:
|
2010-02-11 23:43:45 +01:00
|
|
|
{
|
|
|
|
GpStatus stat;
|
|
|
|
GpTexture *texture = (GpTexture*)brush;
|
|
|
|
GpTexture *new_texture;
|
2007-08-10 03:25:18 +02:00
|
|
|
|
2010-02-11 23:43:45 +01:00
|
|
|
stat = GdipCreateTexture(texture->image, texture->wrap, &new_texture);
|
2007-08-10 03:25:18 +02:00
|
|
|
|
2010-02-11 23:43:45 +01:00
|
|
|
if (stat == Ok)
|
|
|
|
{
|
|
|
|
memcpy(new_texture->transform, texture->transform, sizeof(GpMatrix));
|
|
|
|
*clone = (GpBrush*)new_texture;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
*clone = NULL;
|
|
|
|
|
|
|
|
return stat;
|
|
|
|
}
|
2007-07-24 05:24:24 +02:00
|
|
|
default:
|
2007-08-10 03:25:18 +02:00
|
|
|
ERR("not implemented for brush type %d\n", brush->bt);
|
2007-07-24 05:24:24 +02:00
|
|
|
return NotImplemented;
|
|
|
|
}
|
2007-07-20 03:23:04 +02:00
|
|
|
|
2009-12-18 21:58:28 +01:00
|
|
|
TRACE("<-- %p\n", *clone);
|
2007-07-20 03:23:04 +02:00
|
|
|
return Ok;
|
|
|
|
}
|
|
|
|
|
2009-10-08 20:35:03 +02:00
|
|
|
static const char HatchBrushes[][8] = {
|
|
|
|
{ 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00 }, /* HatchStyleHorizontal */
|
|
|
|
{ 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08 }, /* HatchStyleVertical */
|
|
|
|
{ 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80 }, /* HatchStyleForwardDiagonal */
|
|
|
|
{ 0x80, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x01 }, /* HatchStyleBackwardDiagonal */
|
|
|
|
{ 0x08, 0x08, 0x08, 0xff, 0x08, 0x08, 0x08, 0x08 }, /* HatchStyleCross */
|
|
|
|
{ 0x81, 0x42, 0x24, 0x18, 0x18, 0x24, 0x42, 0x81 }, /* HatchStyleDiagonalCross */
|
2009-10-08 22:48:21 +02:00
|
|
|
{ 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x80 }, /* HatchStyle05Percent */
|
|
|
|
{ 0x00, 0x02, 0x00, 0x88, 0x00, 0x20, 0x00, 0x88 }, /* HatchStyle10Percent */
|
|
|
|
{ 0x00, 0x22, 0x00, 0xcc, 0x00, 0x22, 0x00, 0xcc }, /* HatchStyle20Percent */
|
|
|
|
{ 0x00, 0xcc, 0x00, 0xcc, 0x00, 0xcc, 0x00, 0xcc }, /* HatchStyle25Percent */
|
|
|
|
{ 0x00, 0xcc, 0x04, 0xcc, 0x00, 0xcc, 0x40, 0xcc }, /* HatchStyle30Percent */
|
|
|
|
{ 0x44, 0xcc, 0x22, 0xcc, 0x44, 0xcc, 0x22, 0xcc }, /* HatchStyle40Percent */
|
|
|
|
{ 0x55, 0xcc, 0x55, 0xcc, 0x55, 0xcc, 0x55, 0xcc }, /* HatchStyle50Percent */
|
|
|
|
{ 0x55, 0xcd, 0x55, 0xee, 0x55, 0xdc, 0x55, 0xee }, /* HatchStyle60Percent */
|
|
|
|
{ 0x55, 0xdd, 0x55, 0xff, 0x55, 0xdd, 0x55, 0xff }, /* HatchStyle70Percent */
|
|
|
|
{ 0x55, 0xff, 0x55, 0xff, 0x55, 0xff, 0x55, 0xff }, /* HatchStyle75Percent */
|
|
|
|
{ 0x55, 0xff, 0x59, 0xff, 0x55, 0xff, 0x99, 0xff }, /* HatchStyle80Percent */
|
|
|
|
{ 0x77, 0xff, 0xdd, 0xff, 0x77, 0xff, 0xfd, 0xff }, /* HatchStyle90Percent */
|
|
|
|
{ 0x11, 0x22, 0x44, 0x88, 0x11, 0x22, 0x44, 0x88 }, /* HatchStyleLightDownwardDiagonal */
|
|
|
|
{ 0x88, 0x44, 0x22, 0x11, 0x88, 0x44, 0x22, 0x11 }, /* HatchStyleLightUpwardDiagonal */
|
|
|
|
{ 0x99, 0x33, 0x66, 0xcc, 0x99, 0x33, 0x66, 0xcc }, /* HatchStyleDarkDownwardDiagonal */
|
|
|
|
{ 0xcc, 0x66, 0x33, 0x99, 0xcc, 0x66, 0x33, 0x99 }, /* HatchStyleDarkUpwardDiagonal */
|
|
|
|
{ 0xc1, 0x83, 0x07, 0x0e, 0x1c, 0x38, 0x70, 0xe0 }, /* HatchStyleWideDownwardDiagonal */
|
|
|
|
{ 0xe0, 0x70, 0x38, 0x1c, 0x0e, 0x07, 0x83, 0xc1 }, /* HatchStyleWideUpwardDiagonal */
|
|
|
|
{ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88 }, /* HatchStyleLightVertical */
|
|
|
|
{ 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff }, /* HatchStyleLightHorizontal */
|
|
|
|
{ 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa }, /* HatchStyleNarrowVertical */
|
|
|
|
{ 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff }, /* HatchStyleNarrowHorizontal */
|
|
|
|
{ 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc }, /* HatchStyleDarkVertical */
|
|
|
|
{ 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0xff, 0xff }, /* HatchStyleDarkHorizontal */
|
2009-10-08 20:35:03 +02:00
|
|
|
};
|
2009-01-11 00:45:11 +01:00
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* GdipCreateHatchBrush [GDIPLUS.@]
|
|
|
|
*/
|
2009-01-16 16:36:29 +01:00
|
|
|
GpStatus WINGDIPAPI GdipCreateHatchBrush(HatchStyle hatchstyle, ARGB forecol, ARGB backcol, GpHatch **brush)
|
2009-01-11 00:45:11 +01:00
|
|
|
{
|
|
|
|
COLORREF fgcol = ARGB2COLORREF(forecol);
|
2009-10-08 20:35:03 +02:00
|
|
|
GpStatus stat = Ok;
|
2009-01-11 00:45:11 +01:00
|
|
|
|
|
|
|
TRACE("(%d, %d, %d, %p)\n", hatchstyle, forecol, backcol, brush);
|
|
|
|
|
|
|
|
if(!brush) return InvalidParameter;
|
|
|
|
|
|
|
|
*brush = GdipAlloc(sizeof(GpHatch));
|
|
|
|
if (!*brush) return OutOfMemory;
|
|
|
|
|
2009-10-08 20:35:03 +02:00
|
|
|
if (hatchstyle < sizeof(HatchBrushes) / sizeof(HatchBrushes[0]))
|
2009-01-11 00:45:11 +01:00
|
|
|
{
|
2009-10-08 20:35:03 +02:00
|
|
|
HBITMAP hbmp;
|
|
|
|
HDC hdc;
|
|
|
|
BITMAPINFOHEADER bmih;
|
|
|
|
DWORD* bits;
|
|
|
|
int x, y;
|
2009-01-11 00:45:11 +01:00
|
|
|
|
2009-10-08 20:35:03 +02:00
|
|
|
hdc = CreateCompatibleDC(0);
|
2009-01-11 00:45:11 +01:00
|
|
|
|
2009-10-08 20:35:03 +02:00
|
|
|
if (hdc)
|
|
|
|
{
|
|
|
|
bmih.biSize = sizeof(bmih);
|
|
|
|
bmih.biWidth = 8;
|
|
|
|
bmih.biHeight = 8;
|
|
|
|
bmih.biPlanes = 1;
|
|
|
|
bmih.biBitCount = 32;
|
|
|
|
bmih.biCompression = BI_RGB;
|
|
|
|
bmih.biSizeImage = 0;
|
|
|
|
|
|
|
|
hbmp = CreateDIBSection(hdc, (BITMAPINFO*)&bmih, DIB_RGB_COLORS, (void**)&bits, NULL, 0);
|
|
|
|
|
|
|
|
if (hbmp)
|
|
|
|
{
|
|
|
|
for (y=0; y<8; y++)
|
|
|
|
for (x=0; x<8; x++)
|
|
|
|
if ((HatchBrushes[hatchstyle][y] & (0x80 >> x)) != 0)
|
|
|
|
bits[y*8+x] = forecol;
|
|
|
|
else
|
|
|
|
bits[y*8+x] = backcol;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
stat = GenericError;
|
|
|
|
|
|
|
|
DeleteDC(hdc);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
stat = GenericError;
|
|
|
|
|
|
|
|
if (stat == Ok)
|
|
|
|
{
|
|
|
|
(*brush)->brush.lb.lbStyle = BS_PATTERN;
|
|
|
|
(*brush)->brush.lb.lbColor = 0;
|
|
|
|
(*brush)->brush.lb.lbHatch = (ULONG_PTR)hbmp;
|
|
|
|
(*brush)->brush.gdibrush = CreateBrushIndirect(&(*brush)->brush.lb);
|
|
|
|
|
|
|
|
DeleteObject(hbmp);
|
|
|
|
}
|
2009-01-11 00:45:11 +01:00
|
|
|
}
|
2009-10-08 20:35:03 +02:00
|
|
|
else
|
|
|
|
{
|
|
|
|
FIXME("Unimplemented hatch style %d\n", hatchstyle);
|
2009-01-11 00:45:11 +01:00
|
|
|
|
2009-10-08 20:35:03 +02:00
|
|
|
(*brush)->brush.lb.lbStyle = BS_SOLID;
|
|
|
|
(*brush)->brush.lb.lbColor = fgcol;
|
|
|
|
(*brush)->brush.lb.lbHatch = 0;
|
|
|
|
(*brush)->brush.gdibrush = CreateBrushIndirect(&(*brush)->brush.lb);
|
|
|
|
}
|
2009-01-11 00:45:11 +01:00
|
|
|
|
2009-10-08 20:35:03 +02:00
|
|
|
if (stat == Ok)
|
|
|
|
{
|
|
|
|
(*brush)->brush.bt = BrushTypeHatchFill;
|
|
|
|
(*brush)->forecol = forecol;
|
|
|
|
(*brush)->backcol = backcol;
|
|
|
|
(*brush)->hatchstyle = hatchstyle;
|
2009-12-18 21:58:28 +01:00
|
|
|
TRACE("<-- %p\n", *brush);
|
2009-10-08 20:35:03 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
GdipFree(*brush);
|
|
|
|
*brush = NULL;
|
|
|
|
}
|
2009-01-11 00:45:11 +01:00
|
|
|
|
2009-10-08 20:35:03 +02:00
|
|
|
return stat;
|
2009-01-11 00:45:11 +01:00
|
|
|
}
|
|
|
|
|
2008-09-14 02:12:25 +02:00
|
|
|
/******************************************************************************
|
|
|
|
* GdipCreateLineBrush [GDIPLUS.@]
|
|
|
|
*/
|
2007-08-08 03:42:29 +02:00
|
|
|
GpStatus WINGDIPAPI GdipCreateLineBrush(GDIPCONST GpPointF* startpoint,
|
|
|
|
GDIPCONST GpPointF* endpoint, ARGB startcolor, ARGB endcolor,
|
|
|
|
GpWrapMode wrap, GpLineGradient **line)
|
|
|
|
{
|
|
|
|
COLORREF col = ARGB2COLORREF(startcolor);
|
|
|
|
|
2009-12-18 22:45:02 +01:00
|
|
|
TRACE("(%s, %s, %x, %x, %d, %p)\n", debugstr_pointf(startpoint),
|
|
|
|
debugstr_pointf(endpoint), startcolor, endcolor, wrap, line);
|
2008-09-02 22:13:40 +02:00
|
|
|
|
2007-08-08 03:42:32 +02:00
|
|
|
if(!line || !startpoint || !endpoint || wrap == WrapModeClamp)
|
2007-08-08 03:42:29 +02:00
|
|
|
return InvalidParameter;
|
|
|
|
|
|
|
|
*line = GdipAlloc(sizeof(GpLineGradient));
|
|
|
|
if(!*line) return OutOfMemory;
|
|
|
|
|
|
|
|
(*line)->brush.lb.lbStyle = BS_SOLID;
|
|
|
|
(*line)->brush.lb.lbColor = col;
|
|
|
|
(*line)->brush.lb.lbHatch = 0;
|
|
|
|
(*line)->brush.gdibrush = CreateSolidBrush(col);
|
|
|
|
(*line)->brush.bt = BrushTypeLinearGradient;
|
|
|
|
|
|
|
|
(*line)->startpoint.X = startpoint->X;
|
|
|
|
(*line)->startpoint.Y = startpoint->Y;
|
|
|
|
(*line)->endpoint.X = endpoint->X;
|
|
|
|
(*line)->endpoint.Y = endpoint->Y;
|
|
|
|
(*line)->startcolor = startcolor;
|
|
|
|
(*line)->endcolor = endcolor;
|
|
|
|
(*line)->wrap = wrap;
|
2007-08-08 03:42:40 +02:00
|
|
|
(*line)->gamma = FALSE;
|
2007-08-08 03:42:29 +02:00
|
|
|
|
2009-05-07 18:33:28 +02:00
|
|
|
(*line)->rect.X = (startpoint->X < endpoint->X ? startpoint->X: endpoint->X);
|
|
|
|
(*line)->rect.Y = (startpoint->Y < endpoint->Y ? startpoint->Y: endpoint->Y);
|
|
|
|
(*line)->rect.Width = fabs(startpoint->X - endpoint->X);
|
|
|
|
(*line)->rect.Height = fabs(startpoint->Y - endpoint->Y);
|
|
|
|
|
2009-08-03 16:02:49 +02:00
|
|
|
if ((*line)->rect.Width == 0)
|
|
|
|
{
|
|
|
|
(*line)->rect.X -= (*line)->rect.Height / 2.0f;
|
|
|
|
(*line)->rect.Width = (*line)->rect.Height;
|
|
|
|
}
|
|
|
|
else if ((*line)->rect.Height == 0)
|
|
|
|
{
|
|
|
|
(*line)->rect.Y -= (*line)->rect.Width / 2.0f;
|
|
|
|
(*line)->rect.Height = (*line)->rect.Width;
|
|
|
|
}
|
|
|
|
|
2009-04-29 01:03:41 +02:00
|
|
|
(*line)->blendcount = 1;
|
|
|
|
(*line)->blendfac = GdipAlloc(sizeof(REAL));
|
|
|
|
(*line)->blendpos = GdipAlloc(sizeof(REAL));
|
|
|
|
|
|
|
|
if (!(*line)->blendfac || !(*line)->blendpos)
|
|
|
|
{
|
|
|
|
GdipFree((*line)->blendfac);
|
|
|
|
GdipFree((*line)->blendpos);
|
|
|
|
DeleteObject((*line)->brush.gdibrush);
|
|
|
|
GdipFree(*line);
|
|
|
|
*line = NULL;
|
|
|
|
return OutOfMemory;
|
|
|
|
}
|
|
|
|
|
|
|
|
(*line)->blendfac[0] = 1.0f;
|
|
|
|
(*line)->blendpos[0] = 1.0f;
|
|
|
|
|
2009-09-14 23:21:50 +02:00
|
|
|
(*line)->pblendcolor = NULL;
|
|
|
|
(*line)->pblendpos = NULL;
|
|
|
|
(*line)->pblendcount = 0;
|
|
|
|
|
2009-12-18 21:58:28 +01:00
|
|
|
TRACE("<-- %p\n", *line);
|
|
|
|
|
2007-08-08 03:42:29 +02:00
|
|
|
return Ok;
|
|
|
|
}
|
|
|
|
|
2008-04-20 22:45:52 +02:00
|
|
|
GpStatus WINGDIPAPI GdipCreateLineBrushI(GDIPCONST GpPoint* startpoint,
|
|
|
|
GDIPCONST GpPoint* endpoint, ARGB startcolor, ARGB endcolor,
|
|
|
|
GpWrapMode wrap, GpLineGradient **line)
|
|
|
|
{
|
|
|
|
GpPointF stF;
|
|
|
|
GpPointF endF;
|
|
|
|
|
2008-09-02 22:13:40 +02:00
|
|
|
TRACE("(%p, %p, %x, %x, %d, %p)\n", startpoint, endpoint,
|
|
|
|
startcolor, endcolor, wrap, line);
|
|
|
|
|
2008-04-20 22:45:52 +02:00
|
|
|
if(!startpoint || !endpoint)
|
|
|
|
return InvalidParameter;
|
|
|
|
|
|
|
|
stF.X = (REAL)startpoint->X;
|
|
|
|
stF.Y = (REAL)startpoint->Y;
|
|
|
|
endF.X = (REAL)endpoint->X;
|
|
|
|
endF.X = (REAL)endpoint->Y;
|
|
|
|
|
|
|
|
return GdipCreateLineBrush(&stF, &endF, startcolor, endcolor, wrap, line);
|
|
|
|
}
|
|
|
|
|
2008-04-25 21:17:46 +02:00
|
|
|
GpStatus WINGDIPAPI GdipCreateLineBrushFromRect(GDIPCONST GpRectF* rect,
|
2007-08-08 03:43:00 +02:00
|
|
|
ARGB startcolor, ARGB endcolor, LinearGradientMode mode, GpWrapMode wrap,
|
|
|
|
GpLineGradient **line)
|
|
|
|
{
|
|
|
|
GpPointF start, end;
|
2009-05-07 18:40:13 +02:00
|
|
|
GpStatus stat;
|
2007-08-08 03:43:00 +02:00
|
|
|
|
2008-09-02 22:13:40 +02:00
|
|
|
TRACE("(%p, %x, %x, %d, %d, %p)\n", rect, startcolor, endcolor, mode,
|
|
|
|
wrap, line);
|
|
|
|
|
2007-08-08 03:43:00 +02:00
|
|
|
if(!line || !rect)
|
|
|
|
return InvalidParameter;
|
|
|
|
|
2009-05-06 23:36:06 +02:00
|
|
|
switch (mode)
|
|
|
|
{
|
|
|
|
case LinearGradientModeHorizontal:
|
|
|
|
start.X = rect->X;
|
|
|
|
start.Y = rect->Y;
|
|
|
|
end.X = rect->X + rect->Width;
|
|
|
|
end.Y = rect->Y;
|
|
|
|
break;
|
|
|
|
case LinearGradientModeVertical:
|
|
|
|
start.X = rect->X;
|
|
|
|
start.Y = rect->Y;
|
|
|
|
end.X = rect->X;
|
|
|
|
end.Y = rect->Y + rect->Height;
|
|
|
|
break;
|
|
|
|
case LinearGradientModeForwardDiagonal:
|
|
|
|
start.X = rect->X;
|
|
|
|
start.Y = rect->Y;
|
|
|
|
end.X = rect->X + rect->Width;
|
|
|
|
end.Y = rect->Y + rect->Height;
|
|
|
|
break;
|
|
|
|
case LinearGradientModeBackwardDiagonal:
|
|
|
|
start.X = rect->X + rect->Width;
|
|
|
|
start.Y = rect->Y;
|
|
|
|
end.X = rect->X;
|
|
|
|
end.Y = rect->Y + rect->Height;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
return InvalidParameter;
|
|
|
|
}
|
2007-08-08 03:43:00 +02:00
|
|
|
|
2009-05-07 18:40:13 +02:00
|
|
|
stat = GdipCreateLineBrush(&start, &end, startcolor, endcolor, wrap, line);
|
|
|
|
|
|
|
|
if (stat == Ok)
|
|
|
|
(*line)->rect = *rect;
|
|
|
|
|
|
|
|
return stat;
|
2007-08-08 03:43:00 +02:00
|
|
|
}
|
|
|
|
|
2008-04-25 21:17:46 +02:00
|
|
|
GpStatus WINGDIPAPI GdipCreateLineBrushFromRectI(GDIPCONST GpRect* rect,
|
|
|
|
ARGB startcolor, ARGB endcolor, LinearGradientMode mode, GpWrapMode wrap,
|
|
|
|
GpLineGradient **line)
|
|
|
|
{
|
|
|
|
GpRectF rectF;
|
|
|
|
|
2008-09-02 22:13:40 +02:00
|
|
|
TRACE("(%p, %x, %x, %d, %d, %p)\n", rect, startcolor, endcolor, mode,
|
|
|
|
wrap, line);
|
|
|
|
|
2008-04-25 21:17:46 +02:00
|
|
|
rectF.X = (REAL) rect->X;
|
|
|
|
rectF.Y = (REAL) rect->Y;
|
|
|
|
rectF.Width = (REAL) rect->Width;
|
|
|
|
rectF.Height = (REAL) rect->Height;
|
|
|
|
|
|
|
|
return GdipCreateLineBrushFromRect(&rectF, startcolor, endcolor, mode, wrap, line);
|
|
|
|
}
|
|
|
|
|
2008-09-14 02:12:25 +02:00
|
|
|
/******************************************************************************
|
|
|
|
* GdipCreateLineBrushFromRectWithAngle [GDIPLUS.@]
|
|
|
|
*/
|
2008-07-08 23:45:07 +02:00
|
|
|
GpStatus WINGDIPAPI GdipCreateLineBrushFromRectWithAngle(GDIPCONST GpRectF* rect,
|
|
|
|
ARGB startcolor, ARGB endcolor, REAL angle, BOOL isAngleScalable, GpWrapMode wrap,
|
|
|
|
GpLineGradient **line)
|
|
|
|
{
|
2010-02-06 22:43:16 +01:00
|
|
|
GpStatus stat;
|
|
|
|
LinearGradientMode mode;
|
|
|
|
REAL width, height, exofs, eyofs;
|
|
|
|
REAL sin_angle, cos_angle, sin_cos_angle;
|
|
|
|
|
2008-09-02 22:13:40 +02:00
|
|
|
TRACE("(%p, %x, %x, %.2f, %d, %d, %p)\n", rect, startcolor, endcolor, angle, isAngleScalable,
|
|
|
|
wrap, line);
|
|
|
|
|
2010-02-06 22:43:16 +01:00
|
|
|
sin_angle = sinf(deg2rad(angle));
|
|
|
|
cos_angle = cosf(deg2rad(angle));
|
|
|
|
sin_cos_angle = sin_angle * cos_angle;
|
|
|
|
|
|
|
|
if (isAngleScalable)
|
|
|
|
{
|
|
|
|
width = height = 1.0;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
width = rect->Width;
|
|
|
|
height = rect->Height;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (sin_cos_angle >= 0)
|
|
|
|
mode = LinearGradientModeForwardDiagonal;
|
|
|
|
else
|
|
|
|
mode = LinearGradientModeBackwardDiagonal;
|
|
|
|
|
|
|
|
stat = GdipCreateLineBrushFromRect(rect, startcolor, endcolor, mode, wrap, line);
|
|
|
|
|
|
|
|
if (stat == Ok)
|
|
|
|
{
|
|
|
|
if (sin_cos_angle >= 0)
|
|
|
|
{
|
|
|
|
exofs = width * sin_cos_angle + height * cos_angle * cos_angle;
|
|
|
|
eyofs = width * sin_angle * sin_angle + height * sin_cos_angle;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
exofs = width * sin_angle * sin_angle + height * sin_cos_angle;
|
|
|
|
eyofs = -width * sin_cos_angle + height * sin_angle * sin_angle;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (isAngleScalable)
|
|
|
|
{
|
|
|
|
exofs = exofs * rect->Width;
|
|
|
|
eyofs = eyofs * rect->Height;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (sin_angle >= 0)
|
|
|
|
{
|
|
|
|
(*line)->endpoint.X = rect->X + exofs;
|
|
|
|
(*line)->endpoint.Y = rect->Y + eyofs;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
(*line)->endpoint.X = (*line)->startpoint.X;
|
|
|
|
(*line)->endpoint.Y = (*line)->startpoint.Y;
|
|
|
|
(*line)->startpoint.X = rect->X + exofs;
|
|
|
|
(*line)->startpoint.Y = rect->Y + eyofs;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return stat;
|
2008-07-08 23:45:07 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
GpStatus WINGDIPAPI GdipCreateLineBrushFromRectWithAngleI(GDIPCONST GpRect* rect,
|
|
|
|
ARGB startcolor, ARGB endcolor, REAL angle, BOOL isAngleScalable, GpWrapMode wrap,
|
|
|
|
GpLineGradient **line)
|
|
|
|
{
|
2008-09-02 22:13:40 +02:00
|
|
|
TRACE("(%p, %x, %x, %.2f, %d, %d, %p)\n", rect, startcolor, endcolor, angle, isAngleScalable,
|
|
|
|
wrap, line);
|
|
|
|
|
2008-07-08 23:45:07 +02:00
|
|
|
return GdipCreateLineBrushFromRectI(rect, startcolor, endcolor, LinearGradientModeForwardDiagonal,
|
|
|
|
wrap, line);
|
|
|
|
}
|
|
|
|
|
2007-08-03 02:54:24 +02:00
|
|
|
GpStatus WINGDIPAPI GdipCreatePathGradient(GDIPCONST GpPointF* points,
|
|
|
|
INT count, GpWrapMode wrap, GpPathGradient **grad)
|
|
|
|
{
|
|
|
|
COLORREF col = ARGB2COLORREF(0xffffffff);
|
|
|
|
|
2008-09-02 22:13:40 +02:00
|
|
|
TRACE("(%p, %d, %d, %p)\n", points, count, wrap, grad);
|
|
|
|
|
2007-08-03 02:54:24 +02:00
|
|
|
if(!points || !grad)
|
|
|
|
return InvalidParameter;
|
|
|
|
|
|
|
|
if(count <= 0)
|
|
|
|
return OutOfMemory;
|
|
|
|
|
|
|
|
*grad = GdipAlloc(sizeof(GpPathGradient));
|
|
|
|
if (!*grad) return OutOfMemory;
|
|
|
|
|
2008-07-21 21:30:39 +02:00
|
|
|
(*grad)->blendfac = GdipAlloc(sizeof(REAL));
|
2010-06-19 23:31:14 +02:00
|
|
|
(*grad)->blendpos = GdipAlloc(sizeof(REAL));
|
|
|
|
if(!(*grad)->blendfac || !(*grad)->blendpos){
|
|
|
|
GdipFree((*grad)->blendfac);
|
|
|
|
GdipFree((*grad)->blendpos);
|
2008-07-21 21:30:39 +02:00
|
|
|
GdipFree(*grad);
|
2010-06-20 00:17:11 +02:00
|
|
|
*grad = NULL;
|
2008-07-21 21:30:39 +02:00
|
|
|
return OutOfMemory;
|
|
|
|
}
|
|
|
|
(*grad)->blendfac[0] = 1.0;
|
2010-06-19 23:31:14 +02:00
|
|
|
(*grad)->blendpos[0] = 1.0;
|
2008-07-21 21:30:39 +02:00
|
|
|
(*grad)->blendcount = 1;
|
|
|
|
|
2007-08-03 02:54:24 +02:00
|
|
|
(*grad)->pathdata.Count = count;
|
|
|
|
(*grad)->pathdata.Points = GdipAlloc(count * sizeof(PointF));
|
|
|
|
(*grad)->pathdata.Types = GdipAlloc(count);
|
|
|
|
|
|
|
|
if(!(*grad)->pathdata.Points || !(*grad)->pathdata.Types){
|
|
|
|
GdipFree((*grad)->pathdata.Points);
|
|
|
|
GdipFree((*grad)->pathdata.Types);
|
|
|
|
GdipFree(*grad);
|
|
|
|
return OutOfMemory;
|
|
|
|
}
|
|
|
|
|
|
|
|
memcpy((*grad)->pathdata.Points, points, count * sizeof(PointF));
|
|
|
|
memset((*grad)->pathdata.Types, PathPointTypeLine, count);
|
|
|
|
|
|
|
|
(*grad)->brush.lb.lbStyle = BS_SOLID;
|
|
|
|
(*grad)->brush.lb.lbColor = col;
|
|
|
|
(*grad)->brush.lb.lbHatch = 0;
|
|
|
|
|
|
|
|
(*grad)->brush.gdibrush = CreateSolidBrush(col);
|
|
|
|
(*grad)->brush.bt = BrushTypePathGradient;
|
|
|
|
(*grad)->centercolor = 0xffffffff;
|
|
|
|
(*grad)->wrap = wrap;
|
2007-08-03 02:52:49 +02:00
|
|
|
(*grad)->gamma = FALSE;
|
2007-08-03 02:52:59 +02:00
|
|
|
(*grad)->center.X = 0.0;
|
|
|
|
(*grad)->center.Y = 0.0;
|
2007-08-03 02:53:04 +02:00
|
|
|
(*grad)->focus.X = 0.0;
|
|
|
|
(*grad)->focus.Y = 0.0;
|
2007-08-03 02:54:24 +02:00
|
|
|
|
2009-12-18 21:58:28 +01:00
|
|
|
TRACE("<-- %p\n", *grad);
|
|
|
|
|
2007-08-03 02:54:24 +02:00
|
|
|
return Ok;
|
|
|
|
}
|
|
|
|
|
2008-04-25 21:17:41 +02:00
|
|
|
GpStatus WINGDIPAPI GdipCreatePathGradientI(GDIPCONST GpPoint* points,
|
|
|
|
INT count, GpWrapMode wrap, GpPathGradient **grad)
|
|
|
|
{
|
|
|
|
GpPointF *pointsF;
|
|
|
|
GpStatus ret;
|
|
|
|
INT i;
|
|
|
|
|
2008-09-02 22:13:40 +02:00
|
|
|
TRACE("(%p, %d, %d, %p)\n", points, count, wrap, grad);
|
|
|
|
|
2008-04-25 21:17:41 +02:00
|
|
|
if(!points || !grad)
|
|
|
|
return InvalidParameter;
|
|
|
|
|
|
|
|
if(count <= 0)
|
|
|
|
return OutOfMemory;
|
|
|
|
|
|
|
|
pointsF = GdipAlloc(sizeof(GpPointF) * count);
|
|
|
|
if(!pointsF)
|
|
|
|
return OutOfMemory;
|
|
|
|
|
|
|
|
for(i = 0; i < count; i++){
|
|
|
|
pointsF[i].X = (REAL)points[i].X;
|
|
|
|
pointsF[i].Y = (REAL)points[i].Y;
|
|
|
|
}
|
|
|
|
|
|
|
|
ret = GdipCreatePathGradient(pointsF, count, wrap, grad);
|
|
|
|
GdipFree(pointsF);
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2008-09-14 02:12:25 +02:00
|
|
|
/******************************************************************************
|
|
|
|
* GdipCreatePathGradientFromPath [GDIPLUS.@]
|
|
|
|
*
|
|
|
|
* FIXME: path gradient brushes not truly supported (drawn as solid brushes)
|
|
|
|
*/
|
2007-08-02 02:56:02 +02:00
|
|
|
GpStatus WINGDIPAPI GdipCreatePathGradientFromPath(GDIPCONST GpPath* path,
|
|
|
|
GpPathGradient **grad)
|
|
|
|
{
|
|
|
|
COLORREF col = ARGB2COLORREF(0xffffffff);
|
|
|
|
|
2008-09-02 22:13:40 +02:00
|
|
|
TRACE("(%p, %p)\n", path, grad);
|
|
|
|
|
2007-08-02 02:56:02 +02:00
|
|
|
if(!path || !grad)
|
|
|
|
return InvalidParameter;
|
|
|
|
|
|
|
|
*grad = GdipAlloc(sizeof(GpPathGradient));
|
|
|
|
if (!*grad) return OutOfMemory;
|
|
|
|
|
2008-07-21 21:30:39 +02:00
|
|
|
(*grad)->blendfac = GdipAlloc(sizeof(REAL));
|
2010-06-19 23:31:14 +02:00
|
|
|
(*grad)->blendpos = GdipAlloc(sizeof(REAL));
|
|
|
|
if(!(*grad)->blendfac || !(*grad)->blendpos){
|
|
|
|
GdipFree((*grad)->blendfac);
|
|
|
|
GdipFree((*grad)->blendpos);
|
2008-07-21 21:30:39 +02:00
|
|
|
GdipFree(*grad);
|
2010-06-20 00:17:11 +02:00
|
|
|
*grad = NULL;
|
2008-07-21 21:30:39 +02:00
|
|
|
return OutOfMemory;
|
|
|
|
}
|
|
|
|
(*grad)->blendfac[0] = 1.0;
|
2010-06-19 23:31:14 +02:00
|
|
|
(*grad)->blendpos[0] = 1.0;
|
2008-07-21 21:30:39 +02:00
|
|
|
(*grad)->blendcount = 1;
|
|
|
|
|
2007-08-03 02:51:49 +02:00
|
|
|
(*grad)->pathdata.Count = path->pathdata.Count;
|
|
|
|
(*grad)->pathdata.Points = GdipAlloc(path->pathdata.Count * sizeof(PointF));
|
|
|
|
(*grad)->pathdata.Types = GdipAlloc(path->pathdata.Count);
|
|
|
|
|
|
|
|
if(!(*grad)->pathdata.Points || !(*grad)->pathdata.Types){
|
|
|
|
GdipFree((*grad)->pathdata.Points);
|
|
|
|
GdipFree((*grad)->pathdata.Types);
|
|
|
|
GdipFree(*grad);
|
|
|
|
return OutOfMemory;
|
|
|
|
}
|
|
|
|
|
|
|
|
memcpy((*grad)->pathdata.Points, path->pathdata.Points,
|
|
|
|
path->pathdata.Count * sizeof(PointF));
|
|
|
|
memcpy((*grad)->pathdata.Types, path->pathdata.Types, path->pathdata.Count);
|
|
|
|
|
2007-08-02 02:56:02 +02:00
|
|
|
(*grad)->brush.lb.lbStyle = BS_SOLID;
|
|
|
|
(*grad)->brush.lb.lbColor = col;
|
|
|
|
(*grad)->brush.lb.lbHatch = 0;
|
|
|
|
|
|
|
|
(*grad)->brush.gdibrush = CreateSolidBrush(col);
|
2007-08-03 02:51:49 +02:00
|
|
|
(*grad)->brush.bt = BrushTypePathGradient;
|
2007-08-02 02:56:02 +02:00
|
|
|
(*grad)->centercolor = 0xffffffff;
|
2007-08-02 02:56:10 +02:00
|
|
|
(*grad)->wrap = WrapModeClamp;
|
2007-08-03 02:52:49 +02:00
|
|
|
(*grad)->gamma = FALSE;
|
2007-08-03 02:52:59 +02:00
|
|
|
/* FIXME: this should be set to the "centroid" of the path by default */
|
|
|
|
(*grad)->center.X = 0.0;
|
|
|
|
(*grad)->center.Y = 0.0;
|
2007-08-03 02:53:04 +02:00
|
|
|
(*grad)->focus.X = 0.0;
|
|
|
|
(*grad)->focus.Y = 0.0;
|
2007-08-02 02:56:02 +02:00
|
|
|
|
2009-12-18 21:58:28 +01:00
|
|
|
TRACE("<-- %p\n", *grad);
|
|
|
|
|
2007-08-02 02:56:02 +02:00
|
|
|
return Ok;
|
|
|
|
}
|
|
|
|
|
2008-09-14 02:12:25 +02:00
|
|
|
/******************************************************************************
|
|
|
|
* GdipCreateSolidFill [GDIPLUS.@]
|
|
|
|
*/
|
2007-06-15 01:09:07 +02:00
|
|
|
GpStatus WINGDIPAPI GdipCreateSolidFill(ARGB color, GpSolidFill **sf)
|
|
|
|
{
|
|
|
|
COLORREF col = ARGB2COLORREF(color);
|
|
|
|
|
2008-09-02 22:13:40 +02:00
|
|
|
TRACE("(%x, %p)\n", color, sf);
|
|
|
|
|
2007-06-15 01:09:07 +02:00
|
|
|
if(!sf) return InvalidParameter;
|
|
|
|
|
|
|
|
*sf = GdipAlloc(sizeof(GpSolidFill));
|
|
|
|
if (!*sf) return OutOfMemory;
|
|
|
|
|
2007-07-20 03:22:59 +02:00
|
|
|
(*sf)->brush.lb.lbStyle = BS_SOLID;
|
|
|
|
(*sf)->brush.lb.lbColor = col;
|
|
|
|
(*sf)->brush.lb.lbHatch = 0;
|
|
|
|
|
2007-06-15 01:09:07 +02:00
|
|
|
(*sf)->brush.gdibrush = CreateSolidBrush(col);
|
|
|
|
(*sf)->brush.bt = BrushTypeSolidColor;
|
2007-07-24 05:24:24 +02:00
|
|
|
(*sf)->color = color;
|
2009-05-20 18:24:18 +02:00
|
|
|
(*sf)->bmp = ARGB2BMP(color);
|
2007-06-15 01:09:07 +02:00
|
|
|
|
2009-12-18 21:58:28 +01:00
|
|
|
TRACE("<-- %p\n", *sf);
|
|
|
|
|
2007-06-15 01:09:07 +02:00
|
|
|
return Ok;
|
|
|
|
}
|
|
|
|
|
2008-09-14 02:12:25 +02:00
|
|
|
/******************************************************************************
|
2008-08-31 07:06:58 +02:00
|
|
|
* GdipCreateTexture [GDIPLUS.@]
|
|
|
|
*
|
|
|
|
* PARAMS
|
|
|
|
* image [I] image to use
|
|
|
|
* wrapmode [I] optional
|
|
|
|
* texture [O] pointer to the resulting texturebrush
|
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* SUCCESS: Ok
|
|
|
|
* FAILURE: element of GpStatus
|
|
|
|
*/
|
2008-08-31 07:06:42 +02:00
|
|
|
GpStatus WINGDIPAPI GdipCreateTexture(GpImage *image, GpWrapMode wrapmode,
|
|
|
|
GpTexture **texture)
|
|
|
|
{
|
2008-08-31 07:06:58 +02:00
|
|
|
UINT width, height;
|
|
|
|
GpImageAttributes attributes;
|
|
|
|
GpStatus stat;
|
2008-08-31 07:06:42 +02:00
|
|
|
|
2008-08-31 07:06:58 +02:00
|
|
|
TRACE("%p, %d %p\n", image, wrapmode, texture);
|
|
|
|
|
|
|
|
if (!(image && texture))
|
|
|
|
return InvalidParameter;
|
|
|
|
|
|
|
|
stat = GdipGetImageWidth(image, &width);
|
|
|
|
if (stat != Ok) return stat;
|
|
|
|
stat = GdipGetImageHeight(image, &height);
|
|
|
|
if (stat != Ok) return stat;
|
|
|
|
attributes.wrap = wrapmode;
|
|
|
|
|
|
|
|
return GdipCreateTextureIA(image, &attributes, 0, 0, width, height,
|
|
|
|
texture);
|
2008-08-31 07:06:42 +02:00
|
|
|
}
|
|
|
|
|
2008-09-14 02:12:25 +02:00
|
|
|
/******************************************************************************
|
|
|
|
* GdipCreateTexture2 [GDIPLUS.@]
|
|
|
|
*/
|
2008-08-31 07:06:49 +02:00
|
|
|
GpStatus WINGDIPAPI GdipCreateTexture2(GpImage *image, GpWrapMode wrapmode,
|
|
|
|
REAL x, REAL y, REAL width, REAL height, GpTexture **texture)
|
|
|
|
{
|
2008-08-31 07:07:02 +02:00
|
|
|
GpImageAttributes attributes;
|
|
|
|
|
|
|
|
TRACE("%p %d %f %f %f %f %p\n", image, wrapmode,
|
2008-08-31 07:06:49 +02:00
|
|
|
x, y, width, height, texture);
|
|
|
|
|
2008-08-31 07:07:02 +02:00
|
|
|
attributes.wrap = wrapmode;
|
|
|
|
return GdipCreateTextureIA(image, &attributes, x, y, width, height,
|
|
|
|
texture);
|
2008-08-31 07:06:49 +02:00
|
|
|
}
|
|
|
|
|
2008-09-14 02:12:25 +02:00
|
|
|
/******************************************************************************
|
|
|
|
* GdipCreateTextureIA [GDIPLUS.@]
|
|
|
|
*
|
|
|
|
* FIXME: imageattr ignored
|
|
|
|
*/
|
2007-08-10 03:25:14 +02:00
|
|
|
GpStatus WINGDIPAPI GdipCreateTextureIA(GpImage *image,
|
|
|
|
GDIPCONST GpImageAttributes *imageattr, REAL x, REAL y, REAL width,
|
|
|
|
REAL height, GpTexture **texture)
|
|
|
|
{
|
2010-04-17 22:38:44 +02:00
|
|
|
HBITMAP hbm=NULL;
|
2008-09-25 06:54:24 +02:00
|
|
|
GpStatus status;
|
2010-02-11 23:30:56 +01:00
|
|
|
GpImage *new_image=NULL;
|
2007-08-10 03:25:14 +02:00
|
|
|
|
2008-09-02 22:13:40 +02:00
|
|
|
TRACE("(%p, %p, %.2f, %.2f, %.2f, %.2f, %p)\n", image, imageattr, x, y, width, height,
|
|
|
|
texture);
|
|
|
|
|
2007-08-10 03:25:14 +02:00
|
|
|
if(!image || !texture || x < 0.0 || y < 0.0 || width < 0.0 || height < 0.0)
|
|
|
|
return InvalidParameter;
|
|
|
|
|
2010-02-16 11:54:48 +01:00
|
|
|
*texture = NULL;
|
|
|
|
|
2007-08-10 03:25:14 +02:00
|
|
|
if(image->type != ImageTypeBitmap){
|
|
|
|
FIXME("not implemented for image type %d\n", image->type);
|
|
|
|
return NotImplemented;
|
|
|
|
}
|
|
|
|
|
2010-02-11 23:30:56 +01:00
|
|
|
status = GdipCloneBitmapArea(x, y, width, height, PixelFormatDontCare, (GpBitmap*)image, (GpBitmap**)&new_image);
|
|
|
|
if (status != Ok)
|
|
|
|
return status;
|
2007-08-10 03:25:14 +02:00
|
|
|
|
2010-04-17 22:38:44 +02:00
|
|
|
status = GdipCreateHBITMAPFromBitmap((GpBitmap*)new_image, &hbm, 0);
|
2010-02-11 23:30:56 +01:00
|
|
|
if(!hbm)
|
|
|
|
{
|
|
|
|
status = GenericError;
|
|
|
|
goto exit;
|
2007-08-10 03:25:14 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
*texture = GdipAlloc(sizeof(GpTexture));
|
2008-09-28 21:17:26 +02:00
|
|
|
if (!*texture){
|
2010-02-11 23:30:56 +01:00
|
|
|
status = OutOfMemory;
|
|
|
|
goto exit;
|
2008-09-28 21:17:26 +02:00
|
|
|
}
|
2007-08-10 03:25:14 +02:00
|
|
|
|
2008-09-25 06:54:24 +02:00
|
|
|
if((status = GdipCreateMatrix(&(*texture)->transform)) != Ok){
|
2010-02-11 23:30:56 +01:00
|
|
|
goto exit;
|
2008-09-25 06:54:24 +02:00
|
|
|
}
|
|
|
|
|
2010-02-11 23:30:56 +01:00
|
|
|
(*texture)->brush.lb.lbStyle = BS_PATTERN;
|
|
|
|
(*texture)->brush.lb.lbColor = 0;
|
|
|
|
(*texture)->brush.lb.lbHatch = (ULONG_PTR)hbm;
|
2007-08-10 03:25:14 +02:00
|
|
|
|
|
|
|
(*texture)->brush.gdibrush = CreateBrushIndirect(&(*texture)->brush.lb);
|
|
|
|
(*texture)->brush.bt = BrushTypeTextureFill;
|
2010-03-08 18:28:25 +01:00
|
|
|
if (imageattr)
|
|
|
|
(*texture)->wrap = imageattr->wrap;
|
|
|
|
else
|
|
|
|
(*texture)->wrap = WrapModeTile;
|
2010-02-11 23:43:45 +01:00
|
|
|
(*texture)->image = new_image;
|
2007-08-10 03:25:14 +02:00
|
|
|
|
2010-02-11 23:30:56 +01:00
|
|
|
exit:
|
|
|
|
if (status == Ok)
|
|
|
|
{
|
|
|
|
TRACE("<-- %p\n", *texture);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (*texture)
|
|
|
|
{
|
|
|
|
GdipDeleteMatrix((*texture)->transform);
|
|
|
|
GdipFree(*texture);
|
|
|
|
*texture = NULL;
|
|
|
|
}
|
2010-02-11 23:43:45 +01:00
|
|
|
GdipDisposeImage(new_image);
|
2010-02-11 23:30:56 +01:00
|
|
|
TRACE("<-- error %u\n", status);
|
|
|
|
}
|
2009-12-18 21:58:28 +01:00
|
|
|
|
2010-04-17 22:38:44 +02:00
|
|
|
DeleteObject(hbm);
|
|
|
|
|
2010-02-11 23:30:56 +01:00
|
|
|
return status;
|
2007-08-10 03:25:14 +02:00
|
|
|
}
|
|
|
|
|
2008-09-14 02:12:25 +02:00
|
|
|
/******************************************************************************
|
|
|
|
* GdipCreateTextureIAI [GDIPLUS.@]
|
|
|
|
*/
|
2008-07-03 01:04:40 +02:00
|
|
|
GpStatus WINGDIPAPI GdipCreateTextureIAI(GpImage *image, GDIPCONST GpImageAttributes *imageattr,
|
|
|
|
INT x, INT y, INT width, INT height, GpTexture **texture)
|
|
|
|
{
|
2008-09-02 22:13:40 +02:00
|
|
|
TRACE("(%p, %p, %d, %d, %d, %d, %p)\n", image, imageattr, x, y, width, height,
|
|
|
|
texture);
|
|
|
|
|
2008-07-03 01:04:40 +02:00
|
|
|
return GdipCreateTextureIA(image,imageattr,(REAL)x,(REAL)y,(REAL)width,(REAL)height,texture);
|
|
|
|
}
|
|
|
|
|
2008-08-31 07:06:54 +02:00
|
|
|
GpStatus WINGDIPAPI GdipCreateTexture2I(GpImage *image, GpWrapMode wrapmode,
|
|
|
|
INT x, INT y, INT width, INT height, GpTexture **texture)
|
|
|
|
{
|
2008-08-31 07:07:06 +02:00
|
|
|
GpImageAttributes imageattr;
|
2008-08-31 07:06:54 +02:00
|
|
|
|
2008-09-05 13:14:56 +02:00
|
|
|
TRACE("%p %d %d %d %d %d %p\n", image, wrapmode, x, y, width, height,
|
2008-08-31 07:07:06 +02:00
|
|
|
texture);
|
|
|
|
|
|
|
|
imageattr.wrap = wrapmode;
|
|
|
|
|
|
|
|
return GdipCreateTextureIA(image, &imageattr, x, y, width, height, texture);
|
2008-08-31 07:06:54 +02:00
|
|
|
}
|
|
|
|
|
2007-06-15 01:09:07 +02:00
|
|
|
GpStatus WINGDIPAPI GdipGetBrushType(GpBrush *brush, GpBrushType *type)
|
|
|
|
{
|
2008-09-02 22:13:40 +02:00
|
|
|
TRACE("(%p, %p)\n", brush, type);
|
|
|
|
|
2007-06-15 01:09:07 +02:00
|
|
|
if(!brush || !type) return InvalidParameter;
|
|
|
|
|
|
|
|
*type = brush->bt;
|
|
|
|
|
|
|
|
return Ok;
|
|
|
|
}
|
|
|
|
|
2009-01-11 00:52:31 +01:00
|
|
|
GpStatus WINGDIPAPI GdipGetHatchBackgroundColor(GpHatch *brush, ARGB *backcol)
|
|
|
|
{
|
|
|
|
TRACE("(%p, %p)\n", brush, backcol);
|
|
|
|
|
|
|
|
if(!brush || !backcol) return InvalidParameter;
|
|
|
|
|
|
|
|
*backcol = brush->backcol;
|
|
|
|
|
|
|
|
return Ok;
|
|
|
|
}
|
|
|
|
|
|
|
|
GpStatus WINGDIPAPI GdipGetHatchForegroundColor(GpHatch *brush, ARGB *forecol)
|
|
|
|
{
|
|
|
|
TRACE("(%p, %p)\n", brush, forecol);
|
|
|
|
|
|
|
|
if(!brush || !forecol) return InvalidParameter;
|
|
|
|
|
|
|
|
*forecol = brush->forecol;
|
|
|
|
|
|
|
|
return Ok;
|
|
|
|
}
|
|
|
|
|
|
|
|
GpStatus WINGDIPAPI GdipGetHatchStyle(GpHatch *brush, HatchStyle *hatchstyle)
|
|
|
|
{
|
|
|
|
TRACE("(%p, %p)\n", brush, hatchstyle);
|
|
|
|
|
|
|
|
if(!brush || !hatchstyle) return InvalidParameter;
|
|
|
|
|
|
|
|
*hatchstyle = brush->hatchstyle;
|
|
|
|
|
|
|
|
return Ok;
|
|
|
|
}
|
|
|
|
|
2007-06-15 01:09:07 +02:00
|
|
|
GpStatus WINGDIPAPI GdipDeleteBrush(GpBrush *brush)
|
|
|
|
{
|
2008-09-02 22:13:40 +02:00
|
|
|
TRACE("(%p)\n", brush);
|
|
|
|
|
2007-06-15 01:09:07 +02:00
|
|
|
if(!brush) return InvalidParameter;
|
|
|
|
|
2007-08-03 02:52:55 +02:00
|
|
|
switch(brush->bt)
|
|
|
|
{
|
|
|
|
case BrushTypePathGradient:
|
|
|
|
GdipFree(((GpPathGradient*) brush)->pathdata.Points);
|
|
|
|
GdipFree(((GpPathGradient*) brush)->pathdata.Types);
|
2008-07-21 21:30:39 +02:00
|
|
|
GdipFree(((GpPathGradient*) brush)->blendfac);
|
|
|
|
GdipFree(((GpPathGradient*) brush)->blendpos);
|
2007-08-03 02:52:55 +02:00
|
|
|
break;
|
|
|
|
case BrushTypeSolidColor:
|
2009-05-20 18:24:18 +02:00
|
|
|
if (((GpSolidFill*)brush)->bmp)
|
|
|
|
DeleteObject(((GpSolidFill*)brush)->bmp);
|
2009-04-29 01:03:41 +02:00
|
|
|
break;
|
2007-08-08 03:42:56 +02:00
|
|
|
case BrushTypeLinearGradient:
|
2009-04-29 01:03:41 +02:00
|
|
|
GdipFree(((GpLineGradient*)brush)->blendfac);
|
|
|
|
GdipFree(((GpLineGradient*)brush)->blendpos);
|
2009-09-14 23:21:50 +02:00
|
|
|
GdipFree(((GpLineGradient*)brush)->pblendcolor);
|
|
|
|
GdipFree(((GpLineGradient*)brush)->pblendpos);
|
2008-09-25 06:54:24 +02:00
|
|
|
break;
|
2007-08-10 03:25:18 +02:00
|
|
|
case BrushTypeTextureFill:
|
2008-09-25 06:54:24 +02:00
|
|
|
GdipDeleteMatrix(((GpTexture*)brush)->transform);
|
2010-02-11 23:43:45 +01:00
|
|
|
GdipDisposeImage(((GpTexture*)brush)->image);
|
2008-09-25 06:54:24 +02:00
|
|
|
break;
|
2007-08-03 02:52:55 +02:00
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2007-06-15 01:09:07 +02:00
|
|
|
DeleteObject(brush->gdibrush);
|
|
|
|
GdipFree(brush);
|
|
|
|
|
2007-08-03 02:51:49 +02:00
|
|
|
return Ok;
|
|
|
|
}
|
|
|
|
|
2007-08-08 03:42:40 +02:00
|
|
|
GpStatus WINGDIPAPI GdipGetLineGammaCorrection(GpLineGradient *line,
|
|
|
|
BOOL *usinggamma)
|
|
|
|
{
|
2008-09-02 22:13:40 +02:00
|
|
|
TRACE("(%p, %p)\n", line, usinggamma);
|
|
|
|
|
2008-09-02 22:25:39 +02:00
|
|
|
if(!line || !usinggamma)
|
2007-08-08 03:42:40 +02:00
|
|
|
return InvalidParameter;
|
|
|
|
|
|
|
|
*usinggamma = line->gamma;
|
|
|
|
|
|
|
|
return Ok;
|
|
|
|
}
|
|
|
|
|
2008-07-07 23:32:19 +02:00
|
|
|
GpStatus WINGDIPAPI GdipGetLineWrapMode(GpLineGradient *brush, GpWrapMode *wrapmode)
|
|
|
|
{
|
2008-09-02 22:13:40 +02:00
|
|
|
TRACE("(%p, %p)\n", brush, wrapmode);
|
|
|
|
|
2008-07-07 23:32:19 +02:00
|
|
|
if(!brush || !wrapmode)
|
|
|
|
return InvalidParameter;
|
|
|
|
|
|
|
|
*wrapmode = brush->wrap;
|
|
|
|
|
|
|
|
return Ok;
|
|
|
|
}
|
|
|
|
|
2008-07-21 21:30:50 +02:00
|
|
|
GpStatus WINGDIPAPI GdipGetPathGradientBlend(GpPathGradient *brush, REAL *blend,
|
|
|
|
REAL *positions, INT count)
|
|
|
|
{
|
2008-09-02 22:13:40 +02:00
|
|
|
TRACE("(%p, %p, %p, %d)\n", brush, blend, positions, count);
|
|
|
|
|
2008-07-21 21:30:50 +02:00
|
|
|
if(!brush || !blend || !positions || count <= 0)
|
|
|
|
return InvalidParameter;
|
|
|
|
|
|
|
|
if(count < brush->blendcount)
|
|
|
|
return InsufficientBuffer;
|
|
|
|
|
|
|
|
memcpy(blend, brush->blendfac, count*sizeof(REAL));
|
|
|
|
if(brush->blendcount > 1){
|
|
|
|
memcpy(positions, brush->blendpos, count*sizeof(REAL));
|
|
|
|
}
|
|
|
|
|
|
|
|
return Ok;
|
|
|
|
}
|
|
|
|
|
2008-07-21 21:30:39 +02:00
|
|
|
GpStatus WINGDIPAPI GdipGetPathGradientBlendCount(GpPathGradient *brush, INT *count)
|
|
|
|
{
|
2008-09-02 22:13:40 +02:00
|
|
|
TRACE("(%p, %p)\n", brush, count);
|
|
|
|
|
2008-07-21 21:30:39 +02:00
|
|
|
if(!brush || !count)
|
|
|
|
return InvalidParameter;
|
|
|
|
|
|
|
|
*count = brush->blendcount;
|
|
|
|
|
|
|
|
return Ok;
|
|
|
|
}
|
|
|
|
|
2007-08-03 02:52:59 +02:00
|
|
|
GpStatus WINGDIPAPI GdipGetPathGradientCenterPoint(GpPathGradient *grad,
|
|
|
|
GpPointF *point)
|
|
|
|
{
|
2008-09-02 22:13:40 +02:00
|
|
|
TRACE("(%p, %p)\n", grad, point);
|
|
|
|
|
2007-08-03 02:52:59 +02:00
|
|
|
if(!grad || !point)
|
|
|
|
return InvalidParameter;
|
|
|
|
|
|
|
|
point->X = grad->center.X;
|
|
|
|
point->Y = grad->center.Y;
|
|
|
|
|
|
|
|
return Ok;
|
|
|
|
}
|
|
|
|
|
2008-04-28 22:10:25 +02:00
|
|
|
GpStatus WINGDIPAPI GdipGetPathGradientCenterPointI(GpPathGradient *grad,
|
|
|
|
GpPoint *point)
|
|
|
|
{
|
|
|
|
GpStatus ret;
|
|
|
|
GpPointF ptf;
|
|
|
|
|
2008-09-02 22:13:40 +02:00
|
|
|
TRACE("(%p, %p)\n", grad, point);
|
|
|
|
|
2008-04-28 22:10:25 +02:00
|
|
|
if(!point)
|
|
|
|
return InvalidParameter;
|
|
|
|
|
|
|
|
ret = GdipGetPathGradientCenterPoint(grad,&ptf);
|
|
|
|
|
|
|
|
if(ret == Ok){
|
|
|
|
point->X = roundr(ptf.X);
|
|
|
|
point->Y = roundr(ptf.Y);
|
|
|
|
}
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2010-06-19 23:15:00 +02:00
|
|
|
GpStatus WINGDIPAPI GdipGetPathGradientCenterColor(GpPathGradient *grad,
|
|
|
|
ARGB *colors)
|
|
|
|
{
|
|
|
|
static int calls;
|
|
|
|
|
|
|
|
TRACE("(%p,%p)\n", grad, colors);
|
|
|
|
|
|
|
|
if(!(calls++))
|
|
|
|
FIXME("not implemented\n");
|
|
|
|
|
|
|
|
return NotImplemented;
|
|
|
|
}
|
|
|
|
|
2007-08-03 02:53:04 +02:00
|
|
|
GpStatus WINGDIPAPI GdipGetPathGradientFocusScales(GpPathGradient *grad,
|
|
|
|
REAL *x, REAL *y)
|
|
|
|
{
|
2008-09-02 22:13:40 +02:00
|
|
|
TRACE("(%p, %p, %p)\n", grad, x, y);
|
|
|
|
|
2007-08-03 02:53:04 +02:00
|
|
|
if(!grad || !x || !y)
|
|
|
|
return InvalidParameter;
|
|
|
|
|
|
|
|
*x = grad->focus.X;
|
|
|
|
*y = grad->focus.Y;
|
|
|
|
|
|
|
|
return Ok;
|
|
|
|
}
|
|
|
|
|
2007-08-03 02:52:49 +02:00
|
|
|
GpStatus WINGDIPAPI GdipGetPathGradientGammaCorrection(GpPathGradient *grad,
|
|
|
|
BOOL *gamma)
|
|
|
|
{
|
2008-09-02 22:13:40 +02:00
|
|
|
TRACE("(%p, %p)\n", grad, gamma);
|
|
|
|
|
2007-08-03 02:52:49 +02:00
|
|
|
if(!grad || !gamma)
|
|
|
|
return InvalidParameter;
|
|
|
|
|
|
|
|
*gamma = grad->gamma;
|
|
|
|
|
|
|
|
return Ok;
|
|
|
|
}
|
|
|
|
|
2007-08-03 02:51:49 +02:00
|
|
|
GpStatus WINGDIPAPI GdipGetPathGradientPointCount(GpPathGradient *grad,
|
|
|
|
INT *count)
|
|
|
|
{
|
2008-09-02 22:13:40 +02:00
|
|
|
TRACE("(%p, %p)\n", grad, count);
|
|
|
|
|
2007-08-03 02:51:49 +02:00
|
|
|
if(!grad || !count)
|
|
|
|
return InvalidParameter;
|
|
|
|
|
|
|
|
*count = grad->pathdata.Count;
|
|
|
|
|
2007-06-15 01:09:07 +02:00
|
|
|
return Ok;
|
|
|
|
}
|
2007-07-24 05:24:13 +02:00
|
|
|
|
2008-07-23 00:07:28 +02:00
|
|
|
GpStatus WINGDIPAPI GdipGetPathGradientRect(GpPathGradient *brush, GpRectF *rect)
|
|
|
|
{
|
|
|
|
GpRectF r;
|
|
|
|
GpPath* path;
|
|
|
|
GpStatus stat;
|
|
|
|
|
2008-09-02 22:13:40 +02:00
|
|
|
TRACE("(%p, %p)\n", brush, rect);
|
|
|
|
|
2008-07-23 00:07:28 +02:00
|
|
|
if(!brush || !rect)
|
|
|
|
return InvalidParameter;
|
|
|
|
|
|
|
|
stat = GdipCreatePath2(brush->pathdata.Points, brush->pathdata.Types,
|
|
|
|
brush->pathdata.Count, FillModeAlternate, &path);
|
|
|
|
if(stat != Ok) return stat;
|
|
|
|
|
|
|
|
stat = GdipGetPathWorldBounds(path, &r, NULL, NULL);
|
|
|
|
if(stat != Ok){
|
|
|
|
GdipDeletePath(path);
|
|
|
|
return stat;
|
|
|
|
}
|
|
|
|
|
|
|
|
memcpy(rect, &r, sizeof(GpRectF));
|
|
|
|
|
|
|
|
GdipDeletePath(path);
|
|
|
|
|
|
|
|
return Ok;
|
|
|
|
}
|
|
|
|
|
|
|
|
GpStatus WINGDIPAPI GdipGetPathGradientRectI(GpPathGradient *brush, GpRect *rect)
|
|
|
|
{
|
|
|
|
GpRectF rectf;
|
|
|
|
GpStatus stat;
|
|
|
|
|
2008-09-02 22:13:40 +02:00
|
|
|
TRACE("(%p, %p)\n", brush, rect);
|
|
|
|
|
2008-07-23 00:07:28 +02:00
|
|
|
if(!brush || !rect)
|
|
|
|
return InvalidParameter;
|
|
|
|
|
|
|
|
stat = GdipGetPathGradientRect(brush, &rectf);
|
|
|
|
if(stat != Ok) return stat;
|
|
|
|
|
|
|
|
rect->X = roundr(rectf.X);
|
|
|
|
rect->Y = roundr(rectf.Y);
|
|
|
|
rect->Width = roundr(rectf.Width);
|
|
|
|
rect->Height = roundr(rectf.Height);
|
|
|
|
|
|
|
|
return Ok;
|
|
|
|
}
|
|
|
|
|
2007-08-03 02:51:58 +02:00
|
|
|
GpStatus WINGDIPAPI GdipGetPathGradientSurroundColorsWithCount(GpPathGradient
|
|
|
|
*grad, ARGB *argb, INT *count)
|
|
|
|
{
|
|
|
|
static int calls;
|
|
|
|
|
2009-12-18 22:54:26 +01:00
|
|
|
TRACE("(%p,%p,%p)\n", grad, argb, count);
|
|
|
|
|
2007-08-03 02:51:58 +02:00
|
|
|
if(!grad || !argb || !count || (*count < grad->pathdata.Count))
|
|
|
|
return InvalidParameter;
|
|
|
|
|
|
|
|
if(!(calls++))
|
|
|
|
FIXME("not implemented\n");
|
|
|
|
|
|
|
|
return NotImplemented;
|
|
|
|
}
|
|
|
|
|
2010-03-27 22:55:27 +01:00
|
|
|
GpStatus WINGDIPAPI GdipGetPathGradientSurroundColorCount(GpPathGradient *brush, INT *count)
|
|
|
|
{
|
|
|
|
TRACE("(%p, %p)\n", brush, count);
|
|
|
|
|
|
|
|
if (!brush || !count)
|
|
|
|
return InvalidParameter;
|
|
|
|
|
|
|
|
return NotImplemented;
|
|
|
|
}
|
|
|
|
|
2008-06-29 11:02:27 +02:00
|
|
|
GpStatus WINGDIPAPI GdipGetPathGradientWrapMode(GpPathGradient *brush,
|
|
|
|
GpWrapMode *wrapmode)
|
|
|
|
{
|
2008-09-02 22:13:40 +02:00
|
|
|
TRACE("(%p, %p)\n", brush, wrapmode);
|
|
|
|
|
2008-06-29 11:02:27 +02:00
|
|
|
if(!brush || !wrapmode)
|
|
|
|
return InvalidParameter;
|
|
|
|
|
|
|
|
*wrapmode = brush->wrap;
|
|
|
|
|
|
|
|
return Ok;
|
|
|
|
}
|
|
|
|
|
2007-07-24 05:24:13 +02:00
|
|
|
GpStatus WINGDIPAPI GdipGetSolidFillColor(GpSolidFill *sf, ARGB *argb)
|
|
|
|
{
|
2008-09-02 22:13:40 +02:00
|
|
|
TRACE("(%p, %p)\n", sf, argb);
|
|
|
|
|
2007-07-24 05:24:13 +02:00
|
|
|
if(!sf || !argb)
|
|
|
|
return InvalidParameter;
|
|
|
|
|
2007-07-24 05:24:24 +02:00
|
|
|
*argb = sf->color;
|
|
|
|
|
|
|
|
return Ok;
|
2007-07-24 05:24:13 +02:00
|
|
|
}
|
|
|
|
|
2010-02-13 19:21:08 +01:00
|
|
|
/******************************************************************************
|
|
|
|
* GdipGetTextureImage [GDIPLUS.@]
|
|
|
|
*/
|
|
|
|
GpStatus WINGDIPAPI GdipGetTextureImage(GpTexture *brush, GpImage **image)
|
|
|
|
{
|
|
|
|
TRACE("(%p, %p)\n", brush, image);
|
|
|
|
|
|
|
|
if(!brush || !image)
|
|
|
|
return InvalidParameter;
|
|
|
|
|
|
|
|
return GdipCloneImage(brush->image, image);
|
|
|
|
}
|
|
|
|
|
2008-09-25 06:54:24 +02:00
|
|
|
/******************************************************************************
|
|
|
|
* GdipGetTextureTransform [GDIPLUS.@]
|
|
|
|
*/
|
|
|
|
GpStatus WINGDIPAPI GdipGetTextureTransform(GpTexture *brush, GpMatrix *matrix)
|
|
|
|
{
|
|
|
|
TRACE("(%p, %p)\n", brush, matrix);
|
|
|
|
|
|
|
|
if(!brush || !matrix)
|
|
|
|
return InvalidParameter;
|
|
|
|
|
|
|
|
memcpy(matrix, brush->transform, sizeof(GpMatrix));
|
|
|
|
|
|
|
|
return Ok;
|
|
|
|
}
|
|
|
|
|
2008-10-21 17:39:21 +02:00
|
|
|
/******************************************************************************
|
|
|
|
* GdipGetTextureWrapMode [GDIPLUS.@]
|
|
|
|
*/
|
|
|
|
GpStatus WINGDIPAPI GdipGetTextureWrapMode(GpTexture *brush, GpWrapMode *wrapmode)
|
|
|
|
{
|
|
|
|
TRACE("(%p, %p)\n", brush, wrapmode);
|
|
|
|
|
|
|
|
if(!brush || !wrapmode)
|
|
|
|
return InvalidParameter;
|
|
|
|
|
|
|
|
*wrapmode = brush->wrap;
|
|
|
|
|
|
|
|
return Ok;
|
|
|
|
}
|
|
|
|
|
2008-12-02 22:49:19 +01:00
|
|
|
/******************************************************************************
|
|
|
|
* GdipMultiplyTextureTransform [GDIPLUS.@]
|
|
|
|
*/
|
|
|
|
GpStatus WINGDIPAPI GdipMultiplyTextureTransform(GpTexture* brush,
|
|
|
|
GDIPCONST GpMatrix *matrix, GpMatrixOrder order)
|
|
|
|
{
|
|
|
|
TRACE("(%p, %p, %d)\n", brush, matrix, order);
|
|
|
|
|
|
|
|
if(!brush || !matrix)
|
|
|
|
return InvalidParameter;
|
|
|
|
|
|
|
|
return GdipMultiplyMatrix(brush->transform, matrix, order);
|
|
|
|
}
|
|
|
|
|
2008-09-25 06:57:55 +02:00
|
|
|
/******************************************************************************
|
|
|
|
* GdipResetTextureTransform [GDIPLUS.@]
|
|
|
|
*/
|
|
|
|
GpStatus WINGDIPAPI GdipResetTextureTransform(GpTexture* brush)
|
|
|
|
{
|
|
|
|
TRACE("(%p)\n", brush);
|
|
|
|
|
|
|
|
if(!brush)
|
|
|
|
return InvalidParameter;
|
|
|
|
|
|
|
|
return GdipSetMatrixElements(brush->transform, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0);
|
|
|
|
}
|
|
|
|
|
2008-12-05 08:37:21 +01:00
|
|
|
/******************************************************************************
|
|
|
|
* GdipScaleTextureTransform [GDIPLUS.@]
|
|
|
|
*/
|
|
|
|
GpStatus WINGDIPAPI GdipScaleTextureTransform(GpTexture* brush,
|
|
|
|
REAL sx, REAL sy, GpMatrixOrder order)
|
|
|
|
{
|
|
|
|
TRACE("(%p, %.2f, %.2f, %d)\n", brush, sx, sy, order);
|
|
|
|
|
|
|
|
if(!brush)
|
|
|
|
return InvalidParameter;
|
|
|
|
|
|
|
|
return GdipScaleMatrix(brush->transform, sx, sy, order);
|
|
|
|
}
|
|
|
|
|
2007-08-15 04:01:00 +02:00
|
|
|
GpStatus WINGDIPAPI GdipSetLineBlend(GpLineGradient *brush,
|
2009-04-29 01:25:59 +02:00
|
|
|
GDIPCONST REAL *factors, GDIPCONST REAL* positions, INT count)
|
2007-08-15 04:01:00 +02:00
|
|
|
{
|
2009-04-29 01:25:59 +02:00
|
|
|
REAL *new_blendfac, *new_blendpos;
|
2007-08-15 04:01:00 +02:00
|
|
|
|
2009-04-29 01:25:59 +02:00
|
|
|
TRACE("(%p, %p, %p, %i)\n", brush, factors, positions, count);
|
|
|
|
|
|
|
|
if(!brush || !factors || !positions || count <= 0 ||
|
|
|
|
(count >= 2 && (positions[0] != 0.0f || positions[count-1] != 1.0f)))
|
2007-08-15 04:01:00 +02:00
|
|
|
return InvalidParameter;
|
|
|
|
|
2009-04-29 01:25:59 +02:00
|
|
|
new_blendfac = GdipAlloc(count * sizeof(REAL));
|
|
|
|
new_blendpos = GdipAlloc(count * sizeof(REAL));
|
|
|
|
|
|
|
|
if (!new_blendfac || !new_blendpos)
|
|
|
|
{
|
|
|
|
GdipFree(new_blendfac);
|
|
|
|
GdipFree(new_blendpos);
|
|
|
|
return OutOfMemory;
|
|
|
|
}
|
|
|
|
|
|
|
|
memcpy(new_blendfac, factors, count * sizeof(REAL));
|
|
|
|
memcpy(new_blendpos, positions, count * sizeof(REAL));
|
|
|
|
|
|
|
|
GdipFree(brush->blendfac);
|
|
|
|
GdipFree(brush->blendpos);
|
|
|
|
|
|
|
|
brush->blendcount = count;
|
|
|
|
brush->blendfac = new_blendfac;
|
|
|
|
brush->blendpos = new_blendpos;
|
2007-08-15 04:01:00 +02:00
|
|
|
|
|
|
|
return Ok;
|
|
|
|
}
|
|
|
|
|
2009-04-29 00:28:22 +02:00
|
|
|
GpStatus WINGDIPAPI GdipGetLineBlend(GpLineGradient *brush, REAL *factors,
|
|
|
|
REAL *positions, INT count)
|
|
|
|
{
|
|
|
|
TRACE("(%p, %p, %p, %i)\n", brush, factors, positions, count);
|
|
|
|
|
2009-04-29 01:18:26 +02:00
|
|
|
if (!brush || !factors || !positions || count <= 0)
|
|
|
|
return InvalidParameter;
|
2009-04-29 00:28:22 +02:00
|
|
|
|
2009-04-29 01:18:26 +02:00
|
|
|
if (count < brush->blendcount)
|
|
|
|
return InsufficientBuffer;
|
|
|
|
|
|
|
|
memcpy(factors, brush->blendfac, brush->blendcount * sizeof(REAL));
|
|
|
|
memcpy(positions, brush->blendpos, brush->blendcount * sizeof(REAL));
|
|
|
|
|
|
|
|
return Ok;
|
2009-04-29 00:28:22 +02:00
|
|
|
}
|
|
|
|
|
2009-04-29 00:01:38 +02:00
|
|
|
GpStatus WINGDIPAPI GdipGetLineBlendCount(GpLineGradient *brush, INT *count)
|
|
|
|
{
|
|
|
|
TRACE("(%p, %p)\n", brush, count);
|
|
|
|
|
2009-04-29 01:08:54 +02:00
|
|
|
if (!brush || !count)
|
|
|
|
return InvalidParameter;
|
2009-04-29 00:01:38 +02:00
|
|
|
|
2009-04-29 01:08:54 +02:00
|
|
|
*count = brush->blendcount;
|
|
|
|
|
|
|
|
return Ok;
|
2009-04-29 00:01:38 +02:00
|
|
|
}
|
|
|
|
|
2007-08-08 03:42:40 +02:00
|
|
|
GpStatus WINGDIPAPI GdipSetLineGammaCorrection(GpLineGradient *line,
|
|
|
|
BOOL usegamma)
|
|
|
|
{
|
2008-09-02 22:13:40 +02:00
|
|
|
TRACE("(%p, %d)\n", line, usegamma);
|
|
|
|
|
2007-08-08 03:42:40 +02:00
|
|
|
if(!line)
|
|
|
|
return InvalidParameter;
|
|
|
|
|
|
|
|
line->gamma = usegamma;
|
|
|
|
|
|
|
|
return Ok;
|
|
|
|
}
|
|
|
|
|
2007-08-08 03:42:36 +02:00
|
|
|
GpStatus WINGDIPAPI GdipSetLineSigmaBlend(GpLineGradient *line, REAL focus,
|
|
|
|
REAL scale)
|
|
|
|
{
|
2009-05-05 00:53:48 +02:00
|
|
|
REAL factors[33];
|
|
|
|
REAL positions[33];
|
|
|
|
int num_points = 0;
|
|
|
|
int i;
|
|
|
|
const int precision = 16;
|
|
|
|
REAL erf_range; /* we use values erf(-erf_range) through erf(+erf_range) */
|
|
|
|
REAL min_erf;
|
|
|
|
REAL scale_erf;
|
|
|
|
|
|
|
|
TRACE("(%p, %0.2f, %0.2f)\n", line, focus, scale);
|
2007-08-08 03:42:36 +02:00
|
|
|
|
|
|
|
if(!line || focus < 0.0 || focus > 1.0 || scale < 0.0 || scale > 1.0)
|
|
|
|
return InvalidParameter;
|
|
|
|
|
2009-05-05 00:53:48 +02:00
|
|
|
/* we want 2 standard deviations */
|
|
|
|
erf_range = 2.0 / sqrt(2);
|
2007-08-08 03:42:36 +02:00
|
|
|
|
2009-05-05 00:53:48 +02:00
|
|
|
/* calculate the constants we need to normalize the error function to be
|
|
|
|
between 0.0 and scale over the range we need */
|
|
|
|
min_erf = erf(-erf_range);
|
|
|
|
scale_erf = scale / (-2.0 * min_erf);
|
|
|
|
|
|
|
|
if (focus != 0.0)
|
|
|
|
{
|
|
|
|
positions[0] = 0.0;
|
|
|
|
factors[0] = 0.0;
|
|
|
|
for (i=1; i<precision; i++)
|
|
|
|
{
|
|
|
|
positions[i] = focus * i / precision;
|
|
|
|
factors[i] = scale_erf * (erf(2 * erf_range * i / precision - erf_range) - min_erf);
|
|
|
|
}
|
|
|
|
num_points += precision;
|
|
|
|
}
|
|
|
|
|
|
|
|
positions[num_points] = focus;
|
|
|
|
factors[num_points] = scale;
|
|
|
|
num_points += 1;
|
|
|
|
|
|
|
|
if (focus != 1.0)
|
|
|
|
{
|
|
|
|
for (i=1; i<precision; i++)
|
|
|
|
{
|
|
|
|
positions[i+num_points-1] = (focus + ((1.0-focus) * i / precision));
|
|
|
|
factors[i+num_points-1] = scale_erf * (erf(erf_range - 2 * erf_range * i / precision) - min_erf);
|
|
|
|
}
|
|
|
|
num_points += precision;
|
|
|
|
positions[num_points-1] = 1.0;
|
|
|
|
factors[num_points-1] = 0.0;
|
|
|
|
}
|
|
|
|
|
|
|
|
return GdipSetLineBlend(line, factors, positions, num_points);
|
2007-08-08 03:42:36 +02:00
|
|
|
}
|
|
|
|
|
2007-08-08 03:42:32 +02:00
|
|
|
GpStatus WINGDIPAPI GdipSetLineWrapMode(GpLineGradient *line,
|
|
|
|
GpWrapMode wrap)
|
|
|
|
{
|
2008-09-02 22:13:40 +02:00
|
|
|
TRACE("(%p, %d)\n", line, wrap);
|
|
|
|
|
2007-08-08 03:42:32 +02:00
|
|
|
if(!line || wrap == WrapModeClamp)
|
|
|
|
return InvalidParameter;
|
|
|
|
|
|
|
|
line->wrap = wrap;
|
|
|
|
|
|
|
|
return Ok;
|
|
|
|
}
|
|
|
|
|
2008-09-25 06:51:02 +02:00
|
|
|
GpStatus WINGDIPAPI GdipSetPathGradientBlend(GpPathGradient *brush, GDIPCONST REAL *blend,
|
|
|
|
GDIPCONST REAL *pos, INT count)
|
|
|
|
{
|
|
|
|
static int calls;
|
|
|
|
|
2009-12-18 22:54:26 +01:00
|
|
|
TRACE("(%p,%p,%p,%i)\n", brush, blend, pos, count);
|
|
|
|
|
2008-09-25 06:51:02 +02:00
|
|
|
if(!(calls++))
|
|
|
|
FIXME("not implemented\n");
|
|
|
|
|
|
|
|
return NotImplemented;
|
|
|
|
}
|
|
|
|
|
2009-06-09 19:11:38 +02:00
|
|
|
GpStatus WINGDIPAPI GdipSetPathGradientPresetBlend(GpPathGradient *brush,
|
|
|
|
GDIPCONST ARGB *blend, GDIPCONST REAL *pos, INT count)
|
|
|
|
{
|
|
|
|
FIXME("(%p,%p,%p,%i): stub\n", brush, blend, pos, count);
|
|
|
|
return NotImplemented;
|
|
|
|
}
|
|
|
|
|
2010-06-25 00:12:19 +02:00
|
|
|
GpStatus WINGDIPAPI GdipGetPathGradientPresetBlendCount(GpPathGradient *brush,
|
|
|
|
INT *count)
|
|
|
|
{
|
|
|
|
FIXME("(%p,%p): stub\n", brush, count);
|
|
|
|
return NotImplemented;
|
|
|
|
}
|
|
|
|
|
2007-08-02 02:56:05 +02:00
|
|
|
GpStatus WINGDIPAPI GdipSetPathGradientCenterColor(GpPathGradient *grad,
|
|
|
|
ARGB argb)
|
|
|
|
{
|
2008-09-02 22:13:40 +02:00
|
|
|
TRACE("(%p, %x)\n", grad, argb);
|
|
|
|
|
2007-08-02 02:56:05 +02:00
|
|
|
if(!grad)
|
|
|
|
return InvalidParameter;
|
|
|
|
|
|
|
|
grad->centercolor = argb;
|
|
|
|
grad->brush.lb.lbColor = ARGB2COLORREF(argb);
|
|
|
|
|
|
|
|
DeleteObject(grad->brush.gdibrush);
|
|
|
|
grad->brush.gdibrush = CreateSolidBrush(grad->brush.lb.lbColor);
|
|
|
|
|
|
|
|
return Ok;
|
|
|
|
}
|
|
|
|
|
2007-08-03 02:52:59 +02:00
|
|
|
GpStatus WINGDIPAPI GdipSetPathGradientCenterPoint(GpPathGradient *grad,
|
|
|
|
GpPointF *point)
|
|
|
|
{
|
2009-12-18 22:45:02 +01:00
|
|
|
TRACE("(%p, %s)\n", grad, debugstr_pointf(point));
|
2008-09-02 22:13:40 +02:00
|
|
|
|
2007-08-03 02:52:59 +02:00
|
|
|
if(!grad || !point)
|
|
|
|
return InvalidParameter;
|
|
|
|
|
|
|
|
grad->center.X = point->X;
|
|
|
|
grad->center.Y = point->Y;
|
|
|
|
|
|
|
|
return Ok;
|
|
|
|
}
|
|
|
|
|
2008-04-29 23:28:45 +02:00
|
|
|
GpStatus WINGDIPAPI GdipSetPathGradientCenterPointI(GpPathGradient *grad,
|
|
|
|
GpPoint *point)
|
|
|
|
{
|
|
|
|
GpPointF ptf;
|
|
|
|
|
2008-09-02 22:13:40 +02:00
|
|
|
TRACE("(%p, %p)\n", grad, point);
|
|
|
|
|
2008-04-29 23:28:45 +02:00
|
|
|
if(!point)
|
|
|
|
return InvalidParameter;
|
|
|
|
|
|
|
|
ptf.X = (REAL)point->X;
|
|
|
|
ptf.Y = (REAL)point->Y;
|
|
|
|
|
|
|
|
return GdipSetPathGradientCenterPoint(grad,&ptf);
|
|
|
|
}
|
|
|
|
|
2007-08-03 02:53:04 +02:00
|
|
|
GpStatus WINGDIPAPI GdipSetPathGradientFocusScales(GpPathGradient *grad,
|
|
|
|
REAL x, REAL y)
|
|
|
|
{
|
2008-09-02 22:13:40 +02:00
|
|
|
TRACE("(%p, %.2f, %.2f)\n", grad, x, y);
|
|
|
|
|
2007-08-03 02:53:04 +02:00
|
|
|
if(!grad)
|
|
|
|
return InvalidParameter;
|
|
|
|
|
|
|
|
grad->focus.X = x;
|
|
|
|
grad->focus.Y = y;
|
|
|
|
|
|
|
|
return Ok;
|
|
|
|
}
|
|
|
|
|
2007-08-03 02:52:49 +02:00
|
|
|
GpStatus WINGDIPAPI GdipSetPathGradientGammaCorrection(GpPathGradient *grad,
|
|
|
|
BOOL gamma)
|
|
|
|
{
|
2008-09-02 22:13:40 +02:00
|
|
|
TRACE("(%p, %d)\n", grad, gamma);
|
|
|
|
|
2007-08-03 02:52:49 +02:00
|
|
|
if(!grad)
|
|
|
|
return InvalidParameter;
|
|
|
|
|
|
|
|
grad->gamma = gamma;
|
|
|
|
|
|
|
|
return Ok;
|
|
|
|
}
|
|
|
|
|
2007-08-03 02:52:43 +02:00
|
|
|
GpStatus WINGDIPAPI GdipSetPathGradientSigmaBlend(GpPathGradient *grad,
|
|
|
|
REAL focus, REAL scale)
|
|
|
|
{
|
|
|
|
static int calls;
|
|
|
|
|
2009-12-18 22:54:26 +01:00
|
|
|
TRACE("(%p,%0.2f,%0.2f)\n", grad, focus, scale);
|
|
|
|
|
2007-08-03 02:52:43 +02:00
|
|
|
if(!grad || focus < 0.0 || focus > 1.0 || scale < 0.0 || scale > 1.0)
|
|
|
|
return InvalidParameter;
|
|
|
|
|
|
|
|
if(!(calls++))
|
|
|
|
FIXME("not implemented\n");
|
|
|
|
|
|
|
|
return NotImplemented;
|
|
|
|
}
|
|
|
|
|
2007-08-03 02:51:58 +02:00
|
|
|
GpStatus WINGDIPAPI GdipSetPathGradientSurroundColorsWithCount(GpPathGradient
|
2010-03-27 22:55:26 +01:00
|
|
|
*grad, GDIPCONST ARGB *argb, INT *count)
|
2007-08-03 02:51:58 +02:00
|
|
|
{
|
|
|
|
static int calls;
|
|
|
|
|
2009-12-18 22:54:26 +01:00
|
|
|
TRACE("(%p,%p,%p)\n", grad, argb, count);
|
|
|
|
|
2007-08-03 02:51:58 +02:00
|
|
|
if(!grad || !argb || !count || (*count <= 0) ||
|
|
|
|
(*count > grad->pathdata.Count))
|
|
|
|
return InvalidParameter;
|
|
|
|
|
|
|
|
if(!(calls++))
|
|
|
|
FIXME("not implemented\n");
|
|
|
|
|
|
|
|
return NotImplemented;
|
|
|
|
}
|
|
|
|
|
2007-08-02 02:56:10 +02:00
|
|
|
GpStatus WINGDIPAPI GdipSetPathGradientWrapMode(GpPathGradient *grad,
|
|
|
|
GpWrapMode wrap)
|
|
|
|
{
|
2008-09-02 22:13:40 +02:00
|
|
|
TRACE("(%p, %d)\n", grad, wrap);
|
|
|
|
|
2007-08-02 02:56:10 +02:00
|
|
|
if(!grad)
|
|
|
|
return InvalidParameter;
|
|
|
|
|
|
|
|
grad->wrap = wrap;
|
|
|
|
|
|
|
|
return Ok;
|
|
|
|
}
|
|
|
|
|
2010-06-25 00:17:06 +02:00
|
|
|
GpStatus WINGDIPAPI GdipMultiplyPathGradientTransform(GpPathGradient *grad,
|
|
|
|
GDIPCONST GpMatrix *matrix, GpMatrixOrder order)
|
|
|
|
{
|
|
|
|
static int calls;
|
|
|
|
|
|
|
|
TRACE("(%p,%p,%i)\n", grad, matrix, order);
|
|
|
|
|
|
|
|
if(!(calls++))
|
|
|
|
FIXME("not implemented\n");
|
|
|
|
|
|
|
|
return NotImplemented;
|
|
|
|
}
|
|
|
|
|
2007-07-24 05:24:13 +02:00
|
|
|
GpStatus WINGDIPAPI GdipSetSolidFillColor(GpSolidFill *sf, ARGB argb)
|
|
|
|
{
|
2008-09-02 22:13:40 +02:00
|
|
|
TRACE("(%p, %x)\n", sf, argb);
|
|
|
|
|
2007-07-24 05:24:13 +02:00
|
|
|
if(!sf)
|
|
|
|
return InvalidParameter;
|
|
|
|
|
2007-07-24 05:24:24 +02:00
|
|
|
sf->color = argb;
|
|
|
|
sf->brush.lb.lbColor = ARGB2COLORREF(argb);
|
|
|
|
|
|
|
|
DeleteObject(sf->brush.gdibrush);
|
|
|
|
sf->brush.gdibrush = CreateSolidBrush(sf->brush.lb.lbColor);
|
|
|
|
|
|
|
|
return Ok;
|
2007-07-24 05:24:13 +02:00
|
|
|
}
|
2007-08-10 03:25:22 +02:00
|
|
|
|
2008-09-25 06:56:35 +02:00
|
|
|
/******************************************************************************
|
|
|
|
* GdipSetTextureTransform [GDIPLUS.@]
|
|
|
|
*/
|
2007-08-10 03:25:22 +02:00
|
|
|
GpStatus WINGDIPAPI GdipSetTextureTransform(GpTexture *texture,
|
|
|
|
GDIPCONST GpMatrix *matrix)
|
|
|
|
{
|
2008-09-25 06:56:35 +02:00
|
|
|
TRACE("(%p, %p)\n", texture, matrix);
|
2007-08-10 03:25:22 +02:00
|
|
|
|
|
|
|
if(!texture || !matrix)
|
|
|
|
return InvalidParameter;
|
|
|
|
|
2008-09-25 06:56:35 +02:00
|
|
|
memcpy(texture->transform, matrix, sizeof(GpMatrix));
|
2007-08-10 03:25:22 +02:00
|
|
|
|
|
|
|
return Ok;
|
|
|
|
}
|
2008-04-10 21:40:17 +02:00
|
|
|
|
2008-10-21 17:39:21 +02:00
|
|
|
/******************************************************************************
|
|
|
|
* GdipSetTextureWrapMode [GDIPLUS.@]
|
|
|
|
*
|
|
|
|
* WrapMode not used, only stored
|
|
|
|
*/
|
|
|
|
GpStatus WINGDIPAPI GdipSetTextureWrapMode(GpTexture *brush, GpWrapMode wrapmode)
|
|
|
|
{
|
|
|
|
TRACE("(%p, %d)\n", brush, wrapmode);
|
|
|
|
|
|
|
|
if(!brush)
|
|
|
|
return InvalidParameter;
|
|
|
|
|
|
|
|
brush->wrap = wrapmode;
|
|
|
|
|
|
|
|
return Ok;
|
|
|
|
}
|
|
|
|
|
2008-04-10 21:40:17 +02:00
|
|
|
GpStatus WINGDIPAPI GdipSetLineColors(GpLineGradient *brush, ARGB color1,
|
|
|
|
ARGB color2)
|
|
|
|
{
|
2008-09-02 22:13:40 +02:00
|
|
|
TRACE("(%p, %x, %x)\n", brush, color1, color2);
|
|
|
|
|
2008-04-24 20:43:41 +02:00
|
|
|
if(!brush)
|
|
|
|
return InvalidParameter;
|
2008-04-10 21:40:17 +02:00
|
|
|
|
2008-04-24 20:43:41 +02:00
|
|
|
brush->startcolor = color1;
|
|
|
|
brush->endcolor = color2;
|
2008-04-10 21:40:17 +02:00
|
|
|
|
2008-04-24 20:43:41 +02:00
|
|
|
return Ok;
|
2008-04-10 21:40:17 +02:00
|
|
|
}
|
2008-04-10 21:40:18 +02:00
|
|
|
|
2008-04-24 20:43:36 +02:00
|
|
|
GpStatus WINGDIPAPI GdipGetLineColors(GpLineGradient *brush, ARGB *colors)
|
|
|
|
{
|
2008-09-02 22:13:40 +02:00
|
|
|
TRACE("(%p, %p)\n", brush, colors);
|
|
|
|
|
2008-04-24 20:43:36 +02:00
|
|
|
if(!brush || !colors)
|
|
|
|
return InvalidParameter;
|
|
|
|
|
|
|
|
colors[0] = brush->startcolor;
|
|
|
|
colors[1] = brush->endcolor;
|
|
|
|
|
|
|
|
return Ok;
|
|
|
|
}
|
|
|
|
|
2008-12-02 22:33:16 +01:00
|
|
|
/******************************************************************************
|
|
|
|
* GdipRotateTextureTransform [GDIPLUS.@]
|
|
|
|
*/
|
|
|
|
GpStatus WINGDIPAPI GdipRotateTextureTransform(GpTexture* brush, REAL angle,
|
|
|
|
GpMatrixOrder order)
|
|
|
|
{
|
|
|
|
TRACE("(%p, %.2f, %d)\n", brush, angle, order);
|
|
|
|
|
|
|
|
if(!brush)
|
|
|
|
return InvalidParameter;
|
|
|
|
|
|
|
|
return GdipRotateMatrix(brush->transform, angle, order);
|
|
|
|
}
|
|
|
|
|
2008-04-10 21:40:18 +02:00
|
|
|
GpStatus WINGDIPAPI GdipSetLineLinearBlend(GpLineGradient *brush, REAL focus,
|
|
|
|
REAL scale)
|
|
|
|
{
|
2009-07-11 18:49:44 +02:00
|
|
|
REAL factors[3];
|
|
|
|
REAL positions[3];
|
|
|
|
int num_points = 0;
|
2008-04-10 21:40:18 +02:00
|
|
|
|
2009-07-11 18:49:44 +02:00
|
|
|
TRACE("(%p,%.2f,%.2f)\n", brush, focus, scale);
|
2008-04-10 21:40:18 +02:00
|
|
|
|
2009-07-11 18:49:44 +02:00
|
|
|
if (!brush) return InvalidParameter;
|
|
|
|
|
|
|
|
if (focus != 0.0)
|
|
|
|
{
|
|
|
|
factors[num_points] = 0.0;
|
|
|
|
positions[num_points] = 0.0;
|
|
|
|
num_points++;
|
|
|
|
}
|
|
|
|
|
|
|
|
factors[num_points] = scale;
|
|
|
|
positions[num_points] = focus;
|
|
|
|
num_points++;
|
|
|
|
|
|
|
|
if (focus != 1.0)
|
|
|
|
{
|
|
|
|
factors[num_points] = 0.0;
|
|
|
|
positions[num_points] = 1.0;
|
|
|
|
num_points++;
|
|
|
|
}
|
|
|
|
|
|
|
|
return GdipSetLineBlend(brush, factors, positions, num_points);
|
2008-04-10 21:40:18 +02:00
|
|
|
}
|
2008-04-10 21:40:19 +02:00
|
|
|
|
|
|
|
GpStatus WINGDIPAPI GdipSetLinePresetBlend(GpLineGradient *brush,
|
|
|
|
GDIPCONST ARGB *blend, GDIPCONST REAL* positions, INT count)
|
|
|
|
{
|
2009-09-14 23:21:50 +02:00
|
|
|
ARGB *new_color;
|
|
|
|
REAL *new_pos;
|
|
|
|
TRACE("(%p,%p,%p,%i)\n", brush, blend, positions, count);
|
2008-04-10 21:40:19 +02:00
|
|
|
|
2009-09-14 23:21:50 +02:00
|
|
|
if (!brush || !blend || !positions || count < 2 ||
|
|
|
|
positions[0] != 0.0f || positions[count-1] != 1.0f)
|
|
|
|
{
|
|
|
|
return InvalidParameter;
|
|
|
|
}
|
2008-04-10 21:40:19 +02:00
|
|
|
|
2009-09-14 23:21:50 +02:00
|
|
|
new_color = GdipAlloc(count * sizeof(ARGB));
|
|
|
|
new_pos = GdipAlloc(count * sizeof(REAL));
|
|
|
|
if (!new_color || !new_pos)
|
|
|
|
{
|
|
|
|
GdipFree(new_color);
|
|
|
|
GdipFree(new_pos);
|
|
|
|
return OutOfMemory;
|
|
|
|
}
|
|
|
|
|
|
|
|
memcpy(new_color, blend, sizeof(ARGB) * count);
|
|
|
|
memcpy(new_pos, positions, sizeof(REAL) * count);
|
|
|
|
|
|
|
|
GdipFree(brush->pblendcolor);
|
|
|
|
GdipFree(brush->pblendpos);
|
|
|
|
|
|
|
|
brush->pblendcolor = new_color;
|
|
|
|
brush->pblendpos = new_pos;
|
|
|
|
brush->pblendcount = count;
|
|
|
|
|
|
|
|
return Ok;
|
2008-04-10 21:40:19 +02:00
|
|
|
}
|
2008-04-10 21:40:20 +02:00
|
|
|
|
2009-09-14 22:42:21 +02:00
|
|
|
GpStatus WINGDIPAPI GdipGetLinePresetBlend(GpLineGradient *brush,
|
|
|
|
ARGB *blend, REAL* positions, INT count)
|
|
|
|
{
|
2009-09-14 23:21:50 +02:00
|
|
|
if (!brush || !blend || !positions || count < 2)
|
|
|
|
return InvalidParameter;
|
2009-09-14 22:42:21 +02:00
|
|
|
|
2009-09-14 23:21:50 +02:00
|
|
|
if (brush->pblendcount == 0)
|
|
|
|
return GenericError;
|
2009-09-14 22:42:21 +02:00
|
|
|
|
2009-09-14 23:21:50 +02:00
|
|
|
if (count < brush->pblendcount)
|
|
|
|
return InsufficientBuffer;
|
|
|
|
|
|
|
|
memcpy(blend, brush->pblendcolor, sizeof(ARGB) * brush->pblendcount);
|
|
|
|
memcpy(positions, brush->pblendpos, sizeof(REAL) * brush->pblendcount);
|
|
|
|
|
|
|
|
return Ok;
|
2009-09-14 22:42:21 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
GpStatus WINGDIPAPI GdipGetLinePresetBlendCount(GpLineGradient *brush,
|
|
|
|
INT *count)
|
|
|
|
{
|
2009-09-14 23:21:50 +02:00
|
|
|
if (!brush || !count)
|
|
|
|
return InvalidParameter;
|
2009-09-14 22:42:21 +02:00
|
|
|
|
2009-09-14 23:21:50 +02:00
|
|
|
*count = brush->pblendcount;
|
2009-09-14 22:42:21 +02:00
|
|
|
|
2009-09-14 23:21:50 +02:00
|
|
|
return Ok;
|
2009-09-14 22:42:21 +02:00
|
|
|
}
|
|
|
|
|
2009-09-04 20:01:29 +02:00
|
|
|
GpStatus WINGDIPAPI GdipResetLineTransform(GpLineGradient *brush)
|
|
|
|
{
|
|
|
|
static int calls;
|
|
|
|
|
2009-12-18 22:54:26 +01:00
|
|
|
TRACE("(%p)\n", brush);
|
|
|
|
|
2009-09-04 20:01:29 +02:00
|
|
|
if(!(calls++))
|
|
|
|
FIXME("not implemented\n");
|
|
|
|
|
|
|
|
return NotImplemented;
|
|
|
|
}
|
|
|
|
|
2008-04-10 21:40:20 +02:00
|
|
|
GpStatus WINGDIPAPI GdipSetLineTransform(GpLineGradient *brush,
|
|
|
|
GDIPCONST GpMatrix *matrix)
|
|
|
|
{
|
|
|
|
static int calls;
|
|
|
|
|
2009-12-18 22:54:26 +01:00
|
|
|
TRACE("(%p,%p)\n", brush, matrix);
|
|
|
|
|
2008-04-10 21:40:20 +02:00
|
|
|
if(!(calls++))
|
|
|
|
FIXME("not implemented\n");
|
|
|
|
|
|
|
|
return NotImplemented;
|
|
|
|
}
|
2008-04-24 20:43:26 +02:00
|
|
|
|
2010-06-19 23:09:00 +02:00
|
|
|
GpStatus WINGDIPAPI GdipGetLineTransform(GpLineGradient *brush, GpMatrix *matrix)
|
|
|
|
{
|
|
|
|
static int calls;
|
|
|
|
|
|
|
|
TRACE("(%p,%p)\n", brush, matrix);
|
|
|
|
|
|
|
|
if(!(calls++))
|
|
|
|
FIXME("not implemented\n");
|
|
|
|
|
|
|
|
return NotImplemented;
|
|
|
|
}
|
|
|
|
|
2009-09-04 20:12:08 +02:00
|
|
|
GpStatus WINGDIPAPI GdipScaleLineTransform(GpLineGradient *brush, REAL sx, REAL sy,
|
|
|
|
GpMatrixOrder order)
|
|
|
|
{
|
|
|
|
static int calls;
|
|
|
|
|
2009-12-18 22:54:26 +01:00
|
|
|
TRACE("(%p,%0.2f,%0.2f,%u)\n", brush, sx, sy, order);
|
|
|
|
|
2009-09-04 20:12:08 +02:00
|
|
|
if(!(calls++))
|
|
|
|
FIXME("not implemented\n");
|
|
|
|
|
|
|
|
return NotImplemented;
|
|
|
|
}
|
|
|
|
|
2010-06-19 23:11:33 +02:00
|
|
|
GpStatus WINGDIPAPI GdipMultiplyLineTransform(GpLineGradient *brush,
|
|
|
|
GDIPCONST GpMatrix *matrix, GpMatrixOrder order)
|
|
|
|
{
|
|
|
|
static int calls;
|
|
|
|
|
|
|
|
TRACE("(%p,%p,%u)\n", brush, matrix, order);
|
|
|
|
|
|
|
|
if(!(calls++))
|
|
|
|
FIXME("not implemented\n");
|
|
|
|
|
|
|
|
return NotImplemented;
|
|
|
|
}
|
|
|
|
|
2008-08-31 07:06:37 +02:00
|
|
|
GpStatus WINGDIPAPI GdipTranslateLineTransform(GpLineGradient* brush,
|
|
|
|
REAL dx, REAL dy, GpMatrixOrder order)
|
|
|
|
{
|
|
|
|
FIXME("stub: %p %f %f %d\n", brush, dx, dy, order);
|
|
|
|
|
|
|
|
return NotImplemented;
|
|
|
|
}
|
|
|
|
|
2008-12-02 22:22:52 +01:00
|
|
|
/******************************************************************************
|
|
|
|
* GdipTranslateTextureTransform [GDIPLUS.@]
|
|
|
|
*/
|
|
|
|
GpStatus WINGDIPAPI GdipTranslateTextureTransform(GpTexture* brush, REAL dx, REAL dy,
|
|
|
|
GpMatrixOrder order)
|
|
|
|
{
|
|
|
|
TRACE("(%p, %.2f, %.2f, %d)\n", brush, dx, dy, order);
|
|
|
|
|
|
|
|
if(!brush)
|
|
|
|
return InvalidParameter;
|
|
|
|
|
|
|
|
return GdipTranslateMatrix(brush->transform, dx, dy, order);
|
|
|
|
}
|
|
|
|
|
2008-04-24 20:43:26 +02:00
|
|
|
GpStatus WINGDIPAPI GdipGetLineRect(GpLineGradient *brush, GpRectF *rect)
|
|
|
|
{
|
2008-09-02 22:13:40 +02:00
|
|
|
TRACE("(%p, %p)\n", brush, rect);
|
|
|
|
|
2008-04-24 20:43:26 +02:00
|
|
|
if(!brush || !rect)
|
|
|
|
return InvalidParameter;
|
|
|
|
|
2009-05-07 18:33:28 +02:00
|
|
|
*rect = brush->rect;
|
2008-04-24 20:43:26 +02:00
|
|
|
|
|
|
|
return Ok;
|
|
|
|
}
|
|
|
|
|
|
|
|
GpStatus WINGDIPAPI GdipGetLineRectI(GpLineGradient *brush, GpRect *rect)
|
|
|
|
{
|
|
|
|
GpRectF rectF;
|
|
|
|
GpStatus ret;
|
|
|
|
|
2008-09-02 22:13:40 +02:00
|
|
|
TRACE("(%p, %p)\n", brush, rect);
|
|
|
|
|
2008-06-18 09:32:37 +02:00
|
|
|
if(!rect)
|
|
|
|
return InvalidParameter;
|
|
|
|
|
2008-04-24 20:43:26 +02:00
|
|
|
ret = GdipGetLineRect(brush, &rectF);
|
|
|
|
|
|
|
|
if(ret == Ok){
|
|
|
|
rect->X = roundr(rectF.X);
|
|
|
|
rect->Y = roundr(rectF.Y);
|
|
|
|
rect->Width = roundr(rectF.Width);
|
|
|
|
rect->Height = roundr(rectF.Height);
|
|
|
|
}
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
2008-12-27 19:39:57 +01:00
|
|
|
|
|
|
|
GpStatus WINGDIPAPI GdipRotateLineTransform(GpLineGradient* brush,
|
|
|
|
REAL angle, GpMatrixOrder order)
|
|
|
|
{
|
|
|
|
static int calls;
|
|
|
|
|
2009-12-18 22:54:26 +01:00
|
|
|
TRACE("(%p,%0.2f,%u)\n", brush, angle, order);
|
|
|
|
|
2008-12-27 19:39:57 +01:00
|
|
|
if(!brush)
|
|
|
|
return InvalidParameter;
|
|
|
|
|
|
|
|
if(!(calls++))
|
|
|
|
FIXME("(%p, %.2f, %d) stub\n", brush, angle, order);
|
|
|
|
|
|
|
|
return NotImplemented;
|
|
|
|
}
|