When canvas modified update effect cache

This commit is contained in:
Jaex 2017-11-18 19:09:10 +03:00
parent 759533eb27
commit 68b62f7bde

View file

@ -1344,6 +1344,18 @@ public void DrawRegionArea(Graphics g, Rectangle rect, bool isAnimated)
Form.DrawRegionArea(g, rect, isAnimated); Form.DrawRegionArea(g, rect, isAnimated);
} }
private void UpdateCanvas(Image img)
{
Form.InitBackground(img);
foreach (BaseEffectShape effect in EffectShapes)
{
effect.OnMoved();
}
isAnnotated = true;
}
public void CropArea(Rectangle rect) public void CropArea(Rectangle rect)
{ {
Image img = CropImage(rect, true); Image img = CropImage(rect, true);
@ -1351,8 +1363,7 @@ public void CropArea(Rectangle rect)
if (img != null) if (img != null)
{ {
MoveAll(Form.CanvasRectangle.X - rect.X, Form.CanvasRectangle.Y - rect.Y); MoveAll(Form.CanvasRectangle.X - rect.X, Form.CanvasRectangle.Y - rect.Y);
Form.InitBackground(img); UpdateCanvas(img);
isAnnotated = true;
} }
} }
@ -1391,8 +1402,7 @@ private void ChangeImageSize()
if (img != null) if (img != null)
{ {
Form.InitBackground(img); UpdateCanvas(img);
isAnnotated = true;
} }
} }
} }
@ -1411,8 +1421,7 @@ private void ChangeCanvasSize()
if (img != null) if (img != null)
{ {
MoveAll(canvas.Left, canvas.Top); MoveAll(canvas.Left, canvas.Top);
Form.InitBackground(img); UpdateCanvas(img);
isAnnotated = true;
} }
} }
} }
@ -1420,10 +1429,9 @@ private void ChangeCanvasSize()
private void RotateImage(RotateFlipType type) private void RotateImage(RotateFlipType type)
{ {
Image clone = (Image)Form.Canvas.Clone(); Image img = (Image)Form.Canvas.Clone();
clone.RotateFlip(type); img.RotateFlip(type);
Form.InitBackground(clone); UpdateCanvas(img);
isAnnotated = true;
} }
private void OnCurrentShapeChanged(BaseShape shape) private void OnCurrentShapeChanged(BaseShape shape)