Re: gdi+ bitmap copy constructor

From: Michael Phillips, Jr. (m_phillips53_at_nospam.hotmail.com.invalid)
Date: 07/07/04


Date: Wed, 7 Jul 2004 19:53:31 -0400

The clone method makes a copy of the bitmap.

The pointer to the cloned copy is not an alias to the original bitmap's
memory.

You can also copy a Bitmap by creating a new Bitmap with the same
characteristics as the original

and obtaining a Graphics object that will allow you to BitBlt the original
Bitmap to the copy.

It is easier to use the Clone method.

I hope this helps!

"Adam Versteegen" <no@email.com> wrote in message
news:8_OdnROznps2FHHdRVn-uw@comcast.com...
> Michael Phillips, Jr. wrote:
>
>> Hi,
>>
>> You can create a copy by using the Clone method which is inherited from
> the
>> Image Class.
>>
>> // Make a copy of NewSign's Bitmap
>> Bitmap *SignImg = NewSign.Clone();
>
> I read somewhere that that doesn't actually give me a new seperate Bitmap
> object though. I thought that internally it was still pointing to the same
> Image object and that any changes to the copy would happen to the
> original.
>
> Is that not the case? If not then clone is exactly what I need. If so, its
> no good...
>
> --
> Vesty.
>
>



Relevant Pages

  • Re: GDI+ : load file and free files link
    ... > Gdiplus keeps a handle to the opened file for the life of the bitmap ... > You can use the clone method to clone your bitmap and then delete the ... The problem is Bitmap class ...
    (microsoft.public.win32.programmer.gdi)
  • Re: GDI+ : load file and free files link
    ... blit your bitmap to the new object then delete the original ... >> Gdiplus keeps a handle to the opened file for the life of the bitmap ... >> You can use the clone method to clone your bitmap and then delete the ... >> bitmap object. ...
    (microsoft.public.win32.programmer.gdi)
  • Re: memory leak
    ... ArgumentException on Full Framework) when I have a ton of virtual memory ... "new Bitmap" line. ... Dispose is not a required call - it is optional. ... you are done with those resources. ...
    (microsoft.public.dotnet.framework.compactframework)
  • Re: One Thing I Noticed - Line Too Long
    ... > in memory plus a further bitmap, or "extra space on the Form wasting ... Turning on autoredraw keeps a copy of what's on the screen in memory. ... are drawing a bitmap to the screen and have the bitmap in memory then you ... > Picture Box and one Command Button. ...
    (microsoft.public.vb.general.discussion)
  • Re: memory leak
    ... Adding GC.Collectcauses the memory to drop, ... Now do you still agree that the GC will cleanup Bitmap objects? ... Dispose is not a required call - it is optional. ... done with those resources. ...
    (microsoft.public.dotnet.framework.compactframework)