Repo for the search and displace ingest module that takes odf, docx and pdf and transforms it into .md to be used with search and displace operations
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

74 lines
1.5 KiB

3 years ago
  1. unit ImagingTiffMac;
  2. {$I ImagingOptions.inc}
  3. {$IFNDEF MACOSX}
  4. {$FATAL 'Mac OSX only'}
  5. {$ENDIF}
  6. interface
  7. uses
  8. Types, SysUtils, Classes, Imaging, ImagingTypes, ImagingTiff, ImagingUtility;
  9. type
  10. TTiffMacFileFormat = class(TTiffFileFormat)
  11. protected
  12. procedure Define; override;
  13. function LoadData(Handle: TImagingHandle; var Images: TDynImageDataArray;
  14. OnlyFirstLevel: Boolean): Boolean; override;
  15. function SaveData(Handle: TImagingHandle; const Images: TDynImageDataArray;
  16. Index: Integer): Boolean; override;
  17. procedure ConvertToSupported(var Image: TImageData;
  18. const Info: TImageFormatInfo); override;
  19. end;
  20. implementation
  21. uses
  22. ImagingQuartz, ImagingIO;
  23. { TTiffMacFileFormat }
  24. procedure TTiffMacFileFormat.Define;
  25. begin
  26. inherited;
  27. end;
  28. function TTiffMacFileFormat.LoadData(Handle: TImagingHandle;
  29. var Images: TDynImageDataArray; OnlyFirstLevel: Boolean): Boolean;
  30. var
  31. Stream: TCustomMemoryStream;
  32. Handler: TQuartzImageHandler;
  33. begin
  34. Stream := TReadMemoryStream.CreateFromIOHandle(GetIO, Handle);
  35. Handler := TQuartzImageHandler.Create;
  36. try
  37. Handler.LoadImage(Stream, Images, OnlyFirstLevel);
  38. finally
  39. Handler.Free;
  40. Stream.Free;
  41. end;
  42. end;
  43. function TTiffMacFileFormat.SaveData(Handle: TImagingHandle;
  44. const Images: TDynImageDataArray; Index: Integer): Boolean;
  45. begin
  46. end;
  47. procedure TTiffMacFileFormat.ConvertToSupported(var Image: TImageData;
  48. const Info: TImageFormatInfo);
  49. begin
  50. inherited;
  51. end;
  52. initialization
  53. RegisterImageFileFormat(TTiffMacFileFormat);
  54. end.