www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/03/25/20:24:02

From: Shawn Hargreaves <Shawn AT talula DOT demon DOT co DOT uk>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: converting data in memory to stream
Date: Tue, 25 Mar 1997 19:26:32 +0000
Organization: None
Distribution: world
Message-ID: <Gc5CwFAobCOzEwEz@talula.demon.co.uk>
References: <tQhk9AA8R4HzEwpx AT jenkinsdavid DOT demon DOT co DOT uk>
<or1VzBAaUjKzEwS2 AT jenkinsdavid DOT demon DOT co DOT uk>
<bihl$LAZFsKzEwE2 AT talula DOT demon DOT co DOT uk>
<Pine DOT OSF DOT 3 DOT 91 DOT 970325113510 DOT 29770G-100000 AT hermes DOT otago DOT ac DOT nz>
NNTP-Posting-Host: talula.demon.co.uk
MIME-Version: 1.0
Lines: 27
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Michael Bevin writes:
>i've got a programme which uses an allegro datafile to store heaps of 
>jpgs and then uses this jpg library to decode them except the jpg library 
>needs the input coming from a stream (ie *fp) so i have to write 
>each jpg to disk and then fopen it which is pretty 
>pointless... is there any way i can get around this?

As of Allegro 2.2 you can use the register_datafile_object() function to
define your own loading routines for custom object types. The trouble is
that Allegro will give you a pointer to a PACKFILE stream rather than a
regular stdio file, and there's no easy way around that. You could
investigate the possibility of modifying the jpeg library to use Allegro
functions (the syntax is mostly the same, just replace FILE with
PACKFILE and prefix all the reading functions with "pack_").
Alternatively you might be able to use the djgpp filesystem extensions
to hook the Allegro decompression code into the regular disk access
system, but I don't know anything about how that works, and suspect it
would be quite complex...

The easy solution would of course be just not to use datafiles :-) The
main benefit of them is the compression, and since jpegs are already
heavily compressed I doubt my LZSS code will work very well...


--
Shawn Hargreaves - shawn AT talula DOT demon DOT co DOT uk - http://www.talula.demon.co.uk/
Beauty is a French phonetic corruption of a short cloth neck ornament.

- Raw text -


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