1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
|
/*
* Copyright (C) 1996 Lorens Younes
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to
* deal in the Software without restriction, including without limitation the
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
* sell copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* Lorens Younes BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* Except as contained in this notice, the name of Lorens Younes shall not be
* used in advertising or otherwise to promote the sale, use or other dealings
* in this Software without prior written authorization from Lorens Younes.
*/
/*****************************************************************************\
* amigax.h: *
* *
* XPM library *
* Emulates some Xlib functionality for Amiga. *
* *
* Developed by Lorens Younes (d93-hyo@nada.kth.se) 7/95 *
* Revised 4/96 *
\*****************************************************************************/
#ifndef AMIGA_X
#define AMIGA_X
#include <intuition/screens.h>
#include <proto/exec.h>
#include <proto/graphics.h>
#define Success 0
/* really never used */
#define ZPixmap 2
typedef int Bool;
typedef int Status;
#define True 1
#define False 0
typedef struct ColorMap *Colormap;
typedef void *Visual;
typedef struct {
int width, height;
struct RastPort *rp;
} XImage;
typedef struct {
unsigned long pixel;
unsigned short red, green, blue;
} XColor;
typedef struct Screen Display;
#define XGrabServer(dpy) (Forbid ())
#define XUngrabServer(dpy) (Permit ())
#define XDefaultScreen(dpy) (0)
#define XDefaultVisual(dpy, scr) (NULL)
#define XDefaultColormap(dpy, scr) (dpy->ViewPort.ColorMap)
#define XDefaultDepth(dpy, scr) (dpy->RastPort.BitMap->Depth)
#define XCreateImage(dpy, vi, depth, format, offset, data, width, height, pad, bpl) \
(AllocXImage (width, height, depth))
#define XDestroyImage(img) (FreeXImage (img))
#define XAllocColor(dpy, cm, xc) \
(AllocBestPen (cm, xc, PRECISION_EXACT, True))
#define XFreeColors(dpy, cm, pixels, npixels, planes) \
(FreePens (cm, pixels, npixels))
#define XParseColor(dpy, cm, spec, exact_def_return) \
(ParseColor (spec, exact_def_return))
#define XQueryColor(dpy, cm, def_in_out) \
(QueryColor(cm, def_in_out))
#define XQueryColors(dpy, cm, defs_in_out, ncolors) \
(QueryColors(cm, defs_in_out, ncolors))
XImage *
AllocXImage (
unsigned int width,
unsigned int height,
unsigned int depth);
int
FreeXImage (
XImage *ximage);
int
XPutPixel (
XImage *ximage,
int x,
int y,
unsigned long pixel);
Status
AllocBestPen (
Colormap colormap,
XColor *screen_in_out,
unsigned long precision,
Bool fail_if_bad);
int
FreePens (
Colormap colormap,
unsigned long *pixels,
int npixels);
Status
ParseColor (
char *spec,
XColor *exact_def_return);
int
QueryColor (
Colormap colormap,
XColor *def_in_out);
int
QueryColors (
Colormap colormap,
XColor *defs_in_out,
int ncolors);
#endif /* AMIGA_X */
|