2007-07-31 04:09:41 +02:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2007 Google (Evan Stade)
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "windef.h"
|
2007-08-01 04:15:29 +02:00
|
|
|
#include "wingdi.h"
|
2007-07-31 04:09:41 +02:00
|
|
|
|
2007-08-01 04:15:48 +02:00
|
|
|
#include "objbase.h"
|
|
|
|
|
2007-07-31 04:09:41 +02:00
|
|
|
#include "gdiplus.h"
|
|
|
|
#include "gdiplus_private.h"
|
|
|
|
#include "wine/debug.h"
|
|
|
|
|
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(gdiplus);
|
|
|
|
|
2008-06-27 01:26:33 +02:00
|
|
|
GpStatus WINGDIPAPI GdipCloneImageAttributes(GDIPCONST GpImageAttributes *imageattr,
|
|
|
|
GpImageAttributes **cloneImageattr)
|
|
|
|
{
|
2009-12-18 22:18:49 +01:00
|
|
|
GpStatus stat;
|
|
|
|
|
2008-09-02 22:38:01 +02:00
|
|
|
TRACE("(%p, %p)\n", imageattr, cloneImageattr);
|
|
|
|
|
2008-06-27 01:26:33 +02:00
|
|
|
if(!imageattr || !cloneImageattr)
|
|
|
|
return InvalidParameter;
|
|
|
|
|
2009-12-18 22:18:49 +01:00
|
|
|
stat = GdipCreateImageAttributes(cloneImageattr);
|
2008-06-27 01:26:33 +02:00
|
|
|
|
2009-12-18 22:18:49 +01:00
|
|
|
if (stat == Ok)
|
|
|
|
**cloneImageattr = *imageattr;
|
|
|
|
|
|
|
|
return stat;
|
2008-06-27 01:26:33 +02:00
|
|
|
}
|
|
|
|
|
2007-07-31 04:09:41 +02:00
|
|
|
GpStatus WINGDIPAPI GdipCreateImageAttributes(GpImageAttributes **imageattr)
|
|
|
|
{
|
|
|
|
if(!imageattr)
|
|
|
|
return InvalidParameter;
|
|
|
|
|
2007-07-31 04:09:54 +02:00
|
|
|
*imageattr = GdipAlloc(sizeof(GpImageAttributes));
|
|
|
|
if(!*imageattr) return OutOfMemory;
|
2007-07-31 04:09:41 +02:00
|
|
|
|
2010-05-08 19:53:07 +02:00
|
|
|
(*imageattr)->wrap = WrapModeClamp;
|
|
|
|
|
2009-12-18 22:21:30 +01:00
|
|
|
TRACE("<-- %p\n", *imageattr);
|
|
|
|
|
2007-07-31 04:09:54 +02:00
|
|
|
return Ok;
|
2007-07-31 04:09:41 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
GpStatus WINGDIPAPI GdipDisposeImageAttributes(GpImageAttributes *imageattr)
|
|
|
|
{
|
2008-09-02 22:38:01 +02:00
|
|
|
TRACE("(%p)\n", imageattr);
|
|
|
|
|
2007-07-31 04:09:41 +02:00
|
|
|
if(!imageattr)
|
|
|
|
return InvalidParameter;
|
|
|
|
|
2007-08-01 04:14:52 +02:00
|
|
|
GdipFree(imageattr);
|
2007-07-31 04:09:41 +02:00
|
|
|
|
2007-08-01 04:14:52 +02:00
|
|
|
return Ok;
|
2007-07-31 04:09:41 +02:00
|
|
|
}
|
|
|
|
|
2007-08-01 04:16:16 +02:00
|
|
|
GpStatus WINGDIPAPI GdipSetImageAttributesColorKeys(GpImageAttributes *imageattr,
|
|
|
|
ColorAdjustType type, BOOL enableFlag, ARGB colorLow, ARGB colorHigh)
|
|
|
|
{
|
2009-07-25 00:57:38 +02:00
|
|
|
TRACE("(%p,%u,%i,%08x,%08x)\n", imageattr, type, enableFlag, colorLow, colorHigh);
|
2007-08-01 04:16:16 +02:00
|
|
|
|
2009-07-25 00:57:38 +02:00
|
|
|
if(!imageattr || type >= ColorAdjustTypeCount)
|
2007-08-01 04:16:16 +02:00
|
|
|
return InvalidParameter;
|
|
|
|
|
2009-07-25 00:57:38 +02:00
|
|
|
imageattr->colorkeys[type].enabled = enableFlag;
|
|
|
|
imageattr->colorkeys[type].low = colorLow;
|
|
|
|
imageattr->colorkeys[type].high = colorHigh;
|
2007-08-01 04:16:16 +02:00
|
|
|
|
2009-07-25 00:57:38 +02:00
|
|
|
return Ok;
|
2007-08-01 04:16:16 +02:00
|
|
|
}
|
|
|
|
|
2007-08-08 03:42:48 +02:00
|
|
|
GpStatus WINGDIPAPI GdipSetImageAttributesColorMatrix(GpImageAttributes *imageattr,
|
|
|
|
ColorAdjustType type, BOOL enableFlag, GDIPCONST ColorMatrix* colorMatrix,
|
|
|
|
GDIPCONST ColorMatrix* grayMatrix, ColorMatrixFlags flags)
|
|
|
|
{
|
2009-12-19 00:42:18 +01:00
|
|
|
TRACE("(%p,%u,%i,%p,%p,%u)\n", imageattr, type, enableFlag, colorMatrix,
|
|
|
|
grayMatrix, flags);
|
2007-08-08 03:42:48 +02:00
|
|
|
|
2009-12-19 00:42:18 +01:00
|
|
|
if(!imageattr || type >= ColorAdjustTypeCount || flags > ColorMatrixFlagsAltGray)
|
2007-08-08 03:42:48 +02:00
|
|
|
return InvalidParameter;
|
|
|
|
|
2009-12-19 00:42:18 +01:00
|
|
|
if (enableFlag)
|
|
|
|
{
|
|
|
|
if (!colorMatrix)
|
|
|
|
return InvalidParameter;
|
|
|
|
|
|
|
|
if (flags == ColorMatrixFlagsAltGray)
|
|
|
|
{
|
|
|
|
if (!grayMatrix)
|
|
|
|
return InvalidParameter;
|
2007-08-08 03:42:48 +02:00
|
|
|
|
2009-12-19 00:42:18 +01:00
|
|
|
imageattr->colormatrices[type].graymatrix = *grayMatrix;
|
|
|
|
}
|
|
|
|
|
|
|
|
imageattr->colormatrices[type].colormatrix = *colorMatrix;
|
|
|
|
imageattr->colormatrices[type].flags = flags;
|
|
|
|
}
|
|
|
|
|
|
|
|
imageattr->colormatrices[type].enabled = enableFlag;
|
|
|
|
|
|
|
|
return Ok;
|
2007-08-08 03:42:48 +02:00
|
|
|
}
|
|
|
|
|
2007-07-31 04:09:41 +02:00
|
|
|
GpStatus WINGDIPAPI GdipSetImageAttributesWrapMode(GpImageAttributes *imageAttr,
|
|
|
|
WrapMode wrap, ARGB argb, BOOL clamp)
|
|
|
|
{
|
2009-12-18 23:19:34 +01:00
|
|
|
TRACE("(%p,%u,%08x,%i)\n", imageAttr, wrap, argb, clamp);
|
|
|
|
|
2010-05-08 19:53:07 +02:00
|
|
|
if(!imageAttr || wrap > WrapModeClamp)
|
2007-07-31 04:09:41 +02:00
|
|
|
return InvalidParameter;
|
|
|
|
|
2010-05-08 19:53:07 +02:00
|
|
|
imageAttr->wrap = wrap;
|
|
|
|
imageAttr->outside_color = argb;
|
|
|
|
imageAttr->clamp = clamp;
|
2007-07-31 04:09:41 +02:00
|
|
|
|
2010-05-08 19:53:07 +02:00
|
|
|
return Ok;
|
2007-07-31 04:09:41 +02:00
|
|
|
}
|
2008-04-09 22:09:58 +02:00
|
|
|
|
|
|
|
GpStatus WINGDIPAPI GdipSetImageAttributesCachedBackground(GpImageAttributes *imageAttr,
|
|
|
|
BOOL enableFlag)
|
|
|
|
{
|
|
|
|
static int calls;
|
|
|
|
|
2009-12-18 23:19:34 +01:00
|
|
|
TRACE("(%p,%i)\n", imageAttr, enableFlag);
|
|
|
|
|
2008-04-09 22:09:58 +02:00
|
|
|
if(!(calls++))
|
|
|
|
FIXME("not implemented\n");
|
|
|
|
|
|
|
|
return NotImplemented;
|
|
|
|
}
|
2008-04-09 22:14:45 +02:00
|
|
|
|
|
|
|
GpStatus WINGDIPAPI GdipSetImageAttributesGamma(GpImageAttributes *imageAttr,
|
|
|
|
ColorAdjustType type, BOOL enableFlag, REAL gamma)
|
|
|
|
{
|
2009-12-18 23:19:34 +01:00
|
|
|
TRACE("(%p,%u,%i,%0.2f)\n", imageAttr, type, enableFlag, gamma);
|
|
|
|
|
2010-01-31 00:09:06 +01:00
|
|
|
if (!imageAttr || (enableFlag && gamma <= 0.0) || type >= ColorAdjustTypeCount)
|
|
|
|
return InvalidParameter;
|
2008-04-09 22:14:45 +02:00
|
|
|
|
2010-01-31 00:09:06 +01:00
|
|
|
imageAttr->gamma_enabled[type] = enableFlag;
|
|
|
|
imageAttr->gamma[type] = gamma;
|
|
|
|
|
|
|
|
return Ok;
|
2008-04-09 22:14:45 +02:00
|
|
|
}
|
2008-04-09 22:16:32 +02:00
|
|
|
|
|
|
|
GpStatus WINGDIPAPI GdipSetImageAttributesNoOp(GpImageAttributes *imageAttr,
|
|
|
|
ColorAdjustType type, BOOL enableFlag)
|
|
|
|
{
|
|
|
|
static int calls;
|
|
|
|
|
2009-12-18 23:19:34 +01:00
|
|
|
TRACE("(%p,%u,%i)\n", imageAttr, type, enableFlag);
|
|
|
|
|
2008-04-09 22:16:32 +02:00
|
|
|
if(!(calls++))
|
|
|
|
FIXME("not implemented\n");
|
|
|
|
|
|
|
|
return NotImplemented;
|
|
|
|
}
|
2008-04-09 22:25:14 +02:00
|
|
|
|
|
|
|
GpStatus WINGDIPAPI GdipSetImageAttributesOutputChannel(GpImageAttributes *imageAttr,
|
|
|
|
ColorAdjustType type, BOOL enableFlag, ColorChannelFlags channelFlags)
|
|
|
|
{
|
|
|
|
static int calls;
|
|
|
|
|
2009-12-18 23:19:34 +01:00
|
|
|
TRACE("(%p,%u,%i,%x)\n", imageAttr, type, enableFlag, channelFlags);
|
|
|
|
|
2008-04-09 22:25:14 +02:00
|
|
|
if(!(calls++))
|
|
|
|
FIXME("not implemented\n");
|
|
|
|
|
|
|
|
return NotImplemented;
|
|
|
|
}
|
2008-04-09 22:26:48 +02:00
|
|
|
|
|
|
|
GpStatus WINGDIPAPI GdipSetImageAttributesOutputChannelColorProfile(GpImageAttributes *imageAttr,
|
|
|
|
ColorAdjustType type, BOOL enableFlag,
|
|
|
|
GDIPCONST WCHAR *colorProfileFilename)
|
|
|
|
{
|
|
|
|
static int calls;
|
|
|
|
|
2009-12-18 23:19:34 +01:00
|
|
|
TRACE("(%p,%u,%i,%s)\n", imageAttr, type, enableFlag, debugstr_w(colorProfileFilename));
|
|
|
|
|
2008-04-09 22:26:48 +02:00
|
|
|
if(!(calls++))
|
|
|
|
FIXME("not implemented\n");
|
|
|
|
|
|
|
|
return NotImplemented;
|
|
|
|
}
|
2008-04-10 21:40:13 +02:00
|
|
|
|
|
|
|
GpStatus WINGDIPAPI GdipSetImageAttributesRemapTable(GpImageAttributes *imageAttr,
|
|
|
|
ColorAdjustType type, BOOL enableFlag, UINT mapSize,
|
|
|
|
GDIPCONST ColorMap *map)
|
|
|
|
{
|
2009-12-18 23:19:34 +01:00
|
|
|
TRACE("(%p,%u,%i,%u,%p)\n", imageAttr, type, enableFlag, mapSize, map);
|
|
|
|
|
2010-03-04 02:06:33 +01:00
|
|
|
if(!imageAttr || type >= ColorAdjustTypeCount)
|
|
|
|
return InvalidParameter;
|
2008-04-10 21:40:13 +02:00
|
|
|
|
2010-03-04 02:06:33 +01:00
|
|
|
if (enableFlag)
|
|
|
|
{
|
|
|
|
if(!map || !mapSize)
|
|
|
|
return InvalidParameter;
|
|
|
|
|
|
|
|
imageAttr->colorremaptables[type].mapsize = mapSize;
|
|
|
|
imageAttr->colorremaptables[type].colormap = map;
|
|
|
|
}
|
|
|
|
|
|
|
|
imageAttr->colorremaptables[type].enabled = enableFlag;
|
|
|
|
|
|
|
|
return Ok;
|
2008-04-10 21:40:13 +02:00
|
|
|
}
|
2008-04-10 21:40:14 +02:00
|
|
|
|
|
|
|
GpStatus WINGDIPAPI GdipSetImageAttributesThreshold(GpImageAttributes *imageAttr,
|
|
|
|
ColorAdjustType type, BOOL enableFlag, REAL threshold)
|
|
|
|
{
|
|
|
|
static int calls;
|
|
|
|
|
2009-12-18 23:19:34 +01:00
|
|
|
TRACE("(%p,%u,%i,%0.2f)\n", imageAttr, type, enableFlag, threshold);
|
|
|
|
|
2008-04-10 21:40:14 +02:00
|
|
|
if(!(calls++))
|
|
|
|
FIXME("not implemented\n");
|
|
|
|
|
|
|
|
return NotImplemented;
|
|
|
|
}
|
2008-04-10 21:40:15 +02:00
|
|
|
|
|
|
|
GpStatus WINGDIPAPI GdipSetImageAttributesToIdentity(GpImageAttributes *imageAttr,
|
|
|
|
ColorAdjustType type)
|
|
|
|
{
|
|
|
|
static int calls;
|
|
|
|
|
2009-12-18 23:19:34 +01:00
|
|
|
TRACE("(%p,%u)\n", imageAttr, type);
|
|
|
|
|
2008-04-10 21:40:15 +02:00
|
|
|
if(!(calls++))
|
|
|
|
FIXME("not implemented\n");
|
|
|
|
|
|
|
|
return NotImplemented;
|
|
|
|
}
|