A few changes:
- Make the decision about the region clip in managed code so we can re-use the method. - Make GetBounds method a Bounds property - Added exceptions
This commit is contained in:
Родитель
7ce861a8c7
Коммит
48cba424a3
|
@ -35,8 +35,12 @@ namespace SkiaSharp
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public SKRectI Bounds => SkiaApi.sk_region_get_bounds(Handle);
|
||||||
|
|
||||||
public bool Contains(SKRegion src)
|
public bool Contains(SKRegion src)
|
||||||
{
|
{
|
||||||
|
if (src == null)
|
||||||
|
throw new ArgumentNullException (nameof (src));
|
||||||
return SkiaApi.sk_region_contains(Handle, src.Handle);
|
return SkiaApi.sk_region_contains(Handle, src.Handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -47,6 +51,8 @@ namespace SkiaSharp
|
||||||
|
|
||||||
public bool Intersects(SKRegion region)
|
public bool Intersects(SKRegion region)
|
||||||
{
|
{
|
||||||
|
if (region == null)
|
||||||
|
throw new ArgumentNullException (nameof (region));
|
||||||
return SkiaApi.sk_region_intersects(Handle, region.Handle);
|
return SkiaApi.sk_region_intersects(Handle, region.Handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -57,6 +63,8 @@ namespace SkiaSharp
|
||||||
|
|
||||||
public bool Set(SKRegion region)
|
public bool Set(SKRegion region)
|
||||||
{
|
{
|
||||||
|
if (region == null)
|
||||||
|
throw new ArgumentNullException (nameof (region));
|
||||||
return SkiaApi.sk_region_set(Handle, region.Handle);
|
return SkiaApi.sk_region_set(Handle, region.Handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -65,9 +73,20 @@ namespace SkiaSharp
|
||||||
return SkiaApi.sk_region_set_rect(Handle, ref rect);
|
return SkiaApi.sk_region_set_rect(Handle, ref rect);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool SetPath(SKPath path, SKRegion clip)
|
||||||
|
{
|
||||||
|
if (path == null)
|
||||||
|
throw new ArgumentNullException (nameof (path));
|
||||||
|
if (clip == null)
|
||||||
|
throw new ArgumentNullException (nameof (clip));
|
||||||
|
return SkiaApi.sk_region_set_path(Handle, path.Handle, clip.Handle);
|
||||||
|
}
|
||||||
|
|
||||||
public bool SetPath(SKPath path)
|
public bool SetPath(SKPath path)
|
||||||
{
|
{
|
||||||
return SkiaApi.sk_region_set_path(Handle, path.Handle);
|
if (path == null)
|
||||||
|
throw new ArgumentNullException (nameof (path));
|
||||||
|
return SkiaApi.sk_region_set_path(Handle, path.Handle, Handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool Op(int left, int top, int right, int bottom, SKRegionOperation op)
|
public bool Op(int left, int top, int right, int bottom, SKRegionOperation op)
|
||||||
|
@ -79,10 +98,5 @@ namespace SkiaSharp
|
||||||
{
|
{
|
||||||
return SkiaApi.sk_region_op2(Handle, region.Handle, op);
|
return SkiaApi.sk_region_op2(Handle, region.Handle, op);
|
||||||
}
|
}
|
||||||
|
|
||||||
public SKRectI GetBounds()
|
|
||||||
{
|
|
||||||
return SkiaApi.sk_region_get_bounds(Handle);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1229,7 +1229,7 @@ namespace SkiaSharp
|
||||||
public extern static bool sk_region_set_rect(sk_region_t r, ref SKRectI rect);
|
public extern static bool sk_region_set_rect(sk_region_t r, ref SKRectI rect);
|
||||||
[DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
|
||||||
[return: MarshalAs(UnmanagedType.I1)]
|
[return: MarshalAs(UnmanagedType.I1)]
|
||||||
public extern static bool sk_region_set_path(sk_region_t r, sk_path_t t);
|
public extern static bool sk_region_set_path(sk_region_t r, sk_path_t t, sk_region_t clip);
|
||||||
[DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
|
||||||
[return: MarshalAs(UnmanagedType.I1)]
|
[return: MarshalAs(UnmanagedType.I1)]
|
||||||
public extern static bool sk_region_op(sk_region_t r, int left, int top, int right, int bottom, SKRegionOperation op);
|
public extern static bool sk_region_op(sk_region_t r, int left, int top, int right, int bottom, SKRegionOperation op);
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit f63aeb071105c8babbf28b79f693c7d593f9abf6
|
Subproject commit 2e88a2396f0d54fca7883b0a925b3bc37b11fe7e
|
Загрузка…
Ссылка в новой задаче