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 }; }
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); } }
/// <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(); }
/// <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; }
public override bool CanSimplify(Transform other) { return other is CropTransform; }
private static void AddTransformAndUpdateThumbnail(ScannedImage image, Transform transform) { image.AddTransform(transform); var thumbnail = image.GetThumbnail(null); if (thumbnail != null) { image.SetThumbnail(transform.Perform(thumbnail)); } }
public override Transform Simplify(Transform other) { var other2 = (RotationTransform)other; return new RotationTransform(Angle + other2.Angle); }
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(); }
public void AddTransform(Transform transform) { Transform.AddOrSimplify(transformList, transform); }