pmbitmap.pas 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217
  1. {****************************************************************************
  2. This file is part of the Free Pascal run time library.
  3. Copyright (c) 1999-2002 by the Free Pascal development team.
  4. Copyright (c) 1999-2000 by Ramon Bosque
  5. Types and constants for bitmap images manipulation
  6. plus functions implemented in PMPIC.DLL.
  7. See the file COPYING.FPC, included in this distribution,
  8. for details about the copyright.
  9. This program is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  12. ****************************************************************************}
  13. unit PMBitmap;
  14. interface
  15. {$PACKRECORDS 1}
  16. type TBitmapInfoHeader=record
  17. cbFix:cardinal;
  18. cx:word;
  19. cy:word;
  20. cPlanes:word;
  21. cBitCount:word;
  22. end;
  23. PBitmapInfoHeader=^TBitmapInfoHeader;
  24. BitmapInfoHeader=TBitmapInfoHeader;
  25. TRgb=record
  26. bBlue,
  27. bGreen,
  28. bRed:byte;
  29. end;
  30. PRgb=^TRgb;
  31. Rgb=TRgb;
  32. TBitmapInfo=record
  33. cbFix:cardinal;
  34. cx:word;
  35. cy:word;
  36. cPlanes:word;
  37. cBitCount:word;
  38. aRgbColor:array[0..0] of TRgb;
  39. end;
  40. PBitmapInfo=^TBitmapInfo;
  41. BitmapInfo=TBitmapInfo;
  42. TBitmapInfoHeader2=record
  43. cbFix:cardinal; { Length of structure }
  44. cx:cardinal; { Bitmap width in pels }
  45. cy:cardinal; { Bitmap height in pels }
  46. cPlanes:word; { Number of bit planes }
  47. cBitCount:word; { Number of bits per pel within a plane }
  48. ulCompression:cardinal; { Compression scheme used
  49. to store the bitmap }
  50. cbImage:cardinal; { Length of bitmap storage data in bytes }
  51. cxResolution:cardinal; { X resolution of target device }
  52. cyResolution:cardinal; { Y resolution of target device }
  53. cClrUsed:cardinal; { Number of color indices used }
  54. cClrImportant:cardinal; { Number of important color indices }
  55. usUnits:word; { Units of measure }
  56. usReserved:word;
  57. usRecording:word; { Recording algorithm }
  58. usRendering:word; { Halftoning algorithm }
  59. cSize1:cardinal; { Size value 1 }
  60. cSize2:cardinal; { Size value 2 }
  61. ulColorEncoding:cardinal; { Color encoding }
  62. ulIdentifier:cardinal; { Reserved for application use }
  63. end;
  64. PBitmapInfoHeader2=^TBitmapInfoHeader2;
  65. BitmapInfoHeader2=TBitmapInfoHeader2;
  66. TRgb2=record
  67. bBlue,
  68. bGreen,
  69. bRed,
  70. fcOptions:byte; { Reserved, must be zero }
  71. end;
  72. PRgb2=^TRgb2;
  73. Rgb2=TRgb2;
  74. TBitmapInfo2=record
  75. cbFix:cardinal;
  76. cx:cardinal;
  77. cy:cardinal;
  78. cPlanes:word;
  79. cBitCount:word;
  80. ulCompression:cardinal;
  81. cbImage:cardinal;
  82. cxResolution:cardinal;
  83. cyResolution:cardinal;
  84. cClrUsed:cardinal;
  85. cClrImportant:cardinal;
  86. usUnits:word;
  87. usReserved:word;
  88. usRecording:word;
  89. usRendering:word;
  90. cSize1:cardinal;
  91. cSize2:cardinal;
  92. ulColorEncoding:cardinal;
  93. ulIdentifier:cardinal;
  94. aRgbColor:array[0..0] of TRgb2;
  95. end;
  96. PBitmapInfo2=^TBitmapInfo2;
  97. BitmapInfo2=TBitmapInfo2;
  98. TBitmapFileHeader=record
  99. usType:word;
  100. cbSize:cardinal;
  101. xHotspot:integer;
  102. yHotspot:integer;
  103. offBits:cardinal;
  104. bmp:TBitmapInfoHeader;
  105. end;
  106. PBitmapFileHeader=^TBitmapFileHeader;
  107. BitmapFileHeader=TBitmapFileHeader;
  108. TBitmapArrayFileHeader=record
  109. usType:word;
  110. cbSize:cardinal;
  111. offNext:cardinal;
  112. cxDisplay:word;
  113. cyDisplay:word;
  114. bfh:TBitmapFileHeader;
  115. end;
  116. PBitmapArrayFileHeader=^TBitmapArrayFileHeader;
  117. BitmapArrayFileHeader=TBitmapArrayFileHeader;
  118. TBitmapFileHeader2=record
  119. usType:word;
  120. cbSize:cardinal;
  121. xHotspot:integer;
  122. yHotspot:integer;
  123. offBits:cardinal;
  124. bmp2:TBitmapInfoHeader2;
  125. end;
  126. PBitmapFileHeader2=^TBitmapFileHeader2;
  127. BitmapFileHeader2=TBitmapFileHeader2;
  128. TBitmapArrayFileHeader2=record
  129. usType:word;
  130. cbSize:cardinal;
  131. offNext:cardinal;
  132. cxDisplay:word;
  133. cyDisplay:word;
  134. bfh2:TBitmapFileHeader2;
  135. end;
  136. PBitmapArrayFileHeader2=^TBitmapArrayFileHeader2;
  137. BitmapArrayFileHeader2=TBitmapArrayFileHeader2;
  138. { Constants for compression/decompression command }
  139. const CBD_COMPRESSION = 1;
  140. CBD_DECOMPRESSION = 2;
  141. CBD_BITS = 0;
  142. { Flags for compression/decompression option }
  143. CBD_COLOR_CONVERSION =$0000001;
  144. { Compression scheme in the ulCompression field of the bitmapinfo structure }
  145. BCA_UNCOMP = 0;
  146. BCA_HUFFMAN1D = 3;
  147. BCA_RLE4 = 2;
  148. BCA_RLE8 = 1;
  149. BCA_RLE24 = 4;
  150. BRU_METRIC = 0;
  151. BRA_BOTTOMUP = 0;
  152. BRH_NOTHALFTONED = 0;
  153. BRH_ERRORDIFFUSION = 1;
  154. BRH_PANDA = 2;
  155. BRH_SUPERCIRCLE = 3;
  156. BCE_PALETTE = -1;
  157. BCE_RGB = 0;
  158. { Values identifying bitmap types used in usType field
  159. of BITMAPFILEHEADER(2) and BITMAPARRAYFILEHEADER(2).
  160. (BFT_ => Bitmap File Type) }
  161. BFT_ICON = $4349;
  162. BFT_BMAP = $4d42;
  163. BFT_POINTER = $5450;
  164. BFT_COLORICON = $4943;
  165. BFT_COLORPOINTER = $5043;
  166. BFT_BITMAPARRAY = $4142;
  167. { type of picture to print }
  168. const PIP_MF = 1;
  169. PIP_PIF = 2;
  170. { type of conversion required }
  171. PIC_PIFTOMET = 0;
  172. PIC_SSTOFONT = 2;
  173. function PicPrint (ahab: longint; var pszFilename: PChar; lType: longint;
  174. var pszParams: PChar): Longbool; cdecl;
  175. function PicIchg (ahab: longint; var pszFilename1, pszFilename2: PChar;
  176. lType: longint): Longbool; cdecl;
  177. implementation
  178. function PicPrint (ahab: longint; var pszFilename: PChar; lType: longint;
  179. var pszParams: PChar): Longbool; cdecl; external 'PMPIC' index 11;
  180. function PicIchg (ahab: longint; var pszFilename1, pszFilename2: PChar;
  181. lType: longint): Longbool; cdecl; external 'PMPIC' index 12;
  182. end.