Re: Bitmap .net GDI+

Gyorgy Bozoki <[email protected]> Mon, 30 Jul 2007 00:44:25 -0500
Newsgroups gmane.comp.windows.devel.dotnet.web
Message-ID <000401c7d26c$b0657ad0$9cfcbb4c@homepc>
Andrew,

I think that would cause a lot of trouble for you - if you try to do this in
a web project, you'll have concurrency issues (multiple threads might want
to use the same image, so you'd have to use extensive locking.) Also,
creating the image on disk would be very expensive in terms of performance.

Why do you need to return a bitmap from a call to an outside caller? (Or in
other words, do you actually need to return a bitmap?) My experience is that
a class rarely needs to return a bitmap that it creates internally. Most
operations can be done by the same class (and outside callers can just call
public methods to perform those operations, so they don't actually need the
bitmap.) When the caller is done, the original class can save the bitmap to
some storage.

In case you actually need to return the bitmap (because the caller wants to
save it, for example), then I'd just return a copy of it, so the ownership
of the original doesn't change. If the creator class is not needed anymore,
it'll be thrown away at it'll then free up the bitmap. If it's needed, then
it'll need its bitmap to stay intact.

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:31
> To: [email protected]
> Subject: Re: [DOTNET-WEB] Bitmap .net GDI+
>
> 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

===================================
This list is hosted by DevelopMentorĀ®  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com