DrawGdPictureImageRect Method (GdPictureImaging)
In This Topic
Draws a portion of a GdPicture image into another GdPicture image.
Syntax
'Declaration
Public Function DrawGdPictureImageRect( _
ByVal As Integer, _
ByVal As Integer, _
ByVal As Single, _
ByVal As Single, _
ByVal As Single, _
ByVal As Single, _
ByVal As Single, _
ByVal As Single, _
ByVal As Single, _
ByVal As Single, _
ByVal As InterpolationMode _
) As GdPictureStatus
public GdPictureStatus DrawGdPictureImageRect(
int ,
int ,
float ,
float ,
float ,
float ,
float ,
float ,
float ,
float ,
InterpolationMode
)
public function DrawGdPictureImageRect(
: Integer;
: Integer;
: Single;
: Single;
: Single;
: Single;
: Single;
: Single;
: Single;
: Single;
: InterpolationMode
): GdPictureStatus;
public function DrawGdPictureImageRect(
: int,
: int,
: float,
: float,
: float,
: float,
: float,
: float,
: float,
: float,
: InterpolationMode
) : GdPictureStatus;
public: GdPictureStatus DrawGdPictureImageRect(
int ,
int ,
float ,
float ,
float ,
float ,
float ,
float ,
float ,
float ,
InterpolationMode
)
public:
GdPictureStatus DrawGdPictureImageRect(
int ,
int ,
float ,
float ,
float ,
float ,
float ,
float ,
float ,
float ,
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);
}
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