Example #1
0
 public override Transform Simplify(Transform other)
 {
     var other2 = (CropTransform)other;
     return new CropTransform
     {
         Left = Left + other2.Left,
         Right = Right + other2.Right,
         Top = Top + other2.Top,
         Bottom = Bottom + other2.Bottom
     };
 }
Example #2
0
 public static void AddOrSimplify(IList<Transform> transformList, Transform transform)
 {
     var last = transformList.LastOrDefault();
     if (transform.CanSimplify(last))
     {
         var simplified = transform.Simplify(last);
         if (simplified.IsNull)
         {
             transformList.RemoveAt(transformList.Count - 1);
         }
         else
         {
             transformList[transformList.Count - 1] = transform.Simplify(last);
         }
     }
     else if (!transform.IsNull)
     {
         transformList.Add(transform);
     }
 }
Example #3
0
 /// <summary>
 /// Combines this transform with a previous transform to form a single new transform.
 /// </summary>
 /// <param name="other"></param>
 /// <returns></returns>
 public virtual Transform Simplify(Transform other)
 {
     throw new InvalidOperationException();
 }
Example #4
0
 /// <summary>
 /// Determines if this transform performed after another transform can be combined to form a single transform.
 /// </summary>
 /// <param name="other"></param>
 /// <returns></returns>
 public virtual bool CanSimplify(Transform other)
 {
     return false;
 }
Example #5
0
 public void AddTransform(Transform transform)
 {
     RotateFlipCalled += 1;
 }
Example #6
0
 public override bool CanSimplify(Transform other)
 {
     return other is CropTransform;
 }
Example #7
0
 private static void AddTransformAndUpdateThumbnail(ScannedImage image, Transform transform)
 {
     image.AddTransform(transform);
     var thumbnail = image.GetThumbnail(null);
     if (thumbnail != null)
     {
         image.SetThumbnail(transform.Perform(thumbnail));
     }
 }
Example #8
0
 public override Transform Simplify(Transform other)
 {
     var other2 = (RotationTransform)other;
     return new RotationTransform(Angle + other2.Angle);
 }
Example #9
0
 public override bool CanSimplify(Transform other)
 {
     return other is RotationTransform;
 }
Example #10
0
 public void AddTransform(Transform transform)
 {
     // Also updates the recovery index since they reference the same list
     Transform.AddOrSimplify(transformList, transform);
     _recoveryIndexManager.Save();
 }
Example #11
0
 public void AddTransform(Transform transform)
 {
     Transform.AddOrSimplify(transformList, transform);
 }