Added some TODOs for future features

This commit is contained in:
Matthew Leibowitz 2017-08-24 16:51:39 +02:00
Родитель c2112d5fc1
Коммит c78d3bbc2e
4 изменённых файлов: 122 добавлений и 5 удалений

Просмотреть файл

@ -21,6 +21,11 @@ namespace SkiaSharp
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
internal delegate void SKBitmapReleaseDelegateInternal (IntPtr address, IntPtr context);
// TODO: keep in mind SKBitmap may be going away (according to Google)
// TODO: `ComputeIsOpaque` may be useful
// TODO: `GenerationID` may be useful
// TODO: `GetAddr` and `GetPixel` are confusing
public class SKBitmap : SKObject
{
private const string UnsupportedColorTypeMessage = "Setting the ColorTable is only supported for bitmaps with ColorTypes of Index8.";

Просмотреть файл

@ -10,7 +10,17 @@ using System;
namespace SkiaSharp
{
// No dispose, the Canvas is only valid while the Surface is valid.
// TODO: carefully consider the `PeekPixels`, `ReadPixels`
// TODO: `ClipRRect` may be useful
// TODO: `DrawRRect` may be useful
// TODO: `DrawDRRect` may be useful
// TODO: add the `DrawArc` variants
// TODO: add `DrawTextBlob` variants if/when we bind `SKTextBlob`
// TODO: add `DrawPatch` variants
// TODO: add `DrawAtlas` variants
// TODO: add `DrawDrawable` variants if/when we bind `SKDrawable`
// TODO: add `IsClipEmpty` and `IsClipRect`
public class SKCanvas : SKObject
{
[Preserve]
@ -76,6 +86,11 @@ namespace SkiaSharp
SkiaApi.sk_canvas_draw_color (Handle, color, mode);
}
public void DrawLine (SKPoint p0, SKPoint p1, SKPaint paint)
{
DrawLine (p0.X, p0.Y, p1.X, p1.Y, paint);
}
public void DrawLine (float x0, float y0, float x1, float y1, SKPaint paint)
{
if (paint == null)
@ -267,6 +282,11 @@ namespace SkiaSharp
SkiaApi.sk_canvas_draw_region (Handle, region.Handle, paint.Handle);
}
public void DrawRect (float x, float y, float w, float h, SKPaint paint)
{
DrawRect (SKRect.Create (x, y, w, h), paint);
}
public void DrawRect (SKRect rect, SKPaint paint)
{
if (paint == null)
@ -274,6 +294,11 @@ namespace SkiaSharp
SkiaApi.sk_canvas_draw_rect (Handle, ref rect, paint.Handle);
}
public void DrawRoundRect (float x, float y, float w, float h, float rx, float ry, SKPaint paint)
{
DrawRoundRect (SKRect.Create (x, y, w, h), rx, ry, paint);
}
public void DrawRoundRect (SKRect rect, float rx, float ry, SKPaint paint)
{
if (paint == null)
@ -281,11 +306,21 @@ namespace SkiaSharp
SkiaApi.sk_canvas_draw_round_rect (Handle, ref rect, rx, ry, paint.Handle);
}
public void DrawRoundRect (SKRect rect, SKSize r, SKPaint paint)
{
DrawRoundRect (rect, r.Width, r.Height, paint);
}
public void DrawOval (float cx, float cy, float rx, float ry, SKPaint paint)
{
DrawOval (new SKRect (cx - rx, cy - ry, cx + rx, cy + ry), paint);
}
public void DrawOval (SKPoint c, SKSize r, SKPaint paint)
{
DrawOval (c.X, c.Y, r.Width, r.Height, paint);
}
public void DrawOval (SKRect rect, SKPaint paint)
{
if (paint == null)
@ -300,6 +335,11 @@ namespace SkiaSharp
SkiaApi.sk_canvas_draw_circle (Handle, cx, cy, radius, paint.Handle);
}
public void DrawCircle (SKPoint c, float radius, SKPaint paint)
{
DrawCircle (c.X, c.Y, radius, paint);
}
public void DrawPath (SKPath path, SKPaint paint)
{
if (paint == null)
@ -318,6 +358,11 @@ namespace SkiaSharp
SkiaApi.sk_canvas_draw_points (Handle, mode, (IntPtr)points.Length, points, paint.Handle);
}
public void DrawPoint (SKPoint p, SKPaint paint)
{
DrawPoint (p.X, p.Y, paint);
}
public void DrawPoint (float x, float y, SKPaint paint)
{
if (paint == null)
@ -325,6 +370,11 @@ namespace SkiaSharp
SkiaApi.sk_canvas_draw_point (Handle, x, y, paint.Handle);
}
public void DrawPoint (SKPoint p, SKColor color)
{
DrawPoint (p.X, p.Y, color);
}
public void DrawPoint (float x, float y, SKColor color)
{
using (var paint = new SKPaint { Color = color }) {
@ -332,6 +382,11 @@ namespace SkiaSharp
}
}
public void DrawImage (SKImage image, SKPoint p, SKPaint paint = null)
{
DrawImage (image, p.X, p.Y, paint);
}
public void DrawImage (SKImage image, float x, float y, SKPaint paint = null)
{
if (image == null)
@ -353,6 +408,17 @@ namespace SkiaSharp
SkiaApi.sk_canvas_draw_image_rect (Handle, image.Handle, ref source, ref dest, paint == null ? IntPtr.Zero : paint.Handle);
}
public void DrawPicture (SKPicture picture, float x, float y, SKPaint paint = null)
{
var matrix = SKMatrix.MakeTranslation (x, y);
DrawPicture (picture, ref matrix, paint);
}
public void DrawPicture (SKPicture picture, SKPoint p, SKPaint paint = null)
{
DrawPicture (picture, p.X, p.Y, paint);
}
public void DrawPicture (SKPicture picture, ref SKMatrix matrix, SKPaint paint = null)
{
if (picture == null)
@ -367,6 +433,11 @@ namespace SkiaSharp
SkiaApi.sk_canvas_draw_picture (Handle, picture.Handle, IntPtr.Zero, paint == null ? IntPtr.Zero : paint.Handle);
}
public void DrawBitmap (SKBitmap bitmap, SKPoint p, SKPaint paint = null)
{
DrawBitmap (bitmap, p.X, p.Y, paint);
}
public void DrawBitmap (SKBitmap bitmap, float x, float y, SKPaint paint = null)
{
if (bitmap == null)
@ -388,6 +459,11 @@ namespace SkiaSharp
SkiaApi.sk_canvas_draw_bitmap_rect (Handle, bitmap.Handle, ref source, ref dest, paint == null ? IntPtr.Zero : paint.Handle);
}
public void DrawSurface (SKSurface surface, SKPoint p, SKPaint paint = null)
{
DrawSurface (surface, p.X, p.Y, paint);
}
public void DrawSurface (SKSurface surface, float x, float y, SKPaint paint = null)
{
if (surface == null)
@ -396,6 +472,11 @@ namespace SkiaSharp
surface.Draw (this, x, y, paint);
}
public void DrawText (string text, SKPoint p, SKPaint paint)
{
DrawText (text, p.X, p.Y, paint);
}
public void DrawText (string text, float x, float y, SKPaint paint)
{
if (text == null)
@ -407,6 +488,11 @@ namespace SkiaSharp
DrawText (bytes, x, y, paint);
}
public void DrawText (byte[] text, SKPoint p, SKPaint paint)
{
DrawText (text, p.X, p.Y, paint);
}
public void DrawText (byte[] text, float x, float y, SKPaint paint)
{
if (text == null)
@ -454,6 +540,11 @@ namespace SkiaSharp
DrawTextOnPath (buffer, length, path, hOffset, vOffset, paint);
}
public void DrawTextOnPath (IntPtr buffer, int length, SKPath path, SKPoint offset, SKPaint paint)
{
DrawTextOnPath (buffer, length, path, offset.X, offset.Y, paint);
}
public void DrawTextOnPath (IntPtr buffer, int length, SKPath path, float hOffset, float vOffset, SKPaint paint)
{
if (buffer == IntPtr.Zero)
@ -466,6 +557,11 @@ namespace SkiaSharp
SkiaApi.sk_canvas_draw_text_on_path (Handle, buffer, length, path.Handle, hOffset, vOffset, paint.Handle);
}
public void DrawText (IntPtr buffer, int length, SKPoint p, SKPaint paint)
{
DrawText (buffer, length, p.X, p.Y, paint);
}
public void DrawText (IntPtr buffer, int length, float x, float y, SKPaint paint)
{
if (buffer == IntPtr.Zero)
@ -500,6 +596,11 @@ namespace SkiaSharp
DrawTextOnPath (text, path, hOffset, vOffset, paint);
}
public void DrawTextOnPath (string text, SKPath path, SKPoint offset, SKPaint paint)
{
DrawTextOnPath (text, path, offset.X, offset.Y, paint);
}
public void DrawTextOnPath (string text, SKPath path, float hOffset, float vOffset, SKPaint paint)
{
if (text == null)
@ -519,6 +620,11 @@ namespace SkiaSharp
DrawTextOnPath (text, path, hOffset, vOffset, paint);
}
public void DrawTextOnPath (byte[] text, SKPath path, SKPoint offset, SKPaint paint)
{
DrawTextOnPath (text, path, offset.X, offset.Y, paint);
}
public void DrawTextOnPath (byte[] text, SKPath path, float hOffset, float vOffset, SKPaint paint)
{
if (text == null)

Просмотреть файл

@ -12,6 +12,10 @@ using System.Runtime.InteropServices;
namespace SkiaSharp
{
// TODO: `Create(...)` should have overloads that accept a SKPngChunkReader
// TODO: missing the `QueryYuv8` and `GetYuv8Planes` members
// TODO: might be useful to wrap `GetFrameInfo` (single result)
public class SKCodec : SKObject
{
[Preserve]

Просмотреть файл

@ -10,6 +10,8 @@ using System;
namespace SkiaSharp
{
// TODO: `FilterColor` may be useful
public class SKColorFilter : SKObject
{
public const int ColorMatrixSize = 20;