Help Center

CGpGraphics.DrawImageFXmethod

Draws a portion of an image after applying a specified effect.

GraphicsmethodCGpGraphics.incdocumented

Syntax

FUNCTION DrawImageFX (BYVAL pImage AS CGpImage PTR, BYREF sourceRect AS GpRectF, BYVAL pMatrix AS CGpMatrix PTR, BYREF gpEffect AS CGpEffect, BYREF gpImageAttributes AS CGpImageAttributes, BYVAL srcUnit AS GpUnit) AS GpStatus

Parameters

NameDescription
pImagePointer to an Image object that specifies the image to be drawn.
sourceRectPointer to a GpRectF structure that specifies the portion of the image to be drawn.
pMatrixPointer to a Matrix object that specifies the parallelogram in which the image portion is rendered. The destination parallelogram is calculated by applying the affine transformation stored in the matrix to the source rectangle.
pEffectPointer to a instance of a descendant of the CGpEffect class. The descendant specifies an effect or adjustment (for example, a change in contrast) that is applied to the image before rendering. The image is not permanently altered by the effect.
imageAttributesPointer to an ImageAttributes object that specifies color adjustments to be applied when the image is rendered. Can be NULL.
srcUnitElement of the GpUnit enumeration that specifies the unit of measure for the source rectangle.

Return value

If the function succeeds, it returns StatusOk, which is an element of the GpStatus enumeration.

If the function fails, it returns one of the other elements of the GpStatus enumeration.

Description

Draws a portion of an image after applying a specified effect.

Note: Not yet implemented.

Examples

' ======================================================================================== ' Draws an image. ' ======================================================================================== SUB Example_DrawImageFX (BYVAL hdc AS HDC)

' // Create a graphics object from the window device context DIM graphics AS CGpGraphics = hdc ' // Set the scale transform graphics.ScaleTransformForDpi

' // Create an Image object. DIM image AS CGpBitmap = "climber.jpg" image.SetResolutionForDpi

' // Get image dimensions DIM nWidth AS UINT = image.GetWidth DIM nHeight AS UINT = image.GetHeight

' // Define source rectangle using actual image size DIM srcRect AS GpRectF = (0, 0, nWidth, nHeight)

' // Create transformation matrix ' // Position image at 10, 10. DIM matrix AS CGpMatrix = CGpMatrix(1.0, 0.0, 0.0, 1.0, 10.0, 10.0)

' // Draw image with effect graphics.DrawImageFX(@image, @srcRect, @matrix, NULL, NULL, UnitPixel)

END SUB ' ========================================================================================

' ======================================================================================== ' Draws a portion of an image after applying a blur effect. ' ======================================================================================== SUB Example_DrawImageFX (BYVAL hdc AS HDC)

' // Create a graphics object from the window device context DIM graphics AS CGpGraphics = hdc ' // Set the scale transform graphics.ScaleTransformForDpi

' // Create an Image object. DIM image AS CGpBitmap = "climber.jpg" image.SetResolutionForDpi

' // Get image dimensions DIM nWidth AS UINT = image.GetWidth DIM nHeight AS UINT = image.GetHeight

' // Define source rectangle using actual image size DIM srcRect AS GpRectF = (0, 0, nWidth, nHeight)

' // Create transformation matrix DIM matrix AS CGpMatrix = CGpMatrix(1.0, 0.0, 0.0, 1.0, 10.0, 10.0)

' // Create blur effect DIM pBlurEffect AS CGpBlur DIM blurPrms AS BlurParams = (5.0, CTRUE) pBlurEffect.SetParameters(@blurPrms)

' // Draw image with effect graphics.DrawImageFX(@image, @srcRect, @matrix, @pBlurEffect, NULL, UnitPixel)

END SUB ' ========================================================================================

Reference

  • Include file CGpGraphics.inc
  • Defined in AfxNova/CGpGraphics.inc:1199
  • Documented in Graphics/GdiPlus Classes/CGpGraphics Classes.md
  • Topic: CGpGraphics Class