[Mono-list] Help me understand this code...
Alexandre Pigolkine
pigolkine@gmx.de
Wed, 7 May 2003 09:59:25 +0200
Hello Maurizio,
>
> As far as I understand, System.Drawing.Bitmap does not need a
> rendering engine. This class only offers methods to work with
> the pixels, but not to render them.
>
> Correct?
IMO - almost correct.
I do not see (for a moment) a way to implement
GetHbitmap/GetHicon functions without introducing
engine-dependent object from the start.
Bitmap (Image in general) can also be used to construct
Graphics object, and then all painting should happen on
the bitmap surface. At least, it's expected that Bitmap
contains the result of Graphics' function calls.
If some engine is used for Graphics implementation,
the engine should know how to get to Bitmap's bits.
I think that it's better to avoid copying of
bits from Bitmap before / to Bitmap after painting.
IMO, this is one more reason to have engine object
for Bitmap.
>
> I was trying to figure out how to write the constructor:
>
> Bitmap(string)
>
> This constructor should be able to open many kinds of file
> formats. Say I want to begin with png support. How would you
> parse the contenct of the png file? Can I p/invoke libpng?
>
I would also use p/invoke. I do not have experience with
Libpng, so I cannot really provide any information :(
> >
> > Probably you found the Factories.cs.
> > This should be the place where we can decide,
> > which implementation we want to use.
>
> In the case of Bitmap, why would you have multiple
> implementations? Thanks!
>
IMO, multiple implementations of Bitmap simplify
code and help to avoid convertions/copying.
>
> Maurizio
>
>
Alexandre