|
|
DataMuseum.dkPresents historical artifacts from the history of: Commodore CBM-900 |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about Commodore CBM-900 Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - download
Length: 3109 (0xc25)
Types: TextFile
Notes: UNIX file
Names: »gctrl.c«
└─⟦f27320a65⟧ Bits:30001972 Commodore 900 hard disk image with partial source code
└─⟦2d53db1df⟧ UNIX Filesystem
└─⟦this⟧ »hr/src/smgr/gctrl.c«
#include "graph.h"
/*****************************************************************************
Return pointer to graphics state - SM_GetGraph()
Reset to default graphics state - SM_RstGraph()
Set graphics state parameters - SM_SetGraph()
Entry: msgPtr, ^Graphics parameters
msgByte0, Flags to specify which parameters to change.
Exit: SM_GetGraph() returns a pointer to the graphics state.
SM_SetGraph() changes only those parameters whose flag bit
is set in 'gflags'. A parameter is NOT changed if the
desired new value is bad.
******************************************************************************/
void SM_GetGraph()
{
extern WSTRUCT *wtbl[];
msgCmd = WM_REPLY;
msgBytL0 = sizeof(GRAPH);
*(GRAPH *) msgPtr = (wtbl[msgWid]->wn_G = gk.wn_G);
sendmsg(&msg);
}
GRAPH gkReset =
{
{ 1, 1, FP_FORE }, /* working pen (1x1 and solid black) */
L_TRUE, /* bit logical op (1's ANDed with pattern) */
FP_FORE, /* SOLID, HORIZONTAL, VERTICAL, CROSSHATCH */
FP_BACK, /* background fill pattern */
BLACK, /* foreground color (background is opposite)*/
WHITE, /* background color */
{ SYS_FID, /* system font */
0, /* in default style */
1, 1, 1, 1 /* in system font size */
},
/* user definable pattern is all 1's */
{ 0xffff, 0xffff, 0xffff, 0xffff,
0xffff, 0xffff, 0xffff, 0xffff,
0xffff, 0xffff, 0xffff, 0xffff,
0xffff, 0xffff, 0xffff, 0xffff}
};
void SM_RstGraph()
{
gk.wn_G = gkReset;
}
void SM_SetGraph()
{
GRAPH g;
register unsigned gflags;
register unsigned n;
getdata(msgSender, sizeof(GRAPH), msgPtr, &g);
gflags = msgBytL0;
if ( gflags & GCPEN )
{
if ( (n = g.wn_Pen.pn_Width) <= MAXPEN && n )
gkPen.pn_Width = n;
if ( (n = g.wn_Pen.pn_Height) <= MAXPEN && n )
gkPen.pn_Height = n;
if ( (n = g.wn_Pen.pn_Pat) <= MAXPAT )
gkPen.pn_Pat = n;
}
if ( gflags & GCFCOLOR )
{
if ( (unsigned) g.wn_Fcolor <= MAXCOLOR )
gkFcolor = g.wn_Fcolor;
}
if ( gflags & GCBCOLOR )
{
if ( (unsigned) g.wn_Bcolor <= MAXCOLOR )
gkBcolor = g.wn_Bcolor;
}
if ( gflags & GCFPAT )
{
if ( (unsigned) g.wn_Fpat <= MAXPAT )
gkFpat = g.wn_Fpat;
}
if ( gflags & GCBPAT )
{
if ( (unsigned) g.wn_Bpat <= MAXPAT )
gkBpat = g.wn_Bpat;
}
if ( gflags & GCLOG )
{
if ( (unsigned) g.wn_Logop <= L_BLTMAX )
gkLogop = g.wn_Logop;
}
/* A change took place here... the original code commented out */
/*
if ( gflags & GCFONT )
gkFont.fi_Style = g.wn_Font.fi_Style;
*/
if ( gflags & GCFONT )
gkFont = g.wn_Font;
msgCmd = WM_ACK;
msgBytL0 = sizeof(GRAPH);
sendmsg(&msg);
}
#ifdef DEBUG
dumpg()
{
printf("Graphics State:\n");
printf("\tPen:\t%d, %d, %d\n", gkPen.pn_Width, gkPen.pn_Height, gkPen.pn_Pat);
printf("\tLOG:\t%d\n", gkLogop);
printf("\tPATS:\t%d,%d\n", gkFpat, gkBpat);
printf("\tCOLS:\t%d,%d\n", gkFcolor, gkBcolor);
printf("\tFONT:\t(%d,%d), (%d,%d), i=%d, s=%d\n",
gkFont.fi_Scalex.x, gkFont.fi_Scalex.y, gkFont.fi_Scaley.x, gkFont.fi_Scaley.y,
gkFont.fi_Id, gkFont.fi_Style);
}
#endif