WatermarkData.cs 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  1. using ComPDFKit.PDFWatermark;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. using System.Runtime.CompilerServices;
  6. using System.Text;
  7. using System.Threading.Tasks;
  8. using System.Windows.Media;
  9. namespace Compdfkit_Tools.PDFControl
  10. {
  11. public class WatermarkData
  12. {
  13. public event EventHandler ValueChanged;
  14. private C_Watermark_Type _type;
  15. public C_Watermark_Type Type
  16. {
  17. get => _type;
  18. set => UpdateProper(ref _type, value);
  19. }
  20. //Text--------------
  21. private string _text;
  22. public string Text
  23. {
  24. get => _text;
  25. set => UpdateProper(ref _text, value);
  26. }
  27. private string _fontName;
  28. public string FontName
  29. {
  30. get => _fontName;
  31. set => UpdateProper(ref _fontName, value);
  32. }
  33. private float _fontSize;
  34. public float FontSize
  35. {
  36. get => _fontSize;
  37. set => UpdateProper(ref _fontSize, value);
  38. }
  39. private byte[] _color;
  40. public byte[] Color
  41. {
  42. get => _color;
  43. set => UpdateProper(ref _color, value);
  44. }
  45. //----------------
  46. //Image---------
  47. private string _imagePath;
  48. public string ImagePath
  49. {
  50. get => _imagePath;
  51. set => UpdateProper(ref _imagePath, value);
  52. }
  53. private int _imageScale;
  54. public int ImageScale
  55. {
  56. get => _imageScale;
  57. set => UpdateProper(ref _imageScale, value);
  58. }
  59. //----------------
  60. private int _rotation;
  61. public int Rotation
  62. {
  63. get => _rotation;
  64. set => UpdateProper(ref _rotation, value);
  65. }
  66. private byte _opacity;
  67. public byte Opacity
  68. {
  69. get => _opacity;
  70. set => UpdateProper(ref _opacity, value);
  71. }
  72. private int _align;
  73. public int Align
  74. {
  75. get => _align;
  76. set => UpdateProper(ref _align, value);
  77. }
  78. private float _vertOffset;
  79. public float VertOffset
  80. {
  81. get => _vertOffset;
  82. set => UpdateProper(ref _vertOffset, value);
  83. }
  84. private float _horizOffset;
  85. public float HorizOffset
  86. {
  87. get => _horizOffset;
  88. set => UpdateProper(ref _horizOffset, value);
  89. }
  90. private bool _isFront;
  91. public bool IsFront
  92. {
  93. get => _isFront;
  94. set => UpdateProper(ref _isFront, value);
  95. }
  96. private bool _isFullScreen;
  97. public bool IsFullScreen
  98. {
  99. get => _isFullScreen;
  100. set => UpdateProper(ref _isFullScreen, value);
  101. }
  102. private float _verticalSpacing;
  103. public float VerticalSpacing
  104. {
  105. get => _verticalSpacing;
  106. set => UpdateProper(ref _verticalSpacing, value);
  107. }
  108. private float _horizontalSpacing;
  109. public float HorizontalSpacing
  110. {
  111. get => _horizontalSpacing;
  112. set => UpdateProper(ref _horizontalSpacing, value);
  113. }
  114. public WatermarkData()
  115. {
  116. }
  117. protected void OnValueChanged(string propertyName = null)
  118. {
  119. ValueChanged?.Invoke(this, new EventArgs());
  120. }
  121. protected bool UpdateProper<T>(ref T properValue, T newValue, [CallerMemberName] string properName = "")
  122. {
  123. if (object.Equals(properValue, newValue))
  124. return false;
  125. properValue = newValue;
  126. OnValueChanged(properName);
  127. return true;
  128. }
  129. }
  130. public class TextWatermarkData : WatermarkData
  131. {
  132. }
  133. public class ImageWatermarkData : WatermarkData
  134. {
  135. }
  136. }