Skip to content

Commit

Permalink
PenWave
Browse files Browse the repository at this point in the history
  • Loading branch information
JoogabYun committed Dec 10, 2024
1 parent 3ff2757 commit cbe63f4
Show file tree
Hide file tree
Showing 15 changed files with 1,230 additions and 763 deletions.
24 changes: 12 additions & 12 deletions src/Tizen.NUI.PenWave/src/Internal/Canvas/CanvasRenderer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ internal class CanvasRenderer
/// 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.
/// </summary>
/// <param name="canvasId"></param>
public CanvasRenderer(uint canvasId)
internal CanvasRenderer(uint canvasId)
{
this.canvasId = canvasId;
engine = PenWave.Instance;
Expand All @@ -64,15 +64,15 @@ public CanvasRenderer(uint canvasId)
/// <summary>
/// Initializes OpenGL context. This method must be called before any other methods that require OpenGL context.
/// </summary>
public void InitializeGL()
internal void InitializeGL()
{
engine.InitializeGL();
}

/// <summary>
/// Terminates OpenGL context. This method must be called after all methods that require OpenGL context are finished.
/// </summary>
public void TerminateGL()
internal void TerminateGL()
{
engine.TerminateGL();
}
Expand All @@ -82,7 +82,7 @@ public void TerminateGL()
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
public int RenderFrame(in DirectRenderingGLView.RenderCallbackInput input)
internal int RenderFrame(in DirectRenderingGLView.RenderCallbackInput input)
{
return engine.RenderFrameGL();
}
Expand All @@ -92,7 +92,7 @@ public int RenderFrame(in DirectRenderingGLView.RenderCallbackInput input)
/// </summary>
/// <param name="width"></param>
/// <param name="height"></param>
public void Resize(int width, int height)
internal void Resize(int width, int height)
{
engine.UpdateGLWindowSize(width, height);
engine.RenderFullyReDraw();
Expand All @@ -101,7 +101,7 @@ public void Resize(int width, int height)
/// <summary>
/// Clears the current canvas. All strokes and pictures will be removed.
/// </summary>
public void ClearCanvas()
internal void ClearCanvas()
{
engine.ClearCurrentCanvas();
}
Expand All @@ -110,7 +110,7 @@ public void ClearCanvas()
/// Adds picture
/// </summary>
/// <param name="path"></param>
public void AddPicture(string path, Size2D size, Position2D position)
internal void AddPicture(string path, Size2D size, Position2D position)
{
engine.AddPicture(path, position.X, position.Y, size.Width, size.Height);
}
Expand All @@ -119,7 +119,7 @@ public void AddPicture(string path, Size2D size, Position2D position)
/// Toggles the grid
/// </summary>
/// <param name="gridType"></param>
public void ToggleGrid(GridDensityType gridType)
internal void ToggleGrid(GridDensityType gridType)
{
engine.ToggleGrid((int)gridType);
}
Expand All @@ -128,7 +128,7 @@ public void ToggleGrid(GridDensityType gridType)
/// Sets the canvas background color
/// </summary>
/// <param name="color"></param>
public void SetCanvasColor(Color color)
internal void SetCanvasColor(Color color)
{
engine.CanvasSetColor(ToHex(color), 1.0f);
}
Expand All @@ -137,7 +137,7 @@ public void SetCanvasColor(Color color)
/// Saves the canvas
/// </summary>
/// <param name="path"></param>
public void SaveCanvas(string path)
internal void SaveCanvas(string path)
{
engine.SaveCanvas(canvasId, path);
}
Expand All @@ -146,7 +146,7 @@ public void SaveCanvas(string path)
/// Loads the canvas from the specified path.
/// </summary>
/// <param name="path"></param>
public void LoadCanvas(string path)
internal void LoadCanvas(string path)
{
if (!File.Exists(path))
{
Expand All @@ -167,7 +167,7 @@ public void LoadCanvas(string path)
/// <param name="width"></param>
/// <param name="height"></param>
/// <param name="callback"></param>
public void TakeScreenShot(string path, int x, int y, int width, int height, PenWave.ThumbnailSavedCallback callback)
internal void TakeScreenShot(string path, int x, int y, int width, int height, PenWave.ThumbnailSavedCallback callback)
{
engine.TakeScreenshot(canvasId, path, x, y, width, height, callback);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ namespace Tizen.NUI.PenWave
{
internal static partial class Interop
{
public static partial class PenWave
internal static partial class PenWave
{
public const string Lib = "libhand-drawing-engine.so";
private const string Lib = "libhand-drawing-engine.so";

[global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "InitializeGL")]
public static extern void InitializeGL();
Expand Down Expand Up @@ -72,8 +72,9 @@ public static partial class PenWave

[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);
public static extern void CanvasSetZoomValue(float zoomValue);

[global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "CanvasMoveBegin")]
public static extern bool CanvasMoveBegin();
Expand Down Expand Up @@ -122,9 +123,6 @@ public static partial class PenWave
[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();

Expand All @@ -143,10 +141,8 @@ public static partial class PenWave
[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);
Expand Down Expand Up @@ -223,13 +219,13 @@ public static partial class PenWave
[global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "ToggleGrid")]
public static extern void ToggleGrid(int densityType);

// #if CHART
//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();
Expand All @@ -249,7 +245,7 @@ public static partial class PenWave
[return:MarshalAs(UnmanagedType.I1)]
public static extern bool Remove();

// #if CHART
//CHART
[global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "AddChart")]
public static extern void AddChart(int chartType, [MarshalAs(UnmanagedType.LPStr)] string path);

Expand All @@ -258,21 +254,21 @@ public static partial class PenWave

[global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "ChartPosition")]
public static extern void ChartPosition(ref float x, ref float y);
// #endif
//

// #if PICTURE
// 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
// 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
//
// NOTES
[global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "AddNote")]
public static extern uint AddNote(float x, float y, float w, float h);

Expand All @@ -296,7 +292,7 @@ public static partial class PenWave

[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)]
Expand All @@ -306,6 +302,15 @@ public static partial class PenWave
[return:MarshalAs(UnmanagedType.I1)]
public static extern bool Redo();

[global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "CanUndo")]
[return:MarshalAs(UnmanagedType.I1)]
public static extern bool CanUndo();

[global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "CanRedo")]
[return:MarshalAs(UnmanagedType.I1)]
public static extern bool CanRedo();


[global::System.Runtime.InteropServices.DllImport(Lib, EntryPoint = "ResetUndo")]
public static extern void ResetUndo();

Expand Down Expand Up @@ -343,24 +348,6 @@ public static partial class PenWave

[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<ConfigParameter>(configArrayPtr);
// configArrayPtr += Marshal.SizeOf<ConfigParameter>();
// }

// configParameters = configArray;
// }
}
}
}
Loading

0 comments on commit cbe63f4

Please sign in to comment.