// xgrp.h MR Nov 00 // // Header file to 'xgrp.c'. #ifndef _XGRP_H_ #define _XGRP_H_ #include #include // For XK_... key defines #include // For ''back buffer'' stuff // -------------------------------------------------------------------------- // graphics stuff part 1: COLORS // -------------------------------------------------------------------------- // Global color pixel-values array (declared in 'xgrp.c'): #define MAXCOLOR 16 extern long GLOB_colorpixel[MAXCOLOR]; // Indices in global color array: #define CLR_BLACK 0 #define CLR_WHITE 1 #define CLR_GREY 2 #define CLR_RED 3 #define CLR_ORANGE 4 #define CLR_YELLOW 5 #define CLR_YELGR 6 // Yellow-Green #define CLR_GREEN 7 #define CLR_CYAN 8 #define CLR_BLUE 9 #define CLR_PURPLE 10 #define CLR_LGREY 11 #define CLR_DGREY 12 void initcolors( Display * pD ); // This function initializes the global array GLOB_colorpixel // -------------------------------------------------------------------------- // graphics stuff part 2: drawing lines etc. on the screen // -------------------------------------------------------------------------- // // Funcs & structs for use inside 'drawMyPicture()' : // typedef struct { Display * pD; Drawable d; GC gc; //Size of window (values must be managed externally of grp_... funcs): int ourScreenWidth; int ourScreenHeight; } grp_t; void grp_makenew( grp_t * pgrp, Display * pD, Drawable d ); //Fill *pgrp struct with values for Display 'pD', Drawable 'd' // and with a newly allocated and initialized ''GC'' with suitable // default settings. void grp_delete( grp_t * pgrp ); void grp_setoperation( grp_t * pgrp, int function ); // One of the GX... defines (e.g. XGset, XGclear) void grp_setcolor( grp_t * pgrp, long pm_color ); //One of the PM_... defines void grp_setlinewidth( grp_t * pgrp, int linewidth ); void grp_drawline( grp_t * pgrp, int x0, int y0, int x1, int y1 ); void grp_paintline( grp_t * pgrp, int x0, int y0, int x1, int y1, long color ); // First clear, then draw void grp_drawcircle( grp_t * pgrp, int x, int y, int radius ); void grp_fillcircle( grp_t * pgrp, int x, int y, int radius ); void grp_paintcircle( grp_t * pgrp, int x, int y, int radius, long color ); // First clear, then fill void grp_fillrect( grp_t * pgrp, int x, int y, int width, int height ); void grp_paintrect( grp_t * pgrp, int x, int y, int width, int height, long color ); // First clear, then fill void grp_paintbox( grp_t * pgrp, int x, int y, int radius, long color ); //Draw an outlined (not filled) box // -------------------------------------------------------------------------- // graphics stuff parts 3-4: drawing TEXT on the screen // -------------------------------------------------------------------------- void grp_putchar( grp_t * pgrp, unsigned char c, int x, int y ); #include #define CHARWID 6 #define CHARHI 12 void grp_strvprintf( grp_t * pgrp, int x, int y, long color, const char * pFormat, va_list valist ); void grp_strprintf( grp_t * pgrp, int x, int y, long color, const char * pFormat, ... ); #endif // _XGRP_H_