T32QC@CUNYVM.BITNET (NEO) (02/06/91)
This is some code to open up a graphic screen without using intuition
You dont have to worry about title bar etc. I was just wondering how do I
make this screen overscan. This opens up a 640 * 400 screen with 16 colors.
Any help on how to make this an overscaned screen would be greatly appreciated
Thanks
T32QC@CUNYVM.BITNET
-------------------Cut Here----------------------------------
/**********************************************************/
/* This Opens a 640*400 Screen 16 Colors */
/**********************************************************/
#include "exec/types.h"
#include "exec/memory.h"
#include "exec/devices.h"
#include "graphics/gfx.h"
#include "graphics/gfxbase.h"
#include "graphics/gfxmacros.h"
#include "graphics/text.h"
#include "graphics/view.h"
#include "graphics/clip.h"
#include "graphics/copper.h"
#include "graphics/gels.h"
#include "graphics/regions.h"
#include "hardware/blit.h"
#include "devices/keymap.h"
#define Width 640
#define Height 400
#define Depth 4
#define MODES HIRES|LACE
struct GfxBase *GfxBase;
struct View View;
struct ViewPort ViewPort;
struct RasInfo RasInfo;
struct BitMap BitMap;
struct RastPort RastPort;
struct View *oldView;
USHORT Colors[16] = {
0x000,0xfff,0x0bf,0x09f,
0x07f,0x06f,0x04f,0x02f,
0x00f,0x20f,0x40f,0xbbb,
0x999,0x888,0x777,0x666
};
/**********************************************************/
/* Grafix Setup */
/**********************************************************/
main()
{
int i;
if((GfxBase = (struct GfxBase *)
OpenLibrary("graphics.library",0)) == NULL)
{
printf(" No Graphics !!!!!");
Exit (0);
}
oldView = GfxBase->ActiView;
InitView (&View);
InitVPort (&ViewPort);
View.ViewPort = &ViewPort;
View.Modes = MODES;
ViewPort.DWidth = Width;
ViewPort.DHeight = Height;
ViewPort.RasInfo = &RasInfo;
ViewPort.Modes = MODES;
ViewPort.ColorMap = (struct ColorMap *)GetColorMap (16);
if (ViewPort.ColorMap == 0) goto cleanup1;
RasInfo.Next = NULL;
RasInfo.RxOffset = 0;
RasInfo.RyOffset = 0;
RasInfo.BitMap = &BitMap;
InitBitMap (&BitMap, Depth, Width, Height);
for (i=0; i<Depth; i++)
{
BitMap.Planes[i] = (PLANEPTR)
AllocRaster (Width,Height);
if (BitMap.Planes[i] == 0)
{
printf ("No Memory for BitPlanes\n");
goto cleanup1;
}
else
BltClear (BitMap.Planes[i],
RASSIZE (Width,Height),0);
}
InitRastPort (&RastPort);
RastPort.BitMap = &BitMap;
LoadRGB4(&ViewPort,&Colors[0],16);
MakeVPort (&View, &ViewPort);
MrgCop (&View);
LoadView (&View);
/****************************************************/
/* Place Code in here such as draw lines etc. */
/****************************************************/
/****************************************************/
/* Cleanup Routines */
/****************************************************/
FreeColorMap (ViewPort.ColorMap);
FreeVPortCopLists (&ViewPort);
FreeCprList (View.LOFCprList);
FreeCprList (View.SHFCprList);
cleanup1: for (i=0; i<Depth; i++)
{
if (BitMap.Planes[i] != NULL)
FreeRaster (BitMap.Planes[i],
Width,Height);
}
LoadView (oldView);
CloseLibrary(GfxBase);
return (0);
}jnmoyne@lbl.gov (Jean-Noel MOYNE) (02/07/91)
The old-fashion (i.e. 1.3) way to open an overscan ViewPort (first,
don't know if it's different in 2.0, and anyway your program is a 1.3
program (no tags)):
It's very easy, to have .. like 16 pixels of overscan on each side:
ViewPort.DxOffset=-16;
ViewPort.DyOffset=-16;
and that's it !! (don't forget to add 32 to your screen's height & width),
and if you modify the caracteristics of your vp on the fly, don't forget
to do a MakeVPort, MrgCop & LoadView to update the display.
JNM
--
These are my own ideas (not LBL's)