summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Documentation/CHANGES.DOC273
-rw-r--r--Examples/AnimExample.c129
-rw-r--r--Examples/Grabber.S66
-rw-r--r--Examples/Makefile69
4 files changed, 537 insertions, 0 deletions
diff --git a/Documentation/CHANGES.DOC b/Documentation/CHANGES.DOC
new file mode 100644
index 0000000..30e31fc
--- /dev/null
+++ b/Documentation/CHANGES.DOC
@@ -0,0 +1,273 @@
+**
+** $Id: CHANGES.DOC,v 22.1 92/06/03 00:00:25 chris Exp $
+**
+** $Author: chris $
+** $Release: 22.1 $
+** $Date: 92/06/03 00:00:25 $
+**
+
+
+
+
+CHANGES FOR V22.1
+-----------------
+
+* iff.library now makes use of the powerful "xpk" data compression standard
+ for the Amiga. If xpkmaster.library is installed, the IFFL_OpenIFF()
+ function (in read mode) will automatically recognize and decompress all
+ IFF files which are compressed with one of the xpk compression schemes.
+ This is totally transparent, and no changes whatsoever are needed.
+
+
+CHANGES FOR V21.2
+-----------------
+
+* IFFL_SaveClip() and IFFL_SaveBitMap() are now MUCH faster, and use
+ less stack.
+
+* Decompression is a tad faster, and won't corrupt memory even if
+ the input file was corrupt.
+
+
+CHANGES FOR V21.1
+-----------------
+
+This is a major upgrade. Although old binaries are 100% compatible, the
+programmer's interface changed. Here's what's new:
+
+* New names for library functions, to avoid conflicts with Commodore's
+ "iffparse.library". Basically, each function of iff.library has
+ IFFL_ prepended to its name (IFFL_OpenIFF ...).
+
+* OpenIFF() and NewOpenIFF() are both obsolete now. The former had this
+ design stupidity which would load 8SVX files into CHIP RAM; the latter
+ was added to remedy this situation, but actually the memory attribute
+ parameter of NewOpenIFF() was very rarely needed.
+ Now there's just one IFFL_OpenIFF() function, which behaves like
+ OpenIFF() except that it does NOT load 8SVX files to CHIP RAM.
+ It also has an additional parameter which lets you specify a mode
+ (Read or write).
+
+* A set of powerful IFF writing functions has been added. With these
+ functions, you can create any type of IFF FORM (not just ILBM).
+ Look at the autodocs and example programs for more information.
+
+* If you define the symbol IFFLIB_PRE21NAMES in your source codes, you
+ still can compile them using the old naming conventions. However,
+ you will lose the ability to use iffparse.library in the same files
+ because of the name clashes.
+
+* In IFFL_SaveClip() and IFFL_SaveBitMap(), the color values are now
+ calculated correctly (multiplied, not shifted).
+
+
+CHANGES FOR V20.1
+-----------------
+
+* No changes to the library, it's still 19.1
+
+* Lots of new features and bug fixes for ShowIFF (COMMAND option,
+ AppIcon mode under Kickstart 2.x, ...), see ShowIFF/ShowIFF.doc
+ for details!
+
+
+
+CHANGES FOR V19.1
+-----------------
+
+* SaveClip() and SaveBitMap() now correctly write 24 bitplane pictures.
+
+* ShowIFF correctly handles scroll boundaries under Kickstart 2.0, this
+ seems to be a 2.0 bug and so it may break again with new 2.0 releases.
+
+
+CHANGES FOR V18.8
+-----------------
+
+* Modula-2 definition module and example program added, (contributed by
+ Oliver Schraner, thanx!).
+
+* ShowIFF now adjusts the screen size according to the "normal" values
+ stored in GfxBase, for users of MoreRows or Kickstart 2.0.
+
+* ShowIFF no longer crashes if started from WorkBench under Kickstart 2.0.
+ This was actually a bug in my startup code.
+
+* Minor rearrangements in iff.h, iff.i, IFFGlue.asm and example files
+
+* No functional changes to the library (except new version number ;-)
+
+
+CHANGES FOR V18.7
+-----------------
+
+* You can now use DecodePic() to decode pictures with as many as 24
+ bitplanes. Although the original BitMap structure has only 8 pointers,
+ you can simply add more plane-pointers at the end of the structure.
+ Note that these pictures must be in a normal bit-plane format (i.e.
+ not the format for 'Deep ILBMs' specified by Commodore).
+ This feature enables my ShowIFF tool to directly display 24-bit pictures
+ scanned with the ASDG color scanner (with limited colors, of course).
+
+
+CHANGES FOR V18.6
+-----------------
+
+* DecodePic() can deal with pictures which have more planes than the
+ destination BitMap. It will decode as many planes as the BitMap.Depth
+ field of your BitMap structure specifies, all other planes will be
+ discarded. As a result of this, the error message IFF_TOOMANYPLANES
+ is now obsolete.
+
+
+CHANGES FOR V18.5
+-----------------
+
+* OpenIFF() no longer trashes memory if a corrupt FORM (with some random
+ bytes at the end of file, as generated by old DPaint) is loaded.
+
+* SHAM pictures (HAM with palette changes at each line) are now fully
+ supported by ShowIFF.
+
+
+CHANGES FOR V18.4
+-----------------
+
+* The library now handles poorly written BODY chunks correctly (such as
+ written by old DPaint versions). It can now deal with pictures with
+ a height or depth of 0.
+
+
+CHANGES FOR V18.2
+-----------------
+
+* The type IFFFILE has been redefined from 'CPTR' to 'void *'. This allows
+ you to use pointers to ULONG as your IFF file handles (which are easier
+ to use, see AnimExample.c), and the compiler won't generate warnings if
+ you pass these variables to the IFF library functions.
+
+* FindChunk() can be called with a chunk ID of 0. It then returns a pointer
+ to the first byte after the end of the current FORM. This can be used
+ by ANIM readers for jumping from FORM to FORM (see example program).
+
+
+CHANGES FOR V18.1
+-----------------
+
+* New function ModifyFrame(). This functions takes a bitmap and modifies
+ its planes according to a supplied DLTA chunk. This allows you to
+ easily display DPaint III and compatible animations.
+
+* GetViewModes() now correctly masks out the forbidden bits (SPRITES,
+ VP_HIDE and genlock). This bug caused pictures with the VP_HIDE bit
+ set not to be displayed at all!
+ It is now safe to put the result of GetViewModes() directly to the
+ NewScreen.ViewModes field, as it was supposed to.
+ Note that GetViewModes() now returns the full 32 bit CAMG entry, so
+ the prototype for GetViewModes() has changed from UWORD to ULONG.
+ The upper 16 bits of the view modes are reserved for future use by CBM.
+
+* GetColorTab() now correctly masks out the lower 4 bits of the color
+ bytes (These bits are used by some converted Sun rasterfiles).
+
+* The DecodePic() decruncher is more robust, it does not write past the
+ end of the bitmap anymore (remember those nasty 81000007/9 gurus?)
+ If you have pictures which can't be displayed, PLEASE let me know!
+
+* The library base format has changed. Since this structure was never
+ documented, this should not cause any compatibility problems. It is
+ very likely that this structure changes from release to release, so
+ don't use it!
+
+* The name for IffError() in the Assembler include file has changed to
+ IFFError() (IFF in caps) to be compatible with the C names. This
+ requires a global search-and-replace operation on your asm source
+ files.
+
+* The ShowIFF.c example program has been debugged. It should now handle
+ Overscan pictures correctly (in V16.4, it sometimes switched to
+ scrolling-mode if the picture was 480 rows high).
+ The file scanner is no longer recursive, it uses ARP's 'ALL' features.
+ ShowIFF now always returns the memory it allocates.
+
+* There is a new example program 'AnimExample.c'. It loads and displays
+ a DPaint animation, the user can set the speed and number of loops.
+ This example shows how to use the new ModifyFrame() routine.
+
+
+CHANGES FOR V17.x
+-----------------
+
+This version never existed (the IFFLIB17.ZOO release contained iff.lib 16.4).
+To avoid confusion, the new version number is now 18.
+
+
+CHANGES FOR V16.4
+-----------------
+
+* The ShowIFF.c example program was completely rewritten. It now uses the
+ ARP library for command line parsing and directory searching. A powerful
+ WorkBench handler has been added which lets you display the pictures in
+ a drawer or an entire disk by selecting the drawer or disk icon and acti-
+ vating the ShowIFF icon with extended selection.
+ If a picture is larger than the screen, you can use the mouse to scroll
+ the screen. (I have some scanned pictures with a resolution of
+ 2048x2048 pixels, which can be displayed with 1MB chip ram!)
+
+* The Play8SVX demo has been added. It plays sampled sounds from CLI and
+ WorkBench.
+
+* Internal changes to the library code (I now use the DevPac assembler V2
+ by HiSoft instead of the Manx 3.6 assembler)
+
+
+CHANGES FOR V16.3
+-----------------
+
+* The BMHD property chunks can now be in any order (which worked for V16.1,
+ but was broken in 16.2).
+
+
+CHANGES FOR V16.2
+-----------------
+
+* The SaveBitMap/SaveClip() routines sometimes generated a wrong CAMG chunk.
+ This is fixed now.
+
+* There are no more decruncher overruns corrupting the memory list
+
+
+CHANGES FOR V16.1
+-----------------
+
+Since V15.3 I got lots of suggestions, so I made the following changes.
+Note that this version is fully downward-compatible to V15.3.
+
+* There was a bug in the DecodePic() routine which called the guru if the
+ width of the picture was not a multiple of 16. It's fixed now.
+
+* The GetViewModes() routines now calculates the viewmodes correctly for
+ all picture sizes, including Super-Overscan (produced by DigiView 3.0).
+
+* When you open an IFF file with the OpenIFF() call, memory is allocated
+ and the file is read into that memory. Normally, all files are loaded
+ into whatever memory is available, but '8SVX' files are always loaded to
+ CHIP memory (the memory which is accessable by the Amiga's custom chips).
+ This solution is good for playing IFF sounds, but it is not satisfactory
+ for some other applications. The solution of this problem is quite easy:
+ I added a new routine called 'NewOpenIFF', which allows you to specify
+ the type of memory for the file.
+ So if you want to load an IFF instrument into any RAM, the right command
+ is: 'f=NewOpenIFF(filename,0L)' or 'f=OpenIFF(filename,MEMF_PUBLIC)'.
+ You can use any memory attributes you want (PUBLIC,CHIP,FAST...).
+
+* The file 'iff.h' is now split into two files: 'iff.h', which contains the
+ structure definitions and function declarations, and 'IffGlue.asm',
+ which contains the C to Assembler interface routines. These routines are
+ needed for the Manx C compilere V3.6.
+
+* The file 'IFFPragmas.h" is added to support the Lattice C compiler. It
+ was taken from an usenet article by Lyle E. Levine. (Thanks!)
+
+* The demo file 'ShowIFF.c' now correctly handles overscan pictures.
+
diff --git a/Examples/AnimExample.c b/Examples/AnimExample.c
new file mode 100644
index 0000000..28d5357
--- /dev/null
+++ b/Examples/AnimExample.c
@@ -0,0 +1,129 @@
+/*
+ AnimExample.c - A simple DPaint animation player by Christian A. Weber.
+ This program is in the public domain, use and abuse at your own risk.
+ Requires the iff.library in the LIBS: dircetory. Compiles with
+ Lattice C V5.04 (LC -v -L AnimExample), should also work with Manx.
+*/
+
+#include <exec/types.h>
+#include <graphics/gfxbase.h>
+#include <intuition/intuition.h>
+#include <libraries/iff.h> /* Our iff header file */
+
+struct Library *IntuitionBase,*IFFBase, *OpenLibrary();
+struct GfxBase *GfxBase;
+
+struct NewScreen ns =
+{
+ 0,0,0,0,0,0,0, NULL, CUSTOMSCREEN|SCREENBEHIND|SCREENQUIET, NULL,
+ (STRPTR)"Anim Player Example by Christian A. Weber", NULL, NULL
+};
+
+struct Screen *screen1,*screen2, *OpenScreen();
+ULONG *ifffile;
+
+void SetOverscan(screen) /* Adjust the screen position for overscan */
+register struct Screen *screen;
+{
+ register WORD cols,rows,x=screen->Width,y=screen->Height;
+ register struct ViewPort *vp=&(screen->ViewPort);
+
+ cols = GfxBase->NormalDisplayColumns>>1;
+ rows = GfxBase->NormalDisplayRows; if(rows>300) rows>>=1;
+ x -= cols; if(vp->Modes & HIRES) x -= cols;
+ y -= rows; if(vp->Modes & LACE) y -= rows;
+ x >>=1; if(x<0) x=0; y >>=1; if(y<0) y=0; if(y>32) y=32;
+
+ if(vp->Modes & HAM) /* Correct overscan HAM color distortions */
+ {
+ if(GfxBase->ActiView->DxOffset-x < 96)
+ x=GfxBase->ActiView->DxOffset-96;
+ }
+ vp->DxOffset = -x; vp->DyOffset = -y;
+ MakeScreen(screen); RethinkDisplay();
+}
+
+void Fail(text) /* Print error message, free resources and exit */
+char *text;
+{
+ printf("%s, IFFError = %ld\n",text,IFFError());
+
+ if(ifffile) CloseIFF(ifffile);
+ if(screen1) CloseScreen(screen1);
+ if(screen2) CloseScreen(screen2);
+
+ if(IFFBase) CloseLibrary(IFFBase); /* MUST ALWAYS BE CLOSED !! */
+ CloseLibrary(IntuitionBase);
+ CloseLibrary(GfxBase);
+ exit(0);
+}
+
+void main(argc,argv)
+int argc;
+char **argv;
+{
+ register LONG count,i,delay;
+ register ULONG *form,*loopform;
+ struct BitMapHeader *bmhd;
+ UWORD colortable[128];
+
+ if((argc != 4) || !strcmp(argv[1],"?")) {
+ printf("Format: %s filename <delaytime> <# of loops>\n",argv[0]);
+ exit(20);
+ }
+
+ GfxBase = (struct GfxBase *)OpenLibrary("graphics.library",0L);
+ IntuitionBase = OpenLibrary("intuition.library",0L);
+
+ if(!(IFFBase = OpenLibrary(IFFNAME,IFFVERSION))) {
+ printf("Copy the iff.library to your LIBS: directory!\n");
+ exit(10);
+ }
+
+ if(!(ifffile=OpenIFF(argv[1]))) Fail("Error opening file");
+ form=ifffile+3; /* Skip FORM....ANIM */
+
+ if(ifffile[2] != ID_ANIM) Fail("Not an ANIM file");
+ if(!(bmhd=GetBMHD(form))) Fail("BitMapHeader not found");
+
+ ns.Width = bmhd->w;
+ ns.Height = bmhd->h;
+ ns.Depth = bmhd->nPlanes;
+ ns.ViewModes = GetViewModes(form);
+
+ if(!(screen1 = OpenScreen(&ns))) Fail("Can't open screen 1!");
+ if(!(screen2 = OpenScreen(&ns))) Fail("Can't open screen 2!");
+ SetOverscan(screen1); SetOverscan(screen2);
+
+ count = GetColorTab(form,colortable);
+ if(count>32L) count = 32L; /* Some HAM pictures have 64 colors ?! */
+ LoadRGB4(&(screen1->ViewPort),colortable,count);
+ LoadRGB4(&(screen2->ViewPort),colortable,count);
+
+ /* Decode and display the first frame: */
+ if(!DecodePic(form,&screen1->BitMap)) Fail("Can't decode picture");
+ DecodePic(form,&screen2->BitMap);
+ ScreenToFront(screen2);
+ if((delay=atol(argv[2])) > 1) Delay(delay);
+
+ /* Decode and display the second frame: copy and modify the first one */
+ form=FindChunk(ifffile+3,0L); /* First FORM containing a DLTA */
+ if(!ModifyFrame(form,&screen1->BitMap)) Fail("Can't decode frame");
+ ScreenToFront(screen1);
+ if(delay>1) Delay(delay);
+
+ loopform=FindChunk(form,0L); /* FORM to start loop at */
+ for(i=0; i<atol(argv[3]); ++i) /* Loop n times */
+ {
+ for(form=loopform; *form==ID_FORM; form=FindChunk(form,0L))
+ {
+ register struct Screen *dummy;
+ if(!ModifyFrame(form,&screen2->BitMap)) Fail("Can't decode frame");
+ dummy=screen1; screen1=screen2; screen2=dummy; /* Flip screens */
+ ScreenToFront(screen1);
+ if(delay>1) Delay(delay);
+ }
+ }
+ Fail("done"); /* Normal termination */
+}
+
diff --git a/Examples/Grabber.S b/Examples/Grabber.S
new file mode 100644
index 0000000..1a7faa1
--- /dev/null
+++ b/Examples/Grabber.S
@@ -0,0 +1,66 @@
+**
+** $Id: Grabber.S,v 21.1 92/05/28 17:09:27 chris Exp $
+** $Revision: 21.1 $
+**
+** $Filename: Examples/Grabber.S $
+** $Authors: Christian Haller, CHW $
+** $Release: 21.1 $
+** $Date: 92/05/28 17:09:27 $
+**
+** Example for low level Assembler hackers :-)
+**
+** This program saves the contents of the first screen as an IFF file
+** with filename 'RAM:grabber.pic'. The iff.library is required.
+** If you use the DevPac assembler, type 'Genim2 Grabber' to assemble.
+** For simplicity, this program uses hard coded constants. You may wish
+** to use the appropriate standard header files instead.
+**
+** THIS IS PD. NO WARRANTY. USE AT YOUR OWN RISK.
+**
+
+Main: move.l 4,a6 ; AbsExecBase
+ lea IFFName(PC),a1 ; Library Name
+ moveq #16,d0 ; Required library version
+ jsr -552(a6) ; OpenLibrary()
+ move.l d0,a4 ; A4 : IFF Library Base
+ tst.l d0 ; Did we get it ?
+ bne.s IFFOpen ; Yes --->
+ moveq #20,d0 ; Return-code RETURN_FAIL
+ rts ; Return to CLI
+IFFOpen:
+ lea IntuiName(PC),a1 ; Intuition Library Name
+ jsr -408(a6) ; OldOpenLibrary()
+ move.l d0,a5 ; A5 : IntuitionBase
+
+ move.l 60(a5),a0 ; IntuitionBase->FirstScreen
+ move.l 88(a0),d6 ; Screen.BitMap
+
+ move.l 48(a0),a1 ; struct Colormap
+ move.l 4(a1),d7 ; struct ColorTable
+ lea 44(a0),a1 ; sc_ViewPort
+ move.w 32(a1),d1 ; vp_Modes
+ moveq #1,d0 ; Set cruncher-flag
+ btst #11,d1 ; Hold And Modify ?
+ beq.s NoHam ; no --->
+ bset #7,d0 ; Set HAM-Flag for IFF.lib
+NoHam:
+ move.l a4,a6 ; IFFBase
+ lea FileName(PC),a0 ; Name of file to save
+ move.l d6,a1 ; Pointer to BitMap
+ move.l d7,a2 ; Pointer to ColorMap
+ jsr -66(a6) ; SaveBitMap()
+
+ move.l 4,a6 ; AbsExecBase
+ move.l a4,a1 ; IFFBase
+ jsr -414(a6) ; CloseLibrary() (IMPORTANT!)
+
+ move.l a5,a1 ; IntuitionBase
+ jsr -414(a6) ; CloseLibrary()
+
+ moveq #0,d0 ; DOS return code
+ rts
+
+IFFName: dc.b "iff.library",0
+IntuiName: dc.b "intuition.library",0
+FileName: dc.b "RAM:grabber.pic",0
+
diff --git a/Examples/Makefile b/Examples/Makefile
new file mode 100644
index 0000000..3343a0d
--- /dev/null
+++ b/Examples/Makefile
@@ -0,0 +1,69 @@
+##
+## $Id: $
+## $Revision: $
+##
+## $Filename: Examples/Makefile $
+## $Author: Christian A. Weber $
+## $Release: 21.1 $
+## $Date: 92/05/17 03:09:18 $
+##
+## Makefile to build iff.library examples
+##
+## COPYRIGHT (C) 1987-1993 BY CHRISTIAN A. WEBER, BRUGGERWEG 2,
+## CH-8037 ZUERICH, SWITZERLAND.
+## THIS FILE MAY BE FREELY DISTRIBUTED. USE AT YOUR OWN RISK.
+##
+
+ALL: EasyExample AnimExample GrabScreen
+
+
+#############################################################################
+## Flags
+
+CFLAGS = -cfustq -fid -ms -v -rr -s -O
+AFLAGS = -l -iINCLUDE:
+LFLAGS = ADDSYM
+
+
+#############################################################################
+## Rules
+
+.s.o:
+ Genam $(AFLAGS) $*.S
+
+.c.o:
+ LC $(CFLAGS) $*.c
+
+
+#############################################################################
+## EasyExample
+
+EX_STARTUP = LIB:c.o
+EX_MODULES = EasyExample.o
+EX_LIBS = LIB:lcr.lib
+
+EasyExample: $(EX_STARTUP) $(EX_MODULES) $(EX_LIBS)
+ BLINK FROM $(EX_STARTUP) $(EX_MODULES) TO $* LIB $(EX_LIBS)
+
+
+#############################################################################
+## AnimEXample
+
+AX_STARTUP = LIB:c.o
+AX_MODULES = AnimExample.o
+AX_LIBS = LIB:lcr.lib
+
+AnimExample: $(AX_STARTUP) $(AX_MODULES) $(AX_LIBS)
+ BLINK FROM $(AX_STARTUP) $(AX_MODULES) TO $* LIB $(AX_LIBS)
+
+
+#############################################################################
+## GrabScreen
+
+GS_STARTUP = LIB:c.o
+GS_MODULES = GrabScreen.o
+GS_LIBS = LIB:lcr.lib
+
+GrabScreen: $(GS_STARTUP) $(GS_MODULES) $(GS_LIBS)
+ BLINK FROM $(GS_STARTUP) $(GS_MODULES) TO $* LIB $(GS_LIBS)
+