Cloning issue

Discussions about image processing and document imaging.
Post Reply
fnaudeau
Posts: 14
Joined: Thu Dec 25, 2014 7:25 pm

Cloning issue

Post by fnaudeau » Tue Aug 02, 2016 10:51 am

Hello,

I have created a class which embed a GdPictureImaging as member and a "int" for image Id.
I wanted to implement the ICloneable interface in order to create a new instance of my class.
My problem is how to achieve this clone that will duplicate the GdPictureImaging and the associate image id.

Code: Select all

    public class MyImage : ICloneable
    {
        private GdPictureImaging _gdPictureImaging = new GdPictureImaging();
        private int _image = -1;

        public MyImage(System.Drawing.Image image)
        {            
            _image = _gdPictureImaging.CreateGdPictureImageFromBitmap(image as Bitmap);           
        }

        public object Clone()
        {
            // how to return a new instance of MyImage
            return ???
        }
    }
Many thanks for your help.
Frédéric

David
Posts: 66
Joined: Mon Feb 08, 2016 3:12 pm

Re: Cloning issue

Post by David » Mon Aug 08, 2016 11:51 am

Hi Frédéric,

Thank you for your interest in GdPicture.NET.

You should consider the CreateClonedGdPictureImage method. This method creates a new GdPicture Image and initializes it with a copy of the contents of another GdPicture Image. The newly created image will be independent of the image source.

https://www.gdpicture.com/guides/gdpicture/web ... Image.html

Regards,

David

fnaudeau
Posts: 14
Joined: Thu Dec 25, 2014 7:25 pm

Re: Cloning issue

Post by fnaudeau » Tue Aug 09, 2016 12:28 am

Hi,

The CreateClonedGdPictureImage will create a new Id for a copy of the picture but using the same GdPictureImaging object ?
If I instantiate a new GdPictureImaging, will this new Id can be used to retrieve the picture ?
Is this new Id independant of the GdPictureImaging instance ?

Many thanks
Kind regards
Frédéric

David
Posts: 66
Joined: Mon Feb 08, 2016 3:12 pm

Re: Cloning issue

Post by David » Thu Aug 11, 2016 9:13 am

Hi,

As mentioned within the documentation: The newly created image will be independent of the image source.

It will be a totally independent object.

Regards,

David

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest