mirror of
https://github.com/greenshot/greenshot
synced 2025-08-14 02:37:03 -07:00
This commit breaks compiling for a short (!) period, need to sync my work to a different system
This commit is contained in:
parent
1751880581
commit
684a7615d7
38 changed files with 1845 additions and 1324 deletions
|
@ -1,187 +0,0 @@
|
|||
/*
|
||||
* Greenshot - a free and open source screenshot tool
|
||||
* Copyright (C) 2007-2020 Thomas Braun, Jens Klingen, Robin Krom
|
||||
*
|
||||
* For more information see: http://getgreenshot.org/
|
||||
* The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 1 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
|
||||
namespace GreenshotPlugin.Interfaces {
|
||||
/// <summary>
|
||||
/// The capture mode for Greenshot
|
||||
/// </summary>
|
||||
public enum CaptureMode { None, Region, FullScreen, ActiveWindow, Window, LastRegion, Clipboard, File, IE, Import}; //, Video };
|
||||
public enum ScreenCaptureMode { Auto, FullScreen, Fixed};
|
||||
|
||||
/// <summary>
|
||||
/// Details for the capture, like the window title and date/time etc.
|
||||
/// </summary>
|
||||
public interface ICaptureDetails {
|
||||
string Filename {
|
||||
get;
|
||||
set;
|
||||
}
|
||||
string Title {
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
DateTime DateTime {
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
List<IDestination> CaptureDestinations {
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
Dictionary<string, string> MetaData {
|
||||
get;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Helper method to prevent complex code which needs to check every key
|
||||
/// </summary>
|
||||
/// <param name="key">The key for the meta-data</param>
|
||||
/// <param name="value">The value for the meta-data</param>
|
||||
void AddMetaData(string key, string value);
|
||||
|
||||
void ClearDestinations();
|
||||
void RemoveDestination(IDestination captureDestination);
|
||||
void AddDestination(IDestination captureDestination);
|
||||
bool HasDestination(string designation);
|
||||
|
||||
CaptureMode CaptureMode {
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
float DpiX {
|
||||
get;
|
||||
set;
|
||||
}
|
||||
float DpiY {
|
||||
get;
|
||||
set;
|
||||
}
|
||||
}
|
||||
|
||||
public interface ICaptureElement {
|
||||
List<ICaptureElement> Children {
|
||||
get;
|
||||
set;
|
||||
}
|
||||
Rectangle Bounds {
|
||||
get;
|
||||
set;
|
||||
}
|
||||
string Name {
|
||||
get;
|
||||
set;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The interface to the Capture object, so Plugins can use it.
|
||||
/// </summary>
|
||||
public interface ICapture : IDisposable {
|
||||
// The Capture Details
|
||||
ICaptureDetails CaptureDetails {
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
// The captured Image
|
||||
Image Image {
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
void NullImage();
|
||||
|
||||
Rectangle ScreenBounds {
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
Icon Cursor {
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
// Boolean to specify if the cursor is available
|
||||
bool CursorVisible {
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
Point CursorLocation {
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
Point Location {
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Crops the capture to the specified rectangle (with Bitmap coordinates!)
|
||||
/// </summary>
|
||||
/// <param name="cropRectangle">Rectangle with bitmap coordinates</param>
|
||||
bool Crop(Rectangle cropRectangle);
|
||||
|
||||
/// <summary>
|
||||
/// Apply a translate to the mouse location. e.g. needed for crop
|
||||
/// </summary>
|
||||
/// <param name="x">x coordinates to move the mouse</param>
|
||||
/// <param name="y">y coordinates to move the mouse</param>
|
||||
void MoveMouseLocation(int x, int y);
|
||||
|
||||
/// <summary>
|
||||
/// Store the OCR information for this capture
|
||||
/// </summary>
|
||||
OcrInformation OcrInformation { get; set; }
|
||||
|
||||
// / TODO: Enable when the elements are usable again.
|
||||
///// <summary>
|
||||
///// Apply a translate to the elements e.g. needed for crop
|
||||
///// </summary>
|
||||
///// <param name="x">x coordinates to move the elements</param>
|
||||
///// <param name="y">y coordinates to move the elements</param>
|
||||
//void MoveElements(int x, int y);
|
||||
|
||||
///// <summary>
|
||||
///// Add a new element to the capture
|
||||
///// </summary>
|
||||
///// <param name="element">Rectangle</param>
|
||||
//void AddElement(ICaptureElement element);
|
||||
|
||||
///// <summary>
|
||||
///// Returns a list of rectangles which represent objects that are "on" the capture
|
||||
///// </summary>
|
||||
//List<ICaptureElement> Elements {
|
||||
// get;
|
||||
// set;
|
||||
//}
|
||||
}
|
||||
|
||||
}
|
41
GreenshotPlugin/Interfaces/CaptureMode.cs
Normal file
41
GreenshotPlugin/Interfaces/CaptureMode.cs
Normal file
|
@ -0,0 +1,41 @@
|
|||
/*
|
||||
* Greenshot - a free and open source screenshot tool
|
||||
* Copyright (C) 2007-2020 Thomas Braun, Jens Klingen, Robin Krom
|
||||
*
|
||||
* For more information see: http://getgreenshot.org/
|
||||
* The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 1 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
namespace GreenshotPlugin.Interfaces
|
||||
{
|
||||
/// <summary>
|
||||
/// The capture mode for Greenshot
|
||||
/// </summary>
|
||||
public enum CaptureMode
|
||||
{
|
||||
None,
|
||||
Region,
|
||||
FullScreen,
|
||||
ActiveWindow,
|
||||
Window,
|
||||
LastRegion,
|
||||
Clipboard,
|
||||
File,
|
||||
IE,
|
||||
Import
|
||||
// Video
|
||||
};
|
||||
}
|
40
GreenshotPlugin/Interfaces/DrawingModes.cs
Normal file
40
GreenshotPlugin/Interfaces/DrawingModes.cs
Normal file
|
@ -0,0 +1,40 @@
|
|||
/*
|
||||
* Greenshot - a free and open source screenshot tool
|
||||
* Copyright (C) 2007-2020 Thomas Braun, Jens Klingen, Robin Krom
|
||||
*
|
||||
* For more information see: http://getgreenshot.org/
|
||||
* The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 1 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
namespace GreenshotPlugin.Interfaces
|
||||
{
|
||||
public enum DrawingModes
|
||||
{
|
||||
None,
|
||||
Rect,
|
||||
Ellipse,
|
||||
Text,
|
||||
Line,
|
||||
Arrow,
|
||||
Crop,
|
||||
Highlight,
|
||||
Obfuscate,
|
||||
Bitmap,
|
||||
Path,
|
||||
SpeechBubble,
|
||||
StepLabel
|
||||
}
|
||||
}
|
|
@ -1,266 +0,0 @@
|
|||
/*
|
||||
* Greenshot - a free and open source screenshot tool
|
||||
* Copyright (C) 2007-2020 Thomas Braun, Jens Klingen, Robin Krom
|
||||
*
|
||||
* For more information see: http://getgreenshot.org/
|
||||
* The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 1 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Windows.Forms;
|
||||
using GreenshotPlugin.Effects;
|
||||
using GreenshotPlugin.Interfaces.Drawing;
|
||||
|
||||
namespace GreenshotPlugin.Interfaces
|
||||
{
|
||||
/// <summary>
|
||||
/// Alignment Enums for possitioning
|
||||
/// </summary>
|
||||
//public enum HorizontalAlignment {LEFT, CENTER, RIGHT};
|
||||
public enum VerticalAlignment { TOP, CENTER, BOTTOM };
|
||||
|
||||
public enum SurfaceMessageTyp
|
||||
{
|
||||
FileSaved,
|
||||
Error,
|
||||
Info,
|
||||
UploadedUri
|
||||
}
|
||||
|
||||
public class SurfaceMessageEventArgs : EventArgs
|
||||
{
|
||||
public SurfaceMessageTyp MessageType
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
public string Message
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
public ISurface Surface
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
}
|
||||
|
||||
public class SurfaceElementEventArgs : EventArgs
|
||||
{
|
||||
public IDrawableContainerList Elements
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
}
|
||||
|
||||
public class SurfaceDrawingModeEventArgs : EventArgs
|
||||
{
|
||||
public DrawingModes DrawingMode
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
}
|
||||
|
||||
public delegate void SurfaceSizeChangeEventHandler(object sender, EventArgs e);
|
||||
public delegate void SurfaceMessageEventHandler(object sender, SurfaceMessageEventArgs e);
|
||||
public delegate void SurfaceElementEventHandler(object sender, SurfaceElementEventArgs e);
|
||||
public delegate void SurfaceDrawingModeEventHandler(object sender, SurfaceDrawingModeEventArgs e);
|
||||
public enum DrawingModes
|
||||
{
|
||||
None,
|
||||
Rect,
|
||||
Ellipse,
|
||||
Text,
|
||||
Line,
|
||||
Arrow,
|
||||
Crop,
|
||||
Highlight,
|
||||
Obfuscate,
|
||||
Bitmap,
|
||||
Path,
|
||||
SpeechBubble,
|
||||
StepLabel
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The interface to the Surface object, so Plugins can use it.
|
||||
/// </summary>
|
||||
public interface ISurface : IDisposable
|
||||
{
|
||||
event SurfaceSizeChangeEventHandler SurfaceSizeChanged;
|
||||
event SurfaceMessageEventHandler SurfaceMessage;
|
||||
event SurfaceDrawingModeEventHandler DrawingModeChanged;
|
||||
event SurfaceElementEventHandler MovingElementChanged;
|
||||
|
||||
/// <summary>
|
||||
/// Start valueof the step-labels (counts)
|
||||
/// </summary>
|
||||
int CounterStart { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Unique ID of the Surface
|
||||
/// </summary>
|
||||
Guid ID
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
IDrawableContainerList Elements
|
||||
{
|
||||
get;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get/Set the image to the Surface
|
||||
/// get will give the image as is currently visible
|
||||
/// set will overwrite both the visible image as the underlying image
|
||||
///
|
||||
/// important notice:
|
||||
/// The setter will clone the passed bitmap and dispose it when the Surface is disposed
|
||||
/// This means that the supplied image needs to be disposed by the calling code (if needed!)
|
||||
/// </summary>
|
||||
Image Image
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the current Image from the Editor for Exporting (save/upload etc)
|
||||
/// Don't forget to call image.Dispose() when finished!!!
|
||||
/// </summary>
|
||||
/// <returns>Bitmap</returns>
|
||||
Image GetImageForExport();
|
||||
|
||||
/// <summary>
|
||||
/// Add a TextContainer, at the given location, to the Surface.
|
||||
/// The TextContainer will be "re"sized to the text size.
|
||||
/// </summary>
|
||||
/// <param name="text">String to show</param>
|
||||
/// <param name="horizontalAlignment">Left, Center, Right</param>
|
||||
/// <param name="verticalAlignment">TOP, CENTER, BOTTOM</param>
|
||||
/// <param name="family">FontFamily</param>
|
||||
/// <param name="size">Font Size in float</param>
|
||||
/// <param name="italic">bool true if italic</param>
|
||||
/// <param name="bold">bool true if bold</param>
|
||||
/// <param name="shadow">bool true if shadow</param>
|
||||
/// <param name="borderSize">size of border (0 for none)</param>
|
||||
/// <param name="color">Color of string</param>
|
||||
/// <param name="fillColor">Color of background (e.g. Color.Transparent)</param>
|
||||
ITextContainer AddTextContainer(string text, HorizontalAlignment horizontalAlignment, VerticalAlignment verticalAlignment, FontFamily family, float size, bool italic, bool bold, bool shadow, int borderSize, Color color, Color fillColor);
|
||||
|
||||
IImageContainer AddImageContainer(Image image, int x, int y);
|
||||
ICursorContainer AddCursorContainer(Cursor cursor, int x, int y);
|
||||
IIconContainer AddIconContainer(Icon icon, int x, int y);
|
||||
IImageContainer AddImageContainer(string filename, int x, int y);
|
||||
ICursorContainer AddCursorContainer(string filename, int x, int y);
|
||||
IIconContainer AddIconContainer(string filename, int x, int y);
|
||||
long SaveElementsToStream(Stream stream);
|
||||
void LoadElementsFromStream(Stream stream);
|
||||
|
||||
bool HasSelectedElements
|
||||
{
|
||||
get;
|
||||
}
|
||||
void RemoveSelectedElements();
|
||||
void CutSelectedElements();
|
||||
void CopySelectedElements();
|
||||
void PasteElementFromClipboard();
|
||||
void DuplicateSelectedElements();
|
||||
void DeselectElement(IDrawableContainer container, bool generateEvents = true);
|
||||
void DeselectAllElements();
|
||||
|
||||
/// <summary>
|
||||
/// Add an element to the surface
|
||||
/// </summary>
|
||||
/// <param name="elements">IDrawableContainerList</param>
|
||||
/// <param name="makeUndoable">Should it be placed on the undo stack?</param>
|
||||
void AddElements(IDrawableContainerList elements, bool makeUndoable = true);
|
||||
void RemoveElements(IDrawableContainerList elements, bool makeUndoable = true);
|
||||
void SelectElements(IDrawableContainerList elements);
|
||||
|
||||
/// <summary>
|
||||
/// Add an element to the surface
|
||||
/// </summary>
|
||||
/// <param name="element">IDrawableContainer</param>
|
||||
/// <param name="makeUndoable">Should it be placed on the undo stack?</param>
|
||||
/// <param name="invalidate">Should it be invalidated (draw)</param>
|
||||
void AddElement(IDrawableContainer element, bool makeUndoable = true, bool invalidate = true);
|
||||
|
||||
/// <summary>
|
||||
/// Select the supplied container
|
||||
/// </summary>
|
||||
/// <param name="container">IDrawableContainer</param>
|
||||
/// <param name="invalidate">false to skip invalidation</param>
|
||||
/// <param name="generateEvents">false to skip event generation</param>
|
||||
void SelectElement(IDrawableContainer container, bool invalidate = true, bool generateEvents = true);
|
||||
/// <summary>
|
||||
/// Is the supplied container "on" the surface?
|
||||
/// </summary>
|
||||
/// <param name="container"></param>
|
||||
/// <returns>This returns false if the container is deleted but still in the undo stack</returns>
|
||||
bool IsOnSurface(IDrawableContainer container);
|
||||
void Invalidate(Rectangle rectangleToInvalidate);
|
||||
void Invalidate();
|
||||
bool Modified
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
string LastSaveFullPath
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
string UploadUrl
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
/// <summary>
|
||||
/// Remove an element of the elements list
|
||||
/// </summary>
|
||||
/// <param name="elementToRemove">Element to remove</param>
|
||||
/// <param name="makeUndoable">flag specifying if the remove needs to be undoable</param>
|
||||
/// <param name="invalidate">flag specifying if an surface invalidate needs to be called</param>
|
||||
/// <param name="generateEvents">flag specifying if the deselect needs to generate an event</param>
|
||||
void RemoveElement(IDrawableContainer elementToRemove, bool makeUndoable = true, bool invalidate = true, bool generateEvents = true);
|
||||
|
||||
void SendMessageEvent(object source, SurfaceMessageTyp messageType, string message);
|
||||
void ApplyBitmapEffect(IEffect effect);
|
||||
void RemoveCursor();
|
||||
bool HasCursor
|
||||
{
|
||||
get;
|
||||
}
|
||||
|
||||
ICaptureDetails CaptureDetails
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
int Width { get; }
|
||||
int Height { get; }
|
||||
|
||||
void MakeUndoable(IMemento memento, bool allowMerge);
|
||||
}
|
||||
}
|
105
GreenshotPlugin/Interfaces/ICapture.cs
Normal file
105
GreenshotPlugin/Interfaces/ICapture.cs
Normal file
|
@ -0,0 +1,105 @@
|
|||
/*
|
||||
* Greenshot - a free and open source screenshot tool
|
||||
* Copyright (C) 2007-2020 Thomas Braun, Jens Klingen, Robin Krom
|
||||
*
|
||||
* For more information see: http://getgreenshot.org/
|
||||
* The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 1 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Drawing;
|
||||
|
||||
namespace GreenshotPlugin.Interfaces
|
||||
{
|
||||
/// <summary>
|
||||
/// The interface to the Capture object, so Plugins can use it.
|
||||
/// </summary>
|
||||
public interface ICapture : IDisposable {
|
||||
/// <summary>
|
||||
/// The Capture Details
|
||||
/// </summary>
|
||||
ICaptureDetails CaptureDetails {
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The captured Image
|
||||
/// </summary>
|
||||
Image Image {
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Null the image
|
||||
/// </summary>
|
||||
void NullImage();
|
||||
|
||||
/// <summary>
|
||||
/// Bounds on the screen from which the capture comes
|
||||
/// </summary>
|
||||
Rectangle ScreenBounds {
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The cursor
|
||||
/// </summary>
|
||||
Icon Cursor {
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Boolean to specify if the cursor is available
|
||||
/// </summary>
|
||||
bool CursorVisible {
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Location of the cursor
|
||||
/// </summary>
|
||||
Point CursorLocation {
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Location of the capture
|
||||
/// </summary>
|
||||
Point Location {
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Crops the capture to the specified rectangle (with Bitmap coordinates!)
|
||||
/// </summary>
|
||||
/// <param name="cropRectangle">Rectangle with bitmap coordinates</param>
|
||||
bool Crop(Rectangle cropRectangle);
|
||||
|
||||
/// <summary>
|
||||
/// Apply a translate to the mouse location. e.g. needed for crop
|
||||
/// </summary>
|
||||
/// <param name="x">x coordinates to move the mouse</param>
|
||||
/// <param name="y">y coordinates to move the mouse</param>
|
||||
void MoveMouseLocation(int x, int y);
|
||||
}
|
||||
}
|
109
GreenshotPlugin/Interfaces/ICaptureDetails.cs
Normal file
109
GreenshotPlugin/Interfaces/ICaptureDetails.cs
Normal file
|
@ -0,0 +1,109 @@
|
|||
/*
|
||||
* Greenshot - a free and open source screenshot tool
|
||||
* Copyright (C) 2007-2020 Thomas Braun, Jens Klingen, Robin Krom
|
||||
*
|
||||
* For more information see: http://getgreenshot.org/
|
||||
* The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 1 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using GreenshotPlugin.Interfaces.Ocr;
|
||||
using ZXing;
|
||||
|
||||
namespace GreenshotPlugin.Interfaces {
|
||||
/// <summary>
|
||||
/// Details for the capture, like the window title and date/time etc.
|
||||
/// </summary>
|
||||
public interface ICaptureDetails {
|
||||
|
||||
/// <summary>
|
||||
/// If the capture comes from a file, this contains the filename
|
||||
/// </summary>
|
||||
string Filename {
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The title of the capture
|
||||
/// </summary>
|
||||
string Title {
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// When was the capture taken (or loaded)
|
||||
/// </summary>
|
||||
DateTime DateTime {
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Destinations to where this capture goes or went
|
||||
/// </summary>
|
||||
List<IDestination> CaptureDestinations {
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The meta data of the capture
|
||||
/// </summary>
|
||||
Dictionary<string, string> MetaData {
|
||||
get;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Helper method to prevent complex code which needs to check every key
|
||||
/// </summary>
|
||||
/// <param name="key">The key for the meta-data</param>
|
||||
/// <param name="value">The value for the meta-data</param>
|
||||
void AddMetaData(string key, string value);
|
||||
|
||||
void ClearDestinations();
|
||||
void RemoveDestination(IDestination captureDestination);
|
||||
void AddDestination(IDestination captureDestination);
|
||||
bool HasDestination(string designation);
|
||||
|
||||
CaptureMode CaptureMode {
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
float DpiX {
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
float DpiY {
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Store the OCR information for this capture
|
||||
/// </summary>
|
||||
OcrInformation OcrInformation { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Store the QR information for this capture
|
||||
/// </summary>
|
||||
Result QrResult { get; set; }
|
||||
}
|
||||
}
|
41
GreenshotPlugin/Interfaces/ICaptureElement.cs
Normal file
41
GreenshotPlugin/Interfaces/ICaptureElement.cs
Normal file
|
@ -0,0 +1,41 @@
|
|||
/*
|
||||
* Greenshot - a free and open source screenshot tool
|
||||
* Copyright (C) 2007-2020 Thomas Braun, Jens Klingen, Robin Krom
|
||||
*
|
||||
* For more information see: http://getgreenshot.org/
|
||||
* The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 1 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
|
||||
namespace GreenshotPlugin.Interfaces
|
||||
{
|
||||
public interface ICaptureElement {
|
||||
List<ICaptureElement> Children {
|
||||
get;
|
||||
set;
|
||||
}
|
||||
Rectangle Bounds {
|
||||
get;
|
||||
set;
|
||||
}
|
||||
string Name {
|
||||
get;
|
||||
set;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,127 +0,0 @@
|
|||
/*
|
||||
* Greenshot - a free and open source screenshot tool
|
||||
* Copyright (C) 2007-2020 Thomas Braun, Jens Klingen, Robin Krom
|
||||
*
|
||||
* For more information see: http://getgreenshot.org/
|
||||
* The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 1 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace GreenshotPlugin.Interfaces
|
||||
{
|
||||
/// <summary>
|
||||
/// This interface describes something that can do OCR of a bitmap
|
||||
/// </summary>
|
||||
public interface IOcrProvider
|
||||
{
|
||||
/// <summary>
|
||||
/// Start the actual OCR
|
||||
/// </summary>
|
||||
/// <param name="image">Image</param>
|
||||
/// <returns>OcrInformation</returns>
|
||||
Task<OcrInformation> DoOcrAsync(Image image);
|
||||
|
||||
/// <summary>
|
||||
/// Start the actual OCR
|
||||
/// </summary>
|
||||
/// <param name="surface">ISurface</param>
|
||||
/// <returns>OcrInformation</returns>
|
||||
Task<OcrInformation> DoOcrAsync(ISurface surface);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Contains the information about a word
|
||||
/// </summary>
|
||||
public class Word
|
||||
{
|
||||
/// <summary>
|
||||
/// The actual text for the word
|
||||
/// </summary>
|
||||
public string Text { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The location of the word
|
||||
/// </summary>
|
||||
public Rectangle Location { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Describes a line of words
|
||||
/// </summary>
|
||||
public class Line
|
||||
{
|
||||
private Rectangle? _calculatedBounds;
|
||||
|
||||
/// <summary>
|
||||
/// Constructor will preallocate the number of words
|
||||
/// </summary>
|
||||
/// <param name="wordCount">int</param>
|
||||
public Line(int wordCount)
|
||||
{
|
||||
Words = new Word[wordCount];
|
||||
for (int i = 0; i < wordCount; i++)
|
||||
{
|
||||
Words[i] = new Word();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// An array with words
|
||||
/// </summary>
|
||||
public Word[] Words { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Calculate the bounds of the words
|
||||
/// </summary>
|
||||
/// <returns>Rectangle</returns>
|
||||
private Rectangle CalculateBounds()
|
||||
{
|
||||
if (Words.Length == 0)
|
||||
{
|
||||
return Rectangle.Empty;
|
||||
}
|
||||
|
||||
var result = Words[0].Location;
|
||||
for (var index = 0; index < Words.Length; index++)
|
||||
{
|
||||
result = Rectangle.Union(result, Words[index].Location);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Return the calculated bounds for the whole line
|
||||
/// </summary>
|
||||
public Rectangle CalculatedBounds
|
||||
{
|
||||
get { return _calculatedBounds ??= CalculateBounds(); }
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Contains all the information on the OCR result
|
||||
/// </summary>
|
||||
public class OcrInformation
|
||||
{
|
||||
public string Text { get; set; }
|
||||
|
||||
public IList<Line> Lines { get; } = new List<Line>();
|
||||
}
|
||||
}
|
194
GreenshotPlugin/Interfaces/ISurface.cs
Normal file
194
GreenshotPlugin/Interfaces/ISurface.cs
Normal file
|
@ -0,0 +1,194 @@
|
|||
/*
|
||||
* Greenshot - a free and open source screenshot tool
|
||||
* Copyright (C) 2007-2020 Thomas Braun, Jens Klingen, Robin Krom
|
||||
*
|
||||
* For more information see: http://getgreenshot.org/
|
||||
* The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 1 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Windows.Forms;
|
||||
using GreenshotPlugin.Effects;
|
||||
using GreenshotPlugin.Interfaces.Drawing;
|
||||
|
||||
namespace GreenshotPlugin.Interfaces
|
||||
{
|
||||
/// <summary>
|
||||
/// The interface to the Surface object, so Plugins can use it.
|
||||
/// </summary>
|
||||
public interface ISurface : IDisposable
|
||||
{
|
||||
event SurfaceSizeChangeEventHandler SurfaceSizeChanged;
|
||||
event SurfaceMessageEventHandler SurfaceMessage;
|
||||
event SurfaceDrawingModeEventHandler DrawingModeChanged;
|
||||
event SurfaceElementEventHandler MovingElementChanged;
|
||||
|
||||
/// <summary>
|
||||
/// Start value of the step-labels (counts)
|
||||
/// </summary>
|
||||
int CounterStart { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Unique ID of the Surface
|
||||
/// </summary>
|
||||
Guid ID
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
IDrawableContainerList Elements
|
||||
{
|
||||
get;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get/Set the image to the Surface
|
||||
/// get will give the image as is currently visible
|
||||
/// set will overwrite both the visible image as the underlying image
|
||||
///
|
||||
/// important notice:
|
||||
/// The setter will clone the passed bitmap and dispose it when the Surface is disposed
|
||||
/// This means that the supplied image needs to be disposed by the calling code (if needed!)
|
||||
/// </summary>
|
||||
Image Image
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the current Image from the Editor for Exporting (save/upload etc)
|
||||
/// Don't forget to call image.Dispose() when finished!!!
|
||||
/// </summary>
|
||||
/// <returns>Bitmap</returns>
|
||||
Image GetImageForExport();
|
||||
|
||||
/// <summary>
|
||||
/// Add a TextContainer, at the given location, to the Surface.
|
||||
/// The TextContainer will be "re"sized to the text size.
|
||||
/// </summary>
|
||||
/// <param name="text">String to show</param>
|
||||
/// <param name="horizontalAlignment">Left, Center, Right</param>
|
||||
/// <param name="verticalAlignment">TOP, CENTER, BOTTOM</param>
|
||||
/// <param name="family">FontFamily</param>
|
||||
/// <param name="size">Font Size in float</param>
|
||||
/// <param name="italic">bool true if italic</param>
|
||||
/// <param name="bold">bool true if bold</param>
|
||||
/// <param name="shadow">bool true if shadow</param>
|
||||
/// <param name="borderSize">size of border (0 for none)</param>
|
||||
/// <param name="color">Color of string</param>
|
||||
/// <param name="fillColor">Color of background (e.g. Color.Transparent)</param>
|
||||
ITextContainer AddTextContainer(string text, HorizontalAlignment horizontalAlignment, VerticalAlignment verticalAlignment, FontFamily family, float size, bool italic, bool bold, bool shadow, int borderSize, Color color, Color fillColor);
|
||||
|
||||
IImageContainer AddImageContainer(Image image, int x, int y);
|
||||
ICursorContainer AddCursorContainer(Cursor cursor, int x, int y);
|
||||
IIconContainer AddIconContainer(Icon icon, int x, int y);
|
||||
IImageContainer AddImageContainer(string filename, int x, int y);
|
||||
ICursorContainer AddCursorContainer(string filename, int x, int y);
|
||||
IIconContainer AddIconContainer(string filename, int x, int y);
|
||||
long SaveElementsToStream(Stream stream);
|
||||
void LoadElementsFromStream(Stream stream);
|
||||
|
||||
bool HasSelectedElements
|
||||
{
|
||||
get;
|
||||
}
|
||||
void RemoveSelectedElements();
|
||||
void CutSelectedElements();
|
||||
void CopySelectedElements();
|
||||
void PasteElementFromClipboard();
|
||||
void DuplicateSelectedElements();
|
||||
void DeselectElement(IDrawableContainer container, bool generateEvents = true);
|
||||
void DeselectAllElements();
|
||||
|
||||
/// <summary>
|
||||
/// Add an element to the surface
|
||||
/// </summary>
|
||||
/// <param name="elements">IDrawableContainerList</param>
|
||||
/// <param name="makeUndoable">Should it be placed on the undo stack?</param>
|
||||
void AddElements(IDrawableContainerList elements, bool makeUndoable = true);
|
||||
void RemoveElements(IDrawableContainerList elements, bool makeUndoable = true);
|
||||
void SelectElements(IDrawableContainerList elements);
|
||||
|
||||
/// <summary>
|
||||
/// Add an element to the surface
|
||||
/// </summary>
|
||||
/// <param name="element">IDrawableContainer</param>
|
||||
/// <param name="makeUndoable">Should it be placed on the undo stack?</param>
|
||||
/// <param name="invalidate">Should it be invalidated (draw)</param>
|
||||
void AddElement(IDrawableContainer element, bool makeUndoable = true, bool invalidate = true);
|
||||
|
||||
/// <summary>
|
||||
/// Select the supplied container
|
||||
/// </summary>
|
||||
/// <param name="container">IDrawableContainer</param>
|
||||
/// <param name="invalidate">false to skip invalidation</param>
|
||||
/// <param name="generateEvents">false to skip event generation</param>
|
||||
void SelectElement(IDrawableContainer container, bool invalidate = true, bool generateEvents = true);
|
||||
/// <summary>
|
||||
/// Is the supplied container "on" the surface?
|
||||
/// </summary>
|
||||
/// <param name="container"></param>
|
||||
/// <returns>This returns false if the container is deleted but still in the undo stack</returns>
|
||||
bool IsOnSurface(IDrawableContainer container);
|
||||
void Invalidate(Rectangle rectangleToInvalidate);
|
||||
void Invalidate();
|
||||
bool Modified
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
string LastSaveFullPath
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
string UploadUrl
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
/// <summary>
|
||||
/// Remove an element of the elements list
|
||||
/// </summary>
|
||||
/// <param name="elementToRemove">Element to remove</param>
|
||||
/// <param name="makeUndoable">flag specifying if the remove needs to be undoable</param>
|
||||
/// <param name="invalidate">flag specifying if an surface invalidate needs to be called</param>
|
||||
/// <param name="generateEvents">flag specifying if the deselect needs to generate an event</param>
|
||||
void RemoveElement(IDrawableContainer elementToRemove, bool makeUndoable = true, bool invalidate = true, bool generateEvents = true);
|
||||
|
||||
void SendMessageEvent(object source, SurfaceMessageTyp messageType, string message);
|
||||
void ApplyBitmapEffect(IEffect effect);
|
||||
void RemoveCursor();
|
||||
bool HasCursor
|
||||
{
|
||||
get;
|
||||
}
|
||||
|
||||
ICaptureDetails CaptureDetails
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
int Width { get; }
|
||||
int Height { get; }
|
||||
|
||||
void MakeUndoable(IMemento memento, bool allowMerge);
|
||||
}
|
||||
}
|
46
GreenshotPlugin/Interfaces/Ocr/IOcrProvider.cs
Normal file
46
GreenshotPlugin/Interfaces/Ocr/IOcrProvider.cs
Normal file
|
@ -0,0 +1,46 @@
|
|||
/*
|
||||
* Greenshot - a free and open source screenshot tool
|
||||
* Copyright (C) 2007-2020 Thomas Braun, Jens Klingen, Robin Krom
|
||||
*
|
||||
* For more information see: http://getgreenshot.org/
|
||||
* The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 1 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
using System.Drawing;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace GreenshotPlugin.Interfaces.Ocr
|
||||
{
|
||||
/// <summary>
|
||||
/// This interface describes something that can do OCR of a bitmap
|
||||
/// </summary>
|
||||
public interface IOcrProvider
|
||||
{
|
||||
/// <summary>
|
||||
/// Start the actual OCR
|
||||
/// </summary>
|
||||
/// <param name="image">Image</param>
|
||||
/// <returns>OcrInformation</returns>
|
||||
Task<OcrInformation> DoOcrAsync(Image image);
|
||||
|
||||
/// <summary>
|
||||
/// Start the actual OCR
|
||||
/// </summary>
|
||||
/// <param name="surface">ISurface</param>
|
||||
/// <returns>OcrInformation</returns>
|
||||
Task<OcrInformation> DoOcrAsync(ISurface surface);
|
||||
}
|
||||
}
|
81
GreenshotPlugin/Interfaces/Ocr/Line.cs
Normal file
81
GreenshotPlugin/Interfaces/Ocr/Line.cs
Normal file
|
@ -0,0 +1,81 @@
|
|||
using System.Drawing;
|
||||
|
||||
namespace GreenshotPlugin.Interfaces.Ocr
|
||||
{
|
||||
/// <summary>
|
||||
/// Describes a line of words
|
||||
/// </summary>
|
||||
public class Line
|
||||
{
|
||||
private Rectangle? _calculatedBounds;
|
||||
|
||||
/// <summary>
|
||||
/// Constructor will preallocate the number of words
|
||||
/// </summary>
|
||||
/// <param name="wordCount">int</param>
|
||||
public Line(int wordCount)
|
||||
{
|
||||
Words = new Word[wordCount];
|
||||
for (int i = 0; i < wordCount; i++)
|
||||
{
|
||||
Words[i] = new Word();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The text of the line
|
||||
/// </summary>
|
||||
public string Text { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// An array with words
|
||||
/// </summary>
|
||||
public Word[] Words { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Calculate the bounds of the words
|
||||
/// </summary>
|
||||
/// <returns>Rectangle</returns>
|
||||
private Rectangle CalculateBounds()
|
||||
{
|
||||
if (Words.Length == 0)
|
||||
{
|
||||
return Rectangle.Empty;
|
||||
}
|
||||
|
||||
var result = Words[0].Bounds;
|
||||
for (var index = 0; index < Words.Length; index++)
|
||||
{
|
||||
result = Rectangle.Union(result, Words[index].Bounds);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Return the calculated bounds for the whole line
|
||||
/// </summary>
|
||||
public Rectangle CalculatedBounds
|
||||
{
|
||||
get { return _calculatedBounds ??= CalculateBounds(); }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Offset the words with the specified x and y coordinates
|
||||
/// </summary>
|
||||
/// <param name="x">int</param>
|
||||
/// <param name="y">int</param>
|
||||
public void Offset(int x, int y)
|
||||
{
|
||||
foreach (var word in Words)
|
||||
{
|
||||
var location = word.Bounds;
|
||||
location.Offset(x,y);
|
||||
word.Bounds = location;
|
||||
}
|
||||
|
||||
_calculatedBounds = null;
|
||||
CalculateBounds();
|
||||
}
|
||||
}
|
||||
}
|
46
GreenshotPlugin/Interfaces/Ocr/OcrInformation.cs
Normal file
46
GreenshotPlugin/Interfaces/Ocr/OcrInformation.cs
Normal file
|
@ -0,0 +1,46 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace GreenshotPlugin.Interfaces.Ocr
|
||||
{
|
||||
/// <summary>
|
||||
/// Contains all the information on the OCR result
|
||||
/// </summary>
|
||||
public class OcrInformation
|
||||
{
|
||||
/// <summary>
|
||||
/// The complete text
|
||||
/// </summary>
|
||||
public string Text
|
||||
{
|
||||
get
|
||||
{
|
||||
// Build the text from the lines, otherwise it's just everything concatenated together
|
||||
var text = new StringBuilder();
|
||||
foreach (var line in Lines)
|
||||
{
|
||||
text.AppendLine(line.Text);
|
||||
}
|
||||
return text.ToString();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The lines of test which the OCR engine found
|
||||
/// </summary>
|
||||
public IList<Line> Lines { get; } = new List<Line>();
|
||||
|
||||
/// <summary>
|
||||
/// Change the offset of the
|
||||
/// </summary>
|
||||
/// <param name="x">int</param>
|
||||
/// <param name="y">int</param>
|
||||
public void Offset(int x, int y)
|
||||
{
|
||||
foreach (var line in Lines)
|
||||
{
|
||||
line.Offset(x,y);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
20
GreenshotPlugin/Interfaces/Ocr/Word.cs
Normal file
20
GreenshotPlugin/Interfaces/Ocr/Word.cs
Normal file
|
@ -0,0 +1,20 @@
|
|||
using System.Drawing;
|
||||
|
||||
namespace GreenshotPlugin.Interfaces.Ocr
|
||||
{
|
||||
/// <summary>
|
||||
/// Contains the information about a word
|
||||
/// </summary>
|
||||
public class Word
|
||||
{
|
||||
/// <summary>
|
||||
/// The actual text for the word
|
||||
/// </summary>
|
||||
public string Text { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The bounds of the word
|
||||
/// </summary>
|
||||
public Rectangle Bounds { get; set; }
|
||||
}
|
||||
}
|
30
GreenshotPlugin/Interfaces/ScreenCaptureMode.cs
Normal file
30
GreenshotPlugin/Interfaces/ScreenCaptureMode.cs
Normal file
|
@ -0,0 +1,30 @@
|
|||
/*
|
||||
* Greenshot - a free and open source screenshot tool
|
||||
* Copyright (C) 2007-2020 Thomas Braun, Jens Klingen, Robin Krom
|
||||
*
|
||||
* For more information see: http://getgreenshot.org/
|
||||
* The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 1 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
namespace GreenshotPlugin.Interfaces
|
||||
{
|
||||
public enum ScreenCaptureMode
|
||||
{
|
||||
Auto,
|
||||
FullScreen,
|
||||
Fixed
|
||||
};
|
||||
}
|
34
GreenshotPlugin/Interfaces/SurfaceDrawingModeEventArgs.cs
Normal file
34
GreenshotPlugin/Interfaces/SurfaceDrawingModeEventArgs.cs
Normal file
|
@ -0,0 +1,34 @@
|
|||
/*
|
||||
* Greenshot - a free and open source screenshot tool
|
||||
* Copyright (C) 2007-2020 Thomas Braun, Jens Klingen, Robin Krom
|
||||
*
|
||||
* For more information see: http://getgreenshot.org/
|
||||
* The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 1 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
using System;
|
||||
|
||||
namespace GreenshotPlugin.Interfaces
|
||||
{
|
||||
public class SurfaceDrawingModeEventArgs : EventArgs
|
||||
{
|
||||
public DrawingModes DrawingMode
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
}
|
||||
}
|
25
GreenshotPlugin/Interfaces/SurfaceDrawingModeEventHandler.cs
Normal file
25
GreenshotPlugin/Interfaces/SurfaceDrawingModeEventHandler.cs
Normal file
|
@ -0,0 +1,25 @@
|
|||
/*
|
||||
* Greenshot - a free and open source screenshot tool
|
||||
* Copyright (C) 2007-2020 Thomas Braun, Jens Klingen, Robin Krom
|
||||
*
|
||||
* For more information see: http://getgreenshot.org/
|
||||
* The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 1 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
namespace GreenshotPlugin.Interfaces
|
||||
{
|
||||
public delegate void SurfaceDrawingModeEventHandler(object sender, SurfaceDrawingModeEventArgs e);
|
||||
}
|
35
GreenshotPlugin/Interfaces/SurfaceElementEventArgs.cs
Normal file
35
GreenshotPlugin/Interfaces/SurfaceElementEventArgs.cs
Normal file
|
@ -0,0 +1,35 @@
|
|||
/*
|
||||
* Greenshot - a free and open source screenshot tool
|
||||
* Copyright (C) 2007-2020 Thomas Braun, Jens Klingen, Robin Krom
|
||||
*
|
||||
* For more information see: http://getgreenshot.org/
|
||||
* The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 1 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using GreenshotPlugin.Interfaces.Drawing;
|
||||
|
||||
namespace GreenshotPlugin.Interfaces
|
||||
{
|
||||
public class SurfaceElementEventArgs : EventArgs
|
||||
{
|
||||
public IDrawableContainerList Elements
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
}
|
||||
}
|
25
GreenshotPlugin/Interfaces/SurfaceElementEventHandler.cs
Normal file
25
GreenshotPlugin/Interfaces/SurfaceElementEventHandler.cs
Normal file
|
@ -0,0 +1,25 @@
|
|||
/*
|
||||
* Greenshot - a free and open source screenshot tool
|
||||
* Copyright (C) 2007-2020 Thomas Braun, Jens Klingen, Robin Krom
|
||||
*
|
||||
* For more information see: http://getgreenshot.org/
|
||||
* The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 1 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
namespace GreenshotPlugin.Interfaces
|
||||
{
|
||||
public delegate void SurfaceElementEventHandler(object sender, SurfaceElementEventArgs e);
|
||||
}
|
44
GreenshotPlugin/Interfaces/SurfaceMessageEventArgs.cs
Normal file
44
GreenshotPlugin/Interfaces/SurfaceMessageEventArgs.cs
Normal file
|
@ -0,0 +1,44 @@
|
|||
/*
|
||||
* Greenshot - a free and open source screenshot tool
|
||||
* Copyright (C) 2007-2020 Thomas Braun, Jens Klingen, Robin Krom
|
||||
*
|
||||
* For more information see: http://getgreenshot.org/
|
||||
* The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 1 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
using System;
|
||||
|
||||
namespace GreenshotPlugin.Interfaces
|
||||
{
|
||||
public class SurfaceMessageEventArgs : EventArgs
|
||||
{
|
||||
public SurfaceMessageTyp MessageType
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
public string Message
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
public ISurface Surface
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
}
|
||||
}
|
25
GreenshotPlugin/Interfaces/SurfaceMessageEventHandler.cs
Normal file
25
GreenshotPlugin/Interfaces/SurfaceMessageEventHandler.cs
Normal file
|
@ -0,0 +1,25 @@
|
|||
/*
|
||||
* Greenshot - a free and open source screenshot tool
|
||||
* Copyright (C) 2007-2020 Thomas Braun, Jens Klingen, Robin Krom
|
||||
*
|
||||
* For more information see: http://getgreenshot.org/
|
||||
* The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 1 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
namespace GreenshotPlugin.Interfaces
|
||||
{
|
||||
public delegate void SurfaceMessageEventHandler(object sender, SurfaceMessageEventArgs e);
|
||||
}
|
31
GreenshotPlugin/Interfaces/SurfaceMessageTyp.cs
Normal file
31
GreenshotPlugin/Interfaces/SurfaceMessageTyp.cs
Normal file
|
@ -0,0 +1,31 @@
|
|||
/*
|
||||
* Greenshot - a free and open source screenshot tool
|
||||
* Copyright (C) 2007-2020 Thomas Braun, Jens Klingen, Robin Krom
|
||||
*
|
||||
* For more information see: http://getgreenshot.org/
|
||||
* The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 1 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
namespace GreenshotPlugin.Interfaces
|
||||
{
|
||||
public enum SurfaceMessageTyp
|
||||
{
|
||||
FileSaved,
|
||||
Error,
|
||||
Info,
|
||||
UploadedUri
|
||||
}
|
||||
}
|
27
GreenshotPlugin/Interfaces/SurfaceSizeChangeEventHandler.cs
Normal file
27
GreenshotPlugin/Interfaces/SurfaceSizeChangeEventHandler.cs
Normal file
|
@ -0,0 +1,27 @@
|
|||
/*
|
||||
* Greenshot - a free and open source screenshot tool
|
||||
* Copyright (C) 2007-2020 Thomas Braun, Jens Klingen, Robin Krom
|
||||
*
|
||||
* For more information see: http://getgreenshot.org/
|
||||
* The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 1 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
using System;
|
||||
|
||||
namespace GreenshotPlugin.Interfaces
|
||||
{
|
||||
public delegate void SurfaceSizeChangeEventHandler(object sender, EventArgs e);
|
||||
}
|
34
GreenshotPlugin/Interfaces/VerticalAlignment.cs
Normal file
34
GreenshotPlugin/Interfaces/VerticalAlignment.cs
Normal file
|
@ -0,0 +1,34 @@
|
|||
/*
|
||||
* Greenshot - a free and open source screenshot tool
|
||||
* Copyright (C) 2007-2020 Thomas Braun, Jens Klingen, Robin Krom
|
||||
*
|
||||
* For more information see: http://getgreenshot.org/
|
||||
* The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 1 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
namespace GreenshotPlugin.Interfaces
|
||||
{
|
||||
/// <summary>
|
||||
/// Alignment Enums for positioning
|
||||
/// </summary>
|
||||
//public enum HorizontalAlignment {LEFT, CENTER, RIGHT};
|
||||
public enum VerticalAlignment
|
||||
{
|
||||
TOP,
|
||||
CENTER,
|
||||
BOTTOM
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue