home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Fred Fish Collection 1.5
/
ffcollection-1-5-1992-11.iso
/
ff_disks
/
300-399
/
ff348.lzh
/
ILBMLib
/
Remarks
< prev
next >
Wrap
Text File
|
1990-04-15
|
7KB
|
116 lines
"iffparse.library"
VS
The dissidents "ilbm.library"
Leo Schwab has written a library, called "iffparse.library", which can be
used by any application to aid in the loading or saving of IFF files. The
dissidents' "ilbm.library" has similiar goals, but the implementation is
somewhat different. This document is meant to point out the differences
between the two libraries so that a developer can choose which one best suits
his needs.
Although the dissidents library has been written completely in assem-
bly language for speed, and the high/mid level functions are original,
this library is modeled after the Electronic Arts IFF code. This means
that it properly handles ILBM CATs, LISTs, and FORMs in a manner compatible
with the most popular Amiga graphics program, DeluxePaint. To date, it has
been tested with a variety of picture files including HAM, Hires, Lores,
Interlace, Compressed and UnCompressed, and ANIM files. It has also been
tested with files containing PROPs. Although the library has many helpful
features geared toward ILBM and ANIM files, it can be used for any type of IFF
reader/writer (i.e. SMUS, 8SVX, SAMP, etc). In fact, an example program,
Play8SVX.c, shows non-ILBM use. Furthermore, since the low level routines (i.e
WriteIFFBytes, OpenIFF, etc) are functionally identical to the EA code, it is
very easy to adapt any code written with the original EA functions to use this
library. It is fully re-entrant and about 7K in size.
The iffparse library uses a different parsing method than the EA code.
It also can handle PROPs, LISTs, and CATs, but the example programs do not
deal with ANIMs. (The ANIM spec is a slightly deviated IFF FORM). I assume
that the library won't choke on ANIMs but this is unconfirmed. Otherwise, it
is a very general IFF parser, not particularly baised toward any specific form.
Consequently, it doesn't have those extra ILBM/ANIM perks that the ilbm
library has (such as the ability to automatically decompress and scale an image
into your open window/screen, or open a proper size window/screen for you).
It has a completely different set of functions from the EA code, and so any
application written with EA code will have to be modified quite a bit. Leo's
output (write) routines seem to hinge specifically on 3 functions: PushChunk(),
WriteChunkBytes(), and PopChunk(). By passing 2 IDs, or 1 ID and a 0, Push-
Chunk and PopChunk can start/stop both Groups and SubGroups. With the ilbm
library, there are separate start/stop functions for Groups and SubGroups. I
like his Pop and Push "approach" better the original EA method, but essential-
ly, the libraries are very similiar in the complexity of the write routines.
Both require 3 separate functions to write a Group and/or sub Group ID, the
data bytes, and then end the Group/Context. Both libraries take care of
allocating/freeing internal structures for each Group/Context, and pad out odd
size chunks. One feature that iffparse does have is the option of buffered
read/write. This can result in much faster loading and saving of data, but of
course, at the expense of requiring more memory to implement. If you're
writing an application that has to run on a 512K machine, multi-task, and deals
with large files (i.e. ANIMs or several ILBMs), then you probably won't be able
to take advantage of the buffered I/O. The iffparse lib is undoubtably re-
entrant and is 8K in size, slightly larger than ilbm lib.
As mentioned, for ILBMs or ANIMs, the ilbm lib can completely take care
of many details (such as PROPS, LISTS, and CATS) in a completely invisible
manner to your application, placing all of the info in one "ILBMFrame" which
you initially allocate. That ILBMFrame's values always reflect the values of
the current group, and you can reference it at various points. The philoso-
phy is:
1). You open an IFF file and call a library routine to read/write it,
passing an ILBMFrame structure.
2). The library parses through the file, calling your specified
routines whenever it encounters something that you want to handle, or
it doesn't understand (i.e. an 8SVX VHDR chunk). Otherwise, the
library handles ILBMs and ANIMs. For an ILBM, it can even load the
image into a specified window, automatically scaled, if you wish.
For saving, it can automatically write the BMHD, CMAP, CAMG, and
BODY completely on its own.
3). Control returns to you when the file is loaded/saved.
With the iffparse.library, the philosophy is:
1). You allocate an initial structure, open the file in buffered or
unbuffered mode, and call a routine to determine its initial Group
ID.
2). You tell the library when to revert control back to you, and call
its parsing routine.
3). When the library reverts control back, you analyse the return and
then must either do something with the data, or abort the parsing.
4). You call the parsing routine again if you need to parse more of the
file.
Essentially, ilbm lib is the master and only calls you under the circumstances
you initially specify. IffParse is the slave, and reverts control back to you
under the circumstances you initially specify.
Since both libs have the same level of complexity in the read/write
routines, it's a toss-up which one you might use for IFF forms other than ANIM
and ILBM. Both are going to involve numerous calls to lib routines. If your
main interest is fast loads/saves, try IffParse lib. For large data files that
have to live in tight memory constraints, try ilbm lib. For ILBMs or ANIMs,
dissidents ilbm.library has many more features. It even has several high level
functions which make it possible to save or load a screen's bitmap as an IFF
ILBM file via a single lib call. These high level functions make it possible to
easily use the lib with interpreted languages such as Basic and Rexx. There is
even an AmigaBasic "ScreenSave" and "IlbmViewer" example. If all you need to
do with IFF is save or load a picture, then ilbm lib is the answer.
Because the ilbm library always takes care of LISTs and CATs (at the
high and mid levels), if you want to be able to read these kinds of files, then
the ilbm library should be easier for you to use. Also, if you've already
struggled through the EA code, you'll recognize some familiar function names.
Both libs come with documentation, examples, and C and Asm Include
files. Iffparse has no assembly or BASIC examples. I do not believe that it
would be easy to use from BASIC. Ilbm lib has more assembly, and an AmigaBasic
example. Ilbm lib is free. I don't believe that you can freely distribute the
Iffparse library with your product.
Obviously, dissidents has been using ilbm.library in its products, and
we hope to find time to augment the number of source examples for it. Bug
fixes are definitely forthcoming if we ever find something wrong with it. (So
far, everything works.) The one problem that has been noted and corrected is
that the C support file ILBMInterface.asm did not work with Lattice. The new
file corrects that problem. Try the library out, and if you have questions,
contact us.