A unique image identifier of the GdPicture image representing the source image, from which the specified area will be cloned.
The horizontal (X) coordinate of the top left position of the required area to clone, in pixels.
The vertical (Y) coordinate of the top left position of the required area to clone, in pixels.
The width of the required area to clone, in pixels.
The height of the required area to clone, in pixels.
Example





In This Topic
GdPicture14 Namespace / GdPictureImaging Class / CreateClonedGdPictureImageArea Method

CreateClonedGdPictureImageArea Method (GdPictureImaging)

In This Topic
Creates a new GdPicture image from the defined area of the specified GdPicture image, that is represented by its unique image identifier. The newly created image is identified by its unique non-zero image identifier and it is independent of the defined source image.

Please note that it is your responsibility to release the image resources once you have no use for them.

Syntax
'Declaration
 
Public Function CreateClonedGdPictureImageArea( _
   ByVal ImageID As Integer, _
   ByVal SrcLeft As Integer, _
   ByVal SrcTop As Integer, _
   ByVal Width As Integer, _
   ByVal Height As Integer _
) As Integer
public int CreateClonedGdPictureImageArea( 
   int ImageID,
   int SrcLeft,
   int SrcTop,
   int Width,
   int Height
)
public function CreateClonedGdPictureImageArea( 
    ImageID: Integer;
    SrcLeft: Integer;
    SrcTop: Integer;
    Width: Integer;
    Height: Integer
): Integer; 
public function CreateClonedGdPictureImageArea( 
   ImageID : int,
   SrcLeft : int,
   SrcTop : int,
   Width : int,
   Height : int
) : int;
public: int CreateClonedGdPictureImageArea( 
   int ImageID,
   int SrcLeft,
   int SrcTop,
   int Width,
   int Height
) 
public:
int CreateClonedGdPictureImageArea( 
   int ImageID,
   int SrcLeft,
   int SrcTop,
   int Width,
   int Height
) 

Parameters

ImageID
A unique image identifier of the GdPicture image representing the source image, from which the specified area will be cloned.
SrcLeft
The horizontal (X) coordinate of the top left position of the required area to clone, in pixels.
SrcTop
The vertical (Y) coordinate of the top left position of the required area to clone, in pixels.
Width
The width of the required area to clone, in pixels.
Height
The height of the required area to clone, in pixels.

Return Value

A unique image identifier of the GdPicture image representing the newly created image. The returned value is non-zero if the image is successfully created. Please first of all use the GdPictureImaging.GetStat method to determine if this method has been successful.

Be aware that you need to release the image with the GdPictureImaging.ReleaseGdPictureImage method after being used.

Remarks
It is recommend to use the GdPictureImaging.GetStat method to identify the specific reason for the method's failure, if any.

Be aware, that if the source image is a multi-bitmap image, this method will clone the defined area only from the currently selected bitmap (the current page) and it will create a single frame image.

This method requires the Image Documents component to run.

Example
Cloning an area of a jpeg image into a new jpeg image using streams.
using (GdPictureImaging gdpictureImaging = new GdPictureImaging())
{
    using (System.IO.Stream inputStream = new System.IO.FileStream("image.jpg", System.IO.FileMode.Open))
    {
        int imageID1 = gdpictureImaging.CreateGdPictureImageFromStream(inputStream, "image.jpg");
        //Clone an area of the source image into a mew image.
        int imageID2 = gdpictureImaging.CreateClonedGdPictureImageArea(imageID1, 50, 50, 100, 250);
        //Process the cloned image.
        gdpictureImaging.FxPixelize(imageID2);
        using (System.IO.Stream outputStream = new System.IO.FileStream("output.png", System.IO.FileMode.CreateNew))
        {
            //Save a result into a new image file.
            gdpictureImaging.SaveAsStream(imageID2, outputStream, GdPicture14.DocumentFormat.DocumentFormatPNG, 6);
        }
        gdpictureImaging.ReleaseGdPictureImage(imageID2);
        gdpictureImaging.ReleaseGdPictureImage(imageID1);
    }
}
See Also