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