| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249 |
- {========================================================================}
- {= (c) 1995-98 SwiftSoft Ronald Dittrich =}
- {========================================================================}
- {= All Rights Reserved =}
- {========================================================================}
- {= D 01099 Dresden = Tel.: +0351-8012255 =}
- {= Loewenstr.7a = info@swiftsoft.de =}
- {========================================================================}
- {= Actual versions on http://www.swiftsoft.de/mmtools.html =}
- {========================================================================}
- {= This code is for reference purposes only and may not be copied or =}
- {= distributed in any format electronic or otherwise except one copy =}
- {= for backup purposes. =}
- {= =}
- {= No Delphi Component Kit or Component individually or in a collection=}
- {= subclassed or otherwise from the code in this unit, or associated =}
- {= .pas, .dfm, .dcu, .asm or .obj files may be sold or distributed =}
- {= without express permission from SwiftSoft. =}
- {= =}
- {= For more licence informations please refer to the associated =}
- {= HelpFile. =}
- {========================================================================}
- {= $Date: 20.01.1998 - 18:00:00 $ =}
- {========================================================================}
- Unit MMRIFF;
- {$I COMPILER.INC}
- interface
- uses
- {$IFDEF WIN32}
- Windows,
- {$ELSE}
- WinTypes,
- WinProcs,
- {$ENDIF}
- SysUtils,
- MMSystem,
- MMUtils,
- MMDIB,
- MMAbout;
- const
- CHUNK_MODIFIED = 1; { chunk was modified }
- CHUNK_REVERT = 2; { command to revert to original text }
- {$IFDEF WIN32}
- type
- THMMIO = HMMIO; { whats that BORLAND !? }
- {$ENDIF}
- type
- PChunk = ^TChunk;
- TChunk = record
- fcc: FOURCC;
- cksize: Longint;
- data: array[0..0] of Byte;
- end;
- PInfoData = ^TInfoData;
- TInfoData = record
- index : Word; { index into aINFO }
- wFlags : Word; { flags for chunk }
- dwINFOOffset: Longint; { offset in file to INFO chunk }
- lpText : PChar; { text of modified chunk. None if NULL. }
- pNext : PInfoData; { next read sub-chunk }
- end;
- PInfoChunk = ^TInfoChunk;
- TInfoChunk = record
- lpChunk : PChar; { complete chunk in memory (GlobalPtr) }
- cksize : Longint; { size of chunk data }
- pHead : PInfoData; { first sub-chunk data }
- end;
- TInfo = record
- pFOURCC: PChar;
- pShort : PChar;
- pLong : PChar;
- end;
- PDisp = ^TDisp;
- TDisp = record
- cfid : Longint; { Clipboard id of data }
- wFlags : Word; { flags for chunk }
- lpChunk: PChar; { ptr to original file data }
- lpData : PChar; { ptr to modified data }
- pNext : PDISP; { next in list }
- end;
- PDispList = ^TDispList;
- TDispList = record
- pHead : PDisp; { first 'DISP' chunk }
- end;
- const
- aINFO: array[0..23] of TInfo = (
- (pFOURCC: 'IARL';
- pShort: 'Archival Location';
- pLong: 'Indicates where the subject of the file is archived.'),
- (pFOURCC: 'IART';
- pShort: 'Artist';
- pLong: 'Lists the artist of the original subject of the file. For example,'
- +' "Michaelangelo."'),
- (pFOURCC: 'ICMS';
- pShort: 'Commissioned';
- pLong: 'Lists the name of the person or organization that commissioned '
- +'the subject of the file. For example, "Pope Julian II."'),
- (pFOURCC: 'ICMT';
- pShort: 'Comments';
- pLong: 'Provides general comments about the file or the subject of the '
- +'file. If the comment is several sentences long, end each sentence '
- +'with a period. Do not include newline characters.'),
- (pFOURCC: 'ICOP';
- pShort: 'Copyright';
- pLong: 'Records the copyright information for the file. For example, '
- +'"Copyright Encyclopedia International 1991." If there are multiple '
- +'copyrights, separate them by a semicolon followed by a space.'),
- (pFOURCC: 'ICRD';
- pShort: 'Creation date';
- pLong: 'Specifies the date the subject of the file was created. List dates '
- +'in year-month-day format, padding one-digit months and days with a'
- +' zero on the left. For example, "1553-05-03" for May 3), 1553.'),
- (pFOURCC: 'ICRP';
- pShort: 'Cropped';
- pLong: 'Describes whether an image has been cropped and, if so, how it was '
- +'cropped. For example, "lower right corner."'),
- (pFOURCC: 'IDIM';
- pShort: 'Dimensions';
- pLong: 'Specifies the size of the original subject of the file. For example, '
- +'"8.5 in h, 11 in w."'),
- (pFOURCC: 'IDPI';
- pShort: 'Dots Per Inch';
- pLong: 'Stores dots per inch setting of the digitizer used to produce the '
- +'file, such as "300."'),
- (pFOURCC: 'IENG';
- pShort: 'Engineer';
- pLong: 'Stores the name of the engineer who worked on the file. If there '
- +'are multiple engineers, separate the names by a semicolon and a '
- +'blank. For example, "Smith, John; Adams, Joe."'),
- (pFOURCC: 'IGNR';
- pShort: 'Genre';
- pLong: 'Describes the original work, such as, "landscape," "portrait," '
- +'"still life," etc.'),
- (pFOURCC: 'IKEY';
- pShort: 'Keywords';
- pLong: 'Provides a list of keywords that refer to the file or subject of '
- +'the file. Separate multiple keywords with a semicolon and a blank. For example, "Seattle; aerial view; scenery."'),
- (pFOURCC: 'ILGT';
- pShort: 'Lightness';
- pLong: 'Describes the changes in lightness settings on the digitizer required '
- +'to produce the file. Note that the format of this information depends on hardware used.'),
- (pFOURCC: 'IMED';
- pShort: 'Medium';
- pLong: 'Describes the original subject of the file, such as, "computer image," '
- +'"drawing," "lithograph," and so forth.'),
- (pFOURCC: 'INAM';
- pShort: 'Name';
- pLong: 'Stores the title of the subject of the file, such as, "Seattle From '
- +'Above."'),
- (pFOURCC: 'IPLT';
- pShort: 'Palette Setting';
- pLong: 'Specifies the number of colors requested when digitizing an image, '
- +'such as "256."'),
- (pFOURCC: 'IPRD';
- pShort: 'Product';
- pLong: 'Specifies the name of the title the file was originally intended '
- +'for, such as "Encyclopedia of Pacific Northwest Geography."'),
- (pFOURCC: 'ISBJ';
- pShort: 'Subject';
- pLong: 'Describes the contents of the file, such as "Aerial view of Seattle."'),
- (pFOURCC: 'ISFT';
- pShort: 'Software';
- pLong: 'Identifies the name of the software package used to create the file, '
- +'such as "Microsoft WaveEdit."'),
- (pFOURCC: 'ISHP';
- pShort: 'Sharpness';
- pLong: 'Identifies the changes in sharpness for the digitizer required to '
- +'produce the file (the format depends on the hardware used).'),
- (pFOURCC: 'ISRC';
- pShort: 'Source';
- pLong: 'Identifies the name of the person or organization who supplied the '
- +'original subject of the file. For example, "Trey Research."'),
- (pFOURCC: 'ISRF';
- pShort: 'Source Form';
- pLong: 'Identifies the original form of the material that was digitized, '
- +'such as "slide," "paper," "map," and so forth. This is not necessarily '
- +'the same as IMED.'),
- (pFOURCC: 'ITCH';
- pShort: 'Technician';
- pLong: 'Identifies the technician who digitized the subject file. For '
- +'example, "Smith, John."'),
- (pFOURCC: NIL;
- pShort: NIL;
- pLong: NIL));
- {*************************************************************************}
- { error returns from RIFF functions }
- {*************************************************************************}
- const
- RIFFERR_BASE = 0;
- RIFFERR_NOERROR = 0;
- RIFFERR_ERROR = RIFFERR_BASE+1;
- RIFFERR_BADPARAM = RIFFERR_BASE+2;
- RIFFERR_FILEERROR = RIFFERR_BASE+3;
- RIFFERR_NOMEM = RIFFERR_BASE+4;
- RIFFERR_BADFILE = RIFFERR_BASE+5;
- (************************************************************************)
- function mmioFourCC(ch0,ch1,ch2,ch3: Char): FourCC;
- function RiffCopyChunk(hmmioSrc,hmmioDst: THMMIO; lpck: PMMCKINFO): Boolean;
- function RiffCopyList(hmmioSrc,hmmioDst: THMMIO; lpck: PMMCKINFO): Boolean;
- (************************************************************************)
- function RiffInitINFO(Var lpInfo: PInfoChunk): integer;
- function RiffCopyInfo(Var lpInfoDst: PInfoChunk; lpInfoSrc: PInfoChunk): integer;
- function RiffFreeINFO(Var lpInfo: PInfoChunk): integer;
- function RiffReadINFO(hmmio: THMMIO; lpck: PMMCKINFO; lpInfo: PInfoChunk): integer;
- function RiffWriteINFO(hmmio: THMMIO; lpInfo: PInfoChunk): integer;
- function RiffCreateINFO(wFlags, id: Word; dwInfoOffset: Longint; lpText: PChar): PInfoData;
- procedure RiffInsertINFO(lpInfo: PInfoChunk; pInfo: PInfoData);
- function RiffFindPIINFO(lpInfo: PInfoChunk; fcc: FOURCC): PInfoData;
- procedure RiffModifyINFO(lpInfo: PInfoChunk; pi: PInfoData;
- wFlags: Word; dw: Longint; lpText: PChar);
- function RiffFindaINFO(fcc: FOURCC): integer;
- function RiffParseINFO(lpInfo: PInfoChunk): integer;
- (************************************************************************)
- function RiffInitDISP(Var lpDisp: PDispList): integer;
- function RiffCopyDISP(lpDispDst, lpDispSrc: PDISPList): integer;
- function RiffFreeDISP(Var lpDisp: PDispList; FreeList: Boolean): integer;
- function RiffReadDISP(hmmio: THMMIO; lpck: PMMCKINFO; Var lpDisp: PDispList): integer;
- function RiffWriteDISP(hmmio: THMMIO; lpDisp: PDispList): integer;
- function RiffCreateDISP(wFlags: Word; id: Longint; lpChunk, lpData: PChar): PDisp;
- procedure RiffInsertDISP(lpDisp: PDispList; pd: PDisp);
- procedure RiffModifyDISP(lpDisp: PDispList; pd: PDisp;
- wFlags: Word; lpData: PChar);
- implementation
|