/* BigView.C - (c) 1987 DJH BigView will display any IFF picture independent of the physical display size. Default display size is 320 x 200 lo-res; HIRES or LACE attributes added if user width/height exceeds low resolution boundaries. Note that we do not actually call ScrollVPort, since we want to maintain Intuition compatability; the principle is the same, however. Note that not all screen widths/resolutions scroll equally smoothly; experiment! Also : the Rx/RyOffsets seem able to exceed the 1K RKM limitations; investigate. */ #include "iff.h" /* ReadILBM.C defines */ void *IntuitionBase,*GfxBase; main(argc,argv) int argc; char *argv[]; { struct PicMap picmap; struct NewScreen newscreen; struct Screen *screen; int status,dwidth,dheight,i; switch(argc) { case 0: exit(0); break; /* arrgh! WorkBench! */ case 2: dwidth=320; dheight=200; break; case 4: sscanf(argv[2],"%d",&dwidth); sscanf(argv[3],"%d",&dheight); break; default: puts("BigView file [width,height]"); exit(0); } IntuitionBase=OpenLibrary("intuition.library",0); GfxBase=OpenLibrary("graphics.library",0); if (ReadILBM(argv[1],0,&picmap)) exit(0); setmem(&newscreen,sizeof(newscreen),0); /* user dimensions can be smaller, but not larger than picture! */ if (dwidth>picmap.BitMap.BytesPerRow*8) dwidth=picmap.BitMap.BytesPerRow*8; if (dheight>picmap.BitMap.Rows) dheight=picmap.BitMap.Rows; newscreen.Width=dwidth; newscreen.Height=dheight; newscreen.ViewModes=picmap.ViewModes & HAM; /* WE decide other bits */ if (dwidth>LOWIDTH) newscreen.ViewModes|=HIRES; if (dheight>LOHEIGHT) newscreen.ViewModes|=LACE; newscreen.Type=CUSTOMSCREEN|CUSTOMBITMAP; newscreen.Depth=picmap.BitMap.Depth; newscreen.CustomBitMap=&picmap.BitMap; newscreen.DetailPen=0; newscreen.BlockPen=1; screen=OpenScreen(&newscreen); LoadRGB4(&screen->ViewPort,&picmap.colormap[0],1<BitMap.BytesPerRow*8-dwidth, ydelta=screen->BitMap.Rows-dheight; if (xdelta) /* any room to scroll right? */ for (i=1;i<=xdelta;i++) { screen->ViewPort.RasInfo->RxOffset=i; MakeScreen(screen); RethinkDisplay(); } if (ydelta) /* any room to scroll down? */ for (i=1;i<=ydelta;i++) { screen->ViewPort.RasInfo->RyOffset=i; MakeScreen(screen); RethinkDisplay(); } if (xdelta) for (i=xdelta;i;i--) { screen->ViewPort.RasInfo->RxOffset=i-1; MakeScreen(screen); RethinkDisplay(); } if (ydelta) for (i=ydelta;i;i--) { screen->ViewPort.RasInfo->RyOffset=i-1; MakeScreen(screen); RethinkDisplay(); } }