Load a Surface froma portion of a file

hi… i need to load a surface from a portion of a file… how can i do?
i have the file… i have where begin the image and its lenght…
thanks a lot…
Fede!

What format of image are you trying to load? The addon library SDL_image
supports many different image types (include but not limited to GIF, JPEG,
PNG, and PCX). Take a look at it and see if your image is supported.>From: “Federico Berardi”

Reply-To: sdl at libsdl.org
To:
Subject: [SDL] Load a Surface froma portion of a file…
Date: Tue, 21 May 2002 03:40:33 -0300

hi… i need to load a surface from a portion of a file… how can i do?
i have the file… i have where begin the image and its lenght…
thanks a lot…
Fede!


Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp.

BMP> What format of image are you trying to load? The addon library SDL_image

supports many different image types (include but not limited to GIF, JPEG,
PNG, and PCX). Take a look at it and see if your image is supported.

hi… i need to load a surface from a portion of a file… how can i do?
i have the file… i have where begin the image and its lenght…
thanks a lot…
Fede!

BMP

Shoot. Did you even look at the API documentation? There is a big function
in the video section call SDL_LoadBMP. This will load nearly any format of
bitmaps you could possibly think of.

To use:>From: “Federico Berardi”

Reply-To: sdl at libsdl.org
To:
Subject: Re: [SDL] Load a Surface froma portion of a file…
Date: Tue, 21 May 2002 22:43:06 -0300


SDL_Surface *Surface; // store the image here.
Surface = SDL_LoadBMP( “foo.bmp” ); // Load foo.bmp into Surface.


now isn’t that just simple? I see absolutely no reason why you would want to
write your own function to load a bitmap. Remember, documentation is your
friend! Yes. Read the documentation!

Mike S. Codename: Freak901010


Chat with friends online, try MSN Messenger: http://messenger.msn.com

Mike, I Think you have missed the question. He asked how to
load a surface from a “portion” of a file, which is probably
an archive of many other things besides the image.

A quick way to do this is to read the “portion” into memory
and load the image from memory using SDL_RWops.

void *buf;
int len;
SDL_RWops *src;
SDL_Surface *surf;

src = SDL_RWFromMem (buf, len);
surf = IMG_LoadTyped_RW (src, 1, “bmp”);

IMG_LoadTyped_RW is supported in SDL_image library. I didn’t
dive much into the SDL_RWops thing, but it seemed to be very
useful in many ways. It may even help you to read directly
from the file (starting at an arbitary seek position).

My suggestion is to read the SDL source code related to
SDL_RWops and SDL_image source code related to
IMG_LoadTyped_RW. You’ll find the answer.

Regards,
.paul.On Tue, May 21, 2002 at 10:17:32PM -0600, mike shoup wrote:

From: “Federico Berardi”
Reply-To: sdl at libsdl.org
To:
Subject: Re: [SDL] Load a Surface froma portion of a file…
Date: Tue, 21 May 2002 22:43:06 -0300

BMP

Shoot. Did you even look at the API documentation? There is a big function
in the video section call SDL_LoadBMP. This will load nearly any format of
bitmaps you could possibly think of.

To use:


SDL_Surface *Surface; // store the image here.
Surface = SDL_LoadBMP( “foo.bmp” ); // Load foo.bmp into Surface.


now isn’t that just simple? I see absolutely no reason why you would want to
write your own function to load a bitmap. Remember, documentation is your
friend! Yes. Read the documentation!

Mike S. Codename: Freak901010


Chat with friends online, try MSN Messenger: http://messenger.msn.com


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl

Mike, I Think you have missed the question. He asked how to
load a surface from a “portion” of a file, which is probably
an archive of many other things besides the image.

That is excactly what i want… Thanks> A quick way to do this is to read the “portion” into memory

and load the image from memory using SDL_RWops.

void *buf;
int len;
SDL_RWops *src;
SDL_Surface *surf;

src = SDL_RWFromMem (buf, len);
surf = IMG_LoadTyped_RW (src, 1, “bmp”);

IMG_LoadTyped_RW is supported in SDL_image library. I didn’t
dive much into the SDL_RWops thing, but it seemed to be very
useful in many ways. It may even help you to read directly
from the file (starting at an arbitary seek position).

My suggestion is to read the SDL source code related to
SDL_RWops and SDL_image source code related to
IMG_LoadTyped_RW. You’ll find the answer.

Regards,
.paul.