ggi2d.pp 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200
  1. { $Id$
  2. *
  3. * Free Pascal conversion (c) 1999 Sebastian Guenther
  4. *
  5. * GGI/2D interface
  6. *
  7. * Copyright (C) 1998 by Thomas Tanner. See CREDITS for details.
  8. *
  9. * This library is free software; you can redistribute it and/or
  10. * modify it under the terms of the GNU Library General Public
  11. * License as published by the Free Software Foundation; either
  12. * version 2 of the License, or (at your option) any later version.
  13. *
  14. * This library is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  17. * Library General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU Library General Public
  20. * License along with this library; if not, write to the Free
  21. * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  22. *
  23. *}
  24. {$MODE objfpc}
  25. {$PACKRECORDS C}
  26. {$LINKLIB c}
  27. unit GGI2D;
  28. interface
  29. uses GGI;
  30. const
  31. libggi2d = 'ggi2d';
  32. type
  33. TGGIAlpha = Word;
  34. const
  35. GGI_MAX_ALPHA = 255;
  36. // library initialization and exit
  37. function ggi2dInit: Integer; cdecl; external libggi2d;
  38. function ggi2dExit: Integer; cdecl; external libggi2d;
  39. // visual
  40. function ggi2dOpen(Visual: TGGIVisual): Integer; cdecl; external libggi2d;
  41. function ggi2dClose(Visual: TGGIVisual): Integer; cdecl; external libggi2d;
  42. // images
  43. type
  44. TGGI2dImage = Pointer;
  45. function ggi2dCreateImage(Image: TGGI2dImage; Visual, Source: TGGIVisual; x, y, Width, Height: LongWord): Integer; cdecl; external libggi2d;
  46. function ggi2dDestroyImage(Image: TGGI2dImage): Integer; cdecl; external libggi2d;
  47. function ggi2dCompatibleImage(Visual: TGGIVisual; Image: TGGI2dImage): Integer; cdecl; external libggi2d;
  48. // graphics context
  49. type
  50. TGGI2dArcmode = (GGI2D_ARC_SECTOR, GGI2D_ARC_SEGMENT);
  51. TGGI2dPolymode = (GGI2D_POLY_EVENODD, GGI2D_POLY_WINDING);
  52. TGGI2DOperator = (
  53. GGI2D_NOOP, // dest = dest
  54. GGI2D_INVERT, // dest = ~dest
  55. GGI2D_SET, // dest = color
  56. GGI2D_SET_INVERTED, // dest = ~color
  57. GGI2D_AND, // dest = (dest & color)
  58. GGI2D_NAND, // dest = ~(dest & color)
  59. GGI2D_AND_REVERSE, // dest = ~dest & color
  60. GGI2D_AND_INVERTED, // dest = dest & ~color
  61. GGI2D_OR, // dest = (dest | color)
  62. GGI2D_NOR, // dest = ~(dest | color)
  63. GGI2D_OR_REVERSE, // dest = ~dest & color
  64. GGI2D_OR_INVERTED, // dest = dest & ~color
  65. GGI2D_XOR, // dest = (dest ^ color)
  66. GGI2D_EQUIV, // dest = ~(dest ^ color
  67. GGI2D_ADD, // dest = dest + color
  68. GGI2D_SUB); // dest = dest - color
  69. TGGI2dCoord = record
  70. x, y: SmallInt;
  71. end;
  72. function ggi2dSetClip(Visual: TGGIVisual; x1, y1, x2, y2: SmallInt): Integer; cdecl; external libggi2d;
  73. function ggi2dPointVisible(Visual: TGGIVisual; x, y: SmallInt): Integer; cdecl; external libggi2d;
  74. function ggi2dRectVisible(Visual: TGGIVisual; x1, y1, x2, y2: SmallInt): Integer; cdecl; external libggi2d;
  75. function ggi2dSetArcMode(Visual: TGGIVisual; Mode: TGGI2dArcmode): Integer; cdecl; external libggi2d;
  76. function ggi2dGetArcMode(Visual: TGGIVisual): TGGI2dArcmode; cdecl; external libggi2d;
  77. function ggi2dSetPolyMode(Visual: TGGIVisual; Mode: TGGI2dPolymode): Integer; cdecl; external libggi2d;
  78. function ggi2dGetPolyMode(Visual: TGGIVisual): TGGI2dPolymode; cdecl; external libggi2d;
  79. function ggi2dSetLineDash(Visual: TGGIVisual; var Dash: LongWord; Size: LongWord): Integer; cdecl; external libggi2d;
  80. function ggi2dGetLineDash(Visual: TGGIVisual; var Dash: LongWord; var Size: LongWord): Integer; cdecl; external libggi2d;
  81. function ggi2dSetAppendMode(Visual: TGGIVisual; Append: Integer): Integer; cdecl; external libggi2d;
  82. function ggi2dGetAppendMode(Visual: TGGIVisual): Integer; cdecl; external libggi2d;
  83. function ggi2dSetDrawColor(Visual: TGGIVisual; Color: TGGIPixel): Integer; cdecl; external libggi2d;
  84. function ggi2dGetDrawColor(Visual: TGGIVisual): TGGIPixel; cdecl; external libggi2d;
  85. function ggi2dSetFillColor(Visual: TGGIVisual; Color: TGGIPixel): Integer; cdecl; external libggi2d;
  86. function ggi2dGetFillColor(Visual: TGGIVisual): TGGIPixel; cdecl; external libggi2d;
  87. function ggi2dSetFillTexture(Visual: TGGIVisual; RefPoint: TGGI2dCoord; Texture: TGGI2dImage): Integer; cdecl; external libggi2d;
  88. function ggi2dGetFillTexture(Visual: TGGIVisual; var RefPoint: TGGI2dCoord; var Texture: TGGI2dImage): Integer; cdecl; external libggi2d;
  89. function ggi2dSetOperator(Visual: TGGIVisual; Oper: TGGI2dOperator): Integer; cdecl; external libggi2d;
  90. function ggi2dGetOperator(Visual: TGGIVisual): TGGI2dOperator; cdecl; external libggi2d;
  91. // drawing
  92. type
  93. TGGI2dScanline = record
  94. x1, x2, y: SmallInt;
  95. end;
  96. TGGI2dLine = record
  97. x1, y1, x2, y2: SmallInt;
  98. end;
  99. // primitives
  100. function ggi2dPutPixel(Visual: TGGIVisual; x, y: SmallInt; Color: TGGIPixel): Integer; cdecl; external libggi2d;
  101. function ggi2dDrawPixel(Visual: TGGIVisual; x, y: SmallInt): Integer; cdecl; external libggi2d;
  102. function ggi2dFillPixel(Visual: TGGIVisual; x, y: SmallInt): Integer; cdecl; external libggi2d;
  103. function ggi2dDrawPixels(Visual: TGGIVisual; var Coords: TGGI2dCoord; Count: LongWord): Integer; cdecl; external libggi2d;
  104. function ggi2dScanLine(Visual: TGGIVisual; x1, x2, y: SmallInt): Integer; cdecl; external libggi2d;
  105. function ggi2dScanLines(Visual: TGGIVisual; var Scanlines: TGGI2dScanline; Count: LongWord): Integer; cdecl; external libggi2d;
  106. function ggi2dHLine(Visual: TGGIVisual; x1, x2, y: SmallInt): Integer; cdecl; external libggi2d;
  107. function ggi2dVLine(Visual: TGGIVisual; x, y1, y2: SmallInt): Integer; cdecl; external libggi2d;
  108. function ggi2dDrawRect(Visual: TGGIVisual; x1, y1, x2, y2: SmallInt): Integer; cdecl; external libggi2d;
  109. function ggi2dFillRect(Visual: TGGIVisual; x1, y1, x2, y2: SmallInt): Integer; cdecl; external libggi2d;
  110. // curves
  111. function ggi2dLine(Visual: TGGIVisual; x1, y1, x2, y2: SmallInt): Integer; cdecl; external libggi2d;
  112. function ggi2dDrawLines(Visual: TGGIVisual; var Lines: TGGI2dLine; Count: LongWord): Integer; cdecl; external libggi2d;
  113. function ggi2dDrawCircle(Visual: TGGIVisual; x, y, r: SmallInt): Integer; cdecl; external libggi2d;
  114. function ggi2dFillCircle(Visual: TGGIVisual; x, y, r: SmallInt): Integer; cdecl; external libggi2d;
  115. function ggi2dDrawEllipse(Visual: TGGIVisual; x, y, rx, ry: SmallInt): Integer; cdecl; external libggi2d;
  116. function ggi2dFillEllipse(Visual: TGGIVisual; x, y, rx, ry: SmallInt): Integer; cdecl; external libggi2d;
  117. function ggi2dDrawArc(Visual: TGGIVisual; x, y, rx, ry: SmallInt; Start, AEnd: Single; Close: Integer): Integer; cdecl; external libggi2d;
  118. function ggi2dFillArc(Visual: TGGIVisual; x, y, rx, ry: SmallInt; Start, AEnd: Single): Integer; cdecl; external libggi2d;
  119. function ggi2dBezier(Visual: TGGIVisual; x1, y1, x2, y2, x3, y3, x4, y4: SmallInt): Integer; cdecl; external libggi2d;
  120. function ggi2dTrapezoid(Visual: TGGIVisual; xl1, xr1, y1, xl2, xr2, y2: SmallInt): Integer; cdecl; external libggi2d;
  121. function ggi2dTriangle(Visual: TGGIVisual; x1, y1, x2, y2, x3, y3: SmallInt): Integer; cdecl; external libggi2d;
  122. function ggi2dDrawPoly(Visual: TGGIVisual; var Coords: TGGI2dCoord; Count: LongWord): Integer; cdecl; external libggi2d;
  123. function ggi2dFillPoly(Visual: TGGIVisual; var Coords: TGGI2dCoord; Count: LongWord): Integer; cdecl; external libggi2d;
  124. function ggi2dFillPolys(Visual: TGGIVisual; var Coords: TGGI2dCoord; var Counts: LongWord; Count: LongWord): Integer; cdecl; external libggi2d;
  125. // blitting
  126. function ggi2dCopyBox(Visual: TGGIVisual; x, y, w, h, nx, ny: SmallInt): Integer; cdecl; external libggi2d;
  127. function ggi2dCrossBlit(Src: TGGIVisual; sx, sy, w, h: SmallInt; Dest: TGGIVisual; dx, dy: SmallInt): Integer; cdecl; external libggi2d;
  128. function ggi2dBlit(
  129. Visual: TGGIVisual; dx, dy: SmallInt;
  130. Src: TGGI2dImage; sx, sy, Width, Height: SmallInt): Integer; cdecl; external libggi2d;
  131. function ggi2dStretchBlit(
  132. Visual: TGGIVisual; dx, dy, DWith, DHeight: SmallInt;
  133. Src: TGGI2dImage; sx, sy, SWidth, SHeight: SmallInt): Integer; cdecl; external libggi2d;
  134. function ggi2dBlitOp(
  135. Visual: TGGIVisual; dx, dy: SmallInt;
  136. Src1: TGGI2dImage; s1x, s1y: SmallInt;
  137. Src2: TGGI2dImage; s2x, s2y: SmallInt;
  138. Width, Height: SmallInt; Oper: TGGI2dOperator): Integer; cdecl; external libggi2d;
  139. function ggi2dStretchBlitOp(
  140. Visual: TGGIVisual; dx, dy, DWidth, DHeight: SmallInt;
  141. Src1: TGGI2dImage; s1x, s1y: SmallInt;
  142. Src2: TGGI2dImage; s2x, s2y: SmallInt;
  143. SWidth, SHeight: SmallInt; Oper: TGGI2dOperator): Integer; cdecl; external libggi2d;
  144. implementation
  145. end.
  146. {
  147. $Log$
  148. Revision 1.2 2000-07-13 11:33:17 michael
  149. + removed logs
  150. }