Home | Info | Community | Development | myReactOS | Contact Us
ReactOS Development > Doxygenimageattributes.c
Go to the documentation of this file.
00001 /* 00002 * Copyright (C) 2007 Google (Evan Stade) 00003 * 00004 * This library is free software; you can redistribute it and/or 00005 * modify it under the terms of the GNU Lesser General Public 00006 * License as published by the Free Software Foundation; either 00007 * version 2.1 of the License, or (at your option) any later version. 00008 * 00009 * This library is distributed in the hope that it will be useful, 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00012 * Lesser General Public License for more details. 00013 * 00014 * You should have received a copy of the GNU Lesser General Public 00015 * License along with this library; if not, write to the Free Software 00016 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA 00017 */ 00018 00019 #include "windef.h" 00020 #include "wingdi.h" 00021 00022 #include "objbase.h" 00023 00024 #include "gdiplus.h" 00025 #include "gdiplus_private.h" 00026 #include "wine/debug.h" 00027 00028 WINE_DEFAULT_DEBUG_CHANNEL(gdiplus); 00029 00030 GpStatus WINGDIPAPI GdipCloneImageAttributes(GDIPCONST GpImageAttributes *imageattr, 00031 GpImageAttributes **cloneImageattr) 00032 { 00033 GpStatus stat; 00034 00035 TRACE("(%p, %p)\n", imageattr, cloneImageattr); 00036 00037 if(!imageattr || !cloneImageattr) 00038 return InvalidParameter; 00039 00040 stat = GdipCreateImageAttributes(cloneImageattr); 00041 00042 if (stat == Ok) 00043 **cloneImageattr = *imageattr; 00044 00045 return stat; 00046 } 00047 00048 GpStatus WINGDIPAPI GdipCreateImageAttributes(GpImageAttributes **imageattr) 00049 { 00050 if(!imageattr) 00051 return InvalidParameter; 00052 00053 *imageattr = GdipAlloc(sizeof(GpImageAttributes)); 00054 if(!*imageattr) return OutOfMemory; 00055 00056 (*imageattr)->wrap = WrapModeClamp; 00057 00058 TRACE("<-- %p\n", *imageattr); 00059 00060 return Ok; 00061 } 00062 00063 GpStatus WINGDIPAPI GdipDisposeImageAttributes(GpImageAttributes *imageattr) 00064 { 00065 int i; 00066 00067 TRACE("(%p)\n", imageattr); 00068 00069 if(!imageattr) 00070 return InvalidParameter; 00071 00072 for (i=0; i<ColorAdjustTypeCount; i++) 00073 GdipFree(imageattr->colorremaptables[i].colormap); 00074 00075 GdipFree(imageattr); 00076 00077 return Ok; 00078 } 00079 00080 GpStatus WINGDIPAPI GdipSetImageAttributesColorKeys(GpImageAttributes *imageattr, 00081 ColorAdjustType type, BOOL enableFlag, ARGB colorLow, ARGB colorHigh) 00082 { 00083 TRACE("(%p,%u,%i,%08x,%08x)\n", imageattr, type, enableFlag, colorLow, colorHigh); 00084 00085 if(!imageattr || type >= ColorAdjustTypeCount) 00086 return InvalidParameter; 00087 00088 imageattr->colorkeys[type].enabled = enableFlag; 00089 imageattr->colorkeys[type].low = colorLow; 00090 imageattr->colorkeys[type].high = colorHigh; 00091 00092 return Ok; 00093 } 00094 00095 GpStatus WINGDIPAPI GdipSetImageAttributesColorMatrix(GpImageAttributes *imageattr, 00096 ColorAdjustType type, BOOL enableFlag, GDIPCONST ColorMatrix* colorMatrix, 00097 GDIPCONST ColorMatrix* grayMatrix, ColorMatrixFlags flags) 00098 { 00099 TRACE("(%p,%u,%i,%p,%p,%u)\n", imageattr, type, enableFlag, colorMatrix, 00100 grayMatrix, flags); 00101 00102 if(!imageattr || type >= ColorAdjustTypeCount || flags > ColorMatrixFlagsAltGray) 00103 return InvalidParameter; 00104 00105 if (enableFlag) 00106 { 00107 if (!colorMatrix) 00108 return InvalidParameter; 00109 00110 if (flags == ColorMatrixFlagsAltGray) 00111 { 00112 if (!grayMatrix) 00113 return InvalidParameter; 00114 00115 imageattr->colormatrices[type].graymatrix = *grayMatrix; 00116 } 00117 00118 imageattr->colormatrices[type].colormatrix = *colorMatrix; 00119 imageattr->colormatrices[type].flags = flags; 00120 } 00121 00122 imageattr->colormatrices[type].enabled = enableFlag; 00123 00124 return Ok; 00125 } 00126 00127 GpStatus WINGDIPAPI GdipSetImageAttributesWrapMode(GpImageAttributes *imageAttr, 00128 WrapMode wrap, ARGB argb, BOOL clamp) 00129 { 00130 TRACE("(%p,%u,%08x,%i)\n", imageAttr, wrap, argb, clamp); 00131 00132 if(!imageAttr || wrap > WrapModeClamp) 00133 return InvalidParameter; 00134 00135 imageAttr->wrap = wrap; 00136 imageAttr->outside_color = argb; 00137 imageAttr->clamp = clamp; 00138 00139 return Ok; 00140 } 00141 00142 GpStatus WINGDIPAPI GdipSetImageAttributesCachedBackground(GpImageAttributes *imageAttr, 00143 BOOL enableFlag) 00144 { 00145 static int calls; 00146 00147 TRACE("(%p,%i)\n", imageAttr, enableFlag); 00148 00149 if(!(calls++)) 00150 FIXME("not implemented\n"); 00151 00152 return NotImplemented; 00153 } 00154 00155 GpStatus WINGDIPAPI GdipSetImageAttributesGamma(GpImageAttributes *imageAttr, 00156 ColorAdjustType type, BOOL enableFlag, REAL gamma) 00157 { 00158 TRACE("(%p,%u,%i,%0.2f)\n", imageAttr, type, enableFlag, gamma); 00159 00160 if (!imageAttr || (enableFlag && gamma <= 0.0) || type >= ColorAdjustTypeCount) 00161 return InvalidParameter; 00162 00163 imageAttr->gamma_enabled[type] = enableFlag; 00164 imageAttr->gamma[type] = gamma; 00165 00166 return Ok; 00167 } 00168 00169 GpStatus WINGDIPAPI GdipSetImageAttributesNoOp(GpImageAttributes *imageAttr, 00170 ColorAdjustType type, BOOL enableFlag) 00171 { 00172 static int calls; 00173 00174 TRACE("(%p,%u,%i)\n", imageAttr, type, enableFlag); 00175 00176 if(!(calls++)) 00177 FIXME("not implemented\n"); 00178 00179 return NotImplemented; 00180 } 00181 00182 GpStatus WINGDIPAPI GdipSetImageAttributesOutputChannel(GpImageAttributes *imageAttr, 00183 ColorAdjustType type, BOOL enableFlag, ColorChannelFlags channelFlags) 00184 { 00185 static int calls; 00186 00187 TRACE("(%p,%u,%i,%x)\n", imageAttr, type, enableFlag, channelFlags); 00188 00189 if(!(calls++)) 00190 FIXME("not implemented\n"); 00191 00192 return NotImplemented; 00193 } 00194 00195 GpStatus WINGDIPAPI GdipSetImageAttributesOutputChannelColorProfile(GpImageAttributes *imageAttr, 00196 ColorAdjustType type, BOOL enableFlag, 00197 GDIPCONST WCHAR *colorProfileFilename) 00198 { 00199 static int calls; 00200 00201 TRACE("(%p,%u,%i,%s)\n", imageAttr, type, enableFlag, debugstr_w(colorProfileFilename)); 00202 00203 if(!(calls++)) 00204 FIXME("not implemented\n"); 00205 00206 return NotImplemented; 00207 } 00208 00209 GpStatus WINGDIPAPI GdipSetImageAttributesRemapTable(GpImageAttributes *imageAttr, 00210 ColorAdjustType type, BOOL enableFlag, UINT mapSize, 00211 GDIPCONST ColorMap *map) 00212 { 00213 ColorMap *new_map; 00214 00215 TRACE("(%p,%u,%i,%u,%p)\n", imageAttr, type, enableFlag, mapSize, map); 00216 00217 if(!imageAttr || type >= ColorAdjustTypeCount) 00218 return InvalidParameter; 00219 00220 if (enableFlag) 00221 { 00222 if(!map || !mapSize) 00223 return InvalidParameter; 00224 00225 new_map = GdipAlloc(sizeof(*map) * mapSize); 00226 00227 if (!new_map) 00228 return OutOfMemory; 00229 00230 memcpy(new_map, map, sizeof(*map) * mapSize); 00231 00232 GdipFree(imageAttr->colorremaptables[type].colormap); 00233 00234 imageAttr->colorremaptables[type].mapsize = mapSize; 00235 imageAttr->colorremaptables[type].colormap = new_map; 00236 } 00237 else 00238 { 00239 GdipFree(imageAttr->colorremaptables[type].colormap); 00240 imageAttr->colorremaptables[type].colormap = NULL; 00241 } 00242 00243 imageAttr->colorremaptables[type].enabled = enableFlag; 00244 00245 return Ok; 00246 } 00247 00248 GpStatus WINGDIPAPI GdipSetImageAttributesThreshold(GpImageAttributes *imageAttr, 00249 ColorAdjustType type, BOOL enableFlag, REAL threshold) 00250 { 00251 static int calls; 00252 00253 TRACE("(%p,%u,%i,%0.2f)\n", imageAttr, type, enableFlag, threshold); 00254 00255 if(!(calls++)) 00256 FIXME("not implemented\n"); 00257 00258 return NotImplemented; 00259 } 00260 00261 GpStatus WINGDIPAPI GdipSetImageAttributesToIdentity(GpImageAttributes *imageAttr, 00262 ColorAdjustType type) 00263 { 00264 static int calls; 00265 00266 TRACE("(%p,%u)\n", imageAttr, type); 00267 00268 if(!(calls++)) 00269 FIXME("not implemented\n"); 00270 00271 return NotImplemented; 00272 } Generated on Fri May 25 2012 04:21:42 for ReactOS by
1.7.6.1
|