push 6e61d6ca5bcaf95ac09a664b4ba4f88238c927be
[wine/hacks.git] / dlls / gdiplus / imageattributes.c
blob1a7118df7739249918f80fa0859d3535c8612c54
1 /*
2 * Copyright (C) 2007 Google (Evan Stade)
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19 #include "windef.h"
20 #include "wingdi.h"
22 #include "objbase.h"
24 #include "gdiplus.h"
25 #include "gdiplus_private.h"
26 #include "wine/debug.h"
28 WINE_DEFAULT_DEBUG_CHANNEL(gdiplus);
30 GpStatus WINGDIPAPI GdipCloneImageAttributes(GDIPCONST GpImageAttributes *imageattr,
31 GpImageAttributes **cloneImageattr)
33 GpStatus stat;
35 TRACE("(%p, %p)\n", imageattr, cloneImageattr);
37 if(!imageattr || !cloneImageattr)
38 return InvalidParameter;
40 stat = GdipCreateImageAttributes(cloneImageattr);
42 if (stat == Ok)
43 **cloneImageattr = *imageattr;
45 return stat;
48 GpStatus WINGDIPAPI GdipCreateImageAttributes(GpImageAttributes **imageattr)
50 if(!imageattr)
51 return InvalidParameter;
53 *imageattr = GdipAlloc(sizeof(GpImageAttributes));
54 if(!*imageattr) return OutOfMemory;
56 TRACE("<-- %p\n", *imageattr);
58 return Ok;
61 GpStatus WINGDIPAPI GdipDisposeImageAttributes(GpImageAttributes *imageattr)
63 TRACE("(%p)\n", imageattr);
65 if(!imageattr)
66 return InvalidParameter;
68 GdipFree(imageattr);
70 return Ok;
73 GpStatus WINGDIPAPI GdipSetImageAttributesColorKeys(GpImageAttributes *imageattr,
74 ColorAdjustType type, BOOL enableFlag, ARGB colorLow, ARGB colorHigh)
76 TRACE("(%p,%u,%i,%08x,%08x)\n", imageattr, type, enableFlag, colorLow, colorHigh);
78 if(!imageattr || type >= ColorAdjustTypeCount)
79 return InvalidParameter;
81 imageattr->colorkeys[type].enabled = enableFlag;
82 imageattr->colorkeys[type].low = colorLow;
83 imageattr->colorkeys[type].high = colorHigh;
85 return Ok;
88 GpStatus WINGDIPAPI GdipSetImageAttributesColorMatrix(GpImageAttributes *imageattr,
89 ColorAdjustType type, BOOL enableFlag, GDIPCONST ColorMatrix* colorMatrix,
90 GDIPCONST ColorMatrix* grayMatrix, ColorMatrixFlags flags)
92 TRACE("(%p,%u,%i,%p,%p,%u)\n", imageattr, type, enableFlag, colorMatrix,
93 grayMatrix, flags);
95 if(!imageattr || type >= ColorAdjustTypeCount || flags > ColorMatrixFlagsAltGray)
96 return InvalidParameter;
98 if (enableFlag)
100 if (!colorMatrix)
101 return InvalidParameter;
103 if (flags == ColorMatrixFlagsAltGray)
105 if (!grayMatrix)
106 return InvalidParameter;
108 imageattr->colormatrices[type].graymatrix = *grayMatrix;
111 imageattr->colormatrices[type].colormatrix = *colorMatrix;
112 imageattr->colormatrices[type].flags = flags;
115 imageattr->colormatrices[type].enabled = enableFlag;
117 return Ok;
120 GpStatus WINGDIPAPI GdipSetImageAttributesWrapMode(GpImageAttributes *imageAttr,
121 WrapMode wrap, ARGB argb, BOOL clamp)
123 static int calls;
125 TRACE("(%p,%u,%08x,%i)\n", imageAttr, wrap, argb, clamp);
127 if(!imageAttr)
128 return InvalidParameter;
130 if(!(calls++))
131 FIXME("not implemented\n");
133 return NotImplemented;
136 GpStatus WINGDIPAPI GdipSetImageAttributesCachedBackground(GpImageAttributes *imageAttr,
137 BOOL enableFlag)
139 static int calls;
141 TRACE("(%p,%i)\n", imageAttr, enableFlag);
143 if(!(calls++))
144 FIXME("not implemented\n");
146 return NotImplemented;
149 GpStatus WINGDIPAPI GdipSetImageAttributesGamma(GpImageAttributes *imageAttr,
150 ColorAdjustType type, BOOL enableFlag, REAL gamma)
152 TRACE("(%p,%u,%i,%0.2f)\n", imageAttr, type, enableFlag, gamma);
154 if (!imageAttr || (enableFlag && gamma <= 0.0) || type >= ColorAdjustTypeCount)
155 return InvalidParameter;
157 imageAttr->gamma_enabled[type] = enableFlag;
158 imageAttr->gamma[type] = gamma;
160 return Ok;
163 GpStatus WINGDIPAPI GdipSetImageAttributesNoOp(GpImageAttributes *imageAttr,
164 ColorAdjustType type, BOOL enableFlag)
166 static int calls;
168 TRACE("(%p,%u,%i)\n", imageAttr, type, enableFlag);
170 if(!(calls++))
171 FIXME("not implemented\n");
173 return NotImplemented;
176 GpStatus WINGDIPAPI GdipSetImageAttributesOutputChannel(GpImageAttributes *imageAttr,
177 ColorAdjustType type, BOOL enableFlag, ColorChannelFlags channelFlags)
179 static int calls;
181 TRACE("(%p,%u,%i,%x)\n", imageAttr, type, enableFlag, channelFlags);
183 if(!(calls++))
184 FIXME("not implemented\n");
186 return NotImplemented;
189 GpStatus WINGDIPAPI GdipSetImageAttributesOutputChannelColorProfile(GpImageAttributes *imageAttr,
190 ColorAdjustType type, BOOL enableFlag,
191 GDIPCONST WCHAR *colorProfileFilename)
193 static int calls;
195 TRACE("(%p,%u,%i,%s)\n", imageAttr, type, enableFlag, debugstr_w(colorProfileFilename));
197 if(!(calls++))
198 FIXME("not implemented\n");
200 return NotImplemented;
203 GpStatus WINGDIPAPI GdipSetImageAttributesRemapTable(GpImageAttributes *imageAttr,
204 ColorAdjustType type, BOOL enableFlag, UINT mapSize,
205 GDIPCONST ColorMap *map)
207 TRACE("(%p,%u,%i,%u,%p)\n", imageAttr, type, enableFlag, mapSize, map);
209 if(!imageAttr || type >= ColorAdjustTypeCount)
210 return InvalidParameter;
212 if (enableFlag)
214 if(!map || !mapSize)
215 return InvalidParameter;
217 imageAttr->colorremaptables[type].mapsize = mapSize;
218 imageAttr->colorremaptables[type].colormap = map;
221 imageAttr->colorremaptables[type].enabled = enableFlag;
223 return Ok;
226 GpStatus WINGDIPAPI GdipSetImageAttributesThreshold(GpImageAttributes *imageAttr,
227 ColorAdjustType type, BOOL enableFlag, REAL threshold)
229 static int calls;
231 TRACE("(%p,%u,%i,%0.2f)\n", imageAttr, type, enableFlag, threshold);
233 if(!(calls++))
234 FIXME("not implemented\n");
236 return NotImplemented;
239 GpStatus WINGDIPAPI GdipSetImageAttributesToIdentity(GpImageAttributes *imageAttr,
240 ColorAdjustType type)
242 static int calls;
244 TRACE("(%p,%u)\n", imageAttr, type);
246 if(!(calls++))
247 FIXME("not implemented\n");
249 return NotImplemented;