Give previous result to DrawOutput instead of SurfaceImage so effects can be applied to top of each other

This commit is contained in:
Jaex 2016-05-07 03:28:58 +03:00
parent d7d65a3946
commit 431b733fae
5 changed files with 18 additions and 11 deletions

View file

@ -686,22 +686,29 @@ public void UpdateRegionPath()
public override Image GetResultImage()
{
if (SurfaceImage != null && AreaManager.DrawingShapes.Length > 0)
if (SurfaceImage != null)
{
using (Bitmap surfaceCopy = (Bitmap)SurfaceImage.Clone())
using (Graphics g = Graphics.FromImage(SurfaceImage))
if (AreaManager.DrawingShapes.Length > 0)
{
foreach (BaseDrawingShape shape in AreaManager.DrawingShapes)
using (Bitmap bmp = new Bitmap(SurfaceImage))
using (Graphics g = Graphics.FromImage(bmp))
{
if (shape != null)
foreach (BaseDrawingShape shape in AreaManager.DrawingShapes)
{
shape.DrawOutput(g, surfaceCopy);
if (shape != null)
{
shape.DrawOutput(g, bmp);
}
}
return ShapeCaptureHelpers.GetRegionImage(bmp, regionFillPath, regionDrawPath, Config);
}
}
return ShapeCaptureHelpers.GetRegionImage(SurfaceImage, regionFillPath, regionDrawPath, Config);
}
return base.GetResultImage();
return null;
}
protected override void Dispose(bool disposing)

View file

@ -34,7 +34,7 @@ public static class ShapeCaptureHelpers
{
public static Image GetRegionImage(Image surfaceImage, GraphicsPath regionFillPath, GraphicsPath regionDrawPath, SurfaceOptions options)
{
if (regionFillPath != null)
if (surfaceImage != null && regionFillPath != null)
{
Image img;

View file

@ -49,7 +49,7 @@ public override void Draw(Graphics g)
if (Rectangle.Width > 10 && Rectangle.Height > 10)
{
using (Font font = new Font("Verdana", 12, FontStyle.Bold))
using (Font font = new Font("Verdana", 14))
using (StringFormat sf = new StringFormat { Alignment = StringAlignment.Center, LineAlignment = StringAlignment.Center })
{
g.DrawString("Blur", font, Brushes.White, Rectangle, sf);

View file

@ -47,7 +47,7 @@ public override void Draw(Graphics g)
if (Rectangle.Width > 10 && Rectangle.Height > 10)
{
using (Font font = new Font("Verdana", 12, FontStyle.Bold))
using (Font font = new Font("Verdana", 14))
using (StringFormat sf = new StringFormat { Alignment = StringAlignment.Center, LineAlignment = StringAlignment.Center })
{
g.DrawString("Highlight", font, Brushes.Black, Rectangle, sf);

View file

@ -49,7 +49,7 @@ public override void Draw(Graphics g)
if (Rectangle.Width > 10 && Rectangle.Height > 10)
{
using (Font font = new Font("Verdana", 12, FontStyle.Bold))
using (Font font = new Font("Verdana", 14))
using (StringFormat sf = new StringFormat { Alignment = StringAlignment.Center, LineAlignment = StringAlignment.Center })
{
g.DrawString("Pixelate", font, Brushes.White, Rectangle, sf);