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