I assume this is a million times asked question but the archive is
really big! So my question is this: how can I load in an SDL Surface a
jpeg with libjpeg?
^^^^^^^^^^^^
You need to fix your clock!
I assume this is a million times asked question but the archive is
really big! So my question is this: how can I load in an SDL Surface a
jpeg with libjpeg?
The easiest way is to just use the SDL_image library, found on the
"Libraries" page at http://www.libsdl.org/
Good luck!
-bill!On Thu, May 03, 2001 at 12:35:05AM +0300, Chris Savvopoulos wrote:
I assume this is a million times asked question but the archive is
really big! So my question is this: how can I load in an SDL Surface a
jpeg with libjpeg?The easiest way is to just use the SDL_image library, found on the
"Libraries" page at http://www.libsdl.org/
Internally, I think SDL_image uses libjpeg for JPEG decoding, so it’ll at
least give you an idea.
As for doing it yourself: generally speaking, you decode an image, create
a surface with SDL_CreateRGBSurface(), and fill in the surface’s pixel
array with the decoded data in the format you specified to
SDL_CreateRGBSurface(). You can cut out one of those steps by using
SDL_CreateRGBSurfaceFrom().
These two functions are well documented, if you want the specifics.
–ryan.
the hard part is the libjpeg… I can’t find how to load an image with
libjpeg no matter how much I search. Also, I searched the SDL docs if
SDL can load jpegs and I think it can not. If you could send a “Load
Jpeg into SDL Surface function” or an example loading a jpeg in SDL I
would be most greatful!On Fri, 2002-05-03 at 01:04, Ryan C. Gordon wrote:
I assume this is a million times asked question but the archive is
really big! So my question is this: how can I load in an SDL Surface a
jpeg with libjpeg?The easiest way is to just use the SDL_image library, found on the
"Libraries" page at http://www.libsdl.org/Internally, I think SDL_image uses libjpeg for JPEG decoding, so it’ll at
least give you an idea.As for doing it yourself: generally speaking, you decode an image, create
a surface with SDL_CreateRGBSurface(), and fill in the surface’s pixel
array with the decoded data in the format you specified to
SDL_CreateRGBSurface(). You can cut out one of those steps by using
SDL_CreateRGBSurfaceFrom().These two functions are well documented, if you want the specifics.
–ryan.
SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl
This is how SDL_Image does it:
http://www.libsdl.org/cgi/cvsweb.cgi/SDL_image/IMG_jpg.c?rev=1.6
–ryan.> On Fri, 2002-05-03 at 01:04, Ryan C. Gordon wrote:
the hard part is the libjpeg… I can’t find how to load an image with
libjpeg no matter how much I search. Also, I searched the SDL docs if
SDL can load jpegs and I think it can not. If you could send a “Load
Jpeg into SDL Surface function” or an example loading a jpeg in SDL I
would be most greatful!
besides the code, I only link the .o according to what I’m loading
right? so if want to load jpgs I link IMG_jpg.o for exampleOn Fri, 2002-05-03 at 01:36, Ryan C. Gordon wrote:
On Fri, 2002-05-03 at 01:04, Ryan C. Gordon wrote:
the hard part is the libjpeg… I can’t find how to load an image with
libjpeg no matter how much I search. Also, I searched the SDL docs if
SDL can load jpegs and I think it can not. If you could send a “Load
Jpeg into SDL Surface function” or an example loading a jpeg in SDL I
would be most greatful!This is how SDL_Image does it:
http://www.libsdl.org/cgi/cvsweb.cgi/SDL_image/IMG_jpg.c?rev=1.6–ryan.
SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl
besides the code, I only link the .o according to what I’m loading
right? so if want to load jpgs I link IMG_jpg.o for example
It’s probably not that simple. I was just saying that IMG_jpg is an
example of how to use libjpeg with SDL. If you want to use SDL_image, use
SDL_image as a library that has an API you interact with abstractly.
SDL_image can be built in a slimmed down form (i.e. - only decodes JPGs
and not PNGs, etc), but I wouldn’t rip chunks out of it and expect it to
just plug into another application.
–ryan.