2008-03-25 17:34:57 +00:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2007 Google (Evan Stade)
|
2017-09-17 12:34:15 +00:00
|
|
|
* Copyright (C) 2003-2004,2007 Novell, Inc. http://www.novell.com (Ravindra (rkumar@novell.com))
|
2008-03-25 17:34:57 +00:00
|
|
|
*
|
|
|
|
* 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
|
|
|
|
*/
|
|
|
|
|
2018-03-09 12:09:03 +00:00
|
|
|
#include <stdarg.h>
|
|
|
|
|
|
|
|
#include "windef.h"
|
|
|
|
#include "winbase.h"
|
|
|
|
#include "winuser.h"
|
|
|
|
#include "wingdi.h"
|
|
|
|
|
|
|
|
#define COBJMACROS
|
|
|
|
#include "objbase.h"
|
|
|
|
#include "olectl.h"
|
|
|
|
#include "ole2.h"
|
|
|
|
|
|
|
|
#include "gdiplus.h"
|
2008-03-25 17:34:57 +00:00
|
|
|
#include "gdiplus_private.h"
|
2018-03-09 12:09:03 +00:00
|
|
|
#include "wine/debug.h"
|
|
|
|
|
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(gdiplus);
|
2008-03-25 17:34:57 +00:00
|
|
|
|
2015-10-19 18:16:17 +00:00
|
|
|
#ifdef __REACTOS__
|
2009-05-09 09:26:16 +00:00
|
|
|
/*
|
|
|
|
Unix stuff
|
|
|
|
Code from http://www.johndcook.com/blog/2009/01/19/stand-alone-error-function-erf/
|
|
|
|
*/
|
|
|
|
double erf(double x)
|
|
|
|
{
|
2015-10-19 18:16:17 +00:00
|
|
|
const float a1 = 0.254829592f;
|
|
|
|
const float a2 = -0.284496736f;
|
|
|
|
const float a3 = 1.421413741f;
|
|
|
|
const float a4 = -1.453152027f;
|
|
|
|
const float a5 = 1.061405429f;
|
|
|
|
const float p = 0.3275911f;
|
2009-05-09 09:26:16 +00:00
|
|
|
float t, y, sign;
|
|
|
|
|
|
|
|
/* Save the sign of x */
|
|
|
|
sign = 1;
|
|
|
|
if (x < 0)
|
|
|
|
sign = -1;
|
|
|
|
x = abs(x);
|
|
|
|
|
|
|
|
/* A & S 7.1.26 */
|
|
|
|
t = 1.0/(1.0 + p*x);
|
|
|
|
y = 1.0 - (((((a5*t + a4)*t) + a3)*t + a2)*t + a1)*t*exp(-x*x);
|
|
|
|
|
|
|
|
return sign*y;
|
|
|
|
}
|
2015-10-19 18:16:17 +00:00
|
|
|
#endif
|
2009-05-09 09:26:16 +00:00
|
|
|
|
2008-12-06 09:26:01 +00:00
|
|
|
/******************************************************************************
|
|
|
|
* GdipCloneBrush [GDIPLUS.@]
|
|
|
|
*/
|
2008-03-25 17:34:57 +00:00
|
|
|
GpStatus WINGDIPAPI GdipCloneBrush(GpBrush *brush, GpBrush **clone)
|
|
|
|
{
|
2008-09-07 10:32:49 +00:00
|
|
|
TRACE("(%p, %p)\n", brush, clone);
|
|
|
|
|
2008-03-25 17:34:57 +00:00
|
|
|
if(!brush || !clone)
|
|
|
|
return InvalidParameter;
|
|
|
|
|
|
|
|
switch(brush->bt){
|
|
|
|
case BrushTypeSolidColor:
|
2009-05-23 10:32:19 +00:00
|
|
|
{
|
2015-11-22 10:10:02 +00:00
|
|
|
*clone = heap_alloc_zero(sizeof(GpSolidFill));
|
2008-03-25 17:34:57 +00:00
|
|
|
if (!*clone) return OutOfMemory;
|
|
|
|
memcpy(*clone, brush, sizeof(GpSolidFill));
|
2009-01-27 18:03:33 +00:00
|
|
|
break;
|
2009-05-23 10:32:19 +00:00
|
|
|
}
|
2009-01-27 18:03:33 +00:00
|
|
|
case BrushTypeHatchFill:
|
2010-03-04 13:34:05 +00:00
|
|
|
{
|
|
|
|
GpHatch *hatch = (GpHatch*)brush;
|
2009-01-27 18:03:33 +00:00
|
|
|
|
2010-03-04 13:34:05 +00:00
|
|
|
return GdipCreateHatchBrush(hatch->hatchstyle, hatch->forecol, hatch->backcol, (GpHatch**)clone);
|
|
|
|
}
|
2008-03-25 17:34:57 +00:00
|
|
|
case BrushTypePathGradient:{
|
|
|
|
GpPathGradient *src, *dest;
|
2012-05-19 10:03:40 +00:00
|
|
|
INT count, pcount;
|
|
|
|
GpStatus stat;
|
2008-03-25 17:34:57 +00:00
|
|
|
|
2015-11-22 10:10:02 +00:00
|
|
|
*clone = heap_alloc_zero(sizeof(GpPathGradient));
|
2008-03-25 17:34:57 +00:00
|
|
|
if (!*clone) return OutOfMemory;
|
|
|
|
|
|
|
|
src = (GpPathGradient*) brush,
|
|
|
|
dest = (GpPathGradient*) *clone;
|
|
|
|
|
|
|
|
memcpy(dest, src, sizeof(GpPathGradient));
|
|
|
|
|
2012-05-19 10:03:40 +00:00
|
|
|
stat = GdipClonePath(src->path, &dest->path);
|
2008-03-25 17:34:57 +00:00
|
|
|
|
2012-05-19 10:03:40 +00:00
|
|
|
if(stat != Ok){
|
2015-11-22 10:10:02 +00:00
|
|
|
heap_free(dest);
|
2012-05-19 10:03:40 +00:00
|
|
|
return stat;
|
2008-03-25 17:34:57 +00:00
|
|
|
}
|
|
|
|
|
2012-12-11 21:40:15 +00:00
|
|
|
dest->transform = src->transform;
|
2008-03-25 17:34:57 +00:00
|
|
|
|
2008-08-05 12:23:58 +00:00
|
|
|
/* blending */
|
|
|
|
count = src->blendcount;
|
|
|
|
dest->blendcount = count;
|
2015-11-22 10:10:02 +00:00
|
|
|
dest->blendfac = heap_alloc_zero(count * sizeof(REAL));
|
|
|
|
dest->blendpos = heap_alloc_zero(count * sizeof(REAL));
|
|
|
|
dest->surroundcolors = heap_alloc_zero(dest->surroundcolorcount * sizeof(ARGB));
|
2012-05-19 10:03:40 +00:00
|
|
|
pcount = dest->pblendcount;
|
|
|
|
if (pcount)
|
|
|
|
{
|
2015-11-22 10:10:02 +00:00
|
|
|
dest->pblendcolor = heap_alloc_zero(pcount * sizeof(ARGB));
|
|
|
|
dest->pblendpos = heap_alloc_zero(pcount * sizeof(REAL));
|
2012-05-19 10:03:40 +00:00
|
|
|
}
|
2008-08-05 12:23:58 +00:00
|
|
|
|
2012-05-19 10:03:40 +00:00
|
|
|
if(!dest->blendfac || !dest->blendpos || !dest->surroundcolors ||
|
|
|
|
(pcount && (!dest->pblendcolor || !dest->pblendpos))){
|
|
|
|
GdipDeletePath(dest->path);
|
2015-11-22 10:10:02 +00:00
|
|
|
heap_free(dest->blendfac);
|
|
|
|
heap_free(dest->blendpos);
|
|
|
|
heap_free(dest->surroundcolors);
|
|
|
|
heap_free(dest->pblendcolor);
|
|
|
|
heap_free(dest->pblendpos);
|
|
|
|
heap_free(dest);
|
2008-08-05 12:23:58 +00:00
|
|
|
return OutOfMemory;
|
|
|
|
}
|
|
|
|
|
|
|
|
memcpy(dest->blendfac, src->blendfac, count * sizeof(REAL));
|
|
|
|
memcpy(dest->blendpos, src->blendpos, count * sizeof(REAL));
|
2012-05-19 10:03:40 +00:00
|
|
|
memcpy(dest->surroundcolors, src->surroundcolors, dest->surroundcolorcount * sizeof(ARGB));
|
|
|
|
|
|
|
|
if (pcount)
|
|
|
|
{
|
|
|
|
memcpy(dest->pblendcolor, src->pblendcolor, pcount * sizeof(ARGB));
|
|
|
|
memcpy(dest->pblendpos, src->pblendpos, pcount * sizeof(REAL));
|
|
|
|
}
|
2008-08-05 12:23:58 +00:00
|
|
|
|
2008-03-25 17:34:57 +00:00
|
|
|
break;
|
|
|
|
}
|
2009-05-09 09:26:16 +00:00
|
|
|
case BrushTypeLinearGradient:{
|
|
|
|
GpLineGradient *dest, *src;
|
2009-11-28 15:26:02 +00:00
|
|
|
INT count, pcount;
|
2009-05-09 09:26:16 +00:00
|
|
|
|
2015-11-22 10:10:02 +00:00
|
|
|
dest = heap_alloc_zero(sizeof(GpLineGradient));
|
2009-05-09 09:26:16 +00:00
|
|
|
if(!dest) return OutOfMemory;
|
|
|
|
|
|
|
|
src = (GpLineGradient*)brush;
|
2008-03-25 17:34:57 +00:00
|
|
|
|
2009-05-09 09:26:16 +00:00
|
|
|
memcpy(dest, src, sizeof(GpLineGradient));
|
2008-03-25 17:34:57 +00:00
|
|
|
|
2009-05-09 09:26:16 +00:00
|
|
|
count = dest->blendcount;
|
2015-11-22 10:10:02 +00:00
|
|
|
dest->blendfac = heap_alloc_zero(count * sizeof(REAL));
|
|
|
|
dest->blendpos = heap_alloc_zero(count * sizeof(REAL));
|
2009-11-28 15:26:02 +00:00
|
|
|
pcount = dest->pblendcount;
|
|
|
|
if (pcount)
|
|
|
|
{
|
2015-11-22 10:10:02 +00:00
|
|
|
dest->pblendcolor = heap_alloc_zero(pcount * sizeof(ARGB));
|
|
|
|
dest->pblendpos = heap_alloc_zero(pcount * sizeof(REAL));
|
2009-11-28 15:26:02 +00:00
|
|
|
}
|
2009-05-09 09:26:16 +00:00
|
|
|
|
2009-11-28 15:26:02 +00:00
|
|
|
if (!dest->blendfac || !dest->blendpos ||
|
|
|
|
(pcount && (!dest->pblendcolor || !dest->pblendpos)))
|
2009-05-09 09:26:16 +00:00
|
|
|
{
|
2015-11-22 10:10:02 +00:00
|
|
|
heap_free(dest->blendfac);
|
|
|
|
heap_free(dest->blendpos);
|
|
|
|
heap_free(dest->pblendcolor);
|
|
|
|
heap_free(dest->pblendpos);
|
|
|
|
heap_free(dest);
|
2009-05-09 09:26:16 +00:00
|
|
|
return OutOfMemory;
|
|
|
|
}
|
|
|
|
|
2017-09-17 12:34:15 +00:00
|
|
|
dest->transform = src->transform;
|
|
|
|
|
2009-05-09 09:26:16 +00:00
|
|
|
memcpy(dest->blendfac, src->blendfac, count * sizeof(REAL));
|
|
|
|
memcpy(dest->blendpos, src->blendpos, count * sizeof(REAL));
|
|
|
|
|
2009-11-28 15:26:02 +00:00
|
|
|
if (pcount)
|
|
|
|
{
|
|
|
|
memcpy(dest->pblendcolor, src->pblendcolor, pcount * sizeof(ARGB));
|
|
|
|
memcpy(dest->pblendpos, src->pblendpos, pcount * sizeof(REAL));
|
|
|
|
}
|
|
|
|
|
2009-05-09 09:26:16 +00:00
|
|
|
*clone = &dest->brush;
|
2008-03-25 17:34:57 +00:00
|
|
|
break;
|
2009-05-09 09:26:16 +00:00
|
|
|
}
|
2008-03-25 17:34:57 +00:00
|
|
|
case BrushTypeTextureFill:
|
2010-03-04 13:34:05 +00:00
|
|
|
{
|
|
|
|
GpStatus stat;
|
|
|
|
GpTexture *texture = (GpTexture*)brush;
|
|
|
|
GpTexture *new_texture;
|
2012-03-05 20:17:42 +00:00
|
|
|
UINT width, height;
|
2008-03-25 17:34:57 +00:00
|
|
|
|
2012-03-05 20:17:42 +00:00
|
|
|
stat = GdipGetImageWidth(texture->image, &width);
|
|
|
|
if (stat != Ok) return stat;
|
|
|
|
stat = GdipGetImageHeight(texture->image, &height);
|
|
|
|
if (stat != Ok) return stat;
|
|
|
|
|
|
|
|
stat = GdipCreateTextureIA(texture->image, texture->imageattributes, 0, 0, width, height, &new_texture);
|
2008-03-25 17:34:57 +00:00
|
|
|
|
2010-03-04 13:34:05 +00:00
|
|
|
if (stat == Ok)
|
|
|
|
{
|
2012-12-11 21:40:15 +00:00
|
|
|
new_texture->transform = texture->transform;
|
2016-08-19 09:28:13 +00:00
|
|
|
*clone = &new_texture->brush;
|
2010-03-04 13:34:05 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
*clone = NULL;
|
|
|
|
|
|
|
|
return stat;
|
|
|
|
}
|
2008-03-25 17:34:57 +00:00
|
|
|
default:
|
|
|
|
ERR("not implemented for brush type %d\n", brush->bt);
|
|
|
|
return NotImplemented;
|
|
|
|
}
|
|
|
|
|
2010-03-04 13:34:05 +00:00
|
|
|
TRACE("<-- %p\n", *clone);
|
2008-03-25 17:34:57 +00:00
|
|
|
return Ok;
|
|
|
|
}
|
|
|
|
|
2009-11-28 15:26:02 +00: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 */
|
|
|
|
{ 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-01-27 18:03:33 +00:00
|
|
|
|
2018-01-18 23:17:41 +00:00
|
|
|
GpStatus get_hatch_data(GpHatchStyle hatchstyle, const char **result)
|
2012-03-05 20:17:42 +00:00
|
|
|
{
|
2018-05-27 03:10:39 +00:00
|
|
|
if (hatchstyle < ARRAY_SIZE(HatchBrushes))
|
2012-03-05 20:17:42 +00:00
|
|
|
{
|
|
|
|
*result = HatchBrushes[hatchstyle];
|
|
|
|
return Ok;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
return NotImplemented;
|
|
|
|
}
|
|
|
|
|
2009-01-27 18:03:33 +00:00
|
|
|
/******************************************************************************
|
|
|
|
* GdipCreateHatchBrush [GDIPLUS.@]
|
|
|
|
*/
|
2018-01-18 23:17:41 +00:00
|
|
|
GpStatus WINGDIPAPI GdipCreateHatchBrush(GpHatchStyle hatchstyle, ARGB forecol, ARGB backcol, GpHatch **brush)
|
2009-01-27 18:03:33 +00:00
|
|
|
{
|
|
|
|
TRACE("(%d, %d, %d, %p)\n", hatchstyle, forecol, backcol, brush);
|
|
|
|
|
|
|
|
if(!brush) return InvalidParameter;
|
|
|
|
|
2018-01-18 23:17:41 +00:00
|
|
|
if(hatchstyle < HatchStyleMin || hatchstyle > HatchStyleMax)
|
|
|
|
return InvalidParameter;
|
|
|
|
|
2015-11-22 10:10:02 +00:00
|
|
|
*brush = heap_alloc_zero(sizeof(GpHatch));
|
2009-01-27 18:03:33 +00:00
|
|
|
if (!*brush) return OutOfMemory;
|
|
|
|
|
2012-05-19 10:03:40 +00:00
|
|
|
(*brush)->brush.bt = BrushTypeHatchFill;
|
|
|
|
(*brush)->forecol = forecol;
|
|
|
|
(*brush)->backcol = backcol;
|
|
|
|
(*brush)->hatchstyle = hatchstyle;
|
|
|
|
TRACE("<-- %p\n", *brush);
|
2009-01-27 18:03:33 +00:00
|
|
|
|
2012-05-19 10:03:40 +00:00
|
|
|
return Ok;
|
2009-01-27 18:03:33 +00:00
|
|
|
}
|
|
|
|
|
2019-01-25 12:21:54 +00:00
|
|
|
static GpStatus create_line_brush(const GpRectF *rect, ARGB startcolor, ARGB endcolor,
|
|
|
|
GpWrapMode wrap, GpLineGradient **line)
|
|
|
|
{
|
|
|
|
*line = heap_alloc_zero(sizeof(GpLineGradient));
|
|
|
|
if(!*line) return OutOfMemory;
|
|
|
|
|
|
|
|
(*line)->brush.bt = BrushTypeLinearGradient;
|
|
|
|
(*line)->startcolor = startcolor;
|
|
|
|
(*line)->endcolor = endcolor;
|
|
|
|
(*line)->wrap = wrap;
|
|
|
|
(*line)->gamma = FALSE;
|
|
|
|
(*line)->rect = *rect;
|
|
|
|
(*line)->blendcount = 1;
|
|
|
|
(*line)->blendfac = heap_alloc_zero(sizeof(REAL));
|
|
|
|
(*line)->blendpos = heap_alloc_zero(sizeof(REAL));
|
|
|
|
|
|
|
|
if (!(*line)->blendfac || !(*line)->blendpos)
|
|
|
|
{
|
|
|
|
heap_free((*line)->blendfac);
|
|
|
|
heap_free((*line)->blendpos);
|
|
|
|
heap_free(*line);
|
|
|
|
*line = NULL;
|
|
|
|
return OutOfMemory;
|
|
|
|
}
|
|
|
|
|
|
|
|
(*line)->blendfac[0] = 1.0f;
|
|
|
|
(*line)->blendpos[0] = 1.0f;
|
|
|
|
|
|
|
|
(*line)->pblendcolor = NULL;
|
|
|
|
(*line)->pblendpos = NULL;
|
|
|
|
(*line)->pblendcount = 0;
|
|
|
|
|
|
|
|
GdipSetMatrixElements(&(*line)->transform, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f);
|
|
|
|
|
|
|
|
return Ok;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void linegradient_init_transform(const GpPointF *startpoint, const GpPointF *endpoint, GpLineGradient *line)
|
2017-09-17 12:34:15 +00:00
|
|
|
{
|
|
|
|
float trans_x = line->rect.X + (line->rect.Width / 2.f);
|
|
|
|
float trans_y = line->rect.Y + (line->rect.Height / 2.f);
|
2019-01-25 12:21:54 +00:00
|
|
|
float dx = endpoint->X - startpoint->X;
|
|
|
|
float dy = endpoint->Y - startpoint->Y;
|
2017-09-17 12:34:15 +00:00
|
|
|
float t_cos, t_sin, w_ratio, h_ratio;
|
|
|
|
float h;
|
|
|
|
GpMatrix rot;
|
|
|
|
|
|
|
|
h = sqrtf(dx * dx + dy * dy);
|
|
|
|
|
|
|
|
t_cos = dx / h;
|
|
|
|
t_sin = dy / h;
|
|
|
|
|
|
|
|
w_ratio = (fabs(t_cos) * line->rect.Width + fabs(t_sin) * line->rect.Height) / line->rect.Width;
|
|
|
|
h_ratio = (fabs(t_sin) * line->rect.Width + fabs(t_cos) * line->rect.Height) / line->rect.Height;
|
|
|
|
|
|
|
|
GdipSetMatrixElements(&line->transform, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0);
|
|
|
|
|
|
|
|
GdipSetMatrixElements(&rot, t_cos, t_sin, -1.f * t_sin, t_cos, 0, 0);
|
|
|
|
|
|
|
|
/* center about the origin */
|
|
|
|
GdipTranslateMatrix(&line->transform, -trans_x, -trans_y, MatrixOrderAppend);
|
|
|
|
|
|
|
|
/* scale to normalize gradient along gradient line (?) */
|
|
|
|
GdipScaleMatrix(&line->transform, w_ratio, h_ratio, MatrixOrderAppend);
|
|
|
|
|
|
|
|
/* rotate so the gradient is horizontal */
|
|
|
|
GdipMultiplyMatrix(&line->transform, &rot, MatrixOrderAppend);
|
|
|
|
|
|
|
|
/* restore original offset in new coords */
|
|
|
|
GdipTranslateMatrix(&line->transform, trans_x, trans_y, MatrixOrderAppend);
|
|
|
|
}
|
|
|
|
|
2008-12-06 09:26:01 +00:00
|
|
|
/******************************************************************************
|
|
|
|
* GdipCreateLineBrush [GDIPLUS.@]
|
|
|
|
*/
|
2008-03-25 17:34:57 +00:00
|
|
|
GpStatus WINGDIPAPI GdipCreateLineBrush(GDIPCONST GpPointF* startpoint,
|
|
|
|
GDIPCONST GpPointF* endpoint, ARGB startcolor, ARGB endcolor,
|
|
|
|
GpWrapMode wrap, GpLineGradient **line)
|
|
|
|
{
|
2019-01-25 12:21:54 +00:00
|
|
|
GpStatus stat;
|
|
|
|
GpRectF rect;
|
|
|
|
|
2010-03-04 13:34:05 +00:00
|
|
|
TRACE("(%s, %s, %x, %x, %d, %p)\n", debugstr_pointf(startpoint),
|
|
|
|
debugstr_pointf(endpoint), startcolor, endcolor, wrap, line);
|
2008-09-07 10:32:49 +00:00
|
|
|
|
2008-03-25 17:34:57 +00:00
|
|
|
if(!line || !startpoint || !endpoint || wrap == WrapModeClamp)
|
|
|
|
return InvalidParameter;
|
|
|
|
|
2010-11-20 11:24:17 +00:00
|
|
|
if (startpoint->X == endpoint->X && startpoint->Y == endpoint->Y)
|
|
|
|
return OutOfMemory;
|
|
|
|
|
2019-01-25 12:21:54 +00:00
|
|
|
rect.X = startpoint->X < endpoint->X ? startpoint->X : endpoint->X;
|
|
|
|
rect.Y = startpoint->Y < endpoint->Y ? startpoint->Y : endpoint->Y;
|
|
|
|
rect.Width = fabs(startpoint->X - endpoint->X);
|
|
|
|
rect.Height = fabs(startpoint->Y - endpoint->Y);
|
2009-05-09 09:26:16 +00:00
|
|
|
|
2019-01-25 12:21:54 +00:00
|
|
|
if (rect.Width == 0.0f)
|
2009-09-03 15:07:25 +00:00
|
|
|
{
|
2019-01-25 12:21:54 +00:00
|
|
|
rect.X -= rect.Height / 2.0f;
|
|
|
|
rect.Width = rect.Height;
|
2009-09-03 15:07:25 +00:00
|
|
|
}
|
2019-01-25 12:21:54 +00:00
|
|
|
else if (rect.Height == 0.0f)
|
2009-05-09 09:26:16 +00:00
|
|
|
{
|
2019-01-25 12:21:54 +00:00
|
|
|
rect.Y -= rect.Width / 2.0f;
|
|
|
|
rect.Height = rect.Width;
|
2009-05-09 09:26:16 +00:00
|
|
|
}
|
|
|
|
|
2019-01-25 12:21:54 +00:00
|
|
|
stat = create_line_brush(&rect, startcolor, endcolor, wrap, line);
|
|
|
|
if (stat != Ok)
|
|
|
|
return stat;
|
2009-11-28 15:26:02 +00:00
|
|
|
|
2019-01-25 12:21:54 +00:00
|
|
|
linegradient_init_transform(startpoint, endpoint, *line);
|
2017-09-17 12:34:15 +00:00
|
|
|
|
2010-03-04 13:34:05 +00:00
|
|
|
TRACE("<-- %p\n", *line);
|
|
|
|
|
2008-03-25 17:34:57 +00:00
|
|
|
return Ok;
|
|
|
|
}
|
|
|
|
|
2008-05-04 19:41:25 +00:00
|
|
|
GpStatus WINGDIPAPI GdipCreateLineBrushI(GDIPCONST GpPoint* startpoint,
|
|
|
|
GDIPCONST GpPoint* endpoint, ARGB startcolor, ARGB endcolor,
|
|
|
|
GpWrapMode wrap, GpLineGradient **line)
|
|
|
|
{
|
|
|
|
GpPointF stF;
|
|
|
|
GpPointF endF;
|
|
|
|
|
2008-09-07 10:32:49 +00:00
|
|
|
TRACE("(%p, %p, %x, %x, %d, %p)\n", startpoint, endpoint,
|
|
|
|
startcolor, endcolor, wrap, line);
|
|
|
|
|
2008-05-04 19:41:25 +00:00
|
|
|
if(!startpoint || !endpoint)
|
|
|
|
return InvalidParameter;
|
|
|
|
|
|
|
|
stF.X = (REAL)startpoint->X;
|
|
|
|
stF.Y = (REAL)startpoint->Y;
|
|
|
|
endF.X = (REAL)endpoint->X;
|
2010-11-20 11:24:17 +00:00
|
|
|
endF.Y = (REAL)endpoint->Y;
|
2008-05-04 19:41:25 +00:00
|
|
|
|
|
|
|
return GdipCreateLineBrush(&stF, &endF, startcolor, endcolor, wrap, line);
|
|
|
|
}
|
|
|
|
|
|
|
|
GpStatus WINGDIPAPI GdipCreateLineBrushFromRect(GDIPCONST GpRectF* rect,
|
2008-03-25 17:34:57 +00:00
|
|
|
ARGB startcolor, ARGB endcolor, LinearGradientMode mode, GpWrapMode wrap,
|
|
|
|
GpLineGradient **line)
|
|
|
|
{
|
2019-01-25 12:21:54 +00:00
|
|
|
float angle;
|
2008-03-25 17:34:57 +00:00
|
|
|
|
2008-09-07 10:32:49 +00:00
|
|
|
TRACE("(%p, %x, %x, %d, %d, %p)\n", rect, startcolor, endcolor, mode,
|
|
|
|
wrap, line);
|
|
|
|
|
2008-03-25 17:34:57 +00:00
|
|
|
if(!line || !rect)
|
|
|
|
return InvalidParameter;
|
|
|
|
|
2009-05-09 09:26:16 +00:00
|
|
|
switch (mode)
|
|
|
|
{
|
2019-01-25 12:21:54 +00:00
|
|
|
case LinearGradientModeHorizontal:
|
|
|
|
angle = 0.0f;
|
|
|
|
break;
|
2009-05-09 09:26:16 +00:00
|
|
|
case LinearGradientModeVertical:
|
2019-01-13 16:14:41 +00:00
|
|
|
angle = 90.0f;
|
2009-05-09 09:26:16 +00:00
|
|
|
break;
|
|
|
|
case LinearGradientModeForwardDiagonal:
|
2019-01-13 16:14:41 +00:00
|
|
|
angle = 45.0f;
|
2009-05-09 09:26:16 +00:00
|
|
|
break;
|
|
|
|
case LinearGradientModeBackwardDiagonal:
|
2019-01-13 16:14:41 +00:00
|
|
|
angle = 135.0f;
|
2009-05-09 09:26:16 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
return InvalidParameter;
|
|
|
|
}
|
2008-03-25 17:34:57 +00:00
|
|
|
|
2019-01-13 16:14:41 +00:00
|
|
|
return GdipCreateLineBrushFromRectWithAngle(rect, startcolor, endcolor, angle, TRUE, wrap, line);
|
2008-03-25 17:34:57 +00:00
|
|
|
}
|
|
|
|
|
2008-05-04 19:41:25 +00:00
|
|
|
GpStatus WINGDIPAPI GdipCreateLineBrushFromRectI(GDIPCONST GpRect* rect,
|
|
|
|
ARGB startcolor, ARGB endcolor, LinearGradientMode mode, GpWrapMode wrap,
|
|
|
|
GpLineGradient **line)
|
|
|
|
{
|
|
|
|
GpRectF rectF;
|
|
|
|
|
2008-09-07 10:32:49 +00:00
|
|
|
TRACE("(%p, %x, %x, %d, %d, %p)\n", rect, startcolor, endcolor, mode,
|
|
|
|
wrap, line);
|
|
|
|
|
2008-05-04 19:41:25 +00: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-12-06 09:26:01 +00:00
|
|
|
/******************************************************************************
|
|
|
|
* GdipCreateLineBrushFromRectWithAngle [GDIPLUS.@]
|
|
|
|
*/
|
2008-08-05 12:23:58 +00:00
|
|
|
GpStatus WINGDIPAPI GdipCreateLineBrushFromRectWithAngle(GDIPCONST GpRectF* rect,
|
|
|
|
ARGB startcolor, ARGB endcolor, REAL angle, BOOL isAngleScalable, GpWrapMode wrap,
|
|
|
|
GpLineGradient **line)
|
|
|
|
{
|
2010-03-04 13:34:05 +00:00
|
|
|
GpStatus stat;
|
2019-01-13 16:14:41 +00:00
|
|
|
REAL exofs, eyofs, far_x, far_y;
|
2010-03-04 13:34:05 +00:00
|
|
|
REAL sin_angle, cos_angle, sin_cos_angle;
|
2019-01-13 16:14:41 +00:00
|
|
|
GpPointF start, end;
|
2010-03-04 13:34:05 +00:00
|
|
|
|
2008-09-07 10:32:49 +00:00
|
|
|
TRACE("(%p, %x, %x, %.2f, %d, %d, %p)\n", rect, startcolor, endcolor, angle, isAngleScalable,
|
|
|
|
wrap, line);
|
|
|
|
|
2018-01-18 23:17:41 +00:00
|
|
|
if (!rect || !line || wrap == WrapModeClamp)
|
2016-11-17 22:35:44 +00:00
|
|
|
return InvalidParameter;
|
|
|
|
|
2018-01-18 23:17:41 +00:00
|
|
|
if (!rect->Width || !rect->Height)
|
|
|
|
return OutOfMemory;
|
|
|
|
|
2016-11-17 22:35:44 +00:00
|
|
|
angle = fmodf(angle, 360);
|
|
|
|
if (angle < 0)
|
|
|
|
angle += 360;
|
2010-03-04 13:34:05 +00:00
|
|
|
|
|
|
|
if (isAngleScalable)
|
|
|
|
{
|
2016-11-17 22:35:44 +00:00
|
|
|
float add_angle = 0;
|
|
|
|
|
|
|
|
while(angle >= 90) {
|
|
|
|
angle -= 180;
|
|
|
|
add_angle += M_PI;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (angle != 90 && angle != -90)
|
|
|
|
angle = atan((rect->Width / rect->Height) * tan(deg2rad(angle)));
|
|
|
|
else
|
|
|
|
angle = deg2rad(angle);
|
|
|
|
angle += add_angle;
|
2010-03-04 13:34:05 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2016-11-17 22:35:44 +00:00
|
|
|
angle = deg2rad(angle);
|
2010-03-04 13:34:05 +00:00
|
|
|
}
|
|
|
|
|
2016-11-17 22:35:44 +00:00
|
|
|
sin_angle = sinf(angle);
|
|
|
|
cos_angle = cosf(angle);
|
|
|
|
sin_cos_angle = sin_angle * cos_angle;
|
|
|
|
|
2019-01-13 16:14:41 +00:00
|
|
|
far_x = rect->X + rect->Width;
|
|
|
|
far_y = rect->Y + rect->Height;
|
|
|
|
|
2019-01-25 12:21:54 +00:00
|
|
|
if (angle == 0.0f)
|
|
|
|
{
|
|
|
|
start.X = min(rect->X, far_x);
|
|
|
|
start.Y = rect->Y;
|
|
|
|
end.X = max(rect->X, far_x);
|
|
|
|
end.Y = rect->Y;
|
|
|
|
}
|
|
|
|
else if (sin_cos_angle >= 0)
|
2019-01-13 16:14:41 +00:00
|
|
|
{
|
|
|
|
start.X = min(rect->X, far_x);
|
|
|
|
start.Y = min(rect->Y, far_y);
|
|
|
|
end.X = max(rect->X, far_x);
|
|
|
|
end.Y = max(rect->Y, far_y);
|
|
|
|
}
|
2010-03-04 13:34:05 +00:00
|
|
|
else
|
2019-01-13 16:14:41 +00:00
|
|
|
{
|
|
|
|
start.X = max(rect->X, far_x);
|
|
|
|
start.Y = min(rect->Y, far_y);
|
|
|
|
end.X = min(rect->X, far_x);
|
|
|
|
end.Y = max(rect->Y, far_y);
|
|
|
|
}
|
2010-03-04 13:34:05 +00:00
|
|
|
|
2019-01-25 12:21:54 +00:00
|
|
|
stat = create_line_brush(rect, startcolor, endcolor, wrap, line);
|
|
|
|
if (stat != Ok || angle == 0.0f)
|
|
|
|
return stat;
|
2010-03-04 13:34:05 +00:00
|
|
|
|
2019-01-25 12:21:54 +00:00
|
|
|
if (sin_cos_angle >= 0)
|
2010-03-04 13:34:05 +00:00
|
|
|
{
|
2019-01-25 12:21:54 +00:00
|
|
|
exofs = rect->Height * sin_cos_angle + rect->Width * cos_angle * cos_angle;
|
|
|
|
eyofs = rect->Height * sin_angle * sin_angle + rect->Width * sin_cos_angle;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
exofs = rect->Width * sin_angle * sin_angle + rect->Height * sin_cos_angle;
|
|
|
|
eyofs = -rect->Width * sin_cos_angle + rect->Height * sin_angle * sin_angle;
|
|
|
|
}
|
2017-09-17 12:34:15 +00:00
|
|
|
|
2019-01-25 12:21:54 +00:00
|
|
|
if (sin_angle >= 0)
|
|
|
|
{
|
|
|
|
end.X = rect->X + exofs;
|
|
|
|
end.Y = rect->Y + eyofs;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
end.X = start.X;
|
|
|
|
end.Y = start.Y;
|
|
|
|
start.X = rect->X + exofs;
|
|
|
|
start.Y = rect->Y + eyofs;
|
2010-03-04 13:34:05 +00:00
|
|
|
}
|
|
|
|
|
2019-01-25 12:21:54 +00:00
|
|
|
linegradient_init_transform(&start, &end, *line);
|
|
|
|
|
2010-03-04 13:34:05 +00:00
|
|
|
return stat;
|
2008-08-05 12:23:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
GpStatus WINGDIPAPI GdipCreateLineBrushFromRectWithAngleI(GDIPCONST GpRect* rect,
|
|
|
|
ARGB startcolor, ARGB endcolor, REAL angle, BOOL isAngleScalable, GpWrapMode wrap,
|
|
|
|
GpLineGradient **line)
|
|
|
|
{
|
2008-09-07 10:32:49 +00:00
|
|
|
TRACE("(%p, %x, %x, %.2f, %d, %d, %p)\n", rect, startcolor, endcolor, angle, isAngleScalable,
|
|
|
|
wrap, line);
|
|
|
|
|
2008-08-05 12:23:58 +00:00
|
|
|
return GdipCreateLineBrushFromRectI(rect, startcolor, endcolor, LinearGradientModeForwardDiagonal,
|
|
|
|
wrap, line);
|
|
|
|
}
|
|
|
|
|
2012-05-19 10:03:40 +00:00
|
|
|
static GpStatus create_path_gradient(GpPath *path, ARGB centercolor, GpPathGradient **grad)
|
2008-03-25 17:34:57 +00:00
|
|
|
{
|
2012-05-19 10:03:40 +00:00
|
|
|
GpRectF bounds;
|
2008-09-07 10:32:49 +00:00
|
|
|
|
2012-05-19 10:03:40 +00:00
|
|
|
if(!path || !grad)
|
2008-03-25 17:34:57 +00:00
|
|
|
return InvalidParameter;
|
|
|
|
|
2012-05-19 10:03:40 +00:00
|
|
|
if (path->pathdata.Count < 2)
|
2008-03-25 17:34:57 +00:00
|
|
|
return OutOfMemory;
|
|
|
|
|
2012-05-19 10:03:40 +00:00
|
|
|
GdipGetPathWorldBounds(path, &bounds, NULL, NULL);
|
|
|
|
|
2015-11-22 10:10:02 +00:00
|
|
|
*grad = heap_alloc_zero(sizeof(GpPathGradient));
|
2012-05-19 10:03:40 +00:00
|
|
|
if (!*grad)
|
|
|
|
{
|
|
|
|
return OutOfMemory;
|
|
|
|
}
|
|
|
|
|
2012-12-11 21:40:15 +00:00
|
|
|
GdipSetMatrixElements(&(*grad)->transform, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0);
|
2008-03-25 17:34:57 +00:00
|
|
|
|
2015-11-22 10:10:02 +00:00
|
|
|
(*grad)->blendfac = heap_alloc_zero(sizeof(REAL));
|
|
|
|
(*grad)->blendpos = heap_alloc_zero(sizeof(REAL));
|
|
|
|
(*grad)->surroundcolors = heap_alloc_zero(sizeof(ARGB));
|
2012-05-19 10:03:40 +00:00
|
|
|
if(!(*grad)->blendfac || !(*grad)->blendpos || !(*grad)->surroundcolors){
|
2015-11-22 10:10:02 +00:00
|
|
|
heap_free((*grad)->blendfac);
|
|
|
|
heap_free((*grad)->blendpos);
|
|
|
|
heap_free((*grad)->surroundcolors);
|
|
|
|
heap_free(*grad);
|
Finish the Wine sync. These components are not just rc file changes
atl, comctl32, comdlg32, dwmapi, fusion, gdiplus, jscript, mpr, mshtml, msi, msimtf, msxml3, ole32, oleaut32, riched20, shdocvw, shlwapi, urlmon, usp10, version and windowscodecs
Seems to build and boot. /me hides
svn path=/trunk/; revision=48273
2010-07-26 02:26:04 +00:00
|
|
|
*grad = NULL;
|
2008-08-05 12:23:58 +00:00
|
|
|
return OutOfMemory;
|
|
|
|
}
|
|
|
|
(*grad)->blendfac[0] = 1.0;
|
Sync avifil, credui, crypt32, cryptdlg, cryptui, dnsapi, gdiplus, hhctrl, hnetcfg, iccvid, imaadp32, imm32, jscript, localspl, localui, mapi32, mciavi32, mcicda, mciqtz32, mciseq, mciwave, mshtml, msrle32, msvfw32, msvidc32, msxml3, oleacc, oleaut32 to Wine 1.2rc5 (Samuel Serapion, small changes by me)
Remove Esperanto and Walon languages from comctl32, comdlg32, mpr, msi, shlwapi, wininet
svn path=/trunk/; revision=47920
2010-07-01 11:09:47 +00:00
|
|
|
(*grad)->blendpos[0] = 1.0;
|
2008-08-05 12:23:58 +00:00
|
|
|
(*grad)->blendcount = 1;
|
|
|
|
|
2012-05-19 10:03:40 +00:00
|
|
|
(*grad)->path = path;
|
2008-03-25 17:34:57 +00:00
|
|
|
|
|
|
|
(*grad)->brush.bt = BrushTypePathGradient;
|
2012-05-19 10:03:40 +00:00
|
|
|
(*grad)->centercolor = centercolor;
|
|
|
|
(*grad)->wrap = WrapModeClamp;
|
2008-03-25 17:34:57 +00:00
|
|
|
(*grad)->gamma = FALSE;
|
2012-05-19 10:03:40 +00:00
|
|
|
/* FIXME: this should be set to the "centroid" of the path by default */
|
|
|
|
(*grad)->center.X = bounds.X + bounds.Width / 2;
|
|
|
|
(*grad)->center.Y = bounds.Y + bounds.Height / 2;
|
2008-03-25 17:34:57 +00:00
|
|
|
(*grad)->focus.X = 0.0;
|
|
|
|
(*grad)->focus.Y = 0.0;
|
2012-05-19 10:03:40 +00:00
|
|
|
(*grad)->surroundcolors[0] = 0xffffffff;
|
|
|
|
(*grad)->surroundcolorcount = 1;
|
2008-03-25 17:34:57 +00:00
|
|
|
|
2010-03-04 13:34:05 +00:00
|
|
|
TRACE("<-- %p\n", *grad);
|
|
|
|
|
2008-03-25 17:34:57 +00:00
|
|
|
return Ok;
|
|
|
|
}
|
|
|
|
|
2012-05-19 10:03:40 +00:00
|
|
|
GpStatus WINGDIPAPI GdipCreatePathGradient(GDIPCONST GpPointF* points,
|
2008-05-04 19:41:25 +00:00
|
|
|
INT count, GpWrapMode wrap, GpPathGradient **grad)
|
|
|
|
{
|
2012-05-19 10:03:40 +00:00
|
|
|
GpStatus stat;
|
|
|
|
GpPath *path;
|
2008-05-04 19:41:25 +00:00
|
|
|
|
2008-09-07 10:32:49 +00:00
|
|
|
TRACE("(%p, %d, %d, %p)\n", points, count, wrap, grad);
|
|
|
|
|
2012-05-19 10:03:40 +00:00
|
|
|
if(!grad)
|
2008-05-04 19:41:25 +00:00
|
|
|
return InvalidParameter;
|
|
|
|
|
2012-05-19 10:03:40 +00:00
|
|
|
if(!points || count <= 0)
|
2008-05-04 19:41:25 +00:00
|
|
|
return OutOfMemory;
|
|
|
|
|
2012-05-19 10:03:40 +00:00
|
|
|
stat = GdipCreatePath(FillModeAlternate, &path);
|
|
|
|
|
|
|
|
if (stat == Ok)
|
|
|
|
{
|
|
|
|
stat = GdipAddPathLine2(path, points, count);
|
|
|
|
|
|
|
|
if (stat == Ok)
|
|
|
|
stat = create_path_gradient(path, 0xff000000, grad);
|
|
|
|
|
|
|
|
if (stat != Ok)
|
|
|
|
GdipDeletePath(path);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (stat == Ok)
|
|
|
|
(*grad)->wrap = wrap;
|
|
|
|
|
|
|
|
return stat;
|
|
|
|
}
|
|
|
|
|
|
|
|
GpStatus WINGDIPAPI GdipCreatePathGradientI(GDIPCONST GpPoint* points,
|
|
|
|
INT count, GpWrapMode wrap, GpPathGradient **grad)
|
|
|
|
{
|
|
|
|
GpStatus stat;
|
|
|
|
GpPath *path;
|
|
|
|
|
|
|
|
TRACE("(%p, %d, %d, %p)\n", points, count, wrap, grad);
|
|
|
|
|
|
|
|
if(!grad)
|
|
|
|
return InvalidParameter;
|
|
|
|
|
|
|
|
if(!points || count <= 0)
|
2008-05-04 19:41:25 +00:00
|
|
|
return OutOfMemory;
|
|
|
|
|
2012-05-19 10:03:40 +00:00
|
|
|
stat = GdipCreatePath(FillModeAlternate, &path);
|
|
|
|
|
|
|
|
if (stat == Ok)
|
|
|
|
{
|
|
|
|
stat = GdipAddPathLine2I(path, points, count);
|
|
|
|
|
|
|
|
if (stat == Ok)
|
|
|
|
stat = create_path_gradient(path, 0xff000000, grad);
|
|
|
|
|
|
|
|
if (stat != Ok)
|
|
|
|
GdipDeletePath(path);
|
2008-05-04 19:41:25 +00:00
|
|
|
}
|
|
|
|
|
2012-05-19 10:03:40 +00:00
|
|
|
if (stat == Ok)
|
|
|
|
(*grad)->wrap = wrap;
|
2008-05-04 19:41:25 +00:00
|
|
|
|
2012-05-19 10:03:40 +00:00
|
|
|
return stat;
|
2008-05-04 19:41:25 +00:00
|
|
|
}
|
|
|
|
|
2008-12-06 09:26:01 +00:00
|
|
|
/******************************************************************************
|
|
|
|
* GdipCreatePathGradientFromPath [GDIPLUS.@]
|
|
|
|
*/
|
2008-03-25 17:34:57 +00:00
|
|
|
GpStatus WINGDIPAPI GdipCreatePathGradientFromPath(GDIPCONST GpPath* path,
|
|
|
|
GpPathGradient **grad)
|
|
|
|
{
|
2012-05-19 10:03:40 +00:00
|
|
|
GpStatus stat;
|
|
|
|
GpPath *new_path;
|
2008-03-25 17:34:57 +00:00
|
|
|
|
2008-09-07 10:32:49 +00:00
|
|
|
TRACE("(%p, %p)\n", path, grad);
|
|
|
|
|
2012-05-19 10:03:40 +00:00
|
|
|
if(!grad)
|
2008-03-25 17:34:57 +00:00
|
|
|
return InvalidParameter;
|
|
|
|
|
2012-05-19 10:03:40 +00:00
|
|
|
if (!path)
|
2008-03-25 17:34:57 +00:00
|
|
|
return OutOfMemory;
|
|
|
|
|
2012-05-19 10:03:40 +00:00
|
|
|
stat = GdipClonePath((GpPath*)path, &new_path);
|
2008-03-25 17:34:57 +00:00
|
|
|
|
2012-05-19 10:03:40 +00:00
|
|
|
if (stat == Ok)
|
|
|
|
{
|
|
|
|
stat = create_path_gradient(new_path, 0xffffffff, grad);
|
2008-03-25 17:34:57 +00:00
|
|
|
|
2012-05-19 10:03:40 +00:00
|
|
|
if (stat != Ok)
|
|
|
|
GdipDeletePath(new_path);
|
|
|
|
}
|
2010-03-04 13:34:05 +00:00
|
|
|
|
2012-05-19 10:03:40 +00:00
|
|
|
return stat;
|
2008-03-25 17:34:57 +00:00
|
|
|
}
|
|
|
|
|
2008-12-06 09:26:01 +00:00
|
|
|
/******************************************************************************
|
|
|
|
* GdipCreateSolidFill [GDIPLUS.@]
|
|
|
|
*/
|
2008-03-25 17:34:57 +00:00
|
|
|
GpStatus WINGDIPAPI GdipCreateSolidFill(ARGB color, GpSolidFill **sf)
|
|
|
|
{
|
2008-09-07 10:32:49 +00:00
|
|
|
TRACE("(%x, %p)\n", color, sf);
|
|
|
|
|
2008-03-25 17:34:57 +00:00
|
|
|
if(!sf) return InvalidParameter;
|
|
|
|
|
2015-11-22 10:10:02 +00:00
|
|
|
*sf = heap_alloc_zero(sizeof(GpSolidFill));
|
2008-03-25 17:34:57 +00:00
|
|
|
if (!*sf) return OutOfMemory;
|
|
|
|
|
|
|
|
(*sf)->brush.bt = BrushTypeSolidColor;
|
|
|
|
(*sf)->color = color;
|
|
|
|
|
2010-03-04 13:34:05 +00:00
|
|
|
TRACE("<-- %p\n", *sf);
|
|
|
|
|
2008-03-25 17:34:57 +00:00
|
|
|
return Ok;
|
|
|
|
}
|
|
|
|
|
2008-12-06 09:26:01 +00:00
|
|
|
/******************************************************************************
|
2008-09-07 10:32:49 +00: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
|
|
|
|
*/
|
|
|
|
GpStatus WINGDIPAPI GdipCreateTexture(GpImage *image, GpWrapMode wrapmode,
|
|
|
|
GpTexture **texture)
|
|
|
|
{
|
|
|
|
UINT width, height;
|
2012-03-05 20:17:42 +00:00
|
|
|
GpImageAttributes *attributes;
|
2008-09-07 10:32:49 +00:00
|
|
|
GpStatus stat;
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
2012-03-05 20:17:42 +00:00
|
|
|
stat = GdipCreateImageAttributes(&attributes);
|
|
|
|
|
|
|
|
if (stat == Ok)
|
|
|
|
{
|
|
|
|
attributes->wrap = wrapmode;
|
|
|
|
|
|
|
|
stat = GdipCreateTextureIA(image, attributes, 0, 0, width, height,
|
2008-09-07 10:32:49 +00:00
|
|
|
texture);
|
2012-03-05 20:17:42 +00:00
|
|
|
|
|
|
|
GdipDisposeImageAttributes(attributes);
|
|
|
|
}
|
|
|
|
|
|
|
|
return stat;
|
2008-09-07 10:32:49 +00:00
|
|
|
}
|
|
|
|
|
2008-12-06 09:26:01 +00:00
|
|
|
/******************************************************************************
|
|
|
|
* GdipCreateTexture2 [GDIPLUS.@]
|
|
|
|
*/
|
2008-09-07 10:32:49 +00:00
|
|
|
GpStatus WINGDIPAPI GdipCreateTexture2(GpImage *image, GpWrapMode wrapmode,
|
|
|
|
REAL x, REAL y, REAL width, REAL height, GpTexture **texture)
|
|
|
|
{
|
2012-03-05 20:17:42 +00:00
|
|
|
GpImageAttributes *attributes;
|
|
|
|
GpStatus stat;
|
2008-09-07 10:32:49 +00:00
|
|
|
|
|
|
|
TRACE("%p %d %f %f %f %f %p\n", image, wrapmode,
|
|
|
|
x, y, width, height, texture);
|
|
|
|
|
2012-03-05 20:17:42 +00:00
|
|
|
stat = GdipCreateImageAttributes(&attributes);
|
|
|
|
|
|
|
|
if (stat == Ok)
|
|
|
|
{
|
|
|
|
attributes->wrap = wrapmode;
|
|
|
|
|
|
|
|
stat = GdipCreateTextureIA(image, attributes, x, y, width, height,
|
|
|
|
texture);
|
|
|
|
|
|
|
|
GdipDisposeImageAttributes(attributes);
|
|
|
|
}
|
|
|
|
|
|
|
|
return stat;
|
2008-09-07 10:32:49 +00:00
|
|
|
}
|
|
|
|
|
2008-12-06 09:26:01 +00:00
|
|
|
/******************************************************************************
|
|
|
|
* GdipCreateTextureIA [GDIPLUS.@]
|
|
|
|
*/
|
2008-03-25 17:34:57 +00:00
|
|
|
GpStatus WINGDIPAPI GdipCreateTextureIA(GpImage *image,
|
|
|
|
GDIPCONST GpImageAttributes *imageattr, REAL x, REAL y, REAL width,
|
|
|
|
REAL height, GpTexture **texture)
|
|
|
|
{
|
2008-12-06 09:26:01 +00:00
|
|
|
GpStatus status;
|
2010-03-04 13:34:05 +00:00
|
|
|
GpImage *new_image=NULL;
|
2008-03-25 17:34:57 +00:00
|
|
|
|
2008-09-07 10:32:49 +00:00
|
|
|
TRACE("(%p, %p, %.2f, %.2f, %.2f, %.2f, %p)\n", image, imageattr, x, y, width, height,
|
|
|
|
texture);
|
|
|
|
|
2008-03-25 17:34:57 +00:00
|
|
|
if(!image || !texture || x < 0.0 || y < 0.0 || width < 0.0 || height < 0.0)
|
|
|
|
return InvalidParameter;
|
|
|
|
|
2010-03-04 13:34:05 +00:00
|
|
|
*texture = NULL;
|
|
|
|
|
2008-03-25 17:34:57 +00:00
|
|
|
if(image->type != ImageTypeBitmap){
|
|
|
|
FIXME("not implemented for image type %d\n", image->type);
|
|
|
|
return NotImplemented;
|
|
|
|
}
|
|
|
|
|
2010-03-04 13:34:05 +00:00
|
|
|
status = GdipCloneBitmapArea(x, y, width, height, PixelFormatDontCare, (GpBitmap*)image, (GpBitmap**)&new_image);
|
|
|
|
if (status != Ok)
|
|
|
|
return status;
|
2008-03-25 17:34:57 +00:00
|
|
|
|
2015-11-22 10:10:02 +00:00
|
|
|
*texture = heap_alloc_zero(sizeof(GpTexture));
|
2008-12-06 09:26:01 +00:00
|
|
|
if (!*texture){
|
2010-03-04 13:34:05 +00:00
|
|
|
status = OutOfMemory;
|
|
|
|
goto exit;
|
2008-12-06 09:26:01 +00:00
|
|
|
}
|
|
|
|
|
2012-12-11 21:40:15 +00:00
|
|
|
GdipSetMatrixElements(&(*texture)->transform, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0);
|
2008-03-25 17:34:57 +00:00
|
|
|
|
2012-03-05 20:17:42 +00:00
|
|
|
if (imageattr)
|
|
|
|
{
|
|
|
|
status = GdipCloneImageAttributes(imageattr, &(*texture)->imageattributes);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
status = GdipCreateImageAttributes(&(*texture)->imageattributes);
|
|
|
|
if (status == Ok)
|
|
|
|
(*texture)->imageattributes->wrap = WrapModeTile;
|
|
|
|
}
|
2012-05-19 10:03:40 +00:00
|
|
|
if (status == Ok)
|
|
|
|
{
|
|
|
|
(*texture)->brush.bt = BrushTypeTextureFill;
|
|
|
|
(*texture)->image = new_image;
|
|
|
|
}
|
2008-03-25 17:34:57 +00:00
|
|
|
|
2010-03-04 13:34:05 +00:00
|
|
|
exit:
|
|
|
|
if (status == Ok)
|
|
|
|
{
|
|
|
|
TRACE("<-- %p\n", *texture);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (*texture)
|
|
|
|
{
|
2012-03-05 20:17:42 +00:00
|
|
|
GdipDisposeImageAttributes((*texture)->imageattributes);
|
2015-11-22 10:10:02 +00:00
|
|
|
heap_free(*texture);
|
2010-03-04 13:34:05 +00:00
|
|
|
*texture = NULL;
|
|
|
|
}
|
|
|
|
GdipDisposeImage(new_image);
|
|
|
|
TRACE("<-- error %u\n", status);
|
|
|
|
}
|
2008-03-25 17:34:57 +00:00
|
|
|
|
2010-03-04 13:34:05 +00:00
|
|
|
return status;
|
2008-03-25 17:34:57 +00:00
|
|
|
}
|
|
|
|
|
2008-12-06 09:26:01 +00:00
|
|
|
/******************************************************************************
|
|
|
|
* GdipCreateTextureIAI [GDIPLUS.@]
|
|
|
|
*/
|
2008-07-06 16:35:30 +00:00
|
|
|
GpStatus WINGDIPAPI GdipCreateTextureIAI(GpImage *image, GDIPCONST GpImageAttributes *imageattr,
|
|
|
|
INT x, INT y, INT width, INT height, GpTexture **texture)
|
|
|
|
{
|
2008-09-07 10:32:49 +00:00
|
|
|
TRACE("(%p, %p, %d, %d, %d, %d, %p)\n", image, imageattr, x, y, width, height,
|
|
|
|
texture);
|
|
|
|
|
2008-07-06 16:35:30 +00:00
|
|
|
return GdipCreateTextureIA(image,imageattr,(REAL)x,(REAL)y,(REAL)width,(REAL)height,texture);
|
|
|
|
}
|
|
|
|
|
2008-09-07 10:32:49 +00:00
|
|
|
GpStatus WINGDIPAPI GdipCreateTexture2I(GpImage *image, GpWrapMode wrapmode,
|
|
|
|
INT x, INT y, INT width, INT height, GpTexture **texture)
|
|
|
|
{
|
2012-03-05 20:17:42 +00:00
|
|
|
GpImageAttributes *imageattr;
|
|
|
|
GpStatus stat;
|
2008-09-07 10:32:49 +00:00
|
|
|
|
|
|
|
TRACE("%p %d %d %d %d %d %p\n", image, wrapmode, x, y, width, height,
|
|
|
|
texture);
|
|
|
|
|
2012-03-05 20:17:42 +00:00
|
|
|
stat = GdipCreateImageAttributes(&imageattr);
|
2008-09-07 10:32:49 +00:00
|
|
|
|
2012-03-05 20:17:42 +00:00
|
|
|
if (stat == Ok)
|
|
|
|
{
|
|
|
|
imageattr->wrap = wrapmode;
|
|
|
|
|
|
|
|
stat = GdipCreateTextureIA(image, imageattr, x, y, width, height, texture);
|
2014-04-22 15:42:03 +00:00
|
|
|
GdipDisposeImageAttributes(imageattr);
|
2012-03-05 20:17:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return stat;
|
2008-09-07 10:32:49 +00:00
|
|
|
}
|
|
|
|
|
2008-03-25 17:34:57 +00:00
|
|
|
GpStatus WINGDIPAPI GdipGetBrushType(GpBrush *brush, GpBrushType *type)
|
|
|
|
{
|
2008-09-07 10:32:49 +00:00
|
|
|
TRACE("(%p, %p)\n", brush, type);
|
|
|
|
|
2008-03-25 17:34:57 +00:00
|
|
|
if(!brush || !type) return InvalidParameter;
|
|
|
|
|
|
|
|
*type = brush->bt;
|
|
|
|
|
|
|
|
return Ok;
|
|
|
|
}
|
|
|
|
|
2009-01-27 18:03:33 +00: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;
|
|
|
|
}
|
|
|
|
|
2018-01-18 23:17:41 +00:00
|
|
|
GpStatus WINGDIPAPI GdipGetHatchStyle(GpHatch *brush, GpHatchStyle *hatchstyle)
|
2009-01-27 18:03:33 +00:00
|
|
|
{
|
|
|
|
TRACE("(%p, %p)\n", brush, hatchstyle);
|
|
|
|
|
|
|
|
if(!brush || !hatchstyle) return InvalidParameter;
|
|
|
|
|
|
|
|
*hatchstyle = brush->hatchstyle;
|
|
|
|
|
|
|
|
return Ok;
|
|
|
|
}
|
|
|
|
|
2008-03-25 17:34:57 +00:00
|
|
|
GpStatus WINGDIPAPI GdipDeleteBrush(GpBrush *brush)
|
|
|
|
{
|
2008-09-07 10:32:49 +00:00
|
|
|
TRACE("(%p)\n", brush);
|
|
|
|
|
2008-03-25 17:34:57 +00:00
|
|
|
if(!brush) return InvalidParameter;
|
|
|
|
|
|
|
|
switch(brush->bt)
|
|
|
|
{
|
|
|
|
case BrushTypePathGradient:
|
2012-05-19 10:03:40 +00:00
|
|
|
GdipDeletePath(((GpPathGradient*) brush)->path);
|
2015-11-22 10:10:02 +00:00
|
|
|
heap_free(((GpPathGradient*) brush)->blendfac);
|
|
|
|
heap_free(((GpPathGradient*) brush)->blendpos);
|
|
|
|
heap_free(((GpPathGradient*) brush)->surroundcolors);
|
|
|
|
heap_free(((GpPathGradient*) brush)->pblendcolor);
|
|
|
|
heap_free(((GpPathGradient*) brush)->pblendpos);
|
2009-05-09 09:26:16 +00:00
|
|
|
break;
|
2008-03-25 17:34:57 +00:00
|
|
|
case BrushTypeLinearGradient:
|
2015-11-22 10:10:02 +00:00
|
|
|
heap_free(((GpLineGradient*)brush)->blendfac);
|
|
|
|
heap_free(((GpLineGradient*)brush)->blendpos);
|
|
|
|
heap_free(((GpLineGradient*)brush)->pblendcolor);
|
|
|
|
heap_free(((GpLineGradient*)brush)->pblendpos);
|
2008-12-06 09:26:01 +00:00
|
|
|
break;
|
2008-03-25 17:34:57 +00:00
|
|
|
case BrushTypeTextureFill:
|
2010-03-04 13:34:05 +00:00
|
|
|
GdipDisposeImage(((GpTexture*)brush)->image);
|
2012-03-05 20:17:42 +00:00
|
|
|
GdipDisposeImageAttributes(((GpTexture*)brush)->imageattributes);
|
2015-11-22 10:10:02 +00:00
|
|
|
heap_free(((GpTexture*)brush)->bitmap_bits);
|
2008-12-06 09:26:01 +00:00
|
|
|
break;
|
2008-03-25 17:34:57 +00:00
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2015-11-22 10:10:02 +00:00
|
|
|
heap_free(brush);
|
2008-03-25 17:34:57 +00:00
|
|
|
|
|
|
|
return Ok;
|
|
|
|
}
|
|
|
|
|
|
|
|
GpStatus WINGDIPAPI GdipGetLineGammaCorrection(GpLineGradient *line,
|
|
|
|
BOOL *usinggamma)
|
|
|
|
{
|
2008-09-07 10:32:49 +00:00
|
|
|
TRACE("(%p, %p)\n", line, usinggamma);
|
|
|
|
|
|
|
|
if(!line || !usinggamma)
|
2008-03-25 17:34:57 +00:00
|
|
|
return InvalidParameter;
|
|
|
|
|
|
|
|
*usinggamma = line->gamma;
|
|
|
|
|
|
|
|
return Ok;
|
|
|
|
}
|
|
|
|
|
2008-08-05 12:23:58 +00:00
|
|
|
GpStatus WINGDIPAPI GdipGetLineWrapMode(GpLineGradient *brush, GpWrapMode *wrapmode)
|
|
|
|
{
|
2008-09-07 10:32:49 +00:00
|
|
|
TRACE("(%p, %p)\n", brush, wrapmode);
|
|
|
|
|
2013-05-23 17:23:00 +00:00
|
|
|
if(!brush || !wrapmode || brush->brush.bt != BrushTypeLinearGradient)
|
2008-08-05 12:23:58 +00:00
|
|
|
return InvalidParameter;
|
|
|
|
|
|
|
|
*wrapmode = brush->wrap;
|
|
|
|
|
|
|
|
return Ok;
|
|
|
|
}
|
|
|
|
|
|
|
|
GpStatus WINGDIPAPI GdipGetPathGradientBlend(GpPathGradient *brush, REAL *blend,
|
|
|
|
REAL *positions, INT count)
|
|
|
|
{
|
2008-09-07 10:32:49 +00:00
|
|
|
TRACE("(%p, %p, %p, %d)\n", brush, blend, positions, count);
|
|
|
|
|
2013-05-23 17:23:00 +00:00
|
|
|
if(!brush || !blend || !positions || count <= 0 || brush->brush.bt != BrushTypePathGradient)
|
2008-08-05 12:23:58 +00:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
|
|
|
GpStatus WINGDIPAPI GdipGetPathGradientBlendCount(GpPathGradient *brush, INT *count)
|
|
|
|
{
|
2008-09-07 10:32:49 +00:00
|
|
|
TRACE("(%p, %p)\n", brush, count);
|
|
|
|
|
2013-05-23 17:23:00 +00:00
|
|
|
if(!brush || !count || brush->brush.bt != BrushTypePathGradient)
|
2008-08-05 12:23:58 +00:00
|
|
|
return InvalidParameter;
|
|
|
|
|
|
|
|
*count = brush->blendcount;
|
|
|
|
|
|
|
|
return Ok;
|
|
|
|
}
|
|
|
|
|
2008-03-25 17:34:57 +00:00
|
|
|
GpStatus WINGDIPAPI GdipGetPathGradientCenterPoint(GpPathGradient *grad,
|
|
|
|
GpPointF *point)
|
|
|
|
{
|
2008-09-07 10:32:49 +00:00
|
|
|
TRACE("(%p, %p)\n", grad, point);
|
|
|
|
|
2013-05-23 17:23:00 +00:00
|
|
|
if(!grad || !point || grad->brush.bt != BrushTypePathGradient)
|
2008-03-25 17:34:57 +00:00
|
|
|
return InvalidParameter;
|
|
|
|
|
|
|
|
point->X = grad->center.X;
|
|
|
|
point->Y = grad->center.Y;
|
|
|
|
|
|
|
|
return Ok;
|
|
|
|
}
|
|
|
|
|
2008-05-04 19:41:25 +00:00
|
|
|
GpStatus WINGDIPAPI GdipGetPathGradientCenterPointI(GpPathGradient *grad,
|
|
|
|
GpPoint *point)
|
|
|
|
{
|
|
|
|
GpStatus ret;
|
|
|
|
GpPointF ptf;
|
|
|
|
|
2008-09-07 10:32:49 +00:00
|
|
|
TRACE("(%p, %p)\n", grad, point);
|
|
|
|
|
2008-05-04 19:41:25 +00:00
|
|
|
if(!point)
|
|
|
|
return InvalidParameter;
|
|
|
|
|
|
|
|
ret = GdipGetPathGradientCenterPoint(grad,&ptf);
|
|
|
|
|
|
|
|
if(ret == Ok){
|
2012-12-11 21:40:15 +00:00
|
|
|
point->X = gdip_round(ptf.X);
|
|
|
|
point->Y = gdip_round(ptf.Y);
|
2008-05-04 19:41:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
Sync avifil, credui, crypt32, cryptdlg, cryptui, dnsapi, gdiplus, hhctrl, hnetcfg, iccvid, imaadp32, imm32, jscript, localspl, localui, mapi32, mciavi32, mcicda, mciqtz32, mciseq, mciwave, mshtml, msrle32, msvfw32, msvidc32, msxml3, oleacc, oleaut32 to Wine 1.2rc5 (Samuel Serapion, small changes by me)
Remove Esperanto and Walon languages from comctl32, comdlg32, mpr, msi, shlwapi, wininet
svn path=/trunk/; revision=47920
2010-07-01 11:09:47 +00:00
|
|
|
GpStatus WINGDIPAPI GdipGetPathGradientCenterColor(GpPathGradient *grad,
|
|
|
|
ARGB *colors)
|
|
|
|
{
|
|
|
|
TRACE("(%p,%p)\n", grad, colors);
|
|
|
|
|
2013-05-23 17:23:00 +00:00
|
|
|
if (!grad || !colors || grad->brush.bt != BrushTypePathGradient)
|
2012-05-19 10:03:40 +00:00
|
|
|
return InvalidParameter;
|
Sync avifil, credui, crypt32, cryptdlg, cryptui, dnsapi, gdiplus, hhctrl, hnetcfg, iccvid, imaadp32, imm32, jscript, localspl, localui, mapi32, mciavi32, mcicda, mciqtz32, mciseq, mciwave, mshtml, msrle32, msvfw32, msvidc32, msxml3, oleacc, oleaut32 to Wine 1.2rc5 (Samuel Serapion, small changes by me)
Remove Esperanto and Walon languages from comctl32, comdlg32, mpr, msi, shlwapi, wininet
svn path=/trunk/; revision=47920
2010-07-01 11:09:47 +00:00
|
|
|
|
2012-05-19 10:03:40 +00:00
|
|
|
*colors = grad->centercolor;
|
|
|
|
|
|
|
|
return Ok;
|
Sync avifil, credui, crypt32, cryptdlg, cryptui, dnsapi, gdiplus, hhctrl, hnetcfg, iccvid, imaadp32, imm32, jscript, localspl, localui, mapi32, mciavi32, mcicda, mciqtz32, mciseq, mciwave, mshtml, msrle32, msvfw32, msvidc32, msxml3, oleacc, oleaut32 to Wine 1.2rc5 (Samuel Serapion, small changes by me)
Remove Esperanto and Walon languages from comctl32, comdlg32, mpr, msi, shlwapi, wininet
svn path=/trunk/; revision=47920
2010-07-01 11:09:47 +00:00
|
|
|
}
|
|
|
|
|
2008-03-25 17:34:57 +00:00
|
|
|
GpStatus WINGDIPAPI GdipGetPathGradientFocusScales(GpPathGradient *grad,
|
|
|
|
REAL *x, REAL *y)
|
|
|
|
{
|
2008-09-07 10:32:49 +00:00
|
|
|
TRACE("(%p, %p, %p)\n", grad, x, y);
|
|
|
|
|
2013-05-23 17:23:00 +00:00
|
|
|
if(!grad || !x || !y || grad->brush.bt != BrushTypePathGradient)
|
2008-03-25 17:34:57 +00:00
|
|
|
return InvalidParameter;
|
|
|
|
|
|
|
|
*x = grad->focus.X;
|
|
|
|
*y = grad->focus.Y;
|
|
|
|
|
|
|
|
return Ok;
|
|
|
|
}
|
|
|
|
|
|
|
|
GpStatus WINGDIPAPI GdipGetPathGradientGammaCorrection(GpPathGradient *grad,
|
|
|
|
BOOL *gamma)
|
|
|
|
{
|
2008-09-07 10:32:49 +00:00
|
|
|
TRACE("(%p, %p)\n", grad, gamma);
|
|
|
|
|
2013-05-23 17:23:00 +00:00
|
|
|
if(!grad || !gamma || grad->brush.bt != BrushTypePathGradient)
|
2008-03-25 17:34:57 +00:00
|
|
|
return InvalidParameter;
|
|
|
|
|
|
|
|
*gamma = grad->gamma;
|
|
|
|
|
|
|
|
return Ok;
|
|
|
|
}
|
|
|
|
|
2012-05-19 10:03:40 +00:00
|
|
|
GpStatus WINGDIPAPI GdipGetPathGradientPath(GpPathGradient *grad, GpPath *path)
|
|
|
|
{
|
|
|
|
static int calls;
|
|
|
|
|
|
|
|
TRACE("(%p, %p)\n", grad, path);
|
|
|
|
|
|
|
|
if (!(calls++))
|
|
|
|
FIXME("not implemented\n");
|
|
|
|
|
|
|
|
return NotImplemented;
|
|
|
|
}
|
|
|
|
|
2008-03-25 17:34:57 +00:00
|
|
|
GpStatus WINGDIPAPI GdipGetPathGradientPointCount(GpPathGradient *grad,
|
|
|
|
INT *count)
|
|
|
|
{
|
2008-09-07 10:32:49 +00:00
|
|
|
TRACE("(%p, %p)\n", grad, count);
|
|
|
|
|
2013-05-23 17:23:00 +00:00
|
|
|
if(!grad || !count || grad->brush.bt != BrushTypePathGradient)
|
2008-03-25 17:34:57 +00:00
|
|
|
return InvalidParameter;
|
|
|
|
|
2012-05-19 10:03:40 +00:00
|
|
|
*count = grad->path->pathdata.Count;
|
2008-03-25 17:34:57 +00:00
|
|
|
|
|
|
|
return Ok;
|
|
|
|
}
|
|
|
|
|
2008-08-05 12:23:58 +00:00
|
|
|
GpStatus WINGDIPAPI GdipGetPathGradientRect(GpPathGradient *brush, GpRectF *rect)
|
|
|
|
{
|
|
|
|
GpStatus stat;
|
|
|
|
|
2008-09-07 10:32:49 +00:00
|
|
|
TRACE("(%p, %p)\n", brush, rect);
|
|
|
|
|
2013-05-23 17:23:00 +00:00
|
|
|
if(!brush || !rect || brush->brush.bt != BrushTypePathGradient)
|
2008-08-05 12:23:58 +00:00
|
|
|
return InvalidParameter;
|
|
|
|
|
2012-05-19 10:03:40 +00:00
|
|
|
stat = GdipGetPathWorldBounds(brush->path, rect, NULL, NULL);
|
2008-08-05 12:23:58 +00:00
|
|
|
|
2012-05-19 10:03:40 +00:00
|
|
|
return stat;
|
2008-08-05 12:23:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
GpStatus WINGDIPAPI GdipGetPathGradientRectI(GpPathGradient *brush, GpRect *rect)
|
|
|
|
{
|
|
|
|
GpRectF rectf;
|
|
|
|
GpStatus stat;
|
|
|
|
|
2008-09-07 10:32:49 +00:00
|
|
|
TRACE("(%p, %p)\n", brush, rect);
|
|
|
|
|
2008-08-05 12:23:58 +00:00
|
|
|
if(!brush || !rect)
|
|
|
|
return InvalidParameter;
|
|
|
|
|
|
|
|
stat = GdipGetPathGradientRect(brush, &rectf);
|
|
|
|
if(stat != Ok) return stat;
|
|
|
|
|
2012-12-11 21:40:15 +00:00
|
|
|
rect->X = gdip_round(rectf.X);
|
|
|
|
rect->Y = gdip_round(rectf.Y);
|
|
|
|
rect->Width = gdip_round(rectf.Width);
|
|
|
|
rect->Height = gdip_round(rectf.Height);
|
2008-08-05 12:23:58 +00:00
|
|
|
|
|
|
|
return Ok;
|
|
|
|
}
|
|
|
|
|
2008-03-25 17:34:57 +00:00
|
|
|
GpStatus WINGDIPAPI GdipGetPathGradientSurroundColorsWithCount(GpPathGradient
|
|
|
|
*grad, ARGB *argb, INT *count)
|
|
|
|
{
|
2012-05-19 10:03:40 +00:00
|
|
|
INT i;
|
2008-03-25 17:34:57 +00:00
|
|
|
|
2010-03-04 13:34:05 +00:00
|
|
|
TRACE("(%p,%p,%p)\n", grad, argb, count);
|
|
|
|
|
2013-05-23 17:23:00 +00:00
|
|
|
if(!grad || !argb || !count || (*count < grad->path->pathdata.Count) || grad->brush.bt != BrushTypePathGradient)
|
2008-03-25 17:34:57 +00:00
|
|
|
return InvalidParameter;
|
|
|
|
|
2012-05-19 10:03:40 +00:00
|
|
|
for (i=0; i<grad->path->pathdata.Count; i++)
|
|
|
|
{
|
|
|
|
if (i < grad->surroundcolorcount)
|
|
|
|
argb[i] = grad->surroundcolors[i];
|
|
|
|
else
|
|
|
|
argb[i] = grad->surroundcolors[grad->surroundcolorcount-1];
|
|
|
|
}
|
2008-03-25 17:34:57 +00:00
|
|
|
|
2012-05-19 10:03:40 +00:00
|
|
|
*count = grad->surroundcolorcount;
|
|
|
|
|
|
|
|
return Ok;
|
2008-03-25 17:34:57 +00:00
|
|
|
}
|
|
|
|
|
2010-04-20 08:30:10 +00:00
|
|
|
GpStatus WINGDIPAPI GdipGetPathGradientSurroundColorCount(GpPathGradient *brush, INT *count)
|
|
|
|
{
|
|
|
|
TRACE("(%p, %p)\n", brush, count);
|
|
|
|
|
2013-05-23 17:23:00 +00:00
|
|
|
if (!brush || !count || brush->brush.bt != BrushTypePathGradient)
|
2010-04-20 08:30:10 +00:00
|
|
|
return InvalidParameter;
|
|
|
|
|
2012-05-19 10:03:40 +00:00
|
|
|
/* Yes, this actually returns the number of points in the path (which is the
|
|
|
|
* required size of a buffer to get the surround colors), rather than the
|
|
|
|
* number of surround colors. The real count is returned when getting the
|
|
|
|
* colors. */
|
|
|
|
*count = brush->path->pathdata.Count;
|
2012-03-05 20:17:42 +00:00
|
|
|
|
2012-05-19 10:03:40 +00:00
|
|
|
return Ok;
|
2010-04-20 08:30:10 +00:00
|
|
|
}
|
|
|
|
|
2008-07-02 08:19:00 +00:00
|
|
|
GpStatus WINGDIPAPI GdipGetPathGradientWrapMode(GpPathGradient *brush,
|
|
|
|
GpWrapMode *wrapmode)
|
|
|
|
{
|
2008-09-07 10:32:49 +00:00
|
|
|
TRACE("(%p, %p)\n", brush, wrapmode);
|
|
|
|
|
2013-05-23 17:23:00 +00:00
|
|
|
if(!brush || !wrapmode || brush->brush.bt != BrushTypePathGradient)
|
2008-07-02 08:19:00 +00:00
|
|
|
return InvalidParameter;
|
|
|
|
|
|
|
|
*wrapmode = brush->wrap;
|
|
|
|
|
|
|
|
return Ok;
|
|
|
|
}
|
|
|
|
|
2008-03-25 17:34:57 +00:00
|
|
|
GpStatus WINGDIPAPI GdipGetSolidFillColor(GpSolidFill *sf, ARGB *argb)
|
|
|
|
{
|
2008-09-07 10:32:49 +00:00
|
|
|
TRACE("(%p, %p)\n", sf, argb);
|
|
|
|
|
2008-03-25 17:34:57 +00:00
|
|
|
if(!sf || !argb)
|
|
|
|
return InvalidParameter;
|
|
|
|
|
|
|
|
*argb = sf->color;
|
|
|
|
|
|
|
|
return Ok;
|
|
|
|
}
|
|
|
|
|
2010-03-04 13:34:05 +00: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-12-06 09:26:01 +00:00
|
|
|
/******************************************************************************
|
|
|
|
* GdipGetTextureTransform [GDIPLUS.@]
|
|
|
|
*/
|
|
|
|
GpStatus WINGDIPAPI GdipGetTextureTransform(GpTexture *brush, GpMatrix *matrix)
|
|
|
|
{
|
|
|
|
TRACE("(%p, %p)\n", brush, matrix);
|
|
|
|
|
|
|
|
if(!brush || !matrix)
|
|
|
|
return InvalidParameter;
|
|
|
|
|
2012-12-11 21:40:15 +00:00
|
|
|
*matrix = brush->transform;
|
2008-12-06 09:26:01 +00:00
|
|
|
|
|
|
|
return Ok;
|
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* GdipGetTextureWrapMode [GDIPLUS.@]
|
|
|
|
*/
|
|
|
|
GpStatus WINGDIPAPI GdipGetTextureWrapMode(GpTexture *brush, GpWrapMode *wrapmode)
|
|
|
|
{
|
|
|
|
TRACE("(%p, %p)\n", brush, wrapmode);
|
|
|
|
|
|
|
|
if(!brush || !wrapmode)
|
|
|
|
return InvalidParameter;
|
|
|
|
|
2012-03-05 20:17:42 +00:00
|
|
|
*wrapmode = brush->imageattributes->wrap;
|
2008-12-06 09:26:01 +00:00
|
|
|
|
|
|
|
return Ok;
|
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* 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;
|
|
|
|
|
2012-12-11 21:40:15 +00:00
|
|
|
return GdipMultiplyMatrix(&brush->transform, matrix, order);
|
2008-12-06 09:26:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* GdipResetTextureTransform [GDIPLUS.@]
|
|
|
|
*/
|
|
|
|
GpStatus WINGDIPAPI GdipResetTextureTransform(GpTexture* brush)
|
|
|
|
{
|
|
|
|
TRACE("(%p)\n", brush);
|
|
|
|
|
|
|
|
if(!brush)
|
|
|
|
return InvalidParameter;
|
|
|
|
|
2012-12-11 21:40:15 +00:00
|
|
|
return GdipSetMatrixElements(&brush->transform, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0);
|
2008-12-06 09:26:01 +00: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;
|
|
|
|
|
2012-12-11 21:40:15 +00:00
|
|
|
return GdipScaleMatrix(&brush->transform, sx, sy, order);
|
2008-12-06 09:26:01 +00:00
|
|
|
}
|
|
|
|
|
2008-03-25 17:34:57 +00:00
|
|
|
GpStatus WINGDIPAPI GdipSetLineBlend(GpLineGradient *brush,
|
2009-05-09 09:26:16 +00:00
|
|
|
GDIPCONST REAL *factors, GDIPCONST REAL* positions, INT count)
|
2008-03-25 17:34:57 +00:00
|
|
|
{
|
2009-05-09 09:26:16 +00:00
|
|
|
REAL *new_blendfac, *new_blendpos;
|
2008-03-25 17:34:57 +00:00
|
|
|
|
2009-05-09 09:26:16 +00:00
|
|
|
TRACE("(%p, %p, %p, %i)\n", brush, factors, positions, count);
|
|
|
|
|
2013-05-23 17:23:00 +00:00
|
|
|
if(!brush || !factors || !positions || count <= 0 || brush->brush.bt != BrushTypeLinearGradient ||
|
2009-05-09 09:26:16 +00:00
|
|
|
(count >= 2 && (positions[0] != 0.0f || positions[count-1] != 1.0f)))
|
2008-03-25 17:34:57 +00:00
|
|
|
return InvalidParameter;
|
|
|
|
|
2015-11-22 10:10:02 +00:00
|
|
|
new_blendfac = heap_alloc_zero(count * sizeof(REAL));
|
|
|
|
new_blendpos = heap_alloc_zero(count * sizeof(REAL));
|
2009-05-09 09:26:16 +00:00
|
|
|
|
|
|
|
if (!new_blendfac || !new_blendpos)
|
|
|
|
{
|
2015-11-22 10:10:02 +00:00
|
|
|
heap_free(new_blendfac);
|
|
|
|
heap_free(new_blendpos);
|
2009-05-09 09:26:16 +00:00
|
|
|
return OutOfMemory;
|
|
|
|
}
|
|
|
|
|
|
|
|
memcpy(new_blendfac, factors, count * sizeof(REAL));
|
|
|
|
memcpy(new_blendpos, positions, count * sizeof(REAL));
|
|
|
|
|
2015-11-22 10:10:02 +00:00
|
|
|
heap_free(brush->blendfac);
|
|
|
|
heap_free(brush->blendpos);
|
2009-05-09 09:26:16 +00:00
|
|
|
|
|
|
|
brush->blendcount = count;
|
|
|
|
brush->blendfac = new_blendfac;
|
|
|
|
brush->blendpos = new_blendpos;
|
|
|
|
|
|
|
|
return Ok;
|
|
|
|
}
|
|
|
|
|
|
|
|
GpStatus WINGDIPAPI GdipGetLineBlend(GpLineGradient *brush, REAL *factors,
|
|
|
|
REAL *positions, INT count)
|
|
|
|
{
|
|
|
|
TRACE("(%p, %p, %p, %i)\n", brush, factors, positions, count);
|
|
|
|
|
2013-05-23 17:23:00 +00:00
|
|
|
if (!brush || !factors || !positions || count <= 0 || brush->brush.bt != BrushTypeLinearGradient)
|
2009-05-09 09:26:16 +00:00
|
|
|
return InvalidParameter;
|
|
|
|
|
|
|
|
if (count < brush->blendcount)
|
|
|
|
return InsufficientBuffer;
|
|
|
|
|
|
|
|
memcpy(factors, brush->blendfac, brush->blendcount * sizeof(REAL));
|
|
|
|
memcpy(positions, brush->blendpos, brush->blendcount * sizeof(REAL));
|
|
|
|
|
|
|
|
return Ok;
|
|
|
|
}
|
|
|
|
|
|
|
|
GpStatus WINGDIPAPI GdipGetLineBlendCount(GpLineGradient *brush, INT *count)
|
|
|
|
{
|
|
|
|
TRACE("(%p, %p)\n", brush, count);
|
|
|
|
|
2013-05-23 17:23:00 +00:00
|
|
|
if (!brush || !count || brush->brush.bt != BrushTypeLinearGradient)
|
2009-05-09 09:26:16 +00:00
|
|
|
return InvalidParameter;
|
|
|
|
|
|
|
|
*count = brush->blendcount;
|
2008-03-25 17:34:57 +00:00
|
|
|
|
|
|
|
return Ok;
|
|
|
|
}
|
|
|
|
|
|
|
|
GpStatus WINGDIPAPI GdipSetLineGammaCorrection(GpLineGradient *line,
|
|
|
|
BOOL usegamma)
|
|
|
|
{
|
2008-09-07 10:32:49 +00:00
|
|
|
TRACE("(%p, %d)\n", line, usegamma);
|
|
|
|
|
2013-05-23 17:23:00 +00:00
|
|
|
if(!line || line->brush.bt != BrushTypeLinearGradient)
|
2008-03-25 17:34:57 +00:00
|
|
|
return InvalidParameter;
|
|
|
|
|
|
|
|
line->gamma = usegamma;
|
|
|
|
|
|
|
|
return Ok;
|
|
|
|
}
|
|
|
|
|
|
|
|
GpStatus WINGDIPAPI GdipSetLineSigmaBlend(GpLineGradient *line, REAL focus,
|
|
|
|
REAL scale)
|
|
|
|
{
|
2009-05-09 09:26:16 +00: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);
|
2008-03-25 17:34:57 +00:00
|
|
|
|
2013-05-23 17:23:00 +00:00
|
|
|
if(!line || focus < 0.0 || focus > 1.0 || scale < 0.0 || scale > 1.0 || line->brush.bt != BrushTypeLinearGradient)
|
2008-03-25 17:34:57 +00:00
|
|
|
return InvalidParameter;
|
|
|
|
|
2009-05-09 09:26:16 +00:00
|
|
|
/* we want 2 standard deviations */
|
|
|
|
erf_range = 2.0 / sqrt(2);
|
2008-03-25 17:34:57 +00:00
|
|
|
|
2009-05-09 09:26:16 +00: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);
|
2008-03-25 17:34:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
GpStatus WINGDIPAPI GdipSetLineWrapMode(GpLineGradient *line,
|
|
|
|
GpWrapMode wrap)
|
|
|
|
{
|
2008-09-07 10:32:49 +00:00
|
|
|
TRACE("(%p, %d)\n", line, wrap);
|
|
|
|
|
2013-05-23 17:23:00 +00:00
|
|
|
if(!line || wrap == WrapModeClamp || line->brush.bt != BrushTypeLinearGradient)
|
2008-03-25 17:34:57 +00:00
|
|
|
return InvalidParameter;
|
|
|
|
|
|
|
|
line->wrap = wrap;
|
|
|
|
|
|
|
|
return Ok;
|
|
|
|
}
|
|
|
|
|
2008-12-06 09:26:01 +00:00
|
|
|
GpStatus WINGDIPAPI GdipSetPathGradientBlend(GpPathGradient *brush, GDIPCONST REAL *blend,
|
|
|
|
GDIPCONST REAL *pos, INT count)
|
|
|
|
{
|
2012-05-19 10:03:40 +00:00
|
|
|
REAL *new_blendfac, *new_blendpos;
|
2008-12-06 09:26:01 +00:00
|
|
|
|
2010-03-04 13:34:05 +00:00
|
|
|
TRACE("(%p,%p,%p,%i)\n", brush, blend, pos, count);
|
|
|
|
|
2013-05-23 17:23:00 +00:00
|
|
|
if(!brush || !blend || !pos || count <= 0 || brush->brush.bt != BrushTypePathGradient ||
|
2012-05-19 10:03:40 +00:00
|
|
|
(count >= 2 && (pos[0] != 0.0f || pos[count-1] != 1.0f)))
|
|
|
|
return InvalidParameter;
|
2008-12-06 09:26:01 +00:00
|
|
|
|
2015-11-22 10:10:02 +00:00
|
|
|
new_blendfac = heap_alloc_zero(count * sizeof(REAL));
|
|
|
|
new_blendpos = heap_alloc_zero(count * sizeof(REAL));
|
2012-05-19 10:03:40 +00:00
|
|
|
|
|
|
|
if (!new_blendfac || !new_blendpos)
|
|
|
|
{
|
2015-11-22 10:10:02 +00:00
|
|
|
heap_free(new_blendfac);
|
|
|
|
heap_free(new_blendpos);
|
2012-05-19 10:03:40 +00:00
|
|
|
return OutOfMemory;
|
|
|
|
}
|
|
|
|
|
|
|
|
memcpy(new_blendfac, blend, count * sizeof(REAL));
|
|
|
|
memcpy(new_blendpos, pos, count * sizeof(REAL));
|
|
|
|
|
2015-11-22 10:10:02 +00:00
|
|
|
heap_free(brush->blendfac);
|
|
|
|
heap_free(brush->blendpos);
|
2012-05-19 10:03:40 +00:00
|
|
|
|
|
|
|
brush->blendcount = count;
|
|
|
|
brush->blendfac = new_blendfac;
|
|
|
|
brush->blendpos = new_blendpos;
|
|
|
|
|
|
|
|
return Ok;
|
2008-12-06 09:26:01 +00:00
|
|
|
}
|
|
|
|
|
2010-11-20 11:24:17 +00:00
|
|
|
GpStatus WINGDIPAPI GdipSetPathGradientLinearBlend(GpPathGradient *brush,
|
|
|
|
REAL focus, REAL scale)
|
|
|
|
{
|
2012-05-19 10:03:40 +00:00
|
|
|
REAL factors[3];
|
|
|
|
REAL positions[3];
|
|
|
|
int num_points = 0;
|
2010-11-20 11:24:17 +00:00
|
|
|
|
|
|
|
TRACE("(%p,%0.2f,%0.2f)\n", brush, focus, scale);
|
|
|
|
|
2013-05-23 17:23:00 +00:00
|
|
|
if (!brush || brush->brush.bt != BrushTypePathGradient)
|
|
|
|
return InvalidParameter;
|
2010-11-20 11:24:17 +00:00
|
|
|
|
2012-05-19 10:03:40 +00:00
|
|
|
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 GdipSetPathGradientBlend(brush, factors, positions, num_points);
|
2010-11-20 11:24:17 +00:00
|
|
|
}
|
|
|
|
|
2009-09-03 15:07:25 +00:00
|
|
|
GpStatus WINGDIPAPI GdipSetPathGradientPresetBlend(GpPathGradient *brush,
|
|
|
|
GDIPCONST ARGB *blend, GDIPCONST REAL *pos, INT count)
|
|
|
|
{
|
2012-05-19 10:03:40 +00:00
|
|
|
ARGB *new_color;
|
|
|
|
REAL *new_pos;
|
|
|
|
TRACE("(%p,%p,%p,%i)\n", brush, blend, pos, count);
|
|
|
|
|
2013-05-23 17:23:00 +00:00
|
|
|
if (!brush || !blend || !pos || count < 2 || brush->brush.bt != BrushTypePathGradient ||
|
2012-05-19 10:03:40 +00:00
|
|
|
pos[0] != 0.0f || pos[count-1] != 1.0f)
|
|
|
|
{
|
|
|
|
return InvalidParameter;
|
|
|
|
}
|
|
|
|
|
2015-11-22 10:10:02 +00:00
|
|
|
new_color = heap_alloc_zero(count * sizeof(ARGB));
|
|
|
|
new_pos = heap_alloc_zero(count * sizeof(REAL));
|
2012-05-19 10:03:40 +00:00
|
|
|
if (!new_color || !new_pos)
|
|
|
|
{
|
2015-11-22 10:10:02 +00:00
|
|
|
heap_free(new_color);
|
|
|
|
heap_free(new_pos);
|
2012-05-19 10:03:40 +00:00
|
|
|
return OutOfMemory;
|
|
|
|
}
|
|
|
|
|
|
|
|
memcpy(new_color, blend, sizeof(ARGB) * count);
|
|
|
|
memcpy(new_pos, pos, sizeof(REAL) * count);
|
|
|
|
|
2015-11-22 10:10:02 +00:00
|
|
|
heap_free(brush->pblendcolor);
|
|
|
|
heap_free(brush->pblendpos);
|
2012-05-19 10:03:40 +00:00
|
|
|
|
|
|
|
brush->pblendcolor = new_color;
|
|
|
|
brush->pblendpos = new_pos;
|
|
|
|
brush->pblendcount = count;
|
|
|
|
|
|
|
|
return Ok;
|
2009-09-03 15:07:25 +00:00
|
|
|
}
|
|
|
|
|
2010-11-20 11:24:17 +00:00
|
|
|
GpStatus WINGDIPAPI GdipGetPathGradientPresetBlend(GpPathGradient *brush,
|
|
|
|
ARGB *blend, REAL *pos, INT count)
|
|
|
|
{
|
2012-05-19 10:03:40 +00:00
|
|
|
TRACE("(%p,%p,%p,%i)\n", brush, blend, pos, count);
|
|
|
|
|
|
|
|
if (count < 0)
|
|
|
|
return OutOfMemory;
|
|
|
|
|
2013-05-23 17:23:00 +00:00
|
|
|
if (!brush || !blend || !pos || count < 2 || brush->brush.bt != BrushTypePathGradient)
|
2012-05-19 10:03:40 +00:00
|
|
|
return InvalidParameter;
|
|
|
|
|
|
|
|
if (brush->pblendcount == 0)
|
|
|
|
return GenericError;
|
|
|
|
|
|
|
|
if (count != brush->pblendcount)
|
|
|
|
{
|
|
|
|
/* Native lines up the ends of each array, and copies the destination size. */
|
|
|
|
FIXME("Braindead behavior on wrong-sized buffer not implemented.\n");
|
|
|
|
return InvalidParameter;
|
|
|
|
}
|
|
|
|
|
|
|
|
memcpy(blend, brush->pblendcolor, sizeof(ARGB) * brush->pblendcount);
|
|
|
|
memcpy(pos, brush->pblendpos, sizeof(REAL) * brush->pblendcount);
|
|
|
|
|
|
|
|
return Ok;
|
2010-11-20 11:24:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
GpStatus WINGDIPAPI GdipGetPathGradientPresetBlendCount(GpPathGradient *brush,
|
|
|
|
INT *count)
|
|
|
|
{
|
2012-05-19 10:03:40 +00:00
|
|
|
TRACE("(%p,%p)\n", brush, count);
|
|
|
|
|
2013-05-23 17:23:00 +00:00
|
|
|
if (!brush || !count || brush->brush.bt != BrushTypePathGradient)
|
2012-05-19 10:03:40 +00:00
|
|
|
return InvalidParameter;
|
|
|
|
|
|
|
|
*count = brush->pblendcount;
|
|
|
|
|
|
|
|
return Ok;
|
2010-11-20 11:24:17 +00:00
|
|
|
}
|
|
|
|
|
2008-03-25 17:34:57 +00:00
|
|
|
GpStatus WINGDIPAPI GdipSetPathGradientCenterColor(GpPathGradient *grad,
|
|
|
|
ARGB argb)
|
|
|
|
{
|
2008-09-07 10:32:49 +00:00
|
|
|
TRACE("(%p, %x)\n", grad, argb);
|
|
|
|
|
2013-05-23 17:23:00 +00:00
|
|
|
if(!grad || grad->brush.bt != BrushTypePathGradient)
|
2008-03-25 17:34:57 +00:00
|
|
|
return InvalidParameter;
|
|
|
|
|
|
|
|
grad->centercolor = argb;
|
|
|
|
return Ok;
|
|
|
|
}
|
|
|
|
|
|
|
|
GpStatus WINGDIPAPI GdipSetPathGradientCenterPoint(GpPathGradient *grad,
|
|
|
|
GpPointF *point)
|
|
|
|
{
|
2010-03-04 13:34:05 +00:00
|
|
|
TRACE("(%p, %s)\n", grad, debugstr_pointf(point));
|
2008-09-07 10:32:49 +00:00
|
|
|
|
2013-05-23 17:23:00 +00:00
|
|
|
if(!grad || !point || grad->brush.bt != BrushTypePathGradient)
|
2008-03-25 17:34:57 +00:00
|
|
|
return InvalidParameter;
|
|
|
|
|
|
|
|
grad->center.X = point->X;
|
|
|
|
grad->center.Y = point->Y;
|
|
|
|
|
|
|
|
return Ok;
|
|
|
|
}
|
|
|
|
|
2008-05-04 19:41:25 +00:00
|
|
|
GpStatus WINGDIPAPI GdipSetPathGradientCenterPointI(GpPathGradient *grad,
|
|
|
|
GpPoint *point)
|
|
|
|
{
|
|
|
|
GpPointF ptf;
|
|
|
|
|
2008-09-07 10:32:49 +00:00
|
|
|
TRACE("(%p, %p)\n", grad, point);
|
|
|
|
|
2008-05-04 19:41:25 +00:00
|
|
|
if(!point)
|
|
|
|
return InvalidParameter;
|
|
|
|
|
|
|
|
ptf.X = (REAL)point->X;
|
|
|
|
ptf.Y = (REAL)point->Y;
|
|
|
|
|
|
|
|
return GdipSetPathGradientCenterPoint(grad,&ptf);
|
|
|
|
}
|
|
|
|
|
2008-03-25 17:34:57 +00:00
|
|
|
GpStatus WINGDIPAPI GdipSetPathGradientFocusScales(GpPathGradient *grad,
|
|
|
|
REAL x, REAL y)
|
|
|
|
{
|
2008-09-07 10:32:49 +00:00
|
|
|
TRACE("(%p, %.2f, %.2f)\n", grad, x, y);
|
|
|
|
|
2013-05-23 17:23:00 +00:00
|
|
|
if(!grad || grad->brush.bt != BrushTypePathGradient)
|
2008-03-25 17:34:57 +00:00
|
|
|
return InvalidParameter;
|
|
|
|
|
|
|
|
grad->focus.X = x;
|
|
|
|
grad->focus.Y = y;
|
|
|
|
|
|
|
|
return Ok;
|
|
|
|
}
|
|
|
|
|
|
|
|
GpStatus WINGDIPAPI GdipSetPathGradientGammaCorrection(GpPathGradient *grad,
|
|
|
|
BOOL gamma)
|
|
|
|
{
|
2008-09-07 10:32:49 +00:00
|
|
|
TRACE("(%p, %d)\n", grad, gamma);
|
|
|
|
|
2013-05-23 17:23:00 +00:00
|
|
|
if(!grad || grad->brush.bt != BrushTypePathGradient)
|
2008-03-25 17:34:57 +00:00
|
|
|
return InvalidParameter;
|
|
|
|
|
|
|
|
grad->gamma = gamma;
|
|
|
|
|
|
|
|
return Ok;
|
|
|
|
}
|
|
|
|
|
2018-05-27 03:10:39 +00:00
|
|
|
GpStatus WINGDIPAPI GdipSetPathGradientPath(GpPathGradient *grad, GDIPCONST GpPath *path)
|
|
|
|
{
|
|
|
|
static int calls;
|
|
|
|
|
|
|
|
TRACE("(%p, %p)\n", grad, path);
|
|
|
|
|
|
|
|
if (!(calls++))
|
|
|
|
FIXME("not implemented\n");
|
|
|
|
|
|
|
|
return NotImplemented;
|
|
|
|
}
|
|
|
|
|
2008-03-25 17:34:57 +00:00
|
|
|
GpStatus WINGDIPAPI GdipSetPathGradientSigmaBlend(GpPathGradient *grad,
|
|
|
|
REAL focus, REAL scale)
|
|
|
|
{
|
2012-05-19 10:03:40 +00: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;
|
2008-03-25 17:34:57 +00:00
|
|
|
|
2010-03-04 13:34:05 +00:00
|
|
|
TRACE("(%p,%0.2f,%0.2f)\n", grad, focus, scale);
|
|
|
|
|
2013-05-23 17:23:00 +00:00
|
|
|
if(!grad || focus < 0.0 || focus > 1.0 || scale < 0.0 || scale > 1.0 || grad->brush.bt != BrushTypePathGradient)
|
2008-03-25 17:34:57 +00:00
|
|
|
return InvalidParameter;
|
|
|
|
|
2012-05-19 10:03:40 +00:00
|
|
|
/* we want 2 standard deviations */
|
|
|
|
erf_range = 2.0 / sqrt(2);
|
2008-03-25 17:34:57 +00:00
|
|
|
|
2012-05-19 10:03:40 +00: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 GdipSetPathGradientBlend(grad, factors, positions, num_points);
|
2008-03-25 17:34:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
GpStatus WINGDIPAPI GdipSetPathGradientSurroundColorsWithCount(GpPathGradient
|
2010-04-20 08:30:10 +00:00
|
|
|
*grad, GDIPCONST ARGB *argb, INT *count)
|
2008-03-25 17:34:57 +00:00
|
|
|
{
|
2012-05-19 10:03:40 +00:00
|
|
|
ARGB *new_surroundcolors;
|
|
|
|
INT i, num_colors;
|
2008-03-25 17:34:57 +00:00
|
|
|
|
2010-03-04 13:34:05 +00:00
|
|
|
TRACE("(%p,%p,%p)\n", grad, argb, count);
|
|
|
|
|
2013-05-23 17:23:00 +00:00
|
|
|
if(!grad || !argb || !count || (*count <= 0) || grad->brush.bt != BrushTypePathGradient ||
|
2012-05-19 10:03:40 +00:00
|
|
|
(*count > grad->path->pathdata.Count))
|
2008-03-25 17:34:57 +00:00
|
|
|
return InvalidParameter;
|
|
|
|
|
2012-05-19 10:03:40 +00:00
|
|
|
num_colors = *count;
|
2008-03-25 17:34:57 +00:00
|
|
|
|
2012-05-19 10:03:40 +00:00
|
|
|
/* If all colors are the same, only store 1 color. */
|
|
|
|
if (*count > 1)
|
|
|
|
{
|
|
|
|
for (i=1; i < num_colors; i++)
|
|
|
|
if (argb[i] != argb[i-1])
|
|
|
|
break;
|
|
|
|
|
|
|
|
if (i == num_colors)
|
|
|
|
num_colors = 1;
|
|
|
|
}
|
|
|
|
|
2015-11-22 10:10:02 +00:00
|
|
|
new_surroundcolors = heap_alloc_zero(num_colors * sizeof(ARGB));
|
2012-05-19 10:03:40 +00:00
|
|
|
if (!new_surroundcolors)
|
|
|
|
return OutOfMemory;
|
|
|
|
|
|
|
|
memcpy(new_surroundcolors, argb, num_colors * sizeof(ARGB));
|
|
|
|
|
2015-11-22 10:10:02 +00:00
|
|
|
heap_free(grad->surroundcolors);
|
2012-05-19 10:03:40 +00:00
|
|
|
|
|
|
|
grad->surroundcolors = new_surroundcolors;
|
|
|
|
grad->surroundcolorcount = num_colors;
|
|
|
|
|
|
|
|
return Ok;
|
2008-03-25 17:34:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
GpStatus WINGDIPAPI GdipSetPathGradientWrapMode(GpPathGradient *grad,
|
|
|
|
GpWrapMode wrap)
|
|
|
|
{
|
2008-09-07 10:32:49 +00:00
|
|
|
TRACE("(%p, %d)\n", grad, wrap);
|
|
|
|
|
2013-05-23 17:23:00 +00:00
|
|
|
if(!grad || grad->brush.bt != BrushTypePathGradient)
|
2008-03-25 17:34:57 +00:00
|
|
|
return InvalidParameter;
|
|
|
|
|
|
|
|
grad->wrap = wrap;
|
|
|
|
|
|
|
|
return Ok;
|
|
|
|
}
|
|
|
|
|
2010-11-20 11:24:17 +00:00
|
|
|
GpStatus WINGDIPAPI GdipSetPathGradientTransform(GpPathGradient *grad,
|
|
|
|
GpMatrix *matrix)
|
|
|
|
{
|
|
|
|
TRACE("(%p,%p)\n", grad, matrix);
|
|
|
|
|
2013-05-23 17:23:00 +00:00
|
|
|
if (!grad || !matrix || grad->brush.bt != BrushTypePathGradient)
|
2012-05-19 10:03:40 +00:00
|
|
|
return InvalidParameter;
|
2010-11-20 11:24:17 +00:00
|
|
|
|
2012-12-11 21:40:15 +00:00
|
|
|
grad->transform = *matrix;
|
2012-05-19 10:03:40 +00:00
|
|
|
|
|
|
|
return Ok;
|
2010-11-20 11:24:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
GpStatus WINGDIPAPI GdipGetPathGradientTransform(GpPathGradient *grad,
|
|
|
|
GpMatrix *matrix)
|
|
|
|
{
|
|
|
|
TRACE("(%p,%p)\n", grad, matrix);
|
|
|
|
|
2013-05-23 17:23:00 +00:00
|
|
|
if (!grad || !matrix || grad->brush.bt != BrushTypePathGradient)
|
2012-05-19 10:03:40 +00:00
|
|
|
return InvalidParameter;
|
2010-11-20 11:24:17 +00:00
|
|
|
|
2012-12-11 21:40:15 +00:00
|
|
|
*matrix = grad->transform;
|
2012-05-19 10:03:40 +00:00
|
|
|
|
|
|
|
return Ok;
|
2010-11-20 11:24:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
GpStatus WINGDIPAPI GdipMultiplyPathGradientTransform(GpPathGradient *grad,
|
|
|
|
GDIPCONST GpMatrix *matrix, GpMatrixOrder order)
|
|
|
|
{
|
|
|
|
TRACE("(%p,%p,%i)\n", grad, matrix, order);
|
|
|
|
|
2013-05-23 17:23:00 +00:00
|
|
|
if (!grad || grad->brush.bt != BrushTypePathGradient)
|
2012-05-19 10:03:40 +00:00
|
|
|
return InvalidParameter;
|
2010-11-20 11:24:17 +00:00
|
|
|
|
2012-12-11 21:40:15 +00:00
|
|
|
return GdipMultiplyMatrix(&grad->transform, matrix, order);
|
2012-05-19 10:03:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
GpStatus WINGDIPAPI GdipResetPathGradientTransform(GpPathGradient *grad)
|
|
|
|
{
|
|
|
|
TRACE("(%p)\n", grad);
|
|
|
|
|
2013-05-23 17:23:00 +00:00
|
|
|
if (!grad || grad->brush.bt != BrushTypePathGradient)
|
2012-05-19 10:03:40 +00:00
|
|
|
return InvalidParameter;
|
|
|
|
|
2012-12-11 21:40:15 +00:00
|
|
|
return GdipSetMatrixElements(&grad->transform, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0);
|
2010-11-20 11:24:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
GpStatus WINGDIPAPI GdipRotatePathGradientTransform(GpPathGradient *grad,
|
|
|
|
REAL angle, GpMatrixOrder order)
|
|
|
|
{
|
|
|
|
TRACE("(%p,%0.2f,%i)\n", grad, angle, order);
|
|
|
|
|
2013-05-23 17:23:00 +00:00
|
|
|
if (!grad || grad->brush.bt != BrushTypePathGradient)
|
2012-05-19 10:03:40 +00:00
|
|
|
return InvalidParameter;
|
2010-11-20 11:24:17 +00:00
|
|
|
|
2012-12-11 21:40:15 +00:00
|
|
|
return GdipRotateMatrix(&grad->transform, angle, order);
|
2010-11-20 11:24:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
GpStatus WINGDIPAPI GdipScalePathGradientTransform(GpPathGradient *grad,
|
|
|
|
REAL sx, REAL sy, GpMatrixOrder order)
|
|
|
|
{
|
|
|
|
TRACE("(%p,%0.2f,%0.2f,%i)\n", grad, sx, sy, order);
|
|
|
|
|
2013-05-23 17:23:00 +00:00
|
|
|
if (!grad || grad->brush.bt != BrushTypePathGradient)
|
2012-05-19 10:03:40 +00:00
|
|
|
return InvalidParameter;
|
2010-11-20 11:24:17 +00:00
|
|
|
|
2012-12-11 21:40:15 +00:00
|
|
|
return GdipScaleMatrix(&grad->transform, sx, sy, order);
|
2010-11-20 11:24:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
GpStatus WINGDIPAPI GdipTranslatePathGradientTransform(GpPathGradient *grad,
|
|
|
|
REAL dx, REAL dy, GpMatrixOrder order)
|
|
|
|
{
|
|
|
|
TRACE("(%p,%0.2f,%0.2f,%i)\n", grad, dx, dy, order);
|
|
|
|
|
2013-05-23 17:23:00 +00:00
|
|
|
if (!grad || grad->brush.bt != BrushTypePathGradient)
|
2012-05-19 10:03:40 +00:00
|
|
|
return InvalidParameter;
|
2010-11-20 11:24:17 +00:00
|
|
|
|
2012-12-11 21:40:15 +00:00
|
|
|
return GdipTranslateMatrix(&grad->transform, dx, dy, order);
|
2010-11-20 11:24:17 +00:00
|
|
|
}
|
|
|
|
|
2008-03-25 17:34:57 +00:00
|
|
|
GpStatus WINGDIPAPI GdipSetSolidFillColor(GpSolidFill *sf, ARGB argb)
|
|
|
|
{
|
2008-09-07 10:32:49 +00:00
|
|
|
TRACE("(%p, %x)\n", sf, argb);
|
|
|
|
|
2008-03-25 17:34:57 +00:00
|
|
|
if(!sf)
|
|
|
|
return InvalidParameter;
|
|
|
|
|
|
|
|
sf->color = argb;
|
|
|
|
return Ok;
|
|
|
|
}
|
|
|
|
|
2008-12-06 09:26:01 +00:00
|
|
|
/******************************************************************************
|
|
|
|
* GdipSetTextureTransform [GDIPLUS.@]
|
|
|
|
*/
|
2008-03-25 17:34:57 +00:00
|
|
|
GpStatus WINGDIPAPI GdipSetTextureTransform(GpTexture *texture,
|
|
|
|
GDIPCONST GpMatrix *matrix)
|
|
|
|
{
|
2008-12-06 09:26:01 +00:00
|
|
|
TRACE("(%p, %p)\n", texture, matrix);
|
2008-03-25 17:34:57 +00:00
|
|
|
|
|
|
|
if(!texture || !matrix)
|
|
|
|
return InvalidParameter;
|
|
|
|
|
2012-12-11 21:40:15 +00:00
|
|
|
texture->transform = *matrix;
|
2008-12-06 09:26:01 +00:00
|
|
|
|
|
|
|
return Ok;
|
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* GdipSetTextureWrapMode [GDIPLUS.@]
|
|
|
|
*
|
|
|
|
* WrapMode not used, only stored
|
|
|
|
*/
|
|
|
|
GpStatus WINGDIPAPI GdipSetTextureWrapMode(GpTexture *brush, GpWrapMode wrapmode)
|
|
|
|
{
|
|
|
|
TRACE("(%p, %d)\n", brush, wrapmode);
|
|
|
|
|
|
|
|
if(!brush)
|
|
|
|
return InvalidParameter;
|
|
|
|
|
2012-03-05 20:17:42 +00:00
|
|
|
brush->imageattributes->wrap = wrapmode;
|
2008-03-25 17:34:57 +00:00
|
|
|
|
|
|
|
return Ok;
|
|
|
|
}
|
2008-04-14 12:53:30 +00:00
|
|
|
|
|
|
|
GpStatus WINGDIPAPI GdipSetLineColors(GpLineGradient *brush, ARGB color1,
|
|
|
|
ARGB color2)
|
|
|
|
{
|
2008-09-07 10:32:49 +00:00
|
|
|
TRACE("(%p, %x, %x)\n", brush, color1, color2);
|
|
|
|
|
2013-05-23 17:23:00 +00:00
|
|
|
if(!brush || brush->brush.bt != BrushTypeLinearGradient)
|
2008-05-04 19:41:25 +00:00
|
|
|
return InvalidParameter;
|
2008-04-14 12:53:30 +00:00
|
|
|
|
2008-05-04 19:41:25 +00:00
|
|
|
brush->startcolor = color1;
|
|
|
|
brush->endcolor = color2;
|
2008-04-14 12:53:30 +00:00
|
|
|
|
2008-05-04 19:41:25 +00:00
|
|
|
return Ok;
|
|
|
|
}
|
|
|
|
|
|
|
|
GpStatus WINGDIPAPI GdipGetLineColors(GpLineGradient *brush, ARGB *colors)
|
|
|
|
{
|
2008-09-07 10:32:49 +00:00
|
|
|
TRACE("(%p, %p)\n", brush, colors);
|
|
|
|
|
2013-05-23 17:23:00 +00:00
|
|
|
if(!brush || !colors || brush->brush.bt != BrushTypeLinearGradient)
|
2008-05-04 19:41:25 +00:00
|
|
|
return InvalidParameter;
|
|
|
|
|
|
|
|
colors[0] = brush->startcolor;
|
|
|
|
colors[1] = brush->endcolor;
|
|
|
|
|
|
|
|
return Ok;
|
2008-04-14 12:53:30 +00:00
|
|
|
}
|
|
|
|
|
2008-12-06 09:26:01 +00:00
|
|
|
/******************************************************************************
|
|
|
|
* GdipRotateTextureTransform [GDIPLUS.@]
|
|
|
|
*/
|
|
|
|
GpStatus WINGDIPAPI GdipRotateTextureTransform(GpTexture* brush, REAL angle,
|
|
|
|
GpMatrixOrder order)
|
|
|
|
{
|
|
|
|
TRACE("(%p, %.2f, %d)\n", brush, angle, order);
|
|
|
|
|
|
|
|
if(!brush)
|
|
|
|
return InvalidParameter;
|
|
|
|
|
2012-12-11 21:40:15 +00:00
|
|
|
return GdipRotateMatrix(&brush->transform, angle, order);
|
2008-12-06 09:26:01 +00:00
|
|
|
}
|
|
|
|
|
2008-04-14 12:53:30 +00:00
|
|
|
GpStatus WINGDIPAPI GdipSetLineLinearBlend(GpLineGradient *brush, REAL focus,
|
|
|
|
REAL scale)
|
|
|
|
{
|
2009-09-03 15:07:25 +00:00
|
|
|
REAL factors[3];
|
|
|
|
REAL positions[3];
|
|
|
|
int num_points = 0;
|
2008-04-14 12:53:30 +00:00
|
|
|
|
2009-09-03 15:07:25 +00:00
|
|
|
TRACE("(%p,%.2f,%.2f)\n", brush, focus, scale);
|
2008-04-14 12:53:30 +00:00
|
|
|
|
2009-09-03 15:07:25 +00: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-14 12:53:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
GpStatus WINGDIPAPI GdipSetLinePresetBlend(GpLineGradient *brush,
|
|
|
|
GDIPCONST ARGB *blend, GDIPCONST REAL* positions, INT count)
|
2009-11-28 15:26:02 +00:00
|
|
|
{
|
|
|
|
ARGB *new_color;
|
|
|
|
REAL *new_pos;
|
|
|
|
TRACE("(%p,%p,%p,%i)\n", brush, blend, positions, count);
|
|
|
|
|
2013-05-23 17:23:00 +00:00
|
|
|
if (!brush || !blend || !positions || count < 2 || brush->brush.bt != BrushTypeLinearGradient ||
|
2009-11-28 15:26:02 +00:00
|
|
|
positions[0] != 0.0f || positions[count-1] != 1.0f)
|
|
|
|
{
|
|
|
|
return InvalidParameter;
|
|
|
|
}
|
|
|
|
|
2015-11-22 10:10:02 +00:00
|
|
|
new_color = heap_alloc_zero(count * sizeof(ARGB));
|
|
|
|
new_pos = heap_alloc_zero(count * sizeof(REAL));
|
2009-11-28 15:26:02 +00:00
|
|
|
if (!new_color || !new_pos)
|
|
|
|
{
|
2015-11-22 10:10:02 +00:00
|
|
|
heap_free(new_color);
|
|
|
|
heap_free(new_pos);
|
2009-11-28 15:26:02 +00:00
|
|
|
return OutOfMemory;
|
|
|
|
}
|
|
|
|
|
|
|
|
memcpy(new_color, blend, sizeof(ARGB) * count);
|
|
|
|
memcpy(new_pos, positions, sizeof(REAL) * count);
|
|
|
|
|
2015-11-22 10:10:02 +00:00
|
|
|
heap_free(brush->pblendcolor);
|
|
|
|
heap_free(brush->pblendpos);
|
2009-11-28 15:26:02 +00:00
|
|
|
|
|
|
|
brush->pblendcolor = new_color;
|
|
|
|
brush->pblendpos = new_pos;
|
|
|
|
brush->pblendcount = count;
|
|
|
|
|
|
|
|
return Ok;
|
|
|
|
}
|
|
|
|
|
|
|
|
GpStatus WINGDIPAPI GdipGetLinePresetBlend(GpLineGradient *brush,
|
|
|
|
ARGB *blend, REAL* positions, INT count)
|
|
|
|
{
|
2013-05-23 17:23:00 +00:00
|
|
|
if (!brush || !blend || !positions || count < 2 || brush->brush.bt != BrushTypeLinearGradient)
|
2009-11-28 15:26:02 +00:00
|
|
|
return InvalidParameter;
|
|
|
|
|
|
|
|
if (brush->pblendcount == 0)
|
|
|
|
return GenericError;
|
|
|
|
|
|
|
|
if (count < brush->pblendcount)
|
|
|
|
return InsufficientBuffer;
|
|
|
|
|
|
|
|
memcpy(blend, brush->pblendcolor, sizeof(ARGB) * brush->pblendcount);
|
|
|
|
memcpy(positions, brush->pblendpos, sizeof(REAL) * brush->pblendcount);
|
|
|
|
|
|
|
|
return Ok;
|
|
|
|
}
|
|
|
|
|
|
|
|
GpStatus WINGDIPAPI GdipGetLinePresetBlendCount(GpLineGradient *brush,
|
|
|
|
INT *count)
|
|
|
|
{
|
2013-05-23 17:23:00 +00:00
|
|
|
if (!brush || !count || brush->brush.bt != BrushTypeLinearGradient)
|
2009-11-28 15:26:02 +00:00
|
|
|
return InvalidParameter;
|
|
|
|
|
|
|
|
*count = brush->pblendcount;
|
|
|
|
|
|
|
|
return Ok;
|
|
|
|
}
|
|
|
|
|
|
|
|
GpStatus WINGDIPAPI GdipResetLineTransform(GpLineGradient *brush)
|
2008-04-14 12:53:30 +00:00
|
|
|
{
|
2010-03-04 13:34:05 +00:00
|
|
|
TRACE("(%p)\n", brush);
|
|
|
|
|
2017-09-17 12:34:15 +00:00
|
|
|
if(!brush)
|
|
|
|
return InvalidParameter;
|
2008-04-14 12:53:30 +00:00
|
|
|
|
2017-09-17 12:34:15 +00:00
|
|
|
return GdipSetMatrixElements(&brush->transform, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0);
|
2008-04-14 12:53:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
GpStatus WINGDIPAPI GdipSetLineTransform(GpLineGradient *brush,
|
|
|
|
GDIPCONST GpMatrix *matrix)
|
|
|
|
{
|
2010-03-04 13:34:05 +00:00
|
|
|
TRACE("(%p,%p)\n", brush, matrix);
|
|
|
|
|
2017-09-17 12:34:15 +00:00
|
|
|
if(!brush || !matrix)
|
|
|
|
return InvalidParameter;
|
2008-04-14 12:53:30 +00:00
|
|
|
|
2017-09-17 12:34:15 +00:00
|
|
|
brush->transform = *matrix;
|
|
|
|
|
|
|
|
return Ok;
|
2008-04-14 12:53:30 +00:00
|
|
|
}
|
2008-05-04 19:41:25 +00:00
|
|
|
|
Sync avifil, credui, crypt32, cryptdlg, cryptui, dnsapi, gdiplus, hhctrl, hnetcfg, iccvid, imaadp32, imm32, jscript, localspl, localui, mapi32, mciavi32, mcicda, mciqtz32, mciseq, mciwave, mshtml, msrle32, msvfw32, msvidc32, msxml3, oleacc, oleaut32 to Wine 1.2rc5 (Samuel Serapion, small changes by me)
Remove Esperanto and Walon languages from comctl32, comdlg32, mpr, msi, shlwapi, wininet
svn path=/trunk/; revision=47920
2010-07-01 11:09:47 +00:00
|
|
|
GpStatus WINGDIPAPI GdipGetLineTransform(GpLineGradient *brush, GpMatrix *matrix)
|
|
|
|
{
|
|
|
|
TRACE("(%p,%p)\n", brush, matrix);
|
|
|
|
|
2017-09-17 12:34:15 +00:00
|
|
|
if(!brush || !matrix)
|
|
|
|
return InvalidParameter;
|
Sync avifil, credui, crypt32, cryptdlg, cryptui, dnsapi, gdiplus, hhctrl, hnetcfg, iccvid, imaadp32, imm32, jscript, localspl, localui, mapi32, mciavi32, mcicda, mciqtz32, mciseq, mciwave, mshtml, msrle32, msvfw32, msvidc32, msxml3, oleacc, oleaut32 to Wine 1.2rc5 (Samuel Serapion, small changes by me)
Remove Esperanto and Walon languages from comctl32, comdlg32, mpr, msi, shlwapi, wininet
svn path=/trunk/; revision=47920
2010-07-01 11:09:47 +00:00
|
|
|
|
2017-09-17 12:34:15 +00:00
|
|
|
*matrix = brush->transform;
|
|
|
|
|
|
|
|
return Ok;
|
Sync avifil, credui, crypt32, cryptdlg, cryptui, dnsapi, gdiplus, hhctrl, hnetcfg, iccvid, imaadp32, imm32, jscript, localspl, localui, mapi32, mciavi32, mcicda, mciqtz32, mciseq, mciwave, mshtml, msrle32, msvfw32, msvidc32, msxml3, oleacc, oleaut32 to Wine 1.2rc5 (Samuel Serapion, small changes by me)
Remove Esperanto and Walon languages from comctl32, comdlg32, mpr, msi, shlwapi, wininet
svn path=/trunk/; revision=47920
2010-07-01 11:09:47 +00:00
|
|
|
}
|
|
|
|
|
2009-11-28 15:26:02 +00:00
|
|
|
GpStatus WINGDIPAPI GdipScaleLineTransform(GpLineGradient *brush, REAL sx, REAL sy,
|
|
|
|
GpMatrixOrder order)
|
|
|
|
{
|
2010-03-04 13:34:05 +00:00
|
|
|
TRACE("(%p,%0.2f,%0.2f,%u)\n", brush, sx, sy, order);
|
|
|
|
|
2017-09-17 12:34:15 +00:00
|
|
|
if(!brush)
|
|
|
|
return InvalidParameter;
|
2009-11-28 15:26:02 +00:00
|
|
|
|
2017-09-17 12:34:15 +00:00
|
|
|
return GdipScaleMatrix(&brush->transform, sx, sy, order);
|
2009-11-28 15:26:02 +00:00
|
|
|
}
|
|
|
|
|
Sync avifil, credui, crypt32, cryptdlg, cryptui, dnsapi, gdiplus, hhctrl, hnetcfg, iccvid, imaadp32, imm32, jscript, localspl, localui, mapi32, mciavi32, mcicda, mciqtz32, mciseq, mciwave, mshtml, msrle32, msvfw32, msvidc32, msxml3, oleacc, oleaut32 to Wine 1.2rc5 (Samuel Serapion, small changes by me)
Remove Esperanto and Walon languages from comctl32, comdlg32, mpr, msi, shlwapi, wininet
svn path=/trunk/; revision=47920
2010-07-01 11:09:47 +00:00
|
|
|
GpStatus WINGDIPAPI GdipMultiplyLineTransform(GpLineGradient *brush,
|
|
|
|
GDIPCONST GpMatrix *matrix, GpMatrixOrder order)
|
|
|
|
{
|
|
|
|
TRACE("(%p,%p,%u)\n", brush, matrix, order);
|
|
|
|
|
2017-09-17 12:34:15 +00:00
|
|
|
if(!brush)
|
|
|
|
return InvalidParameter;
|
Sync avifil, credui, crypt32, cryptdlg, cryptui, dnsapi, gdiplus, hhctrl, hnetcfg, iccvid, imaadp32, imm32, jscript, localspl, localui, mapi32, mciavi32, mcicda, mciqtz32, mciseq, mciwave, mshtml, msrle32, msvfw32, msvidc32, msxml3, oleacc, oleaut32 to Wine 1.2rc5 (Samuel Serapion, small changes by me)
Remove Esperanto and Walon languages from comctl32, comdlg32, mpr, msi, shlwapi, wininet
svn path=/trunk/; revision=47920
2010-07-01 11:09:47 +00:00
|
|
|
|
2017-09-17 12:34:15 +00:00
|
|
|
if(!matrix)
|
|
|
|
return Ok;
|
|
|
|
|
|
|
|
return GdipMultiplyMatrix(&brush->transform, matrix, order);
|
Sync avifil, credui, crypt32, cryptdlg, cryptui, dnsapi, gdiplus, hhctrl, hnetcfg, iccvid, imaadp32, imm32, jscript, localspl, localui, mapi32, mciavi32, mcicda, mciqtz32, mciseq, mciwave, mshtml, msrle32, msvfw32, msvidc32, msxml3, oleacc, oleaut32 to Wine 1.2rc5 (Samuel Serapion, small changes by me)
Remove Esperanto and Walon languages from comctl32, comdlg32, mpr, msi, shlwapi, wininet
svn path=/trunk/; revision=47920
2010-07-01 11:09:47 +00:00
|
|
|
}
|
|
|
|
|
2017-09-17 12:34:15 +00:00
|
|
|
GpStatus WINGDIPAPI GdipTranslateLineTransform(GpLineGradient *brush,
|
2008-09-07 10:32:49 +00:00
|
|
|
REAL dx, REAL dy, GpMatrixOrder order)
|
|
|
|
{
|
2012-05-19 10:03:40 +00:00
|
|
|
TRACE("(%p,%f,%f,%d)\n", brush, dx, dy, order);
|
|
|
|
|
2017-09-17 12:34:15 +00:00
|
|
|
if(!brush)
|
|
|
|
return InvalidParameter;
|
2012-05-19 10:03:40 +00:00
|
|
|
|
2017-09-17 12:34:15 +00:00
|
|
|
return GdipTranslateMatrix(&brush->transform, dx, dy, order);
|
2008-09-07 10:32:49 +00:00
|
|
|
}
|
|
|
|
|
2008-12-06 09:26:01 +00: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;
|
|
|
|
|
2012-12-11 21:40:15 +00:00
|
|
|
return GdipTranslateMatrix(&brush->transform, dx, dy, order);
|
2008-12-06 09:26:01 +00:00
|
|
|
}
|
|
|
|
|
2008-05-04 19:41:25 +00:00
|
|
|
GpStatus WINGDIPAPI GdipGetLineRect(GpLineGradient *brush, GpRectF *rect)
|
|
|
|
{
|
2008-09-07 10:32:49 +00:00
|
|
|
TRACE("(%p, %p)\n", brush, rect);
|
|
|
|
|
2013-05-23 17:23:00 +00:00
|
|
|
if(!brush || !rect || brush->brush.bt != BrushTypeLinearGradient)
|
2008-05-04 19:41:25 +00:00
|
|
|
return InvalidParameter;
|
|
|
|
|
2009-05-09 09:26:16 +00:00
|
|
|
*rect = brush->rect;
|
2008-05-04 19:41:25 +00:00
|
|
|
|
|
|
|
return Ok;
|
|
|
|
}
|
|
|
|
|
|
|
|
GpStatus WINGDIPAPI GdipGetLineRectI(GpLineGradient *brush, GpRect *rect)
|
|
|
|
{
|
|
|
|
GpRectF rectF;
|
|
|
|
GpStatus ret;
|
|
|
|
|
2008-09-07 10:32:49 +00:00
|
|
|
TRACE("(%p, %p)\n", brush, rect);
|
|
|
|
|
2008-07-02 08:19:00 +00:00
|
|
|
if(!rect)
|
|
|
|
return InvalidParameter;
|
|
|
|
|
2008-05-04 19:41:25 +00:00
|
|
|
ret = GdipGetLineRect(brush, &rectF);
|
|
|
|
|
|
|
|
if(ret == Ok){
|
2012-12-11 21:40:15 +00:00
|
|
|
rect->X = gdip_round(rectF.X);
|
|
|
|
rect->Y = gdip_round(rectF.Y);
|
|
|
|
rect->Width = gdip_round(rectF.Width);
|
|
|
|
rect->Height = gdip_round(rectF.Height);
|
2008-05-04 19:41:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
2009-01-27 18:03:33 +00:00
|
|
|
|
|
|
|
GpStatus WINGDIPAPI GdipRotateLineTransform(GpLineGradient* brush,
|
|
|
|
REAL angle, GpMatrixOrder order)
|
|
|
|
{
|
|
|
|
static int calls;
|
|
|
|
|
2010-03-04 13:34:05 +00:00
|
|
|
TRACE("(%p,%0.2f,%u)\n", brush, angle, order);
|
|
|
|
|
2013-05-23 17:23:00 +00:00
|
|
|
if(!brush || brush->brush.bt != BrushTypeLinearGradient)
|
2009-01-27 18:03:33 +00:00
|
|
|
return InvalidParameter;
|
|
|
|
|
|
|
|
if(!(calls++))
|
|
|
|
FIXME("(%p, %.2f, %d) stub\n", brush, angle, order);
|
|
|
|
|
|
|
|
return NotImplemented;
|
|
|
|
}
|