Procedure MapColor(tnOldColor, tnNewColor, tnOldAlpha, tnNewAlpha) If (Vartype(tnOldColor) != 'N') or (Vartype(tnNewColor) != 'N') Error 11 EndIf If !Empty(tnOldAlpha) and (Vartype(tnOldAlpha) != 'N') Error 11 EndIf If !Empty(tnNewAlpha) and (Vartype(tnNewAlpha) != 'N') Error 11 EndIf Local argbOld, argbNew argbOld = This.MakeARGB(tnOldColor, tnOldAlpha) argbNew = This.MakeARGB(tnNewColor, tnNewAlpha) Local lnFormat, graphics, newImage lnFormat = 0 graphics = 0 newImage = 0 This.stat = GdipGetImagePixelFormat(This.nativeImage, @lnFormat) This.stat = GdipCreateBitmapFromScan0(tnWidth, tnHeight, 0, lnFormat, 0, @newImage) If This.stat != 0 Return EndIf This.stat = GdipGetImageGraphicsContext(newImage, @graphics) If This.stat != 0 Return EndIf This.stat = GdipSetImageAttributesRemapTable(GpImageAttributes *imageattr, ColorAdjustType type, BOOL enableFlag, UINT mapSize, GDIPCONST ColorMap *map) This.stat = GdipDrawImageRectI(graphics, This.nativeImage, 0, 0, tnWidth, tnHeight) If This.stat = 0 GdipDisposeImage(This.nativeImage) This.nativeImage = newImage EndIf EndProc