InkParam.cs 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. using ComPDFKit.Import;
  2. using ComPDFKit.PDFAnnotation;
  3. using System.Collections.Generic;
  4. using System.Windows.Media;
  5. namespace ComPDFKit.Tool
  6. {
  7. public class InkParam:AnnotParam
  8. {
  9. public InkParam ()
  10. {
  11. CurrentType = C_ANNOTATION_TYPE.C_ANNOTATION_INK;
  12. }
  13. public byte[] InkColor { get; set; }
  14. public double Thickness { get; set; }
  15. public List<List<CPoint>> InkPath { get; set; }
  16. public float[] Dash { get; set; }
  17. public override bool CopyTo(AnnotParam transfer)
  18. {
  19. InkParam inkTransfer = transfer as InkParam;
  20. if (inkTransfer == null)
  21. {
  22. return false;
  23. }
  24. if (!base.CopyTo(inkTransfer))
  25. {
  26. return false;
  27. }
  28. if(InkColor != null)
  29. {
  30. inkTransfer.InkColor = (byte[])InkColor.Clone();
  31. }
  32. inkTransfer.Thickness = Thickness;
  33. if(InkPath != null)
  34. {
  35. List<List<CPoint>> inkPoints = new List<List<CPoint>>();
  36. foreach (List<CPoint> points in InkPath)
  37. {
  38. List<CPoint> pointList = new List<CPoint>();
  39. foreach (CPoint point in points)
  40. {
  41. pointList.Add(point);
  42. }
  43. inkPoints.Add(pointList);
  44. }
  45. inkTransfer.InkPath = inkPoints;
  46. }
  47. inkTransfer.Dash = null;
  48. if (Dash != null)
  49. {
  50. float[] DashCopy=new float[Dash.Length];
  51. Dash.CopyTo(DashCopy,0);
  52. inkTransfer.Dash = DashCopy;
  53. }
  54. return true;
  55. }
  56. }
  57. }