GdPicture.NET.14
GdPicture14 Namespace / GdPictureImaging Class / DrawGdPictureImageTransparency Method
GdPicture image identifier. Specifies the image to be drawn from.
GdPicture image identifier. specifies the image to draw on.
Transparency to apply to the drawn image [0 ; 255]. 0 means full opacity and 255 full transparency.
Specifies the x-coordinate in pixels of the upper-left corner of the destination rectangle at which to draw the image.
Specifies the y-coordinate in pixels of the upper-left corner of the destination rectangle at which to draw the image.
Specifies the width, in pixels, of the destination rectangle at which to draw the image.
Specifies the height, in pixels, of the destination rectangle at which to draw the image.
A member of the Drawing2D.InterPolationMode enumeration.
Example





In This Topic
DrawGdPictureImageTransparency Method (GdPictureImaging)
In This Topic
Draws a GdPicture image into another GdPicture image applying a transparency effect.
Syntax
'Declaration
 
Public Function DrawGdPictureImageTransparency( _
   ByVal SrcImage As Integer, _
   ByVal DstImage As Integer, _
   ByVal Transparency As Integer, _
   ByVal DstLeft As Integer, _
   ByVal DstTop As Integer, _
   ByVal DstWidth As Integer, _
   ByVal DstHeight As Integer, _
   ByVal InterpolationMode As InterpolationMode _
) As GdPictureStatus
public GdPictureStatus DrawGdPictureImageTransparency( 
   int SrcImage,
   int DstImage,
   int Transparency,
   int DstLeft,
   int DstTop,
   int DstWidth,
   int DstHeight,
   InterpolationMode InterpolationMode
)
public function DrawGdPictureImageTransparency( 
    SrcImage: Integer;
    DstImage: Integer;
    Transparency: Integer;
    DstLeft: Integer;
    DstTop: Integer;
    DstWidth: Integer;
    DstHeight: Integer;
    InterpolationMode: InterpolationMode
): GdPictureStatus; 
public function DrawGdPictureImageTransparency( 
   SrcImage : int,
   DstImage : int,
   Transparency : int,
   DstLeft : int,
   DstTop : int,
   DstWidth : int,
   DstHeight : int,
   InterpolationMode : InterpolationMode
) : GdPictureStatus;
public: GdPictureStatus DrawGdPictureImageTransparency( 
   int SrcImage,
   int DstImage,
   int Transparency,
   int DstLeft,
   int DstTop,
   int DstWidth,
   int DstHeight,
   InterpolationMode InterpolationMode
) 
public:
GdPictureStatus DrawGdPictureImageTransparency( 
   int SrcImage,
   int DstImage,
   int Transparency,
   int DstLeft,
   int DstTop,
   int DstWidth,
   int DstHeight,
   InterpolationMode InterpolationMode
) 

Parameters

SrcImage
GdPicture image identifier. Specifies the image to be drawn from.
DstImage
GdPicture image identifier. specifies the image to draw on.
Transparency
Transparency to apply to the drawn image [0 ; 255]. 0 means full opacity and 255 full transparency.
DstLeft
Specifies the x-coordinate in pixels of the upper-left corner of the destination rectangle at which to draw the image.
DstTop
Specifies the y-coordinate in pixels of the upper-left corner of the destination rectangle at which to draw the image.
DstWidth
Specifies the width, in pixels, of the destination rectangle at which to draw the image.
DstHeight
Specifies the height, in pixels, of the destination rectangle at which to draw the image.
InterpolationMode
A member of the Drawing2D.InterPolationMode enumeration.

Return Value

A member of the GdPictureStatus enumeration.
Example
Rendering a blue image over a red image using defined transparency and saving the result into a png file.
using (GdPictureImaging gdpictureImaging = new GdPictureImaging())
{
    System.Drawing.Drawing2D.InterpolationMode iMode = System.Drawing.Drawing2D.InterpolationMode.Default;
 
    int width = 180;
    int height = 180;
    int transparency = 100;
 
    // Create images.
    int backImage = gdpictureImaging.CreateNewGdPictureImage(340, 340, 24, 0);
    int redImage = gdpictureImaging.CreateNewGdPictureImage(width, height, 24, gdpictureImaging.ARGBI(255, 255, 0, 0));
    int blueImage = gdpictureImaging.CreateNewGdPictureImage(width, height, 24, gdpictureImaging.ARGBI(255, 0, 0, 255));
 
    // Render a red image without transparency.
    gdpictureImaging.DrawGdPictureImageTransparency(redImage, backImage, 0, 25, 25, width, height, iMode);
 
    // Render a blue image with defined transparency.
    gdpictureImaging.DrawGdPictureImageTransparency(blueImage, backImage, transparency, 135, 135, width, height, iMode);
 
    gdpictureImaging.SaveAsPNG(backImage, "output.png");
 
    // Release used resources
    gdpictureImaging.ReleaseGdPictureImage(redImage);
    gdpictureImaging.ReleaseGdPictureImage(blueImage);
    gdpictureImaging.ReleaseGdPictureImage(backImage);
}
See Also