GdipResetImageAttributesfunction
Adjusts the colors in a palette according to the adjustment settings of a specified category.
Syntax
FUNCTION GdipResetImageAttributes (BYVAL imageattr AS GpImageAttributes PTR, BYVAL type AS ColorAdjustType) AS GpStatus
Parameters
| Name | Description | |
|---|---|---|
imageattr | [in] Pointer to the ImageAttributes object. | |
type | [in] Element of the ColorAdjustType enumeration that specifies the category for which color adjustment is reset. The default value is ColorAdjustTypeDefault. |
Description
Adjusts the colors in a palette according to the adjustment settings of a specified category.
Example
' ======================================================================================== ' This example sets a color remap table, draws an adjusted image, resets the attributes, ' and then draws the original image again to show the effect of GdipResetImageAttributes. ' ======================================================================================== SUB Example_ResetImageAttributes (BYVAL hdc AS HDC)
DIM hStatus AS LONG
' // Create a graphics object from the device context DIM graphics AS GpGraphics PTR hStatus = GdipCreateFromHDC(hdc, @graphics)
' // Get the DPI scaling ratios DIM dpiX AS SINGLE hStatus = GdipGetDpiX(graphics, @dpiX) DIM rxRatio AS SINGLE = dpiX / 96 DIM dpiY AS SINGLE hStatus = GdipGetDpiY(graphics, @dpiY) Dim ryRatio AS SINGLE = dpiY / 96 ' // Set the scale transform hStatus = GdipScaleWorldTransform(graphics, rxRatio, ryRatio, MatrixOrderPrepend)
' // Load an image DIM image AS GpImage PTR hStatus = GdipLoadImageFromFile("RedGreenStripes.bmp", @image) hStatus = GdipBitmapSetResolution(image, dpiX, dpiY)
' // Get image dimensions DIM nWidth AS LONG, nHeight AS LONG hStatus = GdipGetImageWidth(image, @nWidth) hStatus = GdipGetImageHeight(image, @nHeight)
' // Create an ImageAttributes object DIM imgAttr AS GpImageAttributes PTR hStatus = GdipCreateImageAttributes(@imgAttr)
' // Set a remap table: red to blue DIM cMap AS GpColorMap cMap.oldColor = ARGB_RED cMap.newColor = ARGB_BLUE hStatus = GdipSetImageAttributesRemapTable(imgAttr, ColorAdjustTypeDefault, TRUE, 1, @cMap)
' // Draw the image with color remap applied hStatus = GdipDrawImageRectRect(graphics, image, _
10, 10, nWidth, nHeight, _
0, 0, nWidth, nHeight, _
UnitPixel, imgAttr, NULL, NULL)
' // Reset the ImageAttributes for the default category hStatus = GdipResetImageAttributes(imgAttr, ColorAdjustTypeDefault)
' // Draw the image again with reset attributes (should appear unaltered) hStatus = GdipDrawImageRectRect(graphics, image, _
120, 10, nWidth, nHeight, _
0, 0, nWidth, nHeight, _
UnitPixel, imgAttr, NULL, NULL)
' // Cleanup IF imgAttr THEN GdipDisposeImageAttributes(imgAttr) IF image THEN GdipDisposeImage(image) IF graphics THEN GdipDeleteGraphics(graphics)
END SUB ' ========================================================================================
Reference
- Defined in AfxNova/AfxGdiPlus.bi:2131
- Documented in Graphics/GdiPlus Flat Api/GdiPlusImageAttributes.md
- Topic: ImageAttributes Functions