delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/01/22/23:59:56

From: Darac <You_Know_Who AT NoSpam DOT I DOT Am>
Newsgroups: comp.os.msdos.djgpp
Subject: Size of Loaded Bitmaps in Allegro
Organization: Replace 'NoSpam.I.Am' with 'I.Am' in eMail address to Reply
Message-ID: <s2lj8sgn5sea1n1s4ra24b39enjcndplsp@4ax.com>
X-Newsreader: Forte Agent 1.7/32.534
MIME-Version: 1.0
Lines: 50
Date: Sat, 22 Jan 2000 17:01:55 +0000
NNTP-Posting-Host: 212.56.127.117
X-Complaints-To: abuse AT plus DOT net DOT uk
X-Trace: wards 948560690 212.56.127.117 (Sat, 22 Jan 2000 17:04:50 GMT)
NNTP-Posting-Date: Sat, 22 Jan 2000 17:04:50 GMT
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Hello everybody!

I'm making a little program to convert JPGs into BMPs for my Windows
Wallpaper. I've got LIBJPEG 1.03 to load in the JPGs but I was wondering
if it's possible to know how big the loaded file is.

Here's a quick code fragment of what I'm doing:

#inlcude <allegro.h>
#include <jpeg.h>

BITMAP *in_jpeg, *out_bmp;
RGB *in_pal, *out_pal;

int main(){
	allegro_init();

	register_bitmap_file_type("JPG",load_jpeg,save_jpeg);
	register_bitmap_file_type("JPEG",load_jpeg,save_jpeg);

	// Ask user for filename and store it in char *Filename
	.
	.
	.

	set_color_depth(8);	// I want to convert to 256 colors
	set_color_conversion(...All of them...);

	in_jpeg=load_bitmap(filename,in_pal);	// Load JPG
	out_jpeg=create_bitmap(800,600);	// Somewhere to store
	clear(out_jpeg);			// the BMP
	
	stretch_blit(....);			// Squeeze the JPG into 
		// the BMP, letting Allegro do the color conversion, too

and so on.

Now, from what I can tell from the Allegro Docs, load_bitmap will create
the in_jpeg bitmap and load the JPG into it. However, how can I get the
width and height of that bitmap.
Also, I'm assuming that the in_jpeg bitmap will be 24bit (or whatever)
but do I _have_ to go into graphics mode first. I'd prefer to stay in
Text mode all the way through and do all the graphics stuff in memory.

Hope you can help.
-- 
  Paul Saunders  | ICQ : 4161505    | E-Mail : You_Know_Who AT I DOT Am
aka Darac Marjal | PGP : 0xCC9A6F67 |  http://Move.To/PaulsPage
     Get Updates on my Sci-Fi Novel by Subscribing to my
 Mailing List : http://www.onelist.com/community/Pauls_Novel

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019