CPDFCompareOverlay.h 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. //
  2. // CPDFCompareOverlay.h
  3. // ComPDFKit
  4. //
  5. // Copyright © 2014-2023 PDF Technologies, Inc. All Rights Reserved.
  6. //
  7. // THIS SOURCE CODE AND ANY ACCOMPANYING DOCUMENTATION ARE PROTECTED BY INTERNATIONAL COPYRIGHT LAW
  8. // AND MAY NOT BE RESOLD OR REDISTRIBUTED. USAGE IS BOUND TO THE ComPDFKit LICENSE AGREEMENT.
  9. // UNAUTHORIZED REPRODUCTION OR DISTRIBUTION IS SUBJECT TO CIVIL AND CRIMINAL PENALTIES.
  10. // This notice may not be removed from this file.
  11. //
  12. #import <ComPDFKit/CPDFKitPlatform.h>
  13. typedef NS_ENUM(NSInteger, CPDFBlendMode) {
  14. CPDFBlendModeNormal = 0,
  15. CPDFBlendModeMultiply,
  16. CPDFBlendModeDarken,
  17. CPDFBlendModeColorBurn,
  18. CPDFBlendModeHardLight,
  19. CPDFBlendModeDifference,
  20. CPDFBlendModeExclusion,
  21. CPDFBlendModeLuminosity,
  22. CPDFBlendModeLast = CPDFBlendModeLuminosity,
  23. };
  24. @class CPDFDocument;
  25. @interface CPDFCompareOverlay : NSObject
  26. /**
  27. * Initialize it with the given two versions of a document.
  28. * By default, it will generate a comparison document according to the order of pages, starting from the first page of both versions of the document.
  29. *
  30. * @param oldDocument The old version of a document
  31. * @param newDocument The new version of a document.
  32. */
  33. - (instancetype)initWithOldDocument:(CPDFDocument *)oldDocument
  34. newDocument:(CPDFDocument *)newDocument;
  35. /**
  36. * Initialize it with the given two versions of a document.
  37. * and indices of the pages on which the points should be selected in both versions of a document.
  38. *
  39. * @param oldDocument The old version of a document
  40. * @param oldPageRange The page range of the old document, for example: 1,3,5,6-10.
  41. * @param newDocument The new version of a document.
  42. * @param newPageString The page range of the new document, for example: 1,3,5,6-10.
  43. */
  44. - (instancetype)initWithOldDocument:(CPDFDocument *)oldDocument
  45. oldPageRange:(NSString *)oldPageString
  46. newDocument:(CPDFDocument *)newDocument
  47. newPageRange:(NSString *)newPageString;
  48. /**
  49. * Compares the document.
  50. */
  51. - (BOOL)compare;
  52. /**
  53. * Sets the color that will be used to replace all strokes in the old version of a document.
  54. *
  55. * Returns true on success, false on failure.
  56. * @param strokeColor RGB color value, range 0-255.
  57. */
  58. - (BOOL)setOldDocumentStrokeColor:(CPDFKitPlatformColor *)strokeColor;
  59. /**
  60. * Sets the color that will be used to replace all strokes in the new version of a document.
  61. *
  62. * Returns true on success, false on failure.
  63. * @param strokeColor RGB color value, range 0-255.
  64. */
  65. - (BOOL)setNewDocumentStrokeColor:(CPDFKitPlatformColor *)strokeColor;
  66. /**
  67. * Sets the opacity that will be used to replace all strokes in the old version of a document.
  68. *
  69. * Returns true on success, false on failure.
  70. * @param strokeAlpha Opacity value, range 0-1.
  71. */
  72. - (BOOL)setOldDocumentStrokeOpacity:(CGFloat)strokeAlpha;
  73. /**
  74. * Sets the opacity that will be used to replace all strokes in the new version of a document.
  75. *
  76. * Returns true on success, false on failure.
  77. * @param strokeAlpha Opacity value, range 0-1.
  78. */
  79. - (BOOL)setNewDocumentStrokeOpacity:(CGFloat)strokeAlpha;
  80. /**
  81. * Sets the fill opacity that will be used to replace all strokes in the old version of a document.
  82. *
  83. * Returns true on success, false on failure.
  84. * @param fillAlpha Opacity value, range 0-1.
  85. */
  86. - (BOOL)setOldDocumentFillOpacity:(CGFloat)fillAlpha;
  87. /**
  88. * Sets the fill opacity that will be used to replace all strokes in the new version of a document.
  89. *
  90. * Returns true on success, false on failure.
  91. * @param fillAlpha Opacity value, range 0-1.
  92. */
  93. - (BOOL)setNewDocumentFillOpacity:(CGFloat)fillAlpha;
  94. /**
  95. * Sets whether the path is filled with white.
  96. */
  97. - (BOOL)setNoFill:(BOOL)noFill;
  98. /**
  99. * Sets the blend mode that will be used when overlaying the new version of a document onto the old version.
  100. *
  101. * Returns true on success, false on failure.
  102. * @see CPDFBlendMode
  103. */
  104. - (BOOL)setBlendMod:(CPDFBlendMode)blendMod;
  105. /**
  106. * Gets the generated comparison document once the user compares both versions of a document.
  107. *
  108. * Returns The generated document.
  109. */
  110. - (CPDFDocument *)comparisonDocument;
  111. @end