fixed surface prepare error

This commit is contained in:
Jaex 2014-11-26 19:48:25 +02:00
parent 4fc9c13dd4
commit d8a803f9ce
11 changed files with 11 additions and 41 deletions

View file

@ -31,11 +31,6 @@ namespace ScreenCaptureLib
{
public class DiamondRegion : RectangleRegion
{
public DiamondRegion(Image backgroundImage = null)
: base(backgroundImage)
{
}
protected override void AddShapePath(GraphicsPath graphicsPath, Rectangle rect)
{
graphicsPath.AddDiamond(rect);

View file

@ -30,11 +30,6 @@ namespace ScreenCaptureLib
{
public class EllipseRegion : RectangleRegion
{
public EllipseRegion(Image backgroundImage = null)
: base(backgroundImage)
{
}
protected override void AddShapePath(GraphicsPath graphicsPath, Rectangle rect)
{
graphicsPath.AddEllipse(rect);

View file

@ -38,12 +38,10 @@ public class FreeHandRegion : Surface
private bool isAreaCreated;
private Rectangle currentArea;
public FreeHandRegion(Image backgroundImage = null)
: base(backgroundImage)
public FreeHandRegion()
{
points = new List<Point>(128);
regionFillPath = new GraphicsPath();
lastNode = new NodeObject() { Shape = NodeShape.Circle };
DrawableObjects.Add(lastNode);
}

View file

@ -38,11 +38,9 @@ public class PolygonRegion : Surface
private bool isAreaCreated;
private Rectangle currentArea;
public PolygonRegion(Image backgroundImage = null)
: base(backgroundImage)
public PolygonRegion()
{
nodes = new List<NodeObject>();
MouseDown += PolygonRegionSurface_MouseDown;
}

View file

@ -44,8 +44,7 @@ public class RectangleRegion : Surface
// For screen ruler
public bool RulerMode { get; set; }
public RectangleRegion(Image backgroundImage = null)
: base(backgroundImage)
public RectangleRegion()
{
AreaManager = new AreaManager(this);
KeyDown += RectangleRegion_KeyDown;

View file

@ -36,12 +36,10 @@ public class RoundedRectangleRegion : RectangleRegion
public float Radius { get; set; }
public int RadiusIncrement { get; set; }
public RoundedRectangleRegion(Image backgroundImage = null)
: base(backgroundImage)
public RoundedRectangleRegion()
{
Radius = 25;
RadiusIncrement = 3;
KeyDown += RoundedRectangleRegion_KeyDown;
}

View file

@ -58,7 +58,7 @@ public class Surface : Form
public static GraphicsPath LastRegionFillPath, LastRegionDrawPath;
public Surface(Image backgroundImage = null)
public Surface()
{
ScreenRectangle = CaptureHelpers.GetScreenBounds();
ScreenRectangle0Based = CaptureHelpers.ScreenToClient(ScreenRectangle);
@ -70,12 +70,6 @@ public Surface(Image backgroundImage = null)
Cursor = new Cursor(cursorStream);
}
if (backgroundImage != null)
{
SurfaceImage = backgroundImage;
Prepare();
}
DrawableObjects = new List<DrawableObject>();
Config = new SurfaceOptions();
timer = new Stopwatch();

View file

@ -34,11 +34,9 @@ public class TriangleRegion : RectangleRegion
{
public TriangleAngle Angle { get; set; }
public TriangleRegion(Image backgroundImage = null)
: base(backgroundImage)
public TriangleRegion()
{
Angle = TriangleAngle.Top;
KeyDown += TriangleRegion_KeyDown;
}

View file

@ -1478,7 +1478,7 @@
</data>
<data name="niTray.Text" xml:space="preserve">
<value>ShareX</value>
</data>
<comment>@Invariant</comment></data>
<metadata name="$this.Localizable" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
@ -1499,7 +1499,7 @@
</data>
<data name="$this.Text" xml:space="preserve">
<value>ShareX</value>
</data>
<comment>@Invariant</comment></data>
<data name="&gt;&gt;chFilename.Name" xml:space="preserve">
<value>chFilename</value>
</data>

View file

@ -117,9 +117,6 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="lblDragAndDropTip.Text" xml:space="preserve">
<value>Dosyaları bu pencereye sürükleyip bırakabilirsiniz</value>
</data>
<data name="chFilename.Text" xml:space="preserve">
<value>Dosya adı</value>
</data>

View file

@ -348,8 +348,7 @@ public static PointInfo SelectPointColor(SurfaceOptions surfaceOptions = null)
surfaceOptions = new SurfaceOptions();
}
using (Image fullscreen = Screenshot.CaptureFullscreen())
using (RectangleRegion surface = new RectangleRegion(fullscreen))
using (RectangleRegion surface = new RectangleRegion())
{
surface.Config = surfaceOptions;
surface.OneClickMode = true;
@ -360,7 +359,7 @@ public static PointInfo SelectPointColor(SurfaceOptions surfaceOptions = null)
{
PointInfo pointInfo = new PointInfo();
pointInfo.Position = CaptureHelpers.ClientToScreen(surface.OneClickPosition);
pointInfo.Color = ((Bitmap)fullscreen).GetPixel(surface.OneClickPosition.X, surface.OneClickPosition.Y);
pointInfo.Color = ((Bitmap)surface.SurfaceImage).GetPixel(surface.OneClickPosition.X, surface.OneClickPosition.Y);
return pointInfo;
}
}
@ -512,8 +511,7 @@ public static void OpenScreenColorPicker()
public static void OpenRuler()
{
using (Image fullscreen = Screenshot.CaptureFullscreen())
using (RectangleRegion surface = new RectangleRegion(fullscreen))
using (RectangleRegion surface = new RectangleRegion())
{
surface.RulerMode = true;
surface.Config.QuickCrop = false;