home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
QBasic & Borland Pascal & C
/
Delphi5.iso
/
C
/
Samples
/
CSAPE32.ARJ
/
INCLUDE
/
PMAPDECL.H
< prev
next >
Wrap
C/C++ Source or Header
|
1990-11-06
|
4KB
|
96 lines
/*
pmapdecl.h
% declarations for pixel maps
OWL 1.2
Copyright (c) 1988 by Oakland Group, Inc.
ALL RIGHTS RESERVED.
Revision History:
-----------------
2/04/89 ted: Moved device-specific stuff into dig level (dpmap_Control)
2/23/88 ted: Added pmap_Copy.
5/09/89 ted Changed Alloc/Free terms to Open/Close.
7/05/89 ted Added pmap_IoInit macros and related stuff.
7/12/89 ted Converted '_func' prototypes from typedef to macro.
8/08/89 ted Added bmap stuff.
3/28/90 jmd ansi-fied
5/08/90 jmd added underscores to func macros for vms compiler
11/06/90 ted moved the pmapioreq stuff to dispdecl.h and dispprot.h.
*/
/* -------------------------------------------------------------------------- */
/* Bitmap stuff */
#define bmap_GetArraySize(w,h) ((h) * (((w) + 7) / 8))
#define bmap_GetSize(w,h) (bmap_GetArraySize(w, h) + 2*sizeof(odim))
#define bmap_GetLineBytes(bm) (((bm)->width + 7) / 8)
#define bmap_GetLine(bm,l) ((bm)->array + (l) * bmap_GetLineBytes(bm))
#define bmap_struct(w, h) \
struct {odim width; odim height; byte array[bmap_GetArraySize(w, h)];}
typedef bmap_struct(1,1) *bmap_type;
/* -------------------------------------------------------------------------- */
typedef struct pmap_struct {
odim width; /* width of pixmap in pixels */
odim height; /* height of pixmap in pixels */
boolean onboard; /* to request pixmap in display memory */
boolean onscreen; /* if onboard, to request pixmap in visible display */
opcoord xpos; /* if onscreen, position of requested pixmap on screen */
opcoord ypos; /* if onscreen, position of requested pixmap on screen */
VOID *xdata; /* pointer to implementation-specific data */
} *pmap_type;
typedef struct pmap_struct pmapreq_struct;
typedef struct _pmapclearreq {
pmap_type pmap;
opixval color;
} pmapclearreq_struct;
typedef struct _pmapcopyreq {
pmap_type spmap;
pmap_type dpmap;
} pmapcopyreq_struct;
/* -------------------------------------------------------------------------- */
/* PMAPX.C */
extern void pmap_Clear(pmap_type pmap, opixval color);
extern void pmap_Copy(pmap_type dpmap, pmap_type spmap);
/* PMAPOPEN.C */
extern pmap_type pmap_OpenOnboard(odim width, odim height, boolean onboard, boolean onscreen, opcoord xpos, opcoord ypos);
/* PMAPLOAD.C */
extern pmap_type pmap_Load(FILE *fd, ocolmap_type crange);
extern pmap_type pmap_LoadBfile(VOID *xbfile, char *name, ocolmap_type crange);
extern boolean pmap_Save(FILE *fd, pmap_type pmap, ocolmap_type cmap);
extern boolean pmap_SaveBfile(VOID *xbfile, char *name, pmap_type pmap, ocolmap_type cmap);
/* -------------------------------------------------------------------------- */
#define pmap_Open(width, height) pmap_OpenOnboard(width, height, FALSE, FALSE, 0, 0)
#define pmap_Close(pmap) pmap_Control(PC_CLOSEPMAP, pmap, NULL)
#define pmap_GetWidth(pmap) ((pmap)->width)
#define pmap_GetHeight(pmap) ((pmap)->height)
#define pmap_clippoint(pmap,xp,yp) \
opwh_clippoint(pmap_GetWidth(pmap), pmap_GetHeight(pmap), (xp), (yp))
#define pmap_clipbox(pmap,boxp) \
opwh_clipbox(pmap_GetWidth(pmap), pmap_GetHeight(pmap), (boxp))
/* This pmap_Ok macro assumes that a valid pixel map will:
- have its boolean variable values either 0 or 1.
- have its xpos set non-negative.
- have its xpos non-zero if onboard is FALSE
*/
#define pmap_Ok(pm) ((pm) != NULL && \
((unsigned)(pm)->onboard) <= 1 && \
((unsigned)(pm)->onscreen) <= 1 && \
( ((pm)->onboard == FALSE) ? ((pm)->xpos > 0) : ((pm)->xpos >= 0) ))
/* -------------------------------------------------------------------------- */