pmbitmap.pas 7.1 KB

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