PNG package for Dolphin?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

PNG package for Dolphin?

G Krupa-2
Has anyone made a wrapper for libpng or a similar PNG library?  I'm looking
at adding PNG sprites to my game, and hope someone has already done the hard
stuff involved.

The amount of stuff necessary (from C) just to read a PNG file in and blit
it to screen seems ridiculous.  Why would I want to provide callbacks to a
library and expect it to longjmp() back to my code?

Anyway, if no one has done this or is working on it, I guess I'll start down
that road.  Any pointers to libpng "wrapper" libraries that take care of the
details and "just gimme a PNG object" would also be appreciated.

Cheers,

--GK


Reply | Threaded
Open this post in threaded view
|

Re: PNG package for Dolphin?

Dan Antion
You might want to have a look at the GDI+ implementation.  You can
search this newsgroup on Google to see how this developed.  The current
version is quite useful, stable and pretty easy to work with.

You can download the current version from

ftp://204.60.130.68/Dolphin

user: public
pw: public

Dan Antion

G Krupa wrote:

> Has anyone made a wrapper for libpng or a similar PNG library?  I'm looking
> at adding PNG sprites to my game, and hope someone has already done the hard
> stuff involved.
>
> The amount of stuff necessary (from C) just to read a PNG file in and blit
> it to screen seems ridiculous.  Why would I want to provide callbacks to a
> library and expect it to longjmp() back to my code?
>
> Anyway, if no one has done this or is working on it, I guess I'll start down
> that road.  Any pointers to libpng "wrapper" libraries that take care of the
> details and "just gimme a PNG object" would also be appreciated.
>
> Cheers,
>
> --GK
>
>


Reply | Threaded
Open this post in threaded view
|

Re: PNG package for Dolphin?

G Krupa-2
Thanks Dan!

I realized after getting 99% thru my wrapper DLL and Dolphin package that
GDI+ seems to handle PNG and JPEG images.  What I've been unable to find out
is whether or not the GDI+ also handles the alpha channel of the PNGs
properly.  This is the only thing PNGs offer than bitmaps don't (for my
purposes, as game sprites).

Do you know how well/if the GDI+ handles translucent images and images with
many alpha values?  From what I can glean from the MSDN documentation, it
appears to be "not at all."  If I'm wrong, please let me know.  I'd *love*
to be able to ship without three extra DLLs (the PNG lib, ZLIB lib, and my
wrapper/util DLL).

If anyone in the group is wanting such a beast, let me know.  It's still
pretty rough around the edges, but I do have translucent PNG sprites in my
game now.  I'd be more than happy to share the lib, even in this raw state.
Heck, I'll even include the source code for my wrapper DLL, if you call in
the next 30 minutes.  But wait, there's more...  :-)

Cheers,

--GK


"Dan Antion" <[hidden email]> wrote in message
news:3fec3dda$[hidden email]...

> You might want to have a look at the GDI+ implementation.  You can
> search this newsgroup on Google to see how this developed.  The current
> version is quite useful, stable and pretty easy to work with.
>
> You can download the current version from
>
> ftp://204.60.130.68/Dolphin
>
> user: public
> pw: public
>
> Dan Antion
>
> G Krupa wrote:
> > Has anyone made a wrapper for libpng or a similar PNG library?  I'm
looking
> > at adding PNG sprites to my game, and hope someone has already done the
hard
> > stuff involved.
> >
> > The amount of stuff necessary (from C) just to read a PNG file in and
blit
> > it to screen seems ridiculous.  Why would I want to provide callbacks to
a
> > library and expect it to longjmp() back to my code?
> >
> > Anyway, if no one has done this or is working on it, I guess I'll start
down
> > that road.  Any pointers to libpng "wrapper" libraries that take care of
the
> > details and "just gimme a PNG object" would also be appreciated.
> >
> > Cheers,
> >
> > --GK
> >
> >
>


Reply | Threaded
Open this post in threaded view
|

Re: PNG package for Dolphin?

Louis Sumberg-2
Hi GK,

> What I've been unable to find out
> is whether or not the GDI+ also handles the alpha channel of the PNGs
> properly.

I haven't worked with sprites and don't know what you mean by "properly",
but take a look at Gdiplus class method #exampleGdipGAlphaBlending which
shows some things that can be done.  I have an application where I apply a
semi-transparent color over images to show their selection state, so I know
at least that sort of thing works.  Sounds interesting what you're doing -
even if I did respond an hour after the 30 minute window :)

-- Louis

P.S.  You might want to look at GdiplusGraphics class>>width:height:format:
which creates a graphics object, the default pixel format being 32-bit ARGB.
If you use translucent colors to draw on it, then save it with a png
extension, that should work, since GDI+ has an encoder and decoder for png.
Yell if that doesn't work.


Reply | Threaded
Open this post in threaded view
|

Re: PNG package for Dolphin?

G Krupa-2
Wow, it looks like GDI+ does everything I want and more!  Thanks for the
replies.  I guess the broken PNG support in Internet Explorer fooled me into
believing the Win32 APIs were the cause.

If I hadn't already reworked my game to support my libs, I'd rip it out.  I
guess the next one will use the GDI+ libs.

Thanks again to all for your help and pointers.

Cheers,

--GK


"Louis Sumberg" <[hidden email]> wrote in message
news:bt0fm7$22iaj$[hidden email]...

> Hi GK,
>
> > What I've been unable to find out
> > is whether or not the GDI+ also handles the alpha channel of the PNGs
> > properly.
>
> I haven't worked with sprites and don't know what you mean by "properly",
> but take a look at Gdiplus class method #exampleGdipGAlphaBlending which
> shows some things that can be done.  I have an application where I apply a
> semi-transparent color over images to show their selection state, so I
know
> at least that sort of thing works.  Sounds interesting what you're doing -
> even if I did respond an hour after the 30 minute window :)
>
> -- Louis
>
> P.S.  You might want to look at GdiplusGraphics
class>>width:height:format:
> which creates a graphics object, the default pixel format being 32-bit
ARGB.
> If you use translucent colors to draw on it, then save it with a png
> extension, that should work, since GDI+ has an encoder and decoder for
png.
> Yell if that doesn't work.
>
>