1 /***********************************************************************/
5 /* Jacob Navia, after Xavier Leroy */
7 /* Copyright 2001 Institut National de Recherche en Informatique et */
8 /* en Automatique. All rights reserved. This file is distributed */
9 /* under the terms of the GNU Library General Public License, with */
10 /* the special exception on linking described in file ../LICENSE. */
12 /***********************************************************************/
14 /* $Id: libgraph.h 5029 2002-07-23 14:12:03Z doligez $ */
20 int w, h; /* Dimensions of the drawable */
21 HWND win; /* The drawable itself */
22 HDC gc; /* The associated graphics context */
25 extern HWND grdisplay; /* The display connection */
26 //extern int grscreen; /* The screen number */
27 //extern Colormap grcolormap; /* The color map */
28 //extern struct canvas grwindow; /* The graphics window */
29 //extern struct canvas grbstore; /* The pixmap used for backing store */
30 //extern int grwhite, grblack; /* Black and white pixels for X */
31 //extern int grbackground; /* Background color for X
32 // (used for CAML color -1) */
33 extern COLORREF grbackground;
34 extern BOOL grdisplay_mode; /* Display-mode flag */
35 extern BOOL grremember_mode; /* Remember-mode flag */
36 extern int grx, gry; /* Coordinates of the current point */
37 extern int grcolor; /* Current *CAML* drawing color (can be -1) */
38 extern HFONT * grfont; /* Current font */
40 extern BOOL direct_rgb;
41 extern int byte_order;
42 extern int bitmap_unit;
43 extern int bits_per_pixel;
45 #define Wcvt(y) (grwindow.height - 1 - (y))
46 #define Bcvt(y) (grwindow.height - 1 - (y))
47 #define WtoB(y) ((y) + WindowRect.bottom - grwindow.h)
48 //#define BtoW(y) ((y) + WindowRect.bottom - grbstore.h)
50 #define DEFAULT_SCREEN_WIDTH 1024
51 #define DEFAULT_SCREEN_HEIGHT 768
52 #define BORDER_WIDTH 2
53 #define WINDOW_NAME "Caml graphics"
54 #define ICON_NAME "Caml graphics"
55 #define DEFAULT_EVENT_MASK \
56 (ExposureMask | KeyPressMask | StructureNotifyMask)
57 #define DEFAULT_FONT "fixed"
58 #define SIZE_QUEUE 256
60 /* To handle events asynchronously */
63 #define EVENT_SIGNAL SIGIO
66 #define USE_INTERVAL_TIMER
67 #define EVENT_SIGNAL SIGALRM
70 #define EVENT_SIGNAL SIGALRM
74 void gr_fail(char *fmt, char *arg);
75 void gr_check_open(void);
76 unsigned long gr_pixel_rgb(int rgb);
77 int gr_rgb_pixel(long unsigned int pixel);
78 void gr_enqueue_char(unsigned char c);
79 void gr_init_color_cache(void);
81 // Windows specific definitions
82 extern RECT WindowRect;
83 extern int grCurrentColor;
85 typedef struct tagWindow {
99 HDC tempDC; // For image operations;
102 extern GR_WINDOW grwindow;
103 HFONT CreationFont(char *name);
104 extern int MouseLbuttonDown,MouseMbuttonDown,MouseRbuttonDown;
105 extern HANDLE EventHandle;
106 extern int InspectMessages;