40 # define SC_pixel_t unsigned char 44 typedef SC_pixel_t image_t;
46 typedef SC_pixel_t huge image_t;
51 # include <X11/Xlib.h> 52 # include <X11/keysym.h> 53 # include <X11/Xutil.h> 55 # define SC_C_BACKGROUND 12 57 # define SC_C_FULL 255 59 extern Display* SCX_display;
60 extern Window SCX_window;
63 extern XVisualInfo SCX_visual_info;
64 extern unsigned long SCX_color_translation[SC_C_FULL + 1];
66 extern int SC__curPointX, SC__curPointY, SC__filled;
67 extern unsigned long SC__color;
68 extern unsigned SCX_X_MAX(
void), SCX_Y_MAX(
void);
73 # if defined(__cplusplus) || defined(c_plusplus) 74 # define SCX_get_class(vinfo) vinfo.c_class 76 # define SCX_get_class(vinfo) vinfo.class 79 extern void SCX_START(
void);
81 extern void SCX_START_BIG(
void);
82 extern void SCX_STOP(
int stop);
83 extern int SCX_WRITE(
int* x,
int* y,
char* text);
84 extern void SCX_PutImg(image_t*,
int x_begin,
int y_begin,
int lengthX,
int lengthY);
86 # define SCREEN_X_MAX 1024 87 # define SCREEN_Y_MAX 864 88 # define SC_START() SCX_START() 89 # define SC_START_BIG() SCX_START_BIG() 90 # define SC_STOP() SCX_STOP(0) 91 # define SC_STOP_CLEAR() SCX_STOP(1) 92 # define SC_FLUSH() XSync(SCX_display, False) 93 # define SC_X_MAX SCX_X_MAX() 94 # define SC_Y_MAX SCX_Y_MAX() 95 # define SC_CHAR_WIDTH 10 96 # define SC_CHAR_HEIGHT 10 97 # define SC_CHAR_SPACING 7 98 # define SC_PutImg(image, x, y, lx, ly) SCX_PutImg(image, x, y, lx, ly) 99 # define SC_TJUST(hor, ver) 100 # define SC_TSTYLE(par) 101 # define SC_PRMFIL(par) SC__filled = par 102 # define SC_COLOR(par) XSetForeground(SCX_display, SCX_gc, SC__color = (unsigned long)SCX_color_translation[par]) 103 # define SC_TSIZE(par) 104 # define SC_POINT() XDrawPoint(SCX_display, SCX_window, SCX_gc, SC__curPointX, SC__curPointY) 105 # define SC_MOVE(x, y) \ 107 SC__curPointX = (int)(x); \ 108 SC__curPointY = (int)(y); \ 110 # define SC_DRAW(x, y) \ 112 XDrawLine(SCX_display, SCX_window, SCX_gc, SC__curPointX, SC__curPointY, (int)(x), (int)(y)); \ 115 # define SC_LINE(x1, y1, x2, y2) \ 117 XDrawLine(SCX_display, SCX_window, SCX_gc, (int)(x1), (int)(y1), SC__curPointX = (int)(x2), SC__curPointY = (int)(y2)); \ 119 # define SC_RECT(x, y) \ 120 (SC__filled ? XFillRectangle(SCX_display, \ 123 (int)Min(x, SC__curPointX), \ 124 (int)Min(y, SC__curPointY), \ 125 (unsigned int)abs(x - SC__curPointX), \ 126 (unsigned int)abs(y - SC__curPointY)) \ 127 : XDrawRectangle(SCX_display, \ 130 (int)Min(x, SC__curPointX), \ 131 (int)Min(y, SC__curPointY), \ 132 (unsigned int)abs(x - SC__curPointX), \ 133 (unsigned int)abs(y - SC__curPointY))) 134 # define SC_RECTR(x, y) \ 135 (SC__filled ? XFillRectangle(SCX_display, \ 138 (x < 0 ? SC__curPointX + x : SC__curPointX), \ 139 (y < 0 ? SC__curPointY + y : SC__curPointY), \ 142 : XDrawRectangle(SCX_display, \ 145 (x < 0 ? SC__curPointX + x : SC__curPointX), \ 146 (y < 0 ? SC__curPointY + y : SC__curPointY), \ 149 # define SC_ELLIPSE(x, y) \ 150 (SC__filled ? XFillArc(SCX_display, SCX_window, SCX_gc, SC__curPointX - x, SC__curPointY - y, 2 * x, 2 * y, 0, 360 * 64) \ 151 : XDrawArc(SCX_display, SCX_window, SCX_gc, SC__curPointX - x, SC__curPointY - y, 2 * x, 2 * y, 0, 360 * 64)) 152 # define SC_CIRCLE(x) SC_ELLIPSE(x, x) 153 # define SC_TEXT(str) XDrawString(SCX_display, SCX_window, SCX_gc, SC__curPointX, SC__curPointY, str, (int)strlen(str)) 155 # define SC_MASK(par) \ 156 if (SCX_get_class(SCX_visual_info) == PseudoColor) \ 157 XSetPlaneMask(SCX_display, SCX_gc, (unsigned long)par) 158 # define SC_LINFUN(par) XSetFunction(SCX_display, SCX_gc, par) 159 # define SC_LUTX(par, R, G, B) 160 # define SC_CLEARS(par) 161 # define SC_LUTINT(par) 162 # define SC_CLEAR_BLOCK(color, x_b, x_e, y_b, y_e) \ 163 XSetForeground(SCX_display, SCX_gc, (unsigned long)SCX_color_translation[color]); \ 165 SCX_display, SCX_window, SCX_gc, Min((x_b), (x_e)), Min((y_b), (y_e)), abs((x_b) - (x_e)), abs((y_b) - (y_e))); \ 166 XSetForeground(SCX_display, SCX_gc, (unsigned long)SC__color); 167 # define SC_LF_REPLACE GXcopy 168 # define SC_LF_XOR GXxor 169 # define SC_DEPTH SCX_visual_info.depth 170 # define SC_C_ANNOTATE (SC_C_MAX + 1) 176 # define SC_M_ALL ((unsigned long)-1L) 177 # define SC_M_ANNOTATE (SC_C_MAX + 1) 182 extern void SC_SCALE(
int pos_x,
int pos_y,
int size_x,
int size_y);
184 typedef struct screen_image
194 extern void put_textstr(
int x,
int y,
const char* str);
195 extern int center_sc_images(
196 int* Pscale,
int min_x,
int max_x,
int min_y,
int max_y,
int SIZE_X,
int SIZE_Y, screen_image_t sc_image[],
int nr_sc);
197 extern void draw_sc_images(
int size_x,
int size_y, screen_image_t sc_image[],
int no);