/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. * amigax.h: *
  27. * *
  28. * XPM library *
  29. * Emulates some Xlib functionality for Amiga. *
  30. * *
  31. * Developed by Lorens Younes (d93-hyo@nada.kth.se) 7/95 *
  32. * Revised 4/96 *
  33. \*****************************************************************************/
  34. #ifndef AMIGA_X
  35. #define AMIGA_X
  36. #include <intuition/screens.h>
  37. #include <proto/exec.h>
  38. #include <proto/graphics.h>
  39. #define Success 0
  40. /* really never used */
  41. #define ZPixmap 2
  42. #define Bool int
  43. #define Status int
  44. #define True 1
  45. #define False 0
  46. typedef struct ColorMap *Colormap;
  47. typedef void *Visual;
  48. typedef struct {
  49. int width, height;
  50. struct RastPort *rp;
  51. } XImage;
  52. typedef struct {
  53. unsigned long pixel;
  54. unsigned short red, green, blue;
  55. } XColor;
  56. typedef struct Screen Display;
  57. #define XGrabServer(dpy) (Forbid ())
  58. #define XUngrabServer(dpy) (Permit ())
  59. #define XDefaultScreen(dpy) (0)
  60. #define XDefaultVisual(dpy, scr) (NULL)
  61. #define XDefaultColormap(dpy, scr) (dpy->ViewPort.ColorMap)
  62. #define XDefaultDepth(dpy, scr) (dpy->RastPort.BitMap->Depth)
  63. #define XCreateImage(dpy, vi, depth, format, offset, data, width, height, pad, bpl) \
  64. (AllocXImage (width, height, depth))
  65. #define XDestroyImage(img) (FreeXImage (img))
  66. #define XAllocColor(dpy, cm, xc) \
  67. (AllocBestPen (cm, xc, PRECISION_EXACT, True))
  68. #define XFreeColors(dpy, cm, pixels, npixels, planes) \
  69. (FreePens (cm, pixels, npixels))
  70. #define XParseColor(dpy, cm, spec, exact_def_return) \
  71. (ParseColor (spec, exact_def_return))
  72. #define XQueryColor(dpy, cm, def_in_out) \
  73. (QueryColor(cm, def_in_out))
  74. #define XQueryColors(dpy, cm, defs_in_out, ncolors) \
  75. (QueryColors(cm, defs_in_out, ncolors))
  76. XImage *
  77. AllocXImage (
  78. unsigned int width,
  79. unsigned int height,
  80. unsigned int depth);
  81. int
  82. FreeXImage (
  83. XImage *ximage);
  84. int
  85. XPutPixel (
  86. XImage *ximage,
  87. int x,
  88. int y,
  89. unsigned long pixel);
  90. Status
  91. AllocBestPen (
  92. Colormap colormap,
  93. XColor *screen_in_out,
  94. unsigned long precision,
  95. Bool fail_if_bad);
  96. int
  97. FreePens (
  98. Colormap colormap,
  99. unsigned long *pixels,
  100. int npixels);
  101. Status
  102. ParseColor (
  103. char *spec,
  104. XColor *exact_def_return);
  105. int
  106. QueryColor (
  107. Colormap colormap,
  108. XColor *def_in_out);
  109. int
  110. QueryColors (
  111. Colormap colormap,
  112. XColor *defs_in_out,
  113. int ncolors);
  114. #endif /* AMIGA_X */