GdipBitmapCreateApplyEffectfunction
Creates a new **Bitmap** object by applying a specified effect to an existing **Bitmap** object.
Syntax
FUNCTION GdipBitmapCreateApplyEffect (BYVAL inputBitmaps AS GpBitmap PTR PTR, BYVAL numInputs AS INT_, BYVAL effect AS GpEffect PTR, BYVAL roi AS RECT PTR, BYVAL outputRect AS RECT P=TR, BYVAL outputBitmap AS GpBitmap PTR PTR, BYVAL useAuxData AS BOOL, BYVAL auxData AS VOID PTR PTR, BYVAL auxDataSize AS INT_ PTR) AS GpStatus
Parameters
| Name | Description | |
|---|---|---|
inputBitmaps | [in] Address of a pointer to a Bitmap object to which the effect is applied. | |
numInputs | [in] Integer that specifies the number of input bitmaps. This parameter must be set to 1. | |
effect | [in] The effect to be applied. | |
roi | [in] Pointer to a RECT structure that specifies the portion of the input bitmap that is used. | |
outputRect | [out] Pointer to a RECT structure that receives the portion of the input bitmap that was used. If the rectangle specified by ROI lies entirely within the input bitmap, the rectangle returned in outputRect is the same as roi. If part of rectangle specified by roi lies outside the input bitmap, then the rectangle returned in outputRect is the portion of roi that lies within the input bitmap. Pass NULL if you do not want to receive the output rectangle. | |
outputBitmap | [out] Address of a variable that receives a pointer to the new Bitmap object. | |
useAuxData | [in] Flag that specifies whether the function should return a pointer to the auxiliary data that it creates. | |
auxData | [out] Pointer to a set of loo kup tables. | |
auxDataSize | [out] Size, in bytes, of the auxiliary data. |
Description
Creates a new Bitmap object by applying a specified effect to an existing Bitmap object.
Example:
Example
' ======================================================================================== ' Creates a new Bitmap object by applying a specified effect to an existing Bitmap object. ' Demonstrates GdipBitmapCreateApplyEffect to generate a new image from an existing one. ' ======================================================================================== SUB Example_CreateBitmapWithApplyEffect (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 the original bitmap DIM srcBitmap AS GpBitmap PTR hStatus = GdipCreateBitmapFromFile("climber.jpg", @srcBitmap) hStatus = GdipBitmapSetResolution(srcBitmap, dpiX, dpiY)
' // Create the tint effect DIM effect AS GpEffect PTR hStatus = GdipCreateEffect(TintEffectGuid, @effect)
' // Set parameters: Hue = 120 (green), Amount = 60 DIM tintParams AS TintParams tintParams.hue = 120 tintParams.amount = 60 hStatus = GdipSetEffectParameters(effect, @tintParams, SIZEOF(TintParams))
' // Prepare input array DIM inputBitmaps(0 TO 0) AS GpBitmap PTR inputBitmaps(0) = srcBitmap
' // Create output bitmap DIM outputBitmap AS GpBitmap PTR hStatus = GdipBitmapCreateApplyEffect(@inputBitmaps(0), 1, effect, NULL, NULL, @outputBitmap, FALSE, NULL, NULL)
' // Draw the new bitmap hStatus = GdipDrawImage(graphics, CAST(GpImage PTR, outputBitmap), 0, 0)
' // Cleanup IF effect THEN hStatus = GdipDeleteEffect(effect) IF srcBitmap THEN hStatus = GdipDisposeImage(CAST(GpImage PTR, srcBitmap)) IF outputBitmap THEN hStatus = GdipDisposeImage(CAST(GpImage PTR, outputBitmap)) IF graphics THEN hStatus = GdipDeleteGraphics(graphics)
END SUB ' ========================================================================================
Reference
- Defined in AfxNova/AfxGdiPlus.bi:1655
- Documented in Graphics/GdiPlus Flat Api/GdiPlusBitmap.md
- Topic: Bitmap Functions