Exemple #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
     };
 }
Exemple #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);
     }
 }
Exemple #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();
 }
Exemple #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;
 }
 public void AddTransform(Transform transform)
 {
     RotateFlipCalled += 1;
 }
Exemple #6
0
 public override bool CanSimplify(Transform other)
 {
     return other is CropTransform;
 }
Exemple #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));
     }
 }
Exemple #8
0
 public override Transform Simplify(Transform other)
 {
     var other2 = (RotationTransform)other;
     return new RotationTransform(Angle + other2.Angle);
 }
Exemple #9
0
 public override bool CanSimplify(Transform other)
 {
     return other is RotationTransform;
 }
 public void AddTransform(Transform transform)
 {
     // Also updates the recovery index since they reference the same list
     Transform.AddOrSimplify(transformList, transform);
     _recoveryIndexManager.Save();
 }
Exemple #11
0
 public void AddTransform(Transform transform)
 {
     Transform.AddOrSimplify(transformList, transform);
 }