home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Club Amiga de Montreal - CAM
/
CAM_CD_1.iso
/
files
/
269.lha
/
MelaniePaint_v.60
/
sources
/
planes.c
< prev
next >
Wrap
C/C++ Source or Header
|
1989-07-16
|
2KB
|
119 lines
/*============================================================================*/
/* Planes.c: By Kevin T. Seghetti */
/* Change depth of screen */
/*============================================================================*/
#include "equates.h"
#include <functions.h>
#include <exec/types.h>
#include <intuition/intuition.h>
#include <graphics/gfx.h>
#include "iff/jiff.h"
/*----------------------------------------------------------------------------*/
extern USHORT areaPattern[];
extern FLAG UndoBuffer,PatternOn;
extern struct Screen *MPaintScreen;
extern struct NewScreen NewMPaintScreen;
extern struct Window *MPaintWindow,*ToolWindow,*PaletteWindow,*HistWindow,*CoordWindow;
extern struct RastPort UndoRastPort;
extern int MaxColor;
extern UWORD colortable[];
extern struct Window *InitWindow();
extern struct TmpRas myTmpRas;
extern struct RastPort *VRastPort;
extern SHORT PaintWidth;
extern UBYTE *TempPlane;
FLAG Tool,Palette,Coord;
/*============================================================================*/
ShutDownOldScreen()
{
if(MPaintWindow)
{
ClearMenuStrip(MPaintWindow);
CloseWindow(MPaintWindow);
}
DeleteAllPages();
Tool = (!ToolWindow);
Palette = (!PaletteWindow);
Coord = (!CoordWindow);
if(HistWindow)
CloseHistWindow();
if(CoordWindow)
CloseCoordWindow();
if(ToolWindow)
CloseToolWindow();
if(PaletteWindow)
ClosePaletteWindow();
if(UndoBuffer)
myfree_planes( UndoRastPort.BitMap );
if(MPaintScreen)
CloseScreen(MPaintScreen);
}
/*============================================================================*/
SetUpNewScreen()
{
MPaintScreen = OpenScreen(&NewMPaintScreen);
if(!MPaintScreen)
cleanup("Cannot open custom screen",5);
InitWindow();
VRastPort = MPaintWindow->RPort;
VRastPort->TmpRas = &myTmpRas;
if(PatternOn)
SetAfPt(VRastPort,&areaPattern[0],1L);
if(!TempPlane)
InitTempPlane();
InitDefaults();
LoadRGB4(&MPaintScreen->ViewPort,colortable,(long)MaxColor);
if(!Coord)
OpenCoordWindow();
if(!Tool)
OpenToolWindow();
if(!Palette)
OpenPaletteWindow();
/* InitUndoBuffer(); */
UndoBuffer = FALSE;
}
/*============================================================================*/
ChangeDepth(Depth)
int Depth;
{
if(PaintWidth > 320 && Depth == 5)
return();
ShutDownOldScreen();
NewMPaintScreen.Depth = Depth;
MaxColor = 1 << Depth;
SetUpNewScreen();
}