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