GdipSetImageAttributesOutputChannelColorProfilefunction
Sets the CMYK output channel for a specified category.
Syntax
FUNCTION GdipSetImageAttributesOutputChannelColorProfile (BYVAL imageattr AS GpImageAttributes PTR, BYVAL type AS ColorAdjustType, BYVAL enableFlag AS BOOL, BYVAL colorProfileFilename AS CONST WSTRING PTR) 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 the output channel color-profile file is set. The default value is ColorAdjustTypeDefault. | |
enableFlag | [in] Boolean value that specifies whether a separate output channel color profile is enabled for the category specified by the type parameter. | |
colorProfileName | [in] Path name of a color-profile file. If the color-profile file is in the %SystemRoot%\System32\Spool\Drivers\Color directory, then this parameter can be the file name. Otherwise, this parameter must be the fully-qualified path name. |
Description
Sets the output channel color-profile file for a specified category.
Example
' ======================================================================================== ' This example sets a CMYK output channel color profile using GdipSetImageAttributesOutputChannelColorProfile. ' ======================================================================================== SUB Example_SetOutputChannelColorProfile (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 from file DIM image AS GpImage PTR hStatus = GdipLoadImageFromFile("climber.jpg", @image) ' // Set the resolution of this image object to the user's DPI settings hStatus = GdipBitmapSetResolution(image, dpiX, dpiY)
' // Draw the image unaltered. DIM AS LONG nWidth, nHeight hStatus = GdipGetImageWidth(image, @nWidth) hStatus = GdipGetImageHeight(image, @nHeight) hStatus = GdipDrawImageRect(graphics, image, 10, 10, nWidth, nHeight)
' // Create an ImageAttributes object DIM imgAttr AS GpImageAttributes PTR hStatus = GdipCreateImageAttributes(@imgAttr)
' // Set CMYK color profile (must be a valid ICC file path) DIM colorProfileFilename AS WSTRING *MAX_PATH = "C:\Program Files\Bullzip\PDF Printer\icc\sRGB_IEC61966-2-1_no_black_scaling.icc" hStatus = GdipSetImageAttributesOutputChannelColorProfile(imgAttr, _
ColorAdjustTypeDefault, TRUE, colorProfileFilename)
' // Draw image with color profile applied hStatus = GdipDrawImageRectRect(graphics, image, _
10, 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:2144
- Documented in Graphics/GdiPlus Flat Api/GdiPlusImageAttributes.md
- Topic: ImageAttributes Functions