|
@@ -1,4 +1,5 @@
|
|
-using PixiEditor.DrawingApi.Core.Bridge;
|
|
|
|
|
|
+using System;
|
|
|
|
+using PixiEditor.DrawingApi.Core.Bridge;
|
|
using PixiEditor.DrawingApi.Core.ColorsImpl;
|
|
using PixiEditor.DrawingApi.Core.ColorsImpl;
|
|
using PixiEditor.DrawingApi.Core.Numerics;
|
|
using PixiEditor.DrawingApi.Core.Numerics;
|
|
using PixiEditor.DrawingApi.Core.Surface.ImageData;
|
|
using PixiEditor.DrawingApi.Core.Surface.ImageData;
|
|
@@ -6,13 +7,19 @@ using PixiEditor.DrawingApi.Core.Surface.Vector;
|
|
|
|
|
|
namespace PixiEditor.DrawingApi.Core.Surface
|
|
namespace PixiEditor.DrawingApi.Core.Surface
|
|
{
|
|
{
|
|
- public class Canvas
|
|
|
|
|
|
+ public class Canvas : NativeObject
|
|
{
|
|
{
|
|
|
|
+
|
|
|
|
+ internal Canvas(IntPtr objPtr) : base(objPtr)
|
|
|
|
+ {
|
|
|
|
+ }
|
|
|
|
+
|
|
public void DrawPixel(VecI position, Paint drawingPaint) => DrawPixel(position.X, position.Y, drawingPaint);
|
|
public void DrawPixel(VecI position, Paint drawingPaint) => DrawPixel(position.X, position.Y, drawingPaint);
|
|
- public void DrawPixel(int posX, int posY, Paint drawingPaint) => DrawingBackendApi.Current.CanvasImplementation.DrawPixel(posX, posY, drawingPaint);
|
|
|
|
|
|
+ public void DrawPixel(int posX, int posY, Paint drawingPaint) =>
|
|
|
|
+ DrawingBackendApi.Current.CanvasImplementation.DrawPixel(ObjectPointer, posX, posY, drawingPaint);
|
|
|
|
|
|
public void DrawSurface(DrawingSurface original, int x, int y, Paint? paint)
|
|
public void DrawSurface(DrawingSurface original, int x, int y, Paint? paint)
|
|
- => DrawingBackendApi.Current.CanvasImplementation.DrawSurface(original, x, y, paint);
|
|
|
|
|
|
+ => DrawingBackendApi.Current.CanvasImplementation.DrawSurface(ObjectPointer, original, x, y, paint);
|
|
|
|
|
|
public void DrawSurface(DrawingSurface original, int x, int y) => DrawSurface(original, x, y, null);
|
|
public void DrawSurface(DrawingSurface original, int x, int y) => DrawSurface(original, x, y, null);
|
|
|
|
|
|
@@ -21,30 +28,31 @@ namespace PixiEditor.DrawingApi.Core.Surface
|
|
DrawSurface(surfaceToDraw, size.X, size.Y, paint);
|
|
DrawSurface(surfaceToDraw, size.X, size.Y, paint);
|
|
}
|
|
}
|
|
|
|
|
|
- public void DrawImage(Image image, int x, int y) => DrawingBackendApi.Current.CanvasImplementation.DrawImage(image, x, y);
|
|
|
|
|
|
+ public void DrawImage(Image image, int x, int y) => DrawingBackendApi.Current.CanvasImplementation.DrawImage(ObjectPointer, image, x, y);
|
|
|
|
|
|
- public void DrawImage(Image image, RectD rect, Paint paint) => DrawingBackendApi.Current.CanvasImplementation.DrawImage(image, rect, paint);
|
|
|
|
|
|
+ public void DrawImage(Image image, RectD rect, Paint paint) =>
|
|
|
|
+ DrawingBackendApi.Current.CanvasImplementation.DrawImage(ObjectPointer, image, rect, paint);
|
|
|
|
|
|
public int Save()
|
|
public int Save()
|
|
{
|
|
{
|
|
- return DrawingBackendApi.Current.CanvasImplementation.Save();
|
|
|
|
|
|
+ return DrawingBackendApi.Current.CanvasImplementation.Save(ObjectPointer);
|
|
}
|
|
}
|
|
|
|
|
|
public void Restore()
|
|
public void Restore()
|
|
{
|
|
{
|
|
- DrawingBackendApi.Current.CanvasImplementation.Restore();
|
|
|
|
|
|
+ DrawingBackendApi.Current.CanvasImplementation.Restore(ObjectPointer);
|
|
}
|
|
}
|
|
|
|
|
|
- public void Scale(float s) => DrawingBackendApi.Current.CanvasImplementation.Scale(s, s);
|
|
|
|
|
|
+ public void Scale(float s) => DrawingBackendApi.Current.CanvasImplementation.Scale(ObjectPointer, s, s);
|
|
|
|
|
|
/// <param name="sx">The amount to scale in the x-direction.</param>
|
|
/// <param name="sx">The amount to scale in the x-direction.</param>
|
|
/// <param name="sy">The amount to scale in the y-direction.</param>
|
|
/// <param name="sy">The amount to scale in the y-direction.</param>
|
|
/// <summary>Pre-concatenates the current matrix with the specified scale.</summary>
|
|
/// <summary>Pre-concatenates the current matrix with the specified scale.</summary>
|
|
- public void Scale(float sx, float sy) => DrawingBackendApi.Current.CanvasImplementation.Scale(sx, sy);
|
|
|
|
|
|
+ public void Scale(float sx, float sy) => DrawingBackendApi.Current.CanvasImplementation.Scale(ObjectPointer, sx, sy);
|
|
|
|
|
|
/// <param name="size">The amount to scale.</param>
|
|
/// <param name="size">The amount to scale.</param>
|
|
/// <summary>Pre-concatenates the current matrix with the specified scale.</summary>
|
|
/// <summary>Pre-concatenates the current matrix with the specified scale.</summary>
|
|
- public void Scale(Point size) => DrawingBackendApi.Current.CanvasImplementation.Scale(size.X, size.Y);
|
|
|
|
|
|
+ public void Scale(Point size) => DrawingBackendApi.Current.CanvasImplementation.Scale(ObjectPointer, size.X, size.Y);
|
|
|
|
|
|
/// <param name="sx">The amount to scale in the x-direction.</param>
|
|
/// <param name="sx">The amount to scale in the x-direction.</param>
|
|
/// <param name="sy">The amount to scale in the y-direction.</param>
|
|
/// <param name="sy">The amount to scale in the y-direction.</param>
|
|
@@ -60,29 +68,29 @@ namespace PixiEditor.DrawingApi.Core.Surface
|
|
|
|
|
|
public void Translate(float translationX, float translationY)
|
|
public void Translate(float translationX, float translationY)
|
|
{
|
|
{
|
|
- DrawingBackendApi.Current.CanvasImplementation.Translate(translationX, translationY);
|
|
|
|
|
|
+ DrawingBackendApi.Current.CanvasImplementation.Translate(ObjectPointer, translationX, translationY);
|
|
}
|
|
}
|
|
|
|
|
|
public void Translate(VecD vector) => Translate((float)vector.X, (float)vector.Y);
|
|
public void Translate(VecD vector) => Translate((float)vector.X, (float)vector.Y);
|
|
|
|
|
|
public void DrawPath(VectorPath path, Paint paint)
|
|
public void DrawPath(VectorPath path, Paint paint)
|
|
{
|
|
{
|
|
- DrawingBackendApi.Current.CanvasImplementation.DrawPath(path, paint);
|
|
|
|
|
|
+ DrawingBackendApi.Current.CanvasImplementation.DrawPath(ObjectPointer, path, paint);
|
|
}
|
|
}
|
|
|
|
|
|
public void DrawPoint(VecI pos, Paint paint)
|
|
public void DrawPoint(VecI pos, Paint paint)
|
|
{
|
|
{
|
|
- DrawingBackendApi.Current.CanvasImplementation.DrawPoint(pos, paint);
|
|
|
|
|
|
+ DrawingBackendApi.Current.CanvasImplementation.DrawPoint(ObjectPointer, pos, paint);
|
|
}
|
|
}
|
|
|
|
|
|
public void DrawPoints(PointMode pointMode, Point[] points, Paint paint)
|
|
public void DrawPoints(PointMode pointMode, Point[] points, Paint paint)
|
|
{
|
|
{
|
|
- DrawingBackendApi.Current.CanvasImplementation.DrawPoints(pointMode, points, paint);
|
|
|
|
|
|
+ DrawingBackendApi.Current.CanvasImplementation.DrawPoints(ObjectPointer, pointMode, points, paint);
|
|
}
|
|
}
|
|
|
|
|
|
public void DrawRect(int x, int y, int width, int height, Paint paint)
|
|
public void DrawRect(int x, int y, int width, int height, Paint paint)
|
|
{
|
|
{
|
|
- DrawingBackendApi.Current.CanvasImplementation.DrawRect(x, y, width, height, paint);
|
|
|
|
|
|
+ DrawingBackendApi.Current.CanvasImplementation.DrawRect(ObjectPointer, x, y, width, height, paint);
|
|
}
|
|
}
|
|
|
|
|
|
public void DrawRect(RectI rect, Paint paint) => DrawRect(rect.X, rect.Y, rect.Width, rect.Height, paint);
|
|
public void DrawRect(RectI rect, Paint paint) => DrawRect(rect.X, rect.Y, rect.Width, rect.Height, paint);
|
|
@@ -94,57 +102,62 @@ namespace PixiEditor.DrawingApi.Core.Surface
|
|
|
|
|
|
public void ClipPath(VectorPath clipPath, ClipOperation clipOperation, bool antialias)
|
|
public void ClipPath(VectorPath clipPath, ClipOperation clipOperation, bool antialias)
|
|
{
|
|
{
|
|
- DrawingBackendApi.Current.CanvasImplementation.ClipPath(clipPath, clipOperation, antialias);
|
|
|
|
|
|
+ DrawingBackendApi.Current.CanvasImplementation.ClipPath(ObjectPointer, clipPath, clipOperation, antialias);
|
|
}
|
|
}
|
|
|
|
|
|
public void ClipRect(RectD rect, ClipOperation clipOperation = ClipOperation.Intersect)
|
|
public void ClipRect(RectD rect, ClipOperation clipOperation = ClipOperation.Intersect)
|
|
{
|
|
{
|
|
- DrawingBackendApi.Current.CanvasImplementation.ClipRect(rect, clipOperation);
|
|
|
|
|
|
+ DrawingBackendApi.Current.CanvasImplementation.ClipRect(ObjectPointer, rect, clipOperation);
|
|
}
|
|
}
|
|
|
|
|
|
public void Clear()
|
|
public void Clear()
|
|
{
|
|
{
|
|
- DrawingBackendApi.Current.CanvasImplementation.Clear();
|
|
|
|
|
|
+ DrawingBackendApi.Current.CanvasImplementation.Clear(ObjectPointer);
|
|
}
|
|
}
|
|
|
|
|
|
public void Clear(Color color)
|
|
public void Clear(Color color)
|
|
{
|
|
{
|
|
- DrawingBackendApi.Current.CanvasImplementation.Clear(color);
|
|
|
|
|
|
+ DrawingBackendApi.Current.CanvasImplementation.Clear(ObjectPointer, color);
|
|
}
|
|
}
|
|
|
|
|
|
public void DrawLine(VecI from, VecI to, Paint paint)
|
|
public void DrawLine(VecI from, VecI to, Paint paint)
|
|
{
|
|
{
|
|
- DrawingBackendApi.Current.CanvasImplementation.DrawLine(from, to, paint);
|
|
|
|
|
|
+ DrawingBackendApi.Current.CanvasImplementation.DrawLine(ObjectPointer, from, to, paint);
|
|
}
|
|
}
|
|
|
|
|
|
public void Flush()
|
|
public void Flush()
|
|
{
|
|
{
|
|
- DrawingBackendApi.Current.CanvasImplementation.Flush();
|
|
|
|
|
|
+ DrawingBackendApi.Current.CanvasImplementation.Flush(ObjectPointer);
|
|
}
|
|
}
|
|
|
|
|
|
public void SetMatrix(Matrix3X3 finalMatrix)
|
|
public void SetMatrix(Matrix3X3 finalMatrix)
|
|
{
|
|
{
|
|
- DrawingBackendApi.Current.CanvasImplementation.SetMatrix(finalMatrix);
|
|
|
|
|
|
+ DrawingBackendApi.Current.CanvasImplementation.SetMatrix(ObjectPointer, finalMatrix);
|
|
}
|
|
}
|
|
|
|
|
|
public void RestoreToCount(int count)
|
|
public void RestoreToCount(int count)
|
|
{
|
|
{
|
|
- DrawingBackendApi.Current.CanvasImplementation.RestoreToCount(count);
|
|
|
|
|
|
+ DrawingBackendApi.Current.CanvasImplementation.RestoreToCount(ObjectPointer, count);
|
|
}
|
|
}
|
|
|
|
|
|
public void DrawColor(Color color, BlendMode paintBlendMode)
|
|
public void DrawColor(Color color, BlendMode paintBlendMode)
|
|
{
|
|
{
|
|
- DrawingBackendApi.Current.CanvasImplementation.DrawColor(color, paintBlendMode);
|
|
|
|
|
|
+ DrawingBackendApi.Current.CanvasImplementation.DrawColor(ObjectPointer, color, paintBlendMode);
|
|
}
|
|
}
|
|
|
|
|
|
public void RotateRadians(float dataAngle, float centerX, float centerY)
|
|
public void RotateRadians(float dataAngle, float centerX, float centerY)
|
|
{
|
|
{
|
|
- DrawingBackendApi.Current.CanvasImplementation.RotateRadians(dataAngle, centerX, centerY);
|
|
|
|
|
|
+ DrawingBackendApi.Current.CanvasImplementation.RotateRadians(ObjectPointer, dataAngle, centerX, centerY);
|
|
}
|
|
}
|
|
|
|
|
|
public void DrawBitmap(Bitmap bitmap, int x, int y)
|
|
public void DrawBitmap(Bitmap bitmap, int x, int y)
|
|
{
|
|
{
|
|
- DrawingBackendApi.Current.CanvasImplementation.DrawBitmap(bitmap, x, y);
|
|
|
|
|
|
+ DrawingBackendApi.Current.CanvasImplementation.DrawBitmap(ObjectPointer, bitmap, x, y);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public override void Dispose()
|
|
|
|
+ {
|
|
|
|
+ DrawingBackendApi.Current.CanvasImplementation.Dispose(ObjectPointer);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|