Refactoring the interop code to a separate project. Still need to add the interop DLL to the final exe... or maybe I want to use references inside the projects...

git-svn-id: http://svn.code.sf.net/p/greenshot/code/trunk@1690 7dccd23d-a4a3-4e1f-8c07-b4c1b4018ab4
This commit is contained in:
RKrom 2012-03-06 17:45:50 +00:00
commit 5f9deb2f06
67 changed files with 564 additions and 502 deletions

View file

@ -32,6 +32,7 @@ using Greenshot.Plugin;
using GreenshotPlugin.Core;
using Greenshot.Plugin.Drawing;
using Greenshot.Memento;
using System.Drawing.Drawing2D;
namespace Greenshot.Drawing {
/// <summary>
@ -597,6 +598,17 @@ namespace Greenshot.Drawing {
if (RotateFlipType.Rotate90FlipNone == rotateFlipType) {
angle = 270;
}
Rectangle beforeBounds = new Rectangle(Left, Top, Width, Height);
LOG.DebugFormat("Bounds before: {0}", beforeBounds);
GraphicsPath translatePath = new GraphicsPath();
translatePath.AddRectangle(beforeBounds);
Matrix rotateMatrix = new Matrix();
rotateMatrix.RotateAt(angle, new PointF(parent.Width >> 1, parent.Height >> 1));
translatePath.Transform(rotateMatrix);
RectangleF newBounds = translatePath.GetBounds();
LOG.DebugFormat("New bounds by using graphics path: {0}", newBounds);
int ox = 0;
int oy = 0;
int centerX = parent.Width >> 1;
@ -632,6 +644,7 @@ namespace Greenshot.Drawing {
(float)newHeight
);
ApplyBounds(newRectangle);
LOG.DebugFormat("New bounds by using old method: {0}", newRectangle);
}
protected virtual ScaleHelper.IDoubleProcessor GetAngleRoundProcessor() {

View file

@ -27,7 +27,7 @@ using Greenshot.Plugin;
using Greenshot.Plugin.Drawing;
using System.Windows.Forms;
using GreenshotPlugin.Core;
using IniFile;
using Greenshot.IniFile;
using Greenshot.Configuration;
using Greenshot.Helpers;

View file

@ -24,7 +24,7 @@ using System.Drawing;
using System.Runtime.Serialization;
using Greenshot.Configuration;
using IniFile;
using Greenshot.IniFile;
namespace Greenshot.Drawing.Fields {
/// <summary>

View file

@ -23,7 +23,7 @@ using System.Collections.Generic;
using System.ComponentModel;
using Greenshot.Configuration;
using IniFile;
using Greenshot.IniFile;
namespace Greenshot.Drawing.Fields {
/// <summary>

View file

@ -34,6 +34,7 @@ namespace Greenshot.Drawing {
/// </summary>
[Serializable()]
public class FreehandContainer : DrawableContainer {
private static readonly log4net.ILog LOG = log4net.LogManager.GetLogger(typeof(FreehandContainer));
private static readonly float [] POINT_OFFSET = new float[]{0.5f, 0.25f, 0.75f};
[NonSerialized]
@ -168,6 +169,27 @@ namespace Greenshot.Drawing {
myBounds = Rectangle.Round(freehandPath.GetBounds());
}
public override void Rotate(RotateFlipType rotateFlipType) {
int angle = 270;
if (rotateFlipType == RotateFlipType.Rotate90FlipNone) {
angle = 90;
}
LOG.DebugFormat("Bounds before: {0} - {1}", Bounds, freehandPath.GetBounds());
Matrix rotateMatrix = new Matrix();
rotateMatrix.Translate(-(parent.Width >> 1), -(parent.Height >> 1));
freehandPath.Transform(rotateMatrix);
rotateMatrix = new Matrix();
rotateMatrix.Rotate(360 - angle);
freehandPath.Transform(rotateMatrix);
rotateMatrix = new Matrix();
rotateMatrix.Translate(parent.Height >> 1, parent.Width >> 1);
freehandPath.Transform(rotateMatrix);
LOG.DebugFormat("Bounds after: {0} - {1}", Bounds, freehandPath.GetBounds());
//base.Rotate(rotateFlipType);
}
/// <summary>
/// Do the drawing of the freehand "stroke"
/// </summary>

View file

@ -33,7 +33,7 @@ using Greenshot.Plugin;
using Greenshot.Plugin.Drawing;
using GreenshotPlugin.Core;
using Greenshot.Memento;
using IniFile;
using Greenshot.IniFile;
using Greenshot.Drawing.Filters;
using System.Drawing.Drawing2D;
using GreenshotPlugin.Controls;