📄 grafdata.c
字号:
/*************************************************************************/
/* */
/* Copyright (c) 1997 Accelerated Technology, Inc. */
/* */
/* PROPRIETARY RIGHTS of Accelerated Technology are involved in the */
/* subject matter of this material. All manufacturing, reproduction, */
/* use, and sales rights pertaining to this subject matter are governed */
/* by the license agreement. The recipient of this software implicitly */
/* accepts the terms of the license. */
/* */
/*************************************************************************/
/*************************************************************************/
/* */
/* FILE NAME VERSION */
/* */
/* grafdata.c 1.9 */
/* */
/* COMPONENT */
/* */
/* All */
/* */
/* DESCRIPTION */
/* */
/* This file is the MetaWINDOW Global Graphics Data Area. */
/* */
/* AUTHOR */
/* */
/* Robert G. Burrill, Accelerated Technology, Inc. */
/* */
/* DATA STRUCTURES */
/* */
/* None */
/* */
/* FUNCTIONS */
/* */
/* None */
/* */
/* DEPENDENCIES */
/* */
/* HISTORY */
/* */
/* NAME DATE REMARKS */
/* */
/* */
/*************************************************************************/
#include "meta_wnd.h"
#include "metconst.h" /* MetaWINDOW Constant & Stucture Definitions */
#include "metports.h" /* MetaWINDOW Port & Bitmap Definitions */
#include "grafdata.h"
//#include "Nu_math.h"
/* ===== Macros to "align" without generating data ===== */
#define MALIGN short AlnTemp;
#define MALIGN1 byte AlnTemp;
/* Start of graphics data block */
/* ========== Tracking Globals ==========
The ISR switches to this data area as part of it's service. Our
cursor routine typically requires more stack than the OS provides, so
this special data area is for our tracking ISR. Guessing at the size
is a little problematic, because those nasty mouse drivers can do all
kinds of nutty stuff and use stack like crazy. By placing this data
area at the top of our data space, a variety of these nasty ISR/protected
mode/stack problems can be caught, as a segment violation will occur
should a stack overflow arise.
*/
short ISR_STACK[512]; /* Local Tracking ISR stack */
struct _mouseRcd *curTrack; /* current tracking input device */
/* ========== Generic Globals =================== */
short LocX; /* Current global X location */
short LocY; /* Current global Y location */
rect ViewClip; /* "Global" Clipping Limit Rectangle */
DEFN localXconst; /* Local co-ordinate conversion constants */
DEFN localYconst;
DEFN localXinvert;
DEFN localYinvert;
short virtXnumer; /* Virtual co-ordinate conversion factors */
short virtYnumer;
short virtXdenom;
short virtYdenom;
short virtXround;
short virtYround;
DEFN virtXconst;
DEFN virtYconst;
short globalLevel; /* Global co-ordinate indicator ( < 0 = global) */
short grafError; /* Error post code */
short hugeSelAdd; /* 186/286 selector addition value */
short biosSeg; /* selector/segment to fetch BIOS data */
#ifdef CPU386
short dllSeg; /* data segment that the dll runs is */
short dllFill;
long dllFixup; /* offset to add to address to = dll address */
#endif
short gFlags; /* Graphic flags */
#if SIZEOFF == 4
MALIGN
#endif
/* ========== Global grafPort and grafMap Variables =================== */
struct _metaPort *thePort; /* pointer to current grafPort */
struct _metaPort grafPort; /* Shadow copy of current grafPort */
struct _metaPort defPort; /* Default grafPort */
struct _grafMap defGrafMap; /* Default grafMap */
/* ========== Global Blit Record and Blit List =================== */
struct _blitRcd grafBlit; /* Default blit record */
struct _grafBlist grafBlist;
/* ==================== Indirect Vectors ============ */
long QueueIDV; /* event queue posting code */
void (*TrackIDV)(); /* cursor tracking code */
void (*MovCursIDV)(); /* cursor update (resume) */
long lineExecIDV; /* vector to current line routine */
long lineThinIDV; /* vector to thin line primitive */
long lineDashIDV; /* vector to dashed line routine (thin or square pen) */
long linePattIDV; /* vector to patterned thin, square any thin or square pen */
long lineOvalIDV; /* vector to oval pen (patterned, no dash though!) */
long lineOvPolyIDV; /* vector to oval pen polyline */
long lineSqPolyIDV; /* vector to square pen polyline */
void (*txtAlnIDV)(); /* vector to current aligned text func */
void (*txtDrwIDV)(); /* vector to current plain text func */
void (*txtAPPIDV)(); /* vector for text align pre-processor */
void (*txtStrokeIDV)(); /* vector for stroked draw function */
void (*stpEventIDV)(); /* vector for StopEvent */
int (*stpMouseIDV)(); /* vector for StopMouse */
long IDVEnd; /* end of indirect vectors */
/* ==================== Line Style Lookup Table ============ */
/* this relates pen flags to a line style IDV */
long *lineStyleTbl[16]; /* 0 = thin, 1 = dash, 2 = patterned, 3 = oval */
/* ======= Shadow of EGA palette hardware ======== */
byte EGApaldata[16]; /* 16 byte entries */
/* ========== Input Device Globals ========== */
struct _mouseRcd *curInput; /* current input device */
struct _mouseRcd defMouse; /* default input record */
long driverMouse; /* pointer to mouse record for our internal drivers */
long msSerialMouse;
long moSerialMouse;
long joyMouse;
/* ========== Event System Globals ========== */
short eventMask; /* system event mask */
short eventMaskFill; /* address filler */
struct _mouseRcd defKBrd; /* default keyboard input record */
/* Event Queue */
DEFN q_Size; /* event queue size in elements */
long q_Start; /* pointer to top of event queue */
long q_End; /* pointer to end of event queue */
DEFN q_Head; /* offset to current last queue entry */
DEFN q_Tail; /* offset to current first queue entry */
/* ========== Hi Resolution Timer Globals ========== */
long tmrTimeBase; /* user time base setting */
/* ========== Global Dash Lists ========== */
byte dashList1[8];
byte dashList2[8];
byte dashList3[8];
byte dashList4[8];
byte dashList5[8];
byte dashList6[8];
byte dashList7[8];
dashRcd DashTable[8]; /* Current dash list */
dashRcd DefDashTable[8]; /* Default dashlist */
/* ==================== Cursor Globals ======================= */
short CursorLevel; /* cursor display level (<0 = hidden) */
short CursorX; /* current cursor X position */
short CursorY; /* current cursor Y position */
short CursorNumbr; /* current cursor style */
long CursBackColor; /* current cursor colors */
long CursForeColor;
IMAGSTRUCT *CursorMask; /* pointer to current cursor back color image */
IMAGSTRUCT *CursorImag; /* pointer to current cursor fore color image */
DEFN CursorXoff;
DEFN CursorYoff;
/* cursor "save under" buffer */
byte CursorSave[CursorSaveSize];
struct _blitRcd cursBlit; /* cursor blit record */
struct _rect cursBlist; /* cursor blit list */
struct _rect cursClip; /* cursor clip rect */
#ifdef FIXUP386
grafMap *cursBmap; /* copy of cursor grafmap pointer
that never gets fixed up */
#endif
/* cursor protect rectangle */
short ProtXmin; /* Protect Xmin */
short ProtYmin; /* Protect Ymin */
short ProtXmax; /* Protect Xmax */
short ProtYmax; /* Protect Ymax */
/* protect rectangle + hotX/hotY offsets */
short CursProtXmin; /* Protect Xmin */
short CursProtYmin; /* Protect Ymin */
short CursProtXmax; /* Protect Xmax */
short CursProtYmax; /* Protect Ymax */
/* special globals for hypercursor */
/* (for further information of the following structures see CURSOR.DOC) */
DEFN cursDoHyper; /* true if want to use hypercursor */
long **cursBMapRowTbl; /* cursBMap->mapTable[0] */
DEFN cursBMapYmax; /* cursBMap->pixHeight - 1 */
DEFN cursBMapBytesM1; /* cursBMap->pixBytes - 1 */
DEFN cursImagBytesM1; /* cursImag->imRowBytes (need +1 for shifted cases) */
DEFN cursImagHeightM1; /* cursImag->imHeight - 1 */
DEFN curActive[8][4]; /* (offsets to 8 active shift-images)
x (curMask,curMDta,curImag,curIDta) */
byte curBuffer[curBuffSz]; /* Translated cursor work buffer ('m' cursors)
x (2 masks/cursor) x (8 shift-images/mask) */
/* ==================== Global Cursor Lists ======================= */
/* ==================== Default Cursor Data ======================= */
/* Arrow Cursor */
IMAGSTRUCT CursorMask0;
IMAGSTRUCT CursorImag0;
/* Checkmark Cursor */
IMAGSTRUCT CursorMask1;
IMAGSTRUCT CursorImag1;
/* Crosshair Cursor */
IMAGSTRUCT CursorMask2;
IMAGSTRUCT CursorImag2;
/* Box Cursor */
IMAGSTRUCT CursorMask3;
IMAGSTRUCT CursorImag3;
/* Pointing-Hand Cursor */
IMAGSTRUCT CursorMask4;
IMAGSTRUCT CursorImag4;
/* "Hold"ing Hand Cursor */
IMAGSTRUCT CursorMask5;
IMAGSTRUCT CursorImag5;
/* Question Cursor */
IMAGSTRUCT CursorMask6;
IMAGSTRUCT CursorImag6;
/* Hourglass Cursor */
IMAGSTRUCT CursorMask7;
IMAGSTRUCT CursorImag7;
/* Current cursor list */
long CursorTable[8][4];
/* Default cursor list */
long DefCursorTable[8][4];
/* ==================== Default Pattern List ======================= */
/* ==================== Default Pattern Data ======================= */
struct _FillPat FillPat[32];
struct _patList patTable;
/* ==================== Driver & Resource Data =============== */
struct DriverLoaded DLTable[NUMDLTBL];
byte metaPathStr[128]; /* users path sepcification */
/* ======================= Work Space GrafMap ======================== */
struct _grafMap workGrafMap;
/* pointers to areas allocated via GrafAlloc
default driver - DLTable.DLResAdr
default rowtables - defGrafMap.mapTable
pool - mpWorkSpace
default font - defFont */
/* ======================= Memory Pool Area ======================== */
DEFN mpSize; /* pool size */
byte *mpWorkSpace; /* pointer to free pool area */
byte *mpWorkEnd; /* pointer to end of pool area */
short mpRowTblSz; /* size allocated workGrafMaps rowtable */
/* ======================= Font Code Work Variables =================== */
short fntVertAln; /* "current" font vert alignment */
short fntVertTbl[4]; /* font alignment table entries (4) */
char *defFont; /* pointer to default font */
/* ========== Stroked Font Variables ============= */
short StrokeFlags;
short StrokeFlagsFill; /* address filler */
#ifndef FIXPOINT
float qDxx;
float qDxy;
float qDyy;
float qDyx;
float qPxx;
float qPxy;
float qPyy;
float qPyx;
float sinSlant;
float cosSlant;
#else
long qDxx;
long qDxy;
long qDyy;
long qDyx;
long qPxx;
long qPxy;
long qPyy;
long qPyx;
long sinSlant;
long cosSlant;
#endif
byte qDxxSign;
byte qDxySign;
byte qDyySign;
byte qDyxSign;
byte qPxxSign;
byte qPxySign;
byte qPyySign;
byte qPyxSign;
/* ========== Point In/On support ============= */
short PtRslt; /* the result area */
short PtRsltFill; /* address filler */
struct _rect PtTstR; /* The test rectangle */
/* ========== Region Capture support ============= */
rect *regCapPtr; /* capture buffer pointer */
DEFN regCapSize; /* capture buffer size */
DEFN regCapNdx; /* current capture index */
void (*regSaveFill)(); /* fill primitive pointer save area */
DEFN regPenFlags; /* pen flags save area */
/* ========== Bezier Fill/Frame support ============= */
point *ptrBEZPTS; /* pointer into bezPts array */
/* ========== XMS memory support Variables ============= */
long XMSManager;
long xmsLength;
short xmsSrcHand;
short xmsDstHand;
long xmsSrcOff;
long xmsDstOff;
/* ========== Default palette settings ============= */
unsigned short DefPal[16][4];
/* =============== Copyright Notice ===================
This copyright is checked by InitGrafix() and must not be altered */
char Copyright[58];
char *imbFnt; /* pointer to imbedded font */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -