MMRIFF.INT 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249
  1. {========================================================================}
  2. {= (c) 1995-98 SwiftSoft Ronald Dittrich =}
  3. {========================================================================}
  4. {= All Rights Reserved =}
  5. {========================================================================}
  6. {= D 01099 Dresden = Tel.: +0351-8012255 =}
  7. {= Loewenstr.7a = info@swiftsoft.de =}
  8. {========================================================================}
  9. {= Actual versions on http://www.swiftsoft.de/mmtools.html =}
  10. {========================================================================}
  11. {= This code is for reference purposes only and may not be copied or =}
  12. {= distributed in any format electronic or otherwise except one copy =}
  13. {= for backup purposes. =}
  14. {= =}
  15. {= No Delphi Component Kit or Component individually or in a collection=}
  16. {= subclassed or otherwise from the code in this unit, or associated =}
  17. {= .pas, .dfm, .dcu, .asm or .obj files may be sold or distributed =}
  18. {= without express permission from SwiftSoft. =}
  19. {= =}
  20. {= For more licence informations please refer to the associated =}
  21. {= HelpFile. =}
  22. {========================================================================}
  23. {= $Date: 20.01.1998 - 18:00:00 $ =}
  24. {========================================================================}
  25. Unit MMRIFF;
  26. {$I COMPILER.INC}
  27. interface
  28. uses
  29. {$IFDEF WIN32}
  30. Windows,
  31. {$ELSE}
  32. WinTypes,
  33. WinProcs,
  34. {$ENDIF}
  35. SysUtils,
  36. MMSystem,
  37. MMUtils,
  38. MMDIB,
  39. MMAbout;
  40. const
  41. CHUNK_MODIFIED = 1; { chunk was modified }
  42. CHUNK_REVERT = 2; { command to revert to original text }
  43. {$IFDEF WIN32}
  44. type
  45. THMMIO = HMMIO; { whats that BORLAND !? }
  46. {$ENDIF}
  47. type
  48. PChunk = ^TChunk;
  49. TChunk = record
  50. fcc: FOURCC;
  51. cksize: Longint;
  52. data: array[0..0] of Byte;
  53. end;
  54. PInfoData = ^TInfoData;
  55. TInfoData = record
  56. index : Word; { index into aINFO }
  57. wFlags : Word; { flags for chunk }
  58. dwINFOOffset: Longint; { offset in file to INFO chunk }
  59. lpText : PChar; { text of modified chunk. None if NULL. }
  60. pNext : PInfoData; { next read sub-chunk }
  61. end;
  62. PInfoChunk = ^TInfoChunk;
  63. TInfoChunk = record
  64. lpChunk : PChar; { complete chunk in memory (GlobalPtr) }
  65. cksize : Longint; { size of chunk data }
  66. pHead : PInfoData; { first sub-chunk data }
  67. end;
  68. TInfo = record
  69. pFOURCC: PChar;
  70. pShort : PChar;
  71. pLong : PChar;
  72. end;
  73. PDisp = ^TDisp;
  74. TDisp = record
  75. cfid : Longint; { Clipboard id of data }
  76. wFlags : Word; { flags for chunk }
  77. lpChunk: PChar; { ptr to original file data }
  78. lpData : PChar; { ptr to modified data }
  79. pNext : PDISP; { next in list }
  80. end;
  81. PDispList = ^TDispList;
  82. TDispList = record
  83. pHead : PDisp; { first 'DISP' chunk }
  84. end;
  85. const
  86. aINFO: array[0..23] of TInfo = (
  87. (pFOURCC: 'IARL';
  88. pShort: 'Archival Location';
  89. pLong: 'Indicates where the subject of the file is archived.'),
  90. (pFOURCC: 'IART';
  91. pShort: 'Artist';
  92. pLong: 'Lists the artist of the original subject of the file. For example,'
  93. +' "Michaelangelo."'),
  94. (pFOURCC: 'ICMS';
  95. pShort: 'Commissioned';
  96. pLong: 'Lists the name of the person or organization that commissioned '
  97. +'the subject of the file. For example, "Pope Julian II."'),
  98. (pFOURCC: 'ICMT';
  99. pShort: 'Comments';
  100. pLong: 'Provides general comments about the file or the subject of the '
  101. +'file. If the comment is several sentences long, end each sentence '
  102. +'with a period. Do not include newline characters.'),
  103. (pFOURCC: 'ICOP';
  104. pShort: 'Copyright';
  105. pLong: 'Records the copyright information for the file. For example, '
  106. +'"Copyright Encyclopedia International 1991." If there are multiple '
  107. +'copyrights, separate them by a semicolon followed by a space.'),
  108. (pFOURCC: 'ICRD';
  109. pShort: 'Creation date';
  110. pLong: 'Specifies the date the subject of the file was created. List dates '
  111. +'in year-month-day format, padding one-digit months and days with a'
  112. +' zero on the left. For example, "1553-05-03" for May 3), 1553.'),
  113. (pFOURCC: 'ICRP';
  114. pShort: 'Cropped';
  115. pLong: 'Describes whether an image has been cropped and, if so, how it was '
  116. +'cropped. For example, "lower right corner."'),
  117. (pFOURCC: 'IDIM';
  118. pShort: 'Dimensions';
  119. pLong: 'Specifies the size of the original subject of the file. For example, '
  120. +'"8.5 in h, 11 in w."'),
  121. (pFOURCC: 'IDPI';
  122. pShort: 'Dots Per Inch';
  123. pLong: 'Stores dots per inch setting of the digitizer used to produce the '
  124. +'file, such as "300."'),
  125. (pFOURCC: 'IENG';
  126. pShort: 'Engineer';
  127. pLong: 'Stores the name of the engineer who worked on the file. If there '
  128. +'are multiple engineers, separate the names by a semicolon and a '
  129. +'blank. For example, "Smith, John; Adams, Joe."'),
  130. (pFOURCC: 'IGNR';
  131. pShort: 'Genre';
  132. pLong: 'Describes the original work, such as, "landscape," "portrait," '
  133. +'"still life," etc.'),
  134. (pFOURCC: 'IKEY';
  135. pShort: 'Keywords';
  136. pLong: 'Provides a list of keywords that refer to the file or subject of '
  137. +'the file. Separate multiple keywords with a semicolon and a blank. For example, "Seattle; aerial view; scenery."'),
  138. (pFOURCC: 'ILGT';
  139. pShort: 'Lightness';
  140. pLong: 'Describes the changes in lightness settings on the digitizer required '
  141. +'to produce the file. Note that the format of this information depends on hardware used.'),
  142. (pFOURCC: 'IMED';
  143. pShort: 'Medium';
  144. pLong: 'Describes the original subject of the file, such as, "computer image," '
  145. +'"drawing," "lithograph," and so forth.'),
  146. (pFOURCC: 'INAM';
  147. pShort: 'Name';
  148. pLong: 'Stores the title of the subject of the file, such as, "Seattle From '
  149. +'Above."'),
  150. (pFOURCC: 'IPLT';
  151. pShort: 'Palette Setting';
  152. pLong: 'Specifies the number of colors requested when digitizing an image, '
  153. +'such as "256."'),
  154. (pFOURCC: 'IPRD';
  155. pShort: 'Product';
  156. pLong: 'Specifies the name of the title the file was originally intended '
  157. +'for, such as "Encyclopedia of Pacific Northwest Geography."'),
  158. (pFOURCC: 'ISBJ';
  159. pShort: 'Subject';
  160. pLong: 'Describes the contents of the file, such as "Aerial view of Seattle."'),
  161. (pFOURCC: 'ISFT';
  162. pShort: 'Software';
  163. pLong: 'Identifies the name of the software package used to create the file, '
  164. +'such as "Microsoft WaveEdit."'),
  165. (pFOURCC: 'ISHP';
  166. pShort: 'Sharpness';
  167. pLong: 'Identifies the changes in sharpness for the digitizer required to '
  168. +'produce the file (the format depends on the hardware used).'),
  169. (pFOURCC: 'ISRC';
  170. pShort: 'Source';
  171. pLong: 'Identifies the name of the person or organization who supplied the '
  172. +'original subject of the file. For example, "Trey Research."'),
  173. (pFOURCC: 'ISRF';
  174. pShort: 'Source Form';
  175. pLong: 'Identifies the original form of the material that was digitized, '
  176. +'such as "slide," "paper," "map," and so forth. This is not necessarily '
  177. +'the same as IMED.'),
  178. (pFOURCC: 'ITCH';
  179. pShort: 'Technician';
  180. pLong: 'Identifies the technician who digitized the subject file. For '
  181. +'example, "Smith, John."'),
  182. (pFOURCC: NIL;
  183. pShort: NIL;
  184. pLong: NIL));
  185. {*************************************************************************}
  186. { error returns from RIFF functions }
  187. {*************************************************************************}
  188. const
  189. RIFFERR_BASE = 0;
  190. RIFFERR_NOERROR = 0;
  191. RIFFERR_ERROR = RIFFERR_BASE+1;
  192. RIFFERR_BADPARAM = RIFFERR_BASE+2;
  193. RIFFERR_FILEERROR = RIFFERR_BASE+3;
  194. RIFFERR_NOMEM = RIFFERR_BASE+4;
  195. RIFFERR_BADFILE = RIFFERR_BASE+5;
  196. (************************************************************************)
  197. function mmioFourCC(ch0,ch1,ch2,ch3: Char): FourCC;
  198. function RiffCopyChunk(hmmioSrc,hmmioDst: THMMIO; lpck: PMMCKINFO): Boolean;
  199. function RiffCopyList(hmmioSrc,hmmioDst: THMMIO; lpck: PMMCKINFO): Boolean;
  200. (************************************************************************)
  201. function RiffInitINFO(Var lpInfo: PInfoChunk): integer;
  202. function RiffCopyInfo(Var lpInfoDst: PInfoChunk; lpInfoSrc: PInfoChunk): integer;
  203. function RiffFreeINFO(Var lpInfo: PInfoChunk): integer;
  204. function RiffReadINFO(hmmio: THMMIO; lpck: PMMCKINFO; lpInfo: PInfoChunk): integer;
  205. function RiffWriteINFO(hmmio: THMMIO; lpInfo: PInfoChunk): integer;
  206. function RiffCreateINFO(wFlags, id: Word; dwInfoOffset: Longint; lpText: PChar): PInfoData;
  207. procedure RiffInsertINFO(lpInfo: PInfoChunk; pInfo: PInfoData);
  208. function RiffFindPIINFO(lpInfo: PInfoChunk; fcc: FOURCC): PInfoData;
  209. procedure RiffModifyINFO(lpInfo: PInfoChunk; pi: PInfoData;
  210. wFlags: Word; dw: Longint; lpText: PChar);
  211. function RiffFindaINFO(fcc: FOURCC): integer;
  212. function RiffParseINFO(lpInfo: PInfoChunk): integer;
  213. (************************************************************************)
  214. function RiffInitDISP(Var lpDisp: PDispList): integer;
  215. function RiffCopyDISP(lpDispDst, lpDispSrc: PDISPList): integer;
  216. function RiffFreeDISP(Var lpDisp: PDispList; FreeList: Boolean): integer;
  217. function RiffReadDISP(hmmio: THMMIO; lpck: PMMCKINFO; Var lpDisp: PDispList): integer;
  218. function RiffWriteDISP(hmmio: THMMIO; lpDisp: PDispList): integer;
  219. function RiffCreateDISP(wFlags: Word; id: Longint; lpChunk, lpData: PChar): PDisp;
  220. procedure RiffInsertDISP(lpDisp: PDispList; pd: PDisp);
  221. procedure RiffModifyDISP(lpDisp: PDispList; pd: PDisp;
  222. wFlags: Word; lpData: PChar);
  223. implementation