[comp.sys.amiga.programmer] Format of superhires ILBMs?

davids@ucscf.UCSC.EDU (Dave Schreiber) (06/12/91)

What is accepted way of specifying that an IFF ILBM file is a superhires
(1280x200 or 1280x400) picture?  Thanks.

-- 
Dave Schreiber                               E-mail:  davids@ucscf.ucsc.edu
"It was fun learning about logic, but I don't see where or when I will ever
use it again."                               Disclaimer:

spence@cbmvax.commodore.com (Spencer Shanson) (06/12/91)

In article <16955@darkstar.ucsc.edu> davids@ucscf.UCSC.EDU (Dave Schreiber) writes:
>
>
>What is accepted way of specifying that an IFF ILBM file is a superhires
>(1280x200 or 1280x400) picture?  Thanks.
You should be using the 2.0 LONGWORD ModeIds, and putting them in your CAMG
IFF hunk.

You can find a ViewPort's modeid using the GetVPModeID() function.

The LONG ModeIDs were designed so that if any IFF reader only uses the Low
word of the CAMG instead of the whole LONG, then you would get a ViewPort as
close to the intended mode as possible. For example, if you werre to save the
VGAPRODUCT_KEY as a LONG in the CAMG, and an IFF reader only read the low
Word, it would open a HIRES-LACE on a non-ECS machine, and a SUPERHIRES-LACE
on an ECS machine, using the default monitor type (NTSC or PAL).

>
>-- 
>Dave Schreiber                               E-mail:  davids@ucscf.ucsc.edu
>"It was fun learning about logic, but I don't see where or when I will ever
>use it again."                               Disclaimer:


-- 
---------------------------------------------------------------------------
Spencer Shanson - Amiga Software Engineer     | email: spence@commodore.COM
                                              | or uunet!cbmvax!spence
All opinions expressed are my own, and do not | Bix: sshanson
(necessarily) represent those of Commodore.   | "Copper? I hardly even
                                              | know her!"

carolyn@cbmvax.commodore.com (Carolyn Scheppner - CATS) (06/14/91)

In article <22355@cbmvax.commodore.com> spence@cbmvax.commodore.com (Spencer Shanson) writes:
>In article <16955@darkstar.ucsc.edu> davids@ucscf.UCSC.EDU (Dave Schreiber) writes:
>>
>>
>>What is accepted way of specifying that an IFF ILBM file is a superhires
>>(1280x200 or 1280x400) picture?  Thanks.
>You should be using the 2.0 LONGWORD ModeIds, and putting them in your CAMG
>IFF hunk.
>
>You can find a ViewPort's modeid using the GetVPModeID() function.
>
>The LONG ModeIDs were designed so that if any IFF reader only uses the Low
>word of the CAMG instead of the whole LONG, then you would get a ViewPort as
>close to the intended mode as possible. For example, if you werre to save the
>VGAPRODUCT_KEY as a LONG in the CAMG, and an IFF reader only read the low
>Word, it would open a HIRES-LACE on a non-ECS machine, and a SUPERHIRES-LACE
>on an ECS machine, using the default monitor type (NTSC or PAL).
>---------------------------------------------------------------------------
>Spencer Shanson - Amiga Software Engineer     | email: spence@commodore.COM


In addition, you should be storing correct aspect information in the
BMHD.  The old EA code had a bug (recently discovered) which caused
it to always store 10/11 as the aspect.  (check the part of the
code that sets the BMHD aspect - you'll see that it uses "=" rather
than "==" when checking dimensions to decide what aspect to store.

When running under 2.0, you should get the correct aspect information
from the display database and store it in the BMHD.  The display
database aspect info not only covers new modes, but is also more
correct for old modes.


;/* getaspect.c - Execute me to compile me with SAS C 5.10
LC -b1 -cfistq -v -y -j73 getaspect.c
Blink FROM LIB:c.o,getaspect.o TO getaspect LIBRARY LIB:LC.lib,LIB:Amiga.lib
quit
*/

#include <exec/types.h>
#include <exec/memory.h>
#include <libraries/dos.h>
#include <intuition/intuition.h>
#include <intuition/intuitionbase.h>
#include <graphics/displayinfo.h>

#include <clib/exec_protos.h>
#include <clib/dos_protos.h>
#include <clib/intuition_protos.h>
#include <clib/graphics_protos.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>

#ifdef LATTICE
int CXBRK(void) { return(0); }  /* Disable Lattice CTRL/C handling */
int chkabort(void) { return(0); }  /* really */
#endif


#define MINARGS 1

UBYTE *vers = "\0$VER: getaspect 37.1";
UBYTE *Copyright = 
  "getaspect v37.1\nCopyright (c) 1990 Commodore-Amiga, Inc.  All Rights Reserved";
UBYTE *usage = "Usage: getaspect";

void bye(UBYTE *s, int e);
void cleanup(void);

struct Library *IntuitionBase;
struct Library *GfxBase;

void main(int argc, char **argv)
    {
    struct Screen *first;
    struct ViewPort *vp;
    struct DisplayInfo DI;
    ULONG  modeid;

    if(((argc)&&(argc<MINARGS))||(argv[argc-1][0]=='?'))
	{
	printf("%s\n%s\n",Copyright,usage);
	bye("",RETURN_OK);
	}

    IntuitionBase = OpenLibrary("intuition.library",36);
    GfxBase = OpenLibrary("graphics.library",36);
    if((!IntuitionBase)||(!GfxBase))
	bye("Can't open V36 intuition or graphics library",RETURN_FAIL);

    first = ((struct IntuitionBase *)IntuitionBase)->FirstScreen;
    vp = &first->ViewPort;
    modeid = GetVPModeID(vp);

    if(GetDisplayInfoData(NULL, (UBYTE *)&DI, sizeof(struct DisplayInfo),
		DTAG_DISP, modeid)) {
  	printf("ModeID $%08lx\n",modeid);
	printf("PaletteRange is %ld\n",DI.PaletteRange);

	/* store these as BMHD xAspect and yAspect respectively */
	printf("Resolution is %ld by %ld\n",
			DI.Resolution.x,DI.Resolution.y);

	}
    bye("",RETURN_OK);
    }


void bye(UBYTE *s, int e)
    {
    cleanup();
    exit(e);
    }

void cleanup()
    {
    if(GfxBase)	CloseLibrary(GfxBase);
    if(IntuitionBase)	CloseLibrary(IntuitionBase);
    }


-- 
==========================================================================
 Carolyn Scheppner -- Tech. Mgr. CATS - Commodore Amiga Technical Support
 PHONE 215-431-9180 {uunet,rutgers}!cbmvax!carolyn  carolyn@commodore.com

 Oh I'm a numberjack and I'm OK, I code all night and I work all day...
==========================================================================

caw@miroc.Chi.IL.US (Christopher A. Wichura) (06/21/91)

In article <22420@cbmvax.commodore.com> carolyn@cbmvax.commodore.com (Carolyn Scheppner - CATS) writes:
>When running under 2.0, you should get the correct aspect information
>from the display database and store it in the BMHD.  The display
>database aspect info not only covers new modes, but is also more
>correct for old modes.

I've just updated GIFMachine to grab the DisplayInfo stuff under 2.0.  I'm
using HAMLACE_KEY and HAM_KEY as the type possible modeids that might get
stuffed into the ILBM.  I looked at what it stored in the BMHD for these and
they are definately not the values that the old EA iff/ILBM.h code had.  For
example, for HAMLACE_KEY it now stores x=$2C, y=$1A whereas the EA #defines
had x=$14, y=$0B.  Are these new values really correct, or is my
GetDisplayInfoData() call returning garbage?  You did mention that it had
updated values for old modes, but I just want to make sure...

Thanks,
-=> CAW

Christopher A. Wichura                Multitasking.  Just DO it.
caw@miroc.chi.il.us  (my amiga)                          ...the Amiga way...
u12401@uicvm.uic.edu (school account)