GdPicture.NET.14
GdPicture14 Namespace / GdPictureImaging Class / DrawGdPictureImageRect Method
GdPicture image identifier. Specifies the image to be drawn from.
GdPicture image identifier. specifies the image to draw to.
Specifies the x-coordinate, in pixel, 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.
Left pixel source of the image to draw.
Top pixel source of the image to draw.
Width portion in pixels of the image to draw.
Height portion in pixels of the image to draw.
A member of the Drawing2D.InterPolationMode enumeration.
Example





In This Topic
DrawGdPictureImageRect Method (GdPictureImaging)
In This Topic
Draws a portion of a GdPicture image into another GdPicture image.
Syntax
'Declaration
 
Public Function DrawGdPictureImageRect( _
   ByVal SrcImage As Integer, _
   ByVal DstImage As Integer, _
   ByVal DstLeft As Single, _
   ByVal DstTop As Single, _
   ByVal DstWidth As Single, _
   ByVal DstHeight As Single, _
   ByVal SrcLeft As Single, _
   ByVal SrcTop As Single, _
   ByVal SrcWidth As Single, _
   ByVal SrcHeight As Single, _
   ByVal InterpolationMode As InterpolationMode _
) As GdPictureStatus
public GdPictureStatus DrawGdPictureImageRect( 
   int SrcImage,
   int DstImage,
   float DstLeft,
   float DstTop,
   float DstWidth,
   float DstHeight,
   float SrcLeft,
   float SrcTop,
   float SrcWidth,
   float SrcHeight,
   InterpolationMode InterpolationMode
)
public function DrawGdPictureImageRect( 
    SrcImage: Integer;
    DstImage: Integer;
    DstLeft: Single;
    DstTop: Single;
    DstWidth: Single;
    DstHeight: Single;
    SrcLeft: Single;
    SrcTop: Single;
    SrcWidth: Single;
    SrcHeight: Single;
    InterpolationMode: InterpolationMode
): GdPictureStatus; 
public function DrawGdPictureImageRect( 
   SrcImage : int,
   DstImage : int,
   DstLeft : float,
   DstTop : float,
   DstWidth : float,
   DstHeight : float,
   SrcLeft : float,
   SrcTop : float,
   SrcWidth : float,
   SrcHeight : float,
   InterpolationMode : InterpolationMode
) : GdPictureStatus;
public: GdPictureStatus DrawGdPictureImageRect( 
   int SrcImage,
   int DstImage,
   float DstLeft,
   float DstTop,
   float DstWidth,
   float DstHeight,
   float SrcLeft,
   float SrcTop,
   float SrcWidth,
   float SrcHeight,
   InterpolationMode InterpolationMode
) 
public:
GdPictureStatus DrawGdPictureImageRect( 
   int SrcImage,
   int DstImage,
   float DstLeft,
   float DstTop,
   float DstWidth,
   float DstHeight,
   float SrcLeft,
   float SrcTop,
   float SrcWidth,
   float SrcHeight,
   InterpolationMode InterpolationMode
) 

Parameters

SrcImage
GdPicture image identifier. Specifies the image to be drawn from.
DstImage
GdPicture image identifier. specifies the image to draw to.
DstLeft
Specifies the x-coordinate, in pixel, 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.
SrcLeft
Left pixel source of the image to draw.
SrcTop
Top pixel source of the image to draw.
SrcWidth
Width portion in pixels of the image to draw.
SrcHeight
Height portion in pixels of the image to draw.
InterpolationMode
A member of the Drawing2D.InterPolationMode enumeration.

Return Value

A member of the GdPictureStatus enumeration.
Example
Rendering a portion of an image with a circle onto the background image and saving the result into a png file.
using (GdPictureImaging gdpictureImaging = new GdPictureImaging())
{
    System.Drawing.Drawing2D.InterpolationMode iMode = System.Drawing.Drawing2D.InterpolationMode.Default;
    int backColor = gdpictureImaging.ARGBI(255, 0, 255, 0); // Green color
    int circleColor = gdpictureImaging.ARGBI(255, 255, 0, 0); // Red color
 
    int dstLeft = 0;
    int dstTop = 0;
    int dstWidth = 200;
    int dstHeight = 200;
 
    int srcLeft = 0;
    int srcTop = 0;
    int srcWidth = 40;
    int srcHeight = 40;
 
    // Create background image.
    int backImage = gdpictureImaging.CreateNewGdPictureImage(200, 200, 32, backColor);
 
    // Create image with circle.
    int circleImage = gdpictureImaging.CreateNewGdPictureImage(80, 80, 32, gdpictureImaging.ARGBI(0, 0, 0, 0));
    gdpictureImaging.DrawFilledCircle(circleImage, 40, 40, 80, circleColor, true);
 
    // Draw portion of image with circle into the background image.
    gdpictureImaging.DrawGdPictureImageRect(circleImage, backImage, dstLeft, dstTop, dstWidth, dstHeight, srcLeft, srcTop, srcWidth, srcHeight, iMode);
    gdpictureImaging.SaveAsPNG(backImage, "output.png");
 
    // Release used resources.
    gdpictureImaging.ReleaseGdPictureImage(circleImage);
    gdpictureImaging.ReleaseGdPictureImage(backImage);
}
See Also