Re: Bitmap .net GDI+
Andrew Dunn <[email protected]> Mon, 30 Jul 2007 15:31:09 +1000
| Newsgroups | gmane.comp.windows.devel.dotnet.web |
|---|---|
| Message-ID | <5B2CE496DCCE2040B271D9417E72CB2822BD7E@bdbdc2.corporate.hcn.com.au> |
Hi, Thank you. This has given me a few ideas. One idea I was thinking of was rather than returning a bitmap was returning a string with a location to the bitmap (on disk) and the calling class can then do what it likes with it. Any thoughts on this? Andrew -----Original Message----- From: Discussion of building .NET applications targeted for the Web [mailto:[email protected]] On Behalf Of Gyorgy Bozoki Sent: Monday, 30 July 2007 3:26 PM To: [email protected] Subject: Re: [DOTNET-WEB] Bitmap .net GDI+ Andrew, I normally don't return bitmaps from a class. If potential callers need to perform some operations on a bitmap owned by a class, I add those methods to the class and callers can call them. The method implementations internally use the private bitmap object and make necessary changes. If I need to return a bitmap, I normally return a copy of it - when the owner class goes out of scope, it can safely dispose it. (I rarely return bitmaps, as all the copying around takes quite a bit of work for the processor.) If the bitmap needs to be shared, I create it on a higher level and pass it as a parameter to lower level classes. This way all lower level classes can use the same bitmap, but only the higher level class can free it up. From functions within a single class (when the caller is a member of the same class), I think it's ok to return Bitmap objects, as long as the functions know when to get rid of it. HTH, Gyorgy Bozoki > -----Original Message----- > From: Discussion of building .NET applications targeted for > the Web [mailto:[email protected]] On Behalf Of > Andrew Dunn > Sent: Monday, July 30, 2007 12:15 > To: [email protected] > Subject: [DOTNET-WEB] Bitmap .net GDI+ > > Hi, > > Does anyone have a reliable method of when to correctly > dispose of bitmap objects. ie - should i return a Bitmap > object as a class property? What is best practices? > > > Thank you > > > Andrew > > =================================== > This list is hosted by DevelopMentor. http://www.develop.com > > View archives and manage your subscription(s) at > http://discuss.develop.com > =================================== This list is hosted by DevelopMentor(r) http://www.develop.com View archives and manage your subscription(s) at http://discuss.develop.com =================================== This list is hosted by DevelopMentorĀ® http://www.develop.com View archives and manage your subscription(s) at http://discuss.develop.com