From 8bdfab278d0075b621617333da41af4eadb429ec Mon Sep 17 00:00:00 2001 From: "joogab.yun" Date: Fri, 29 Nov 2024 13:07:04 +0900 Subject: [PATCH] PenWave --- .../Canvas/CanvasRenderer.cs | 47 +- src/Tizen.NUI.PenWave/src/Interop/PenWave.cs | 366 +++++++++++++ .../src/public/Canvas/PWEngine.cs | 374 -------------- .../src/public/Canvas/PenWave.cs | 487 ++++++++++++++++++ .../{PWCanvasView.cs => PenWaveCanvas.cs} | 32 +- .../src/public/Picker/PWToolPicker.cs | 4 +- .../src/public/Tools/Eraser/EraserTool.cs | 6 +- .../Tools/Pencil/Brush/DashedLineBrush.cs | 4 +- .../public/Tools/Pencil/Brush/DotBrush .cs | 6 +- .../Tools/Pencil/Brush/HighlighterBrush.cs | 6 +- .../public/Tools/Pencil/Brush/SharpBrush.cs | 2 +- .../public/Tools/Pencil/Brush/SoftBrush.cs | 6 +- .../public/Tools/Pencil/Brush/SprayBrush.cs | 6 +- .../public/Tools/Pencil/Brush/StrokeBrush.cs | 2 +- .../Tools/Pencil/Brush/VarStrokeBrush.cs | 2 +- .../Tools/Pencil/Brush/VarStrokeIncBrush.cs | 2 +- .../src/public/Tools/Pencil/PencilTool.cs | 10 +- .../public/Tools/Selection/SelectionTool.cs | 34 +- .../src/public/Tools/UnRedoManager.cs | 4 +- 19 files changed, 955 insertions(+), 445 deletions(-) rename src/Tizen.NUI.PenWave/src/{internal => Internal}/Canvas/CanvasRenderer.cs (73%) create mode 100644 src/Tizen.NUI.PenWave/src/Interop/PenWave.cs delete mode 100644 src/Tizen.NUI.PenWave/src/public/Canvas/PWEngine.cs create mode 100644 src/Tizen.NUI.PenWave/src/public/Canvas/PenWave.cs rename src/Tizen.NUI.PenWave/src/public/Canvas/{PWCanvasView.cs => PenWaveCanvas.cs} (83%) diff --git a/src/Tizen.NUI.PenWave/src/internal/Canvas/CanvasRenderer.cs b/src/Tizen.NUI.PenWave/src/Internal/Canvas/CanvasRenderer.cs similarity index 73% rename from src/Tizen.NUI.PenWave/src/internal/Canvas/CanvasRenderer.cs rename to src/Tizen.NUI.PenWave/src/Internal/Canvas/CanvasRenderer.cs index 373055a65f3..29bf2dea3a8 100644 --- a/src/Tizen.NUI.PenWave/src/internal/Canvas/CanvasRenderer.cs +++ b/src/Tizen.NUI.PenWave/src/Internal/Canvas/CanvasRenderer.cs @@ -45,6 +45,7 @@ internal class CanvasRenderer // Canvas id. private uint canvasId; + private PenWave engine; /// /// Constructor. Creates a new instance of CanvasRenderer. This constructor sets the current canvas to the specified canvas id. Also it sets paths to resources and initializes textures. @@ -53,10 +54,11 @@ internal class CanvasRenderer public CanvasRenderer(uint canvasId) { this.canvasId = canvasId; - PWEngine.SetCurrentCanvas(canvasId); - PWEngine.SetResourcePath(FrameworkInformation.ResourcePath + "images/"); - PWEngine.SetFontPath(FontPath); - PWEngine.SetTexturePaths(TexturePaths, TexturePaths.Length); + engine = PenWave.Instance; + engine.SetCurrentCanvas(canvasId); + engine.SetResourcePath(FrameworkInformation.ResourcePath + "images/"); + engine.SetFontPath(FontPath); + engine.SetTexturePaths(TexturePaths, TexturePaths.Length); } /// @@ -64,7 +66,7 @@ public CanvasRenderer(uint canvasId) /// public void InitializeGL() { - PWEngine.InitializeGL(); + engine.InitializeGL(); } /// @@ -72,7 +74,7 @@ public void InitializeGL() /// public void TerminateGL() { - PWEngine.TerminateGL(); + engine.TerminateGL(); } /// @@ -82,7 +84,7 @@ public void TerminateGL() /// public int RenderFrame(in DirectRenderingGLView.RenderCallbackInput input) { - return PWEngine.RenderFrameGL(); + return engine.RenderFrameGL(); } /// @@ -92,8 +94,8 @@ public int RenderFrame(in DirectRenderingGLView.RenderCallbackInput input) /// public void Resize(int width, int height) { - PWEngine.UpdateGLWindowSize(width, height); - PWEngine.RenderFullyReDraw(); + engine.UpdateGLWindowSize(width, height); + engine.RenderFullyReDraw(); } /// @@ -101,7 +103,7 @@ public void Resize(int width, int height) /// public void ClearCanvas() { - PWEngine.ClearCurrentCanvas(); + engine.ClearCurrentCanvas(); } /// @@ -110,7 +112,7 @@ public void ClearCanvas() /// public void AddPicture(string path, Size2D size, Position2D position) { - PWEngine.AddPicture(path, position.X, position.Y, size.Width, size.Height); + engine.AddPicture(path, position.X, position.Y, size.Width, size.Height); } /// @@ -119,7 +121,7 @@ public void AddPicture(string path, Size2D size, Position2D position) /// public void ToggleGrid(GridDensityType gridType) { - PWEngine.ToggleGrid((int)gridType); + engine.ToggleGrid((int)gridType); } /// @@ -128,7 +130,7 @@ public void ToggleGrid(GridDensityType gridType) /// public void SetCanvasColor(Color color) { - PWEngine.CanvasSetColor(ToHex(color), 1.0f); + engine.CanvasSetColor(ToHex(color), 1.0f); } /// @@ -137,7 +139,7 @@ public void SetCanvasColor(Color color) /// public void SaveCanvas(string path) { - PWEngine.SaveCanvas(canvasId, path); + engine.SaveCanvas(canvasId, path); } /// @@ -152,10 +154,25 @@ public void LoadCanvas(string path) } else { - PWEngine.LoadCanvas(canvasId, path); + engine.LoadCanvas(canvasId, path); } } + /// + /// Takes screenshot of the current canvas and saves it to the specified path. The area of the screenshot is defined by the coordinates and dimensions. The callback is called when the screenshot is saved. The callback has one parameter which is the path to the saved image. If the path is null, then the screenshot was not saved successfully. + /// + /// + /// + /// + /// + /// + /// + public void TakeScreenShot(string path, int x, int y, int width, int height, PenWave.ThumbnailSavedDelegate callback) + { + engine.TakeScreenshot(canvasId, path, x, y, width, height, callback); + } + + // Converts Color to hex string. private string ToHex(Color color) { var red = (uint)(color.R * 255); diff --git a/src/Tizen.NUI.PenWave/src/Interop/PenWave.cs b/src/Tizen.NUI.PenWave/src/Interop/PenWave.cs new file mode 100644 index 00000000000..042e7b62bb2 --- /dev/null +++ b/src/Tizen.NUI.PenWave/src/Interop/PenWave.cs @@ -0,0 +1,366 @@ +using System; +using System.Text; +using System.Runtime.InteropServices; + +using Tizen.NUI; +using Tizen.NUI.BaseComponents; +using System.ComponentModel; +using System.Net.Http.Headers; +using System.Data; + +namespace Tizen.NUI.PenWave +{ + internal static partial class Interop + { + public static partial class PenWave + { + public const string Lib = "libhand-drawing-engine.so"; + + [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "InitializeGL")] + public static extern void InitializeGL(); + [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "RenderFrameGL")] + public static extern int RenderFrameGL(); + + [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "RenderFullyReDraw")] + public static extern void RenderFullyReDraw(); + + [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "TerminateGL")] + public static extern void TerminateGL(); + + [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "UpdateGLWindowSize")] + public static extern void UpdateGLWindowSize(int w, int h); + + [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "UpdateGLWindowOrientation")] + public static extern void UpdateGLWindowOrientation(int angle); + + [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "BeginShapeDraw")] + public static extern uint BeginShapeDraw(float x, float y, uint time = 1); + + [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "DrawShape")] + public static extern int DrawShape(uint shapeID, float x, float y, uint time = 1); + + [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "EndShapeDraw")] + public static extern int EndShapeDraw(uint shapeID, uint time = 1); + + [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "StopErasing")] + public static extern void StopErasing(); + + [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "EraseShape")] + [return:MarshalAs(UnmanagedType.I1)] + public static extern bool EraseShape(int x, int y, float radius, [MarshalAs(UnmanagedType.I1)] bool partial); + + [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "AddRectanglePath")] + public static extern uint AddRectanglePath(float xStart, float yStart, float x, float y, bool finished); + + [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "AddArcPath")] + public static extern uint AddArcPath(float xCenter, float yCenter, float radius, float x, float y, bool finished); + + [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "ResizeShapePath")] + public static extern int ResizeShapePath(uint shapeID, float x, float y); + + [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "FinishShapePath")] + public static extern int FinishShapePath(uint shapeID); + + [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "CanvasZoomBegin")] + public static extern bool CanvasZoomBegin(); + + [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "CanvasZoom")] + public static extern bool CanvasZoom(float x, float y, float zoom, float dx, float dy); + + [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "CanvasZoomEnd")] + public static extern bool CanvasZoomEnd(); + + [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "CanvasGetZoomValue")] + public static extern int CanvasGetZoomValue(); + [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "CanvasSetZoomValue")] + public static extern float CanvasSetZoomValue(float zoomValue); + + [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "CanvasMoveBegin")] + public static extern bool CanvasMoveBegin(); + + [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "CanvasMove")] + public static extern bool CanvasMove(int x, int y); + + [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "CanvasMoveEnd")] + public static extern bool CanvasMoveEnd(); + + [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "CanvasSetColor")] + public static extern void CanvasSetColor([MarshalAs(UnmanagedType.LPStr)] string hexColor, float a); + [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "CanvasSetSize")] + public static extern void CanvasSetSize(int width, int height); + + [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "SetResourcePath")] + public static extern void SetResourcePath([MarshalAs(UnmanagedType.LPStr)] string resourcePath); + + [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "SetFontPath")] + public static extern void SetFontPath([MarshalAs(UnmanagedType.LPStr)] string fontPath); + + [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "SetTexturePaths")] + public static extern void SetTexturePaths([MarshalAs(UnmanagedType.LPArray, ArraySubType=UnmanagedType.LPStr)] string[] texturePaths, int textureCount); + + [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "SetStrokeSize")] + public static extern void SetStrokeSize(float val); + + [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "SetStrokeColor")] + public static extern void SetStrokeColor([MarshalAs(UnmanagedType.LPStr)] string hexColor, float a); + + [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "SetStrokeType")] + public static extern void SetStrokeType(int brushId); + + [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "SetBrushTexture")] + public static extern void SetBrushTexture(int textureId); + + [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "SetBrushDistance")] + public static extern void SetBrushDistance(float distance); + + [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "SetDashArray")] + public static extern void SetDashArray([MarshalAs(UnmanagedType.LPStr)] string dashArray); + + [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "SetLineAngle")] + public static extern void SetLineAngle(float angle); + + [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "GetBrushSize")] + public static extern float GetBrushSize(); + + [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "GetBrushColor")] + public static extern float GetBrushColor([MarshalAs(UnmanagedType.LPStr)] StringBuilder hex); + + [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "GetBrushType")] + public static extern int GetBrushType(); + + [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "GetBrushTexture")] + public static extern int GetBrushTexture(); + + [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "GetBrushDistance")] + public static extern float GetBrushDistance(); + + [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "GetLineAngle")] + public static extern float GetLineAngle(); + + [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "GetShapeCount")] + public static extern int GetShapeCount(); + + [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "CreateCanvas")] + public static extern uint CreateCanvas(int canvasWidth, int canvasHeight); + + // #if PICTURE + [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "CreateCanvasWithBackgroundImage")] + public static extern uint CreateCanvasWithBackgroundImage([MarshalAs(UnmanagedType.LPStr)] string path); + // #endif + + [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "SetCurrentCanvas")] + public static extern void SetCurrentCanvas(uint canvasID); + + [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "ClearCurrentCanvas")] + public static extern void ClearCurrentCanvas(); + + [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "StartSelectingArea")] + public static extern void StartSelectingArea(float x, float y); + + [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "ResizeSelectedArea")] + public static extern void ResizeSelectedArea(float x, float y); + + [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "InsideSelectedArea")] + [return:MarshalAs(UnmanagedType.I1)] + public static extern bool InsideSelectedArea(float x, float y); + + [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "GetSelectionDimensions")] + [return:MarshalAs(UnmanagedType.I1)] + public static extern bool GetSelectionDimensions(ref float x, ref float y, ref float width, ref float height); + + [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "TouchedDrawable")] + public static extern int TouchedDrawable(float x, float y); + + [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "SelectDrawable")] + public static extern int SelectDrawable(float x, float y); + + [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "SelectDrawables")] + public static extern int SelectDrawables(); + + [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "DragSelectedDrawables")] + public static extern void DragSelectedDrawables(float x, float y); + + [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "EndDraging")] + public static extern void EndDraging(); + + [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "StartRotating")] + [return:MarshalAs(UnmanagedType.I1)] + public static extern bool StartRotating(float x, float y); + + [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "RotateSelected")] + [return:MarshalAs(UnmanagedType.I1)] + public static extern bool RotateSelected(float x, float y); + + [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "EndRotating")] + [return:MarshalAs(UnmanagedType.I1)] + public static extern bool EndRotating(float x, float y); + [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "StartSelectionScale")] + public static extern void StartSelectionScale(bool anchorLeft, bool anchorRight, bool anchorTop, bool anchorBottom, ref float anchorX, ref float anchorY); + + [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "ScaleSelection")] + public static extern void ScaleSelection(float scaleFactorX, float scaleFactorY); + + [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "EndSelectionScale")] + public static extern void EndSelectionScale(float scaleFactorX, float scaleFactorY); + + [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "DropSelectedDrawables")] + public static extern void DropSelectedDrawables(); + + [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "SelectedAreaZoom")] + public static extern void SelectedAreaZoom(float x, float y, float zoom); + + [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "SaveCanvas")] + [return:MarshalAs(UnmanagedType.I1)] + public static extern bool SaveCanvas(uint canvasID, [MarshalAs(UnmanagedType.LPStr)] string path); + + [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "LoadCanvas")] + [return:MarshalAs(UnmanagedType.I1)] + public static extern bool LoadCanvas(uint canvasID, [MarshalAs(UnmanagedType.LPStr)] string path); + + [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "TakeScreenshot")] + public static extern void TakeScreenshot(uint canvasID, [MarshalAs(UnmanagedType.LPStr)] string path, int x, int y, int width, int height, [MarshalAs(UnmanagedType.FunctionPtr)] Tizen.NUI.PenWave.PenWave.ThumbnailSavedDelegate thumbSaved); + + [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "ToggleGrid")] + public static extern void ToggleGrid(int densityType); + + // #if CHART + [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "ToggleChartGrid")] + public static extern void ToggleChartGrid(int densityType); + + [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "GetChartGridDensity")] + public static extern int GetChartGridDensity(); + // #endif + + [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "Dump")] + public static extern void Dump(); + + [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "Copy")] + [return:MarshalAs(UnmanagedType.I1)] + public static extern bool Copy(); + + [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "Paste")] + public static extern int Paste(float x, float y); + + [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "Cut")] + [return:MarshalAs(UnmanagedType.I1)] + public static extern bool Cut(); + + [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "Remove")] + [return:MarshalAs(UnmanagedType.I1)] + public static extern bool Remove(); + + // #if CHART + [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "AddChart")] + public static extern void AddChart(int chartType, [MarshalAs(UnmanagedType.LPStr)] string path); + + [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "ChangeMode")] + public static extern void ChangeMode(int mode); + + [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "ChartPosition")] + public static extern void ChartPosition(ref float x, ref float y); + // #endif + + // #if PICTURE + [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "PlacePicture")] + public static extern void AddPicture([MarshalAs(UnmanagedType.LPStr)] string path, float x, float y, float width, float height); + + [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "SetCanvasBackground")] + public static extern void SetCanvasBackground([MarshalAs(UnmanagedType.LPStr)] string path, float x, float y, float width, float height); + // #endif + + // #if TEXT + [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "AddText")] + public static extern void AddText([MarshalAs(UnmanagedType.LPStr)] string text, float x, float y, float size); + // #endif + // #if NOTES + [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "AddNote")] + public static extern uint AddNote(float x, float y, float w, float h); + + [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "RemoveNote")] + public static extern void RemoveNote(uint noteID); + + [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "ClearNote")] + public static extern void ClearNote(); + + [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "DragNote")] + public static extern bool DragNote(float x, float y); + + [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "EndNoteDragging")] + public static extern bool EndNoteDragging(); + + [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "SetNoteColor")] + public static extern void SetNoteColor([MarshalAs(UnmanagedType.LPStr)] string hexColor, float a); + + [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "SetActiveNote")] + public static extern void SetActiveNote(uint noteID); + + [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "TouchedNote")] + public static extern uint TouchedNote(float x, float y); + // #endif + + [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "Undo")] + [return:MarshalAs(UnmanagedType.I1)] + public static extern bool Undo(); + + [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "Redo")] + [return:MarshalAs(UnmanagedType.I1)] + public static extern bool Redo(); + + [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "ResetUndo")] + public static extern void ResetUndo(); + + [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "ResetRedo")] + public static extern void ResetRedo(); + + [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "GetConfigurationCount")] + public static extern int GetConfigurationCount(); + + [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "GetAllConfigurations", CallingConvention = CallingConvention.Cdecl)] + public static extern IntPtr GetAllConfigurations(); + + [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "GetConfiguration", CallingConvention = CallingConvention.Cdecl)] + public static extern IntPtr GetConfiguration([MarshalAs(UnmanagedType.LPStr)] string key); + + [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "SetConfigurationInt", CallingConvention = CallingConvention.Cdecl)] + [return:MarshalAs(UnmanagedType.I1)] + public static extern bool SetConfigurationInt([MarshalAs(UnmanagedType.LPStr)] string key, int value); + + [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "SetConfigurationFloat", CallingConvention = CallingConvention.Cdecl)] + [return:MarshalAs(UnmanagedType.I1)] + public static extern bool SetConfigurationFloat([MarshalAs(UnmanagedType.LPStr)] string key, float value); + + [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "SetConfigurationString", CallingConvention = CallingConvention.Cdecl)] + [return:MarshalAs(UnmanagedType.I1)] + public static extern bool SetConfigurationString([MarshalAs(UnmanagedType.LPStr)] string key, [MarshalAs(UnmanagedType.LPStr)] string value); + + [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "SetConfigurationBool", CallingConvention = CallingConvention.Cdecl)] + [return:MarshalAs(UnmanagedType.I1)] + public static extern bool SetConfigurationBool([MarshalAs(UnmanagedType.LPStr)] string key, [MarshalAs(UnmanagedType.I1)] bool value); + + [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "SaveProfiler")] + [return:MarshalAs(UnmanagedType.I1)] + public static extern bool SaveProfiler([MarshalAs(UnmanagedType.LPStr)] string path); + + [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "ResetProfiler")] + public static extern void ResetProfiler(); + + //Wrappers for Marshalled APIS + // public static void GetConfigurations(out ConfigParameter[] configParameters, out int count) + // { + // IntPtr configArrayPtr = GetAllConfigurations(); + // int engineConfigCount = GetConfigurationCount(); + // count = engineConfigCount; + + // ConfigParameter[] configArray = new ConfigParameter[count]; + + // for (int i = 0; i < count; i++) + // { + // configArray[i] = Marshal.PtrToStructure(configArrayPtr); + // configArrayPtr += Marshal.SizeOf(); + // } + + // configParameters = configArray; + // } + } + } +} diff --git a/src/Tizen.NUI.PenWave/src/public/Canvas/PWEngine.cs b/src/Tizen.NUI.PenWave/src/public/Canvas/PWEngine.cs deleted file mode 100644 index dac6dcdd278..00000000000 --- a/src/Tizen.NUI.PenWave/src/public/Canvas/PWEngine.cs +++ /dev/null @@ -1,374 +0,0 @@ -using System; -using System.Text; -using System.Runtime.InteropServices; - -using Tizen.NUI; -using Tizen.NUI.BaseComponents; -using System.ComponentModel; -using System.Net.Http.Headers; -using System.Data; - -namespace Tizen.NUI.PenWave -{ - - public class PWEngineDelegates - { - [UnmanagedFunctionPointer(CallingConvention.StdCall)] - public delegate void ThumbnailSavedDelegate(); - - static public ThumbnailSavedDelegate mSwapThumbnailsDelegate = null; - } - - - public static class PWEngine - { - - public const string Lib = "libhand-drawing-engine.so"; - - [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "InitializeGL")] - public static extern void InitializeGL(); - [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "RenderFrameGL")] - public static extern int RenderFrameGL(); - - [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "RenderFullyReDraw")] - public static extern void RenderFullyReDraw(); - - [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "TerminateGL")] - public static extern void TerminateGL(); - - [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "UpdateGLWindowSize")] - public static extern void UpdateGLWindowSize(int w, int h); - - [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "UpdateGLWindowOrientation")] - public static extern void UpdateGLWindowOrientation(int angle); - - [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "BeginShapeDraw")] - public static extern uint BeginShapeDraw(float x, float y, uint time = 1); - - [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "DrawShape")] - public static extern int DrawShape(uint shapeID, float x, float y, uint time = 1); - - [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "EndShapeDraw")] - public static extern int EndShapeDraw(uint shapeID, uint time = 1); - - [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "StopErasing")] - public static extern void StopErasing(); - - [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "EraseShape")] - [return:MarshalAs(UnmanagedType.I1)] - public static extern bool EraseShape(int x, int y, float radius, [MarshalAs(UnmanagedType.I1)] bool partial); - - [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "AddRectanglePath")] - public static extern uint AddRectanglePath(float xStart, float yStart, float x, float y, bool finished); - - [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "AddArcPath")] - public static extern uint AddArcPath(float xCenter, float yCenter, float radius, float x, float y, bool finished); - - [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "ResizeShapePath")] - public static extern int ResizeShapePath(uint shapeID, float x, float y); - - [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "FinishShapePath")] - public static extern int FinishShapePath(uint shapeID); - - [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "CanvasZoomBegin")] - public static extern bool CanvasZoomBegin(); - - [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "CanvasZoom")] - public static extern bool CanvasZoom(float x, float y, float zoom, float dx, float dy); - - [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "CanvasZoomEnd")] - public static extern bool CanvasZoomEnd(); - - [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "CanvasGetZoomValue")] - public static extern int CanvasGetZoomValue(); - [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "CanvasSetZoomValue")] - public static extern float CanvasSetZoomValue(float zoomValue); - - [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "CanvasMoveBegin")] - public static extern bool CanvasMoveBegin(); - - [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "CanvasMove")] - public static extern bool CanvasMove(int x, int y); - - [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "CanvasMoveEnd")] - public static extern bool CanvasMoveEnd(); - - [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "CanvasSetColor")] - public static extern void CanvasSetColor([MarshalAs(UnmanagedType.LPStr)] string hexColor, float a); - [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "CanvasSetSize")] - public static extern void CanvasSetSize(int width, int height); - - [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "SetResourcePath")] - public static extern void SetResourcePath([MarshalAs(UnmanagedType.LPStr)] string resourcePath); - - [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "SetFontPath")] - public static extern void SetFontPath([MarshalAs(UnmanagedType.LPStr)] string fontPath); - - [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "SetTexturePaths")] - public static extern void SetTexturePaths([MarshalAs(UnmanagedType.LPArray, ArraySubType=UnmanagedType.LPStr)] string[] texturePaths, int textureCount); - - [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "SetStrokeSize")] - public static extern void SetStrokeSize(float val); - - [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "SetStrokeColor")] - public static extern void SetStrokeColor([MarshalAs(UnmanagedType.LPStr)] string hexColor, float a); - - [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "SetStrokeType")] - public static extern void SetStrokeType(int brushId); - - [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "SetBrushTexture")] - public static extern void SetBrushTexture(int textureId); - - [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "SetBrushDistance")] - public static extern void SetBrushDistance(float distance); - - [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "SetDashArray")] - public static extern void SetDashArray([MarshalAs(UnmanagedType.LPStr)] string dashArray); - - [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "SetLineAngle")] - public static extern void SetLineAngle(float angle); - - [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "GetBrushSize")] - public static extern float GetBrushSize(); - - [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "GetBrushColor")] - public static extern float GetBrushColor([MarshalAs(UnmanagedType.LPStr)] StringBuilder hex); - - [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "GetBrushType")] - public static extern int GetBrushType(); - - [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "GetBrushTexture")] - public static extern int GetBrushTexture(); - - [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "GetBrushDistance")] - public static extern float GetBrushDistance(); - - [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "GetLineAngle")] - public static extern float GetLineAngle(); - - [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "GetShapeCount")] - public static extern int GetShapeCount(); - - [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "CreateCanvas")] - public static extern uint CreateCanvas(int canvasWidth, int canvasHeight); - - // #if PICTURE - [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "CreateCanvasWithBackgroundImage")] - public static extern uint CreateCanvasWithBackgroundImage([MarshalAs(UnmanagedType.LPStr)] string path); - // #endif - - [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "SetCurrentCanvas")] - public static extern void SetCurrentCanvas(uint canvasID); - - [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "ClearCurrentCanvas")] - public static extern void ClearCurrentCanvas(); - - [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "StartSelectingArea")] - public static extern void StartSelectingArea(float x, float y); - - [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "ResizeSelectedArea")] - public static extern void ResizeSelectedArea(float x, float y); - - [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "InsideSelectedArea")] - [return:MarshalAs(UnmanagedType.I1)] - public static extern bool InsideSelectedArea(float x, float y); - - [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "GetSelectionDimensions")] - [return:MarshalAs(UnmanagedType.I1)] - public static extern bool GetSelectionDimensions(ref float x, ref float y, ref float width, ref float height); - - [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "TouchedDrawable")] - public static extern int TouchedDrawable(float x, float y); - - [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "SelectDrawable")] - public static extern int SelectDrawable(float x, float y); - - [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "SelectDrawables")] - public static extern int SelectDrawables(); - - [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "DragSelectedDrawables")] - public static extern void DragSelectedDrawables(float x, float y); - - [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "EndDraging")] - public static extern void EndDraging(); - - [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "StartRotating")] - [return:MarshalAs(UnmanagedType.I1)] - public static extern bool StartRotating(float x, float y); - - [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "RotateSelected")] - [return:MarshalAs(UnmanagedType.I1)] - public static extern bool RotateSelected(float x, float y); - - [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "EndRotating")] - [return:MarshalAs(UnmanagedType.I1)] - public static extern bool EndRotating(float x, float y); - [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "StartSelectionScale")] - public static extern void StartSelectionScale(bool anchorLeft, bool anchorRight, bool anchorTop, bool anchorBottom, ref float anchorX, ref float anchorY); - - [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "ScaleSelection")] - public static extern void ScaleSelection(float scaleFactorX, float scaleFactorY); - - [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "EndSelectionScale")] - public static extern void EndSelectionScale(float scaleFactorX, float scaleFactorY); - - [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "DropSelectedDrawables")] - public static extern void DropSelectedDrawables(); - - [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "SelectedAreaZoom")] - public static extern void SelectedAreaZoom(float x, float y, float zoom); - - [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "SaveCanvas")] - [return:MarshalAs(UnmanagedType.I1)] - public static extern bool SaveCanvas(uint canvasID, [MarshalAs(UnmanagedType.LPStr)] string path); - - [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "LoadCanvas")] - [return:MarshalAs(UnmanagedType.I1)] - public static extern bool LoadCanvas(uint canvasID, [MarshalAs(UnmanagedType.LPStr)] string path); - - [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "TakeScreenshot")] - public static extern void TakeScreenshot(uint canvasID, [MarshalAs(UnmanagedType.LPStr)] string path, int x, int y, int width, int height, [MarshalAs(UnmanagedType.FunctionPtr)] PWEngineDelegates.ThumbnailSavedDelegate thumbSaved); - - [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "ToggleGrid")] - public static extern void ToggleGrid(int densityType); - - // #if CHART - [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "ToggleChartGrid")] - public static extern void ToggleChartGrid(int densityType); - - [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "GetChartGridDensity")] - public static extern int GetChartGridDensity(); - // #endif - - [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "Dump")] - public static extern void Dump(); - - [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "Copy")] - [return:MarshalAs(UnmanagedType.I1)] - public static extern bool Copy(); - - [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "Paste")] - public static extern int Paste(float x, float y); - - [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "Cut")] - [return:MarshalAs(UnmanagedType.I1)] - public static extern bool Cut(); - - [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "Remove")] - [return:MarshalAs(UnmanagedType.I1)] - public static extern bool Remove(); - - // #if CHART - [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "AddChart")] - public static extern void AddChart(int chartType, [MarshalAs(UnmanagedType.LPStr)] string path); - - [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "ChangeMode")] - public static extern void ChangeMode(int mode); - - [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "ChartPosition")] - public static extern void ChartPosition(ref float x, ref float y); - // #endif - - // #if PICTURE - [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "PlacePicture")] - public static extern void AddPicture([MarshalAs(UnmanagedType.LPStr)] string path, float x, float y, float width, float height); - - [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "SetCanvasBackground")] - public static extern void SetCanvasBackground([MarshalAs(UnmanagedType.LPStr)] string path, float x, float y, float width, float height); - // #endif - - // #if TEXT - [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "AddText")] - public static extern void AddText([MarshalAs(UnmanagedType.LPStr)] string text, float x, float y, float size); - // #endif - // #if NOTES - [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "AddNote")] - public static extern uint AddNote(float x, float y, float w, float h); - - [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "RemoveNote")] - public static extern void RemoveNote(uint noteID); - - [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "ClearNote")] - public static extern void ClearNote(); - - [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "DragNote")] - public static extern bool DragNote(float x, float y); - - [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "EndNoteDragging")] - public static extern bool EndNoteDragging(); - - [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "SetNoteColor")] - public static extern void SetNoteColor([MarshalAs(UnmanagedType.LPStr)] string hexColor, float a); - - [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "SetActiveNote")] - public static extern void SetActiveNote(uint noteID); - - [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "TouchedNote")] - public static extern uint TouchedNote(float x, float y); - // #endif - - [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "Undo")] - [return:MarshalAs(UnmanagedType.I1)] - public static extern bool Undo(); - - [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "Redo")] - [return:MarshalAs(UnmanagedType.I1)] - public static extern bool Redo(); - - [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "ResetUndo")] - public static extern void ResetUndo(); - - [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "ResetRedo")] - public static extern void ResetRedo(); - - [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "GetConfigurationCount")] - public static extern int GetConfigurationCount(); - - [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "GetAllConfigurations", CallingConvention = CallingConvention.Cdecl)] - public static extern IntPtr GetAllConfigurations(); - - [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "GetConfiguration", CallingConvention = CallingConvention.Cdecl)] - public static extern IntPtr GetConfiguration([MarshalAs(UnmanagedType.LPStr)] string key); - - [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "SetConfigurationInt", CallingConvention = CallingConvention.Cdecl)] - [return:MarshalAs(UnmanagedType.I1)] - public static extern bool SetConfigurationInt([MarshalAs(UnmanagedType.LPStr)] string key, int value); - - [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "SetConfigurationFloat", CallingConvention = CallingConvention.Cdecl)] - [return:MarshalAs(UnmanagedType.I1)] - public static extern bool SetConfigurationFloat([MarshalAs(UnmanagedType.LPStr)] string key, float value); - - [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "SetConfigurationString", CallingConvention = CallingConvention.Cdecl)] - [return:MarshalAs(UnmanagedType.I1)] - public static extern bool SetConfigurationString([MarshalAs(UnmanagedType.LPStr)] string key, [MarshalAs(UnmanagedType.LPStr)] string value); - - [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "SetConfigurationBool", CallingConvention = CallingConvention.Cdecl)] - [return:MarshalAs(UnmanagedType.I1)] - public static extern bool SetConfigurationBool([MarshalAs(UnmanagedType.LPStr)] string key, [MarshalAs(UnmanagedType.I1)] bool value); - - [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "SaveProfiler")] - [return:MarshalAs(UnmanagedType.I1)] - public static extern bool SaveProfiler([MarshalAs(UnmanagedType.LPStr)] string path); - - [global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "ResetProfiler")] - public static extern void ResetProfiler(); - - //Wrappers for Marshalled APIS - // public static void GetConfigurations(out ConfigParameter[] configParameters, out int count) - // { - // IntPtr configArrayPtr = GetAllConfigurations(); - // int engineConfigCount = GetConfigurationCount(); - // count = engineConfigCount; - - // ConfigParameter[] configArray = new ConfigParameter[count]; - - // for (int i = 0; i < count; i++) - // { - // configArray[i] = Marshal.PtrToStructure(configArrayPtr); - // configArrayPtr += Marshal.SizeOf(); - // } - - // configParameters = configArray; - // } - } -} diff --git a/src/Tizen.NUI.PenWave/src/public/Canvas/PenWave.cs b/src/Tizen.NUI.PenWave/src/public/Canvas/PenWave.cs new file mode 100644 index 00000000000..06c1986852e --- /dev/null +++ b/src/Tizen.NUI.PenWave/src/public/Canvas/PenWave.cs @@ -0,0 +1,487 @@ +using System; +using System.Text; +using System.Runtime.InteropServices; + +using Tizen.NUI; +using Tizen.NUI.BaseComponents; +using System.ComponentModel; +using System.Net.Http.Headers; +using System.Data; + +namespace Tizen.NUI.PenWave +{ + public class PenWave + { + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + public delegate void ThumbnailSavedDelegate(); + + static public ThumbnailSavedDelegate ThumbnailsDelegate = null; + + private static readonly PenWave instance = new PenWave(); + private PenWave() { } + public static PenWave Instance => instance; + + public void InitializeGL() + { + Interop.PenWave.InitializeGL(); + } + + public int RenderFrameGL() + { + return Interop.PenWave.RenderFrameGL(); + } + + public void RenderFullyReDraw() + { + Interop.PenWave.RenderFullyReDraw(); + } + + public void TerminateGL() + { + Interop.PenWave.TerminateGL(); + } + + public void UpdateGLWindowSize(int w, int h) + { + Interop.PenWave.UpdateGLWindowSize(w, h); + } + + public void UpdateGLWindowOrientation(int angle) + { + Interop.PenWave.UpdateGLWindowOrientation(angle); + } + + public uint BeginShapeDraw(float x, float y, uint time = 1) + { + return Interop.PenWave.BeginShapeDraw(x, y, time); + } + + public int DrawShape(uint shapeID, float x, float y, uint time = 1) + { + return Interop.PenWave.DrawShape(shapeID, x, y, time); + } + + public int EndShapeDraw(uint shapeID, uint time = 1) + { + return Interop.PenWave.EndShapeDraw(shapeID, time); + } + + public void StopErasing() + { + Interop.PenWave.StopErasing(); + } + + public bool EraseShape(int x, int y, float radius, bool partial) + { + return Interop.PenWave.EraseShape(x, y, radius, partial); + } + + public uint AddRectanglePath(float xStart, float yStart, float x, float y, bool finished) + { + return Interop.PenWave.AddRectanglePath(xStart, yStart, x, y, finished); + } + + public uint AddArcPath(float xCenter, float yCenter, float radius, float x, float y, bool finished) + { + return Interop.PenWave.AddArcPath(xCenter, yCenter, radius, x, y, finished); + } + + public int ResizeShapePath(uint shapeID, float x, float y) + { + return Interop.PenWave.ResizeShapePath(shapeID, x, y); + } + + public int FinishShapePath(uint shapeID) + { + return Interop.PenWave.FinishShapePath(shapeID); + } + + public bool CanvasZoomBegin() + { + return Interop.PenWave.CanvasZoomBegin(); + } + + public bool CanvasZoom(float x, float y, float zoom, float dx, float dy) + { + return Interop.PenWave.CanvasZoom(x, y, zoom, dx, dy); + } + + public bool CanvasZoomEnd() + { + return Interop.PenWave.CanvasZoomEnd(); + } + + public int CanvasGetZoomValue() + { + return Interop.PenWave.CanvasGetZoomValue(); + } + + public float CanvasSetZoomValue(float zoomValue) + { + return Interop.PenWave.CanvasSetZoomValue(zoomValue); + } + + public bool CanvasMoveBegin() + { + return Interop.PenWave.CanvasMoveBegin(); + } + + public bool CanvasMove(int x, int y) + { + return Interop.PenWave.CanvasMove(x, y); + } + + public bool CanvasMoveEnd() + { + return Interop.PenWave.CanvasMoveEnd(); + } + + public void CanvasSetColor(string hexColor, float a) + { + Interop.PenWave.CanvasSetColor(hexColor, a); + } + + public void CanvasSetSize(int width, int height) + { + Interop.PenWave.CanvasSetSize(width, height); + } + + public void SetResourcePath(string resourcePath) + { + Interop.PenWave.SetResourcePath(resourcePath); + } + + public void SetFontPath(string fontPath) + { + Interop.PenWave.SetFontPath(fontPath); + } + + public void SetTexturePaths(string[] texturePaths, int textureCount) + { + Interop.PenWave.SetTexturePaths(texturePaths, textureCount); + } + + public void SetStrokeSize(float val) + { + Interop.PenWave.SetStrokeSize(val); + } + + public void SetStrokeColor(string hexColor, float a) + { + Interop.PenWave.SetStrokeColor(hexColor, a); + } + + public void SetStrokeType(int brushId) + { + Interop.PenWave.SetStrokeType(brushId); + } + + public void SetBrushTexture(int textureId) + { + Interop.PenWave.SetBrushTexture(textureId); + } + + public void SetBrushDistance(float distance) + { + Interop.PenWave.SetBrushDistance(distance); + } + + public void SetDashArray(string dashArray) + { + Interop.PenWave.SetDashArray(dashArray); + } + + public void SetLineAngle(float angle) + { + Interop.PenWave.SetLineAngle(angle); + } + + public float GetBrushSize() + { + return Interop.PenWave.GetBrushSize(); + } + + public float GetBrushColor(StringBuilder hex) + { + return Interop.PenWave.GetBrushColor(hex); + } + + public int GetBrushType() + { + return Interop.PenWave.GetBrushType(); + } + + public int GetBrushTexture() + { + return Interop.PenWave.GetBrushTexture(); + } + + public float GetBrushDistance() + { + return Interop.PenWave.GetBrushDistance(); + } + + public float GetLineAngle() + { + return Interop.PenWave.GetLineAngle(); + } + + public int GetShapeCount() + { + return Interop.PenWave.GetShapeCount(); + } + + public uint CreateCanvas(int canvasWidth, int canvasHeight) + { + return Interop.PenWave.CreateCanvas(canvasWidth, canvasHeight); + } + + public uint CreateCanvasWithBackgroundImage(string path) + { + return Interop.PenWave.CreateCanvasWithBackgroundImage(path); + } + + public void SetCurrentCanvas(uint canvasID) + { + Interop.PenWave.SetCurrentCanvas(canvasID); + } + + public void ClearCurrentCanvas() + { + Interop.PenWave.ClearCurrentCanvas(); + } + + public void StartSelectingArea(float x, float y) + { + Interop.PenWave.StartSelectingArea(x, y); + } + + public void ResizeSelectedArea(float x, float y) + { + Interop.PenWave.ResizeSelectedArea(x, y); + } + + public bool InsideSelectedArea(float x, float y) + { + return Interop.PenWave.InsideSelectedArea(x, y); + } + + public bool GetSelectionDimensions(ref float x, ref float y, ref float width, ref float height) + { + return Interop.PenWave.GetSelectionDimensions(ref x, ref y, ref width, ref height); + } + + public int TouchedDrawable(float x, float y) + { + return Interop.PenWave.TouchedDrawable(x, y); + } + + public int SelectDrawable(float x, float y) + { + return Interop.PenWave.SelectDrawable(x, y); + } + + public int SelectDrawables() + { + return Interop.PenWave.SelectDrawables(); + } + + public void DragSelectedDrawables(float x, float y) + { + Interop.PenWave.DragSelectedDrawables(x, y); + } + + public void EndDraging() + { + Interop.PenWave.EndDraging(); + } + + public bool StartRotating(float x, float y) + { + return Interop.PenWave.StartRotating(x, y); + } + + public bool RotateSelected(float x, float y) + { + return Interop.PenWave.RotateSelected(x, y); + } + + public bool EndRotating(float x, float y) + { + return Interop.PenWave.EndRotating(x, y); + } + + public void StartSelectionScale(bool anchorLeft, bool anchorRight, bool anchorTop, bool anchorBottom, ref float anchorX, ref float anchorY) + { + Interop.PenWave.StartSelectionScale(anchorLeft, anchorRight, anchorTop, anchorBottom, ref anchorX, ref anchorY); + } + + public void ScaleSelection(float scaleFactorX, float scaleFactorY) + { + Interop.PenWave.ScaleSelection(scaleFactorX, scaleFactorY); + } + + public void EndSelectionScale(float scaleFactorX, float scaleFactorY) + { + Interop.PenWave.EndSelectionScale(scaleFactorX, scaleFactorY); + } + + public void DropSelectedDrawables() + { + Interop.PenWave.DropSelectedDrawables(); + } + + public void SelectedAreaZoom(float x, float y, float zoom) + { + Interop.PenWave.SelectedAreaZoom(x, y, zoom); + } + + public bool SaveCanvas(uint canvasID, string path) + { + return Interop.PenWave.SaveCanvas(canvasID, path); + } + + public bool LoadCanvas(uint canvasID, string path) + { + return Interop.PenWave.LoadCanvas(canvasID, path); + } + + public void TakeScreenshot(uint canvasID, string path, int x, int y, int width, int height, ThumbnailSavedDelegate thumbSaved) + { + Interop.PenWave.TakeScreenshot(canvasID, path, x, y, width, height, thumbSaved); + } + + public void ToggleGrid(int densityType) + { + Interop.PenWave.ToggleGrid(densityType); + } + + public void ToggleChartGrid(int densityType) + { + Interop.PenWave.ToggleChartGrid(densityType); + } + + public int GetChartGridDensity() + { + return Interop.PenWave.GetChartGridDensity(); + } + + public void Dump() + { + Interop.PenWave.Dump(); + } + + public bool Copy() + { + return Interop.PenWave.Copy(); + } + + public int Paste(float x, float y) + { + return Interop.PenWave.Paste(x, y); + } + + public bool Cut() + { + return Interop.PenWave.Cut(); + } + + public bool Remove() + { + return Interop.PenWave.Remove(); + } + + public void AddChart(int chartType, string path) + { + Interop.PenWave.AddChart(chartType, path); + } + + public void ChangeMode(int mode) + { + Interop.PenWave.ChangeMode(mode); + } + + + public void ChartPosition(ref float x, ref float y) + { + Interop.PenWave.ChartPosition(ref x, ref y); + } + + + public void AddPicture(string path, float x, float y, float width, float height) + { + Interop.PenWave.AddPicture(path, x, y, width, height); + } + + public void SetCanvasBackground(string path, float x, float y, float width, float height) + { + Interop.PenWave.SetCanvasBackground(path, x, y, width, height); + } + + + public void AddText(string text, float x, float y, float size) + { + Interop.PenWave.AddText(text, x, y, size); + } + + public uint AddNote(float x, float y, float w, float h) + { + return Interop.PenWave.AddNote(x, y, w, h); + } + + public void RemoveNote(uint noteID) + { + Interop.PenWave.RemoveNote(noteID); + } + + public void ClearNote() + { + Interop.PenWave.ClearNote(); + } + + public bool DragNote(float x, float y) + { + return Interop.PenWave.DragNote(x, y); + } + + public bool EndNoteDragging() + { + return Interop.PenWave.EndNoteDragging(); + } + + public void SetNoteColor(string hexColor, float a) + { + Interop.PenWave.SetNoteColor(hexColor, a); + } + + public void SetActiveNote(uint noteID) + { + Interop.PenWave.SetActiveNote(noteID); + } + + public uint TouchedNote(float x, float y) + { + return Interop.PenWave.TouchedNote(x, y); + } + + public bool Undo() + { + return Interop.PenWave.Undo(); + } + + public bool Redo() + { + return Interop.PenWave.Redo(); + } + + public void ResetUndo() + { + Interop.PenWave.ResetUndo(); + } + + public void ResetRedo() + { + Interop.PenWave.ResetRedo(); + } + } +} diff --git a/src/Tizen.NUI.PenWave/src/public/Canvas/PWCanvasView.cs b/src/Tizen.NUI.PenWave/src/public/Canvas/PenWaveCanvas.cs similarity index 83% rename from src/Tizen.NUI.PenWave/src/public/Canvas/PWCanvasView.cs rename to src/Tizen.NUI.PenWave/src/public/Canvas/PenWaveCanvas.cs index ae2687a93f7..8191823e435 100644 --- a/src/Tizen.NUI.PenWave/src/public/Canvas/PWCanvasView.cs +++ b/src/Tizen.NUI.PenWave/src/public/Canvas/PenWaveCanvas.cs @@ -24,9 +24,9 @@ namespace Tizen.NUI.PenWave { /// - /// PWCanvasView is a view that allows drawing on it using various tools. + /// PenWaveCanvas is a view that allows drawing on it using various tools. /// - public class PWCanvasView : DirectRenderingGLView + public class PenWaveCanvas : DirectRenderingGLView { /// /// Events that are triggered when the tool starts an action. @@ -44,21 +44,21 @@ public class PWCanvasView : DirectRenderingGLView private ToolBase currentTool; /// - /// Creates a new instance of a PWCanvasView. + /// Creates a new instance of a PenWaveCanvas. /// - public PWCanvasView() : base(DirectRenderingGLView.ColorFormat.RGBA8888, DirectRenderingGLView.BackendMode.UnsafeDirectRendering) + public PenWaveCanvas() : base(DirectRenderingGLView.ColorFormat.RGBA8888, DirectRenderingGLView.BackendMode.UnsafeDirectRendering) { - renderer = new CanvasRenderer(PWEngine.CreateCanvas(-1, -1)); + renderer = new CanvasRenderer(PenWave.Instance.CreateCanvas(-1, -1)); InitializeCanvas(); } /// - /// Creates a new instance of a PWCanvasView with a background image. + /// Creates a new instance of a PenWaveCanvas with a background image. /// /// - public PWCanvasView(string backgroundPath) : base(DirectRenderingGLView.ColorFormat.RGBA8888, DirectRenderingGLView.BackendMode.UnsafeDirectRendering) + public PenWaveCanvas(string backgroundPath) : base(DirectRenderingGLView.ColorFormat.RGBA8888, DirectRenderingGLView.BackendMode.UnsafeDirectRendering) { - renderer = new CanvasRenderer(PWEngine.CreateCanvasWithBackgroundImage(backgroundPath)); + renderer = new CanvasRenderer(PenWave.Instance.CreateCanvasWithBackgroundImage(backgroundPath)); InitializeCanvas(); } @@ -216,7 +216,21 @@ public void LoadCanvas(string path) } /// - /// Disposes the PWCanvasView. + /// Takes a screen shot of the canvas and saves it to a file. + /// + /// + /// + /// + /// + /// + /// + public void TakeScreenShot(string path, int x, int y, int width, int height, PenWave.ThumbnailSavedDelegate callback) + { + renderer.TakeScreenShot(path, x, y, width, height, callback); + } + + /// + /// Disposes the PenWaveCanvas. /// /// protected override void Dispose(DisposeTypes type) diff --git a/src/Tizen.NUI.PenWave/src/public/Picker/PWToolPicker.cs b/src/Tizen.NUI.PenWave/src/public/Picker/PWToolPicker.cs index aa06e08a367..fdc960b92ca 100644 --- a/src/Tizen.NUI.PenWave/src/public/Picker/PWToolPicker.cs +++ b/src/Tizen.NUI.PenWave/src/public/Picker/PWToolPicker.cs @@ -67,7 +67,7 @@ public class PWToolPicker : View { GridDensityType.Large, "icon_large_grid_density.png" }, }; - private readonly PWCanvasView canvasView; + private readonly PenWaveCanvas canvasView; private readonly Dictionary tools; private View rootView; @@ -85,7 +85,7 @@ public class PWToolPicker : View public View PopupView { get; private set; } public event Action ToolChanged; - public PWToolPicker(PWCanvasView canvasView) + public PWToolPicker(PenWaveCanvas canvasView) { this.canvasView = canvasView; tools = new Dictionary(); diff --git a/src/Tizen.NUI.PenWave/src/public/Tools/Eraser/EraserTool.cs b/src/Tizen.NUI.PenWave/src/public/Tools/Eraser/EraserTool.cs index b66731f2ccc..8e39112c418 100644 --- a/src/Tizen.NUI.PenWave/src/public/Tools/Eraser/EraserTool.cs +++ b/src/Tizen.NUI.PenWave/src/public/Tools/Eraser/EraserTool.cs @@ -83,18 +83,18 @@ public override void HandleInput(Touch touch, UnRedoManager unredoManager) private void StartDrawing(Vector2 position, uint touchTime) { - PWEngine.EraseShape((int)position.X, (int)position.Y, EraserRadius, (Eraser == EraserType.Partial)); + PenWave.Instance.EraseShape((int)position.X, (int)position.Y, EraserRadius, (Eraser == EraserType.Partial)); NotifyActionStarted(); } private void ContinueDrawing(Vector2 position, uint touchTime) { - PWEngine.EraseShape((int)position.X, (int)position.Y, EraserRadius, (Eraser == EraserType.Partial)); + PenWave.Instance.EraseShape((int)position.X, (int)position.Y, EraserRadius, (Eraser == EraserType.Partial)); } private void EndDrawing() { - PWEngine.StopErasing(); + PenWave.Instance.StopErasing(); NotifyActionFinished(); } diff --git a/src/Tizen.NUI.PenWave/src/public/Tools/Pencil/Brush/DashedLineBrush.cs b/src/Tizen.NUI.PenWave/src/public/Tools/Pencil/Brush/DashedLineBrush.cs index 76f91ba1dd7..1a1b359534b 100644 --- a/src/Tizen.NUI.PenWave/src/public/Tools/Pencil/Brush/DashedLineBrush.cs +++ b/src/Tizen.NUI.PenWave/src/public/Tools/Pencil/Brush/DashedLineBrush.cs @@ -24,8 +24,8 @@ public class DashedLineBrush : IBrushStrategy { public void ApplyBrushSettings() { - PWEngine.SetStrokeType(5); - PWEngine.SetDashArray("1 3"); + PenWave.Instance.SetStrokeType(5); + PenWave.Instance.SetDashArray("1 3"); } } } diff --git a/src/Tizen.NUI.PenWave/src/public/Tools/Pencil/Brush/DotBrush .cs b/src/Tizen.NUI.PenWave/src/public/Tools/Pencil/Brush/DotBrush .cs index fed8b380b2c..848c0eb37e7 100644 --- a/src/Tizen.NUI.PenWave/src/public/Tools/Pencil/Brush/DotBrush .cs +++ b/src/Tizen.NUI.PenWave/src/public/Tools/Pencil/Brush/DotBrush .cs @@ -24,9 +24,9 @@ public class DotBrush : IBrushStrategy { public void ApplyBrushSettings() { - PWEngine.SetStrokeType(1); - PWEngine.SetBrushTexture(1); - PWEngine.SetBrushDistance(2.0f); + PenWave.Instance.SetStrokeType(1); + PenWave.Instance.SetBrushTexture(1); + PenWave.Instance.SetBrushDistance(2.0f); } } } diff --git a/src/Tizen.NUI.PenWave/src/public/Tools/Pencil/Brush/HighlighterBrush.cs b/src/Tizen.NUI.PenWave/src/public/Tools/Pencil/Brush/HighlighterBrush.cs index 252f898c572..135c09ff359 100644 --- a/src/Tizen.NUI.PenWave/src/public/Tools/Pencil/Brush/HighlighterBrush.cs +++ b/src/Tizen.NUI.PenWave/src/public/Tools/Pencil/Brush/HighlighterBrush.cs @@ -24,9 +24,9 @@ public class HighlighterBrush : IBrushStrategy { public void ApplyBrushSettings() { - PWEngine.SetStrokeType(1); - PWEngine.SetBrushTexture(3); - PWEngine.SetBrushDistance(0.25f); + PenWave.Instance.SetStrokeType(1); + PenWave.Instance.SetBrushTexture(3); + PenWave.Instance.SetBrushDistance(0.25f); } } } diff --git a/src/Tizen.NUI.PenWave/src/public/Tools/Pencil/Brush/SharpBrush.cs b/src/Tizen.NUI.PenWave/src/public/Tools/Pencil/Brush/SharpBrush.cs index 02b51316141..7d2c0f91a63 100644 --- a/src/Tizen.NUI.PenWave/src/public/Tools/Pencil/Brush/SharpBrush.cs +++ b/src/Tizen.NUI.PenWave/src/public/Tools/Pencil/Brush/SharpBrush.cs @@ -24,7 +24,7 @@ public class SharpBrush : IBrushStrategy { public void ApplyBrushSettings() { - PWEngine.SetStrokeType(8); + PenWave.Instance.SetStrokeType(8); } } } diff --git a/src/Tizen.NUI.PenWave/src/public/Tools/Pencil/Brush/SoftBrush.cs b/src/Tizen.NUI.PenWave/src/public/Tools/Pencil/Brush/SoftBrush.cs index 023e8fc72ea..e2a92102470 100644 --- a/src/Tizen.NUI.PenWave/src/public/Tools/Pencil/Brush/SoftBrush.cs +++ b/src/Tizen.NUI.PenWave/src/public/Tools/Pencil/Brush/SoftBrush.cs @@ -24,9 +24,9 @@ public class SoftBrush : IBrushStrategy { public void ApplyBrushSettings() { - PWEngine.SetStrokeType(1); - PWEngine.SetBrushTexture(4); - PWEngine.SetBrushDistance(1.0f); + PenWave.Instance.SetStrokeType(1); + PenWave.Instance.SetBrushTexture(4); + PenWave.Instance.SetBrushDistance(1.0f); } } } diff --git a/src/Tizen.NUI.PenWave/src/public/Tools/Pencil/Brush/SprayBrush.cs b/src/Tizen.NUI.PenWave/src/public/Tools/Pencil/Brush/SprayBrush.cs index 10850a26aa8..a1f0eaa99ee 100644 --- a/src/Tizen.NUI.PenWave/src/public/Tools/Pencil/Brush/SprayBrush.cs +++ b/src/Tizen.NUI.PenWave/src/public/Tools/Pencil/Brush/SprayBrush.cs @@ -24,9 +24,9 @@ public class SprayBrush : IBrushStrategy { public void ApplyBrushSettings() { - PWEngine.SetStrokeType(1); - PWEngine.SetBrushTexture(0); - PWEngine.SetBrushDistance(3.0f); + PenWave.Instance.SetStrokeType(1); + PenWave.Instance.SetBrushTexture(0); + PenWave.Instance.SetBrushDistance(3.0f); } } } diff --git a/src/Tizen.NUI.PenWave/src/public/Tools/Pencil/Brush/StrokeBrush.cs b/src/Tizen.NUI.PenWave/src/public/Tools/Pencil/Brush/StrokeBrush.cs index 8aa16e515c9..22bda2bc814 100644 --- a/src/Tizen.NUI.PenWave/src/public/Tools/Pencil/Brush/StrokeBrush.cs +++ b/src/Tizen.NUI.PenWave/src/public/Tools/Pencil/Brush/StrokeBrush.cs @@ -24,7 +24,7 @@ public class StrokeBrush : IBrushStrategy { public void ApplyBrushSettings() { - PWEngine.SetStrokeType(0); + PenWave.Instance.SetStrokeType(0); } } } diff --git a/src/Tizen.NUI.PenWave/src/public/Tools/Pencil/Brush/VarStrokeBrush.cs b/src/Tizen.NUI.PenWave/src/public/Tools/Pencil/Brush/VarStrokeBrush.cs index 5c51222607f..6bce2b19574 100644 --- a/src/Tizen.NUI.PenWave/src/public/Tools/Pencil/Brush/VarStrokeBrush.cs +++ b/src/Tizen.NUI.PenWave/src/public/Tools/Pencil/Brush/VarStrokeBrush.cs @@ -24,7 +24,7 @@ public class VarStrokeBrush : IBrushStrategy { public void ApplyBrushSettings() { - PWEngine.SetStrokeType(6); + PenWave.Instance.SetStrokeType(6); } } } diff --git a/src/Tizen.NUI.PenWave/src/public/Tools/Pencil/Brush/VarStrokeIncBrush.cs b/src/Tizen.NUI.PenWave/src/public/Tools/Pencil/Brush/VarStrokeIncBrush.cs index 5d4b2b71784..dbfd8b04a38 100644 --- a/src/Tizen.NUI.PenWave/src/public/Tools/Pencil/Brush/VarStrokeIncBrush.cs +++ b/src/Tizen.NUI.PenWave/src/public/Tools/Pencil/Brush/VarStrokeIncBrush.cs @@ -24,7 +24,7 @@ public class VarStrokeIncBrush : IBrushStrategy { public void ApplyBrushSettings() { - PWEngine.SetStrokeType(7); + PenWave.Instance.SetStrokeType(7); } } } diff --git a/src/Tizen.NUI.PenWave/src/public/Tools/Pencil/PencilTool.cs b/src/Tizen.NUI.PenWave/src/public/Tools/Pencil/PencilTool.cs index 908404e6f03..a9a4fbd6d04 100644 --- a/src/Tizen.NUI.PenWave/src/public/Tools/Pencil/PencilTool.cs +++ b/src/Tizen.NUI.PenWave/src/public/Tools/Pencil/PencilTool.cs @@ -85,8 +85,8 @@ private void SetBrushType(BrushType brushType) public override void Activate() { SetBrushType(Brush); - PWEngine.SetStrokeColor(ToHex(BrushColor), 1.0f); - PWEngine.SetStrokeSize(BrushSize); + PenWave.Instance.SetStrokeColor(ToHex(BrushColor), 1.0f); + PenWave.Instance.SetStrokeSize(BrushSize); } public override void Deactivate() @@ -127,7 +127,7 @@ public override void HandleInput(Touch touch, UnRedoManager unredoManager) private void StartDrawing(Vector2 position, uint touchTime) { - currentShapeId = PWEngine.BeginShapeDraw(position.X, position.Y, touchTime); + currentShapeId = PenWave.Instance.BeginShapeDraw(position.X, position.Y, touchTime); NotifyActionStarted(); } @@ -135,7 +135,7 @@ private void ContinueDrawing(Vector2 position, uint touchTime) { if (currentShapeId > 0) { - var result = (ErrorShapeAddPointsType)PWEngine.DrawShape(currentShapeId, position.X, position.Y, touchTime); + var result = (ErrorShapeAddPointsType)PenWave.Instance.DrawShape(currentShapeId, position.X, position.Y, touchTime); if (result == ErrorShapeAddPointsType.OverflowShape) { EndDrawing(); @@ -150,7 +150,7 @@ private void ContinueDrawing(Vector2 position, uint touchTime) private void EndDrawing() { - PWEngine.EndShapeDraw(currentShapeId, 0); + PenWave.Instance.EndShapeDraw(currentShapeId, 0); currentShapeId = 0; NotifyActionFinished(); } diff --git a/src/Tizen.NUI.PenWave/src/public/Tools/Selection/SelectionTool.cs b/src/Tizen.NUI.PenWave/src/public/Tools/Selection/SelectionTool.cs index 6e83dffe089..f4f12cc5012 100644 --- a/src/Tizen.NUI.PenWave/src/public/Tools/Selection/SelectionTool.cs +++ b/src/Tizen.NUI.PenWave/src/public/Tools/Selection/SelectionTool.cs @@ -143,25 +143,25 @@ public override void HandleInput(Touch touch, UnRedoManager unredoManager) private void StartDrawing(Vector2 position, uint touchTime) { initialTouch = new Vector2(position.X, position.Y); - isTouchedInsideSelectedArea = PWEngine.InsideSelectedArea(position.X, position.Y); + isTouchedInsideSelectedArea = PenWave.Instance.InsideSelectedArea(position.X, position.Y); if (!isTouchedInsideSelectedArea) { - PWEngine.DropSelectedDrawables(); - drawableType = (DrawableType)PWEngine.SelectDrawable(position.X, position.Y); + PenWave.Instance.DropSelectedDrawables(); + drawableType = (DrawableType)PenWave.Instance.SelectDrawable(position.X, position.Y); } else { if (Selection == SelectionType.Rotate) { - PWEngine.StartRotating(position.X, position.Y); + PenWave.Instance.StartRotating(position.X, position.Y); } else if (Selection == SelectionType.Scale) { float topLeftX = 0, topLeftY = 0, widthSelection = 0, heightSelection = 0; - PWEngine.GetSelectionDimensions(ref topLeftX, ref topLeftY, ref widthSelection, ref heightSelection); + PenWave.Instance.GetSelectionDimensions(ref topLeftX, ref topLeftY, ref widthSelection, ref heightSelection); if (!Double.IsNaN(topLeftX)) { - PWEngine.StartSelectionScale( + PenWave.Instance.StartSelectionScale( initialTouch.X >= topLeftX+widthSelection*0.5f, initialTouch.X < topLeftX+widthSelection*0.5f, initialTouch.Y >= topLeftY+heightSelection*0.5f, @@ -186,26 +186,26 @@ private void ContinueDrawing(Vector2 position, uint touchTime) { if (currentMode == Mode.None) { - PWEngine.StartSelectingArea(position.X, position.Y); + PenWave.Instance.StartSelectingArea(position.X, position.Y); } - PWEngine.ResizeSelectedArea(position.X, position.Y); + PenWave.Instance.ResizeSelectedArea(position.X, position.Y); currentMode = Mode.Resize; } else if (currentMode != Mode.Resize && drawableType != DrawableType.None) { if (Selection == SelectionType.Move) { - PWEngine.DragSelectedDrawables(position.X, position.Y); + PenWave.Instance.DragSelectedDrawables(position.X, position.Y); currentMode = Mode.Move; } else if (Selection == SelectionType.Rotate) { - PWEngine.RotateSelected(position.X, position.Y); + PenWave.Instance.RotateSelected(position.X, position.Y); currentMode = Mode.Rotate; } else if (Selection == SelectionType.Scale) { - PWEngine.ScaleSelection( + PenWave.Instance.ScaleSelection( (position.X-anchorX)/(startScaleX-anchorX), (position.Y-anchorY)/(startScaleY-anchorY) ); @@ -220,23 +220,23 @@ private void EndDrawing(Vector2 position, uint touchTime) switch (currentMode) { case Mode.Move : - PWEngine.EndDraging(); + PenWave.Instance.EndDraging(); break; case Mode.Resize : - drawableType = (DrawableType)PWEngine.SelectDrawables(); + drawableType = (DrawableType)PenWave.Instance.SelectDrawables(); break; case Mode.Rotate : - PWEngine.EndRotating(position.X, position.Y); + PenWave.Instance.EndRotating(position.X, position.Y); break; case Mode.Scale : - PWEngine.EndRotating(position.X, position.Y); - PWEngine.EndSelectionScale( + PenWave.Instance.EndRotating(position.X, position.Y); + PenWave.Instance.EndSelectionScale( (position.X-anchorX)/(startScaleX-anchorX), (position.Y-anchorY)/(startScaleY-anchorY) ); break; default : - PWEngine.DropSelectedDrawables(); + PenWave.Instance.DropSelectedDrawables(); break; } isTouchedInsideSelectedArea = false; diff --git a/src/Tizen.NUI.PenWave/src/public/Tools/UnRedoManager.cs b/src/Tizen.NUI.PenWave/src/public/Tools/UnRedoManager.cs index b7cfb3a5262..99680e3fd7a 100644 --- a/src/Tizen.NUI.PenWave/src/public/Tools/UnRedoManager.cs +++ b/src/Tizen.NUI.PenWave/src/public/Tools/UnRedoManager.cs @@ -44,7 +44,7 @@ public void Undo() if (undoStack.Count > 0) { ICommand command = undoStack.Pop(); - PWEngine.Undo(); + PenWave.Instance.Undo(); redoStack.Push(command); } } @@ -57,7 +57,7 @@ public void Redo() if (redoStack.Count > 0) { ICommand command = redoStack.Pop(); - PWEngine.Redo(); + PenWave.Instance.Redo(); undoStack.Push(command); } }