Merge branch 'gpu-support' into merge-m54

# Conflicts:
#	binding/Binding/Definitions.cs
#	binding/Binding/SKCanvas.cs
#	binding/Binding/SkiaApi.cs
This commit is contained in:
Matthew Leibowitz 2016-09-02 04:19:40 +02:00
Родитель 4f2644e010 e0c79534cb
Коммит e9f66ac376
54 изменённых файлов: 1926 добавлений и 14 удалений

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

@ -10,6 +10,7 @@
</PropertyGroup>
<ItemGroup>
<Compile Include="$(MSBuildThisFileDirectory)Definitions.cs" />
<Compile Include="$(MSBuildThisFileDirectory)GRGlInterface.cs" />
<Compile Include="$(MSBuildThisFileDirectory)SKColorTable.cs" />
<Compile Include="$(MSBuildThisFileDirectory)SkiaApi.cs" />
<Compile Include="$(MSBuildThisFileDirectory)SKObject.cs" />
@ -18,6 +19,7 @@
<Compile Include="$(MSBuildThisFileDirectory)SKPaint.cs" />
<Compile Include="$(MSBuildThisFileDirectory)SKDocument.cs" />
<Compile Include="$(MSBuildThisFileDirectory)SKPathEffect.cs" />
<Compile Include="$(MSBuildThisFileDirectory)GRContext.cs" />
<Compile Include="$(MSBuildThisFileDirectory)SKSurface.cs" />
<Compile Include="$(MSBuildThisFileDirectory)SKCanvas.cs" />
<Compile Include="$(MSBuildThisFileDirectory)SKShader.cs" />

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

@ -1,4 +1,4 @@
//
//
// Skia Definitions, enumerations and interop structures
//
// Author:
@ -42,6 +42,9 @@ using System;
using System.Runtime.InteropServices;
using System.Globalization;
using GRBackendObject = System.IntPtr;
using GRBackendContext = System.IntPtr;
namespace SkiaSharp
{
public enum SKCodecResult {
@ -522,6 +525,14 @@ namespace SkiaSharp
BgrVertical
}
[Flags]
public enum SKSurfacePropsFlags {
DisallowAntiAlias = 1 << 0,
DisallowDither = 1 << 1,
UseDeviceIndependentFonts = 1 << 2,
GammaCorrect = 1 << 3,
}
public enum SKEncoding {
Utf8, Utf16, Utf32
}
@ -749,11 +760,17 @@ namespace SkiaSharp
[StructLayout(LayoutKind.Sequential)]
public struct SKSurfaceProps {
private SKPixelGeometry pixelGeometry;
private SKSurfacePropsFlags flags;
public SKPixelGeometry PixelGeometry {
get { return pixelGeometry; }
set { pixelGeometry = value; }
}
public SKSurfacePropsFlags Flags {
get { return flags; }
set { flags = value; }
}
}
public enum SKZeroInitialized {
@ -2256,5 +2273,191 @@ typeMask = Mask.Scale | Mask.RectStaysRect
}
}
}
public enum GRSurfaceOrigin {
TopLeft,
BottomLeft,
}
public enum GRPixelConfig {
Unknown,
Alpha8,
Index8,
Rgb565,
Rgba4444,
Rgba8888,
Bgra8888,
Srgba8888,
Sbgra8888,
Etc1,
Latc,
R11Eac,
Astc12x12,
RgbaFloat,
AlphaHalf,
RgbaHalf,
}
[StructLayout(LayoutKind.Sequential)]
public struct GRBackendRenderTargetDesc {
private int width;
private int height;
private GRPixelConfig config;
private GRSurfaceOrigin origin;
private int sampleCount;
private int stencilBits;
private GRBackendObject renderTargetHandle;
public int Width {
get { return width; }
set { width = value; }
}
public int Height {
get { return height; }
set { height = value; }
}
public GRPixelConfig Config {
get { return config; }
set { config = value; }
}
public GRSurfaceOrigin Origin {
get { return origin; }
set { origin = value; }
}
public int SampleCount {
get { return sampleCount; }
set { sampleCount = value; }
}
public int StencilBits {
get { return stencilBits; }
set { stencilBits = value; }
}
public GRBackendObject RenderTargetHandle {
get { return renderTargetHandle; }
set { renderTargetHandle = value; }
}
}
public enum GRBackend {
OpenGL,
Vulkan,
}
[Flags]
public enum GRBackendTextureDescFlags {
None = 0,
RenderTarget = 1,
}
[StructLayout(LayoutKind.Sequential)]
public struct GRBackendTextureDesc {
private GRBackendTextureDescFlags flags;
private GRSurfaceOrigin origin;
private int width;
private int height;
private GRPixelConfig config;
private int sampleCount;
private GRBackendObject textureHandle;
public GRBackendTextureDescFlags Flags {
get { return flags; }
set { flags = value; }
}
public GRSurfaceOrigin Origin {
get { return origin; }
set { origin = value; }
}
public int Width {
get { return width; }
set { width = value; }
}
public int Height {
get { return height; }
set { height = value; }
}
public GRPixelConfig Config {
get { return config; }
set { config = value; }
}
public int SampleCount {
get { return sampleCount; }
set { sampleCount = value; }
}
public GRBackendObject TextureHandle {
get { return textureHandle; }
set { textureHandle = value; }
}
}
[StructLayout(LayoutKind.Sequential)]
public struct GRContextOptions {
private bool suppressPrints;
private int maxTextureSizeOverride;
private int maxTileSizeOverride;
private bool suppressDualSourceBlending;
private int bufferMapThreshold;
private bool useDrawInsteadOfPartialRenderTargetWrite;
private bool immediateMode;
private bool clipBatchToBounds;
private bool drawBatchBounds;
private int maxBatchLookback;
private int maxBatchLookahead;
private bool useShaderSwizzling;
private bool doManualMipmapping;
public bool SuppressPrints {
get { return suppressPrints; }
set { suppressPrints = value; }
}
public int MaxTextureSizeOverride {
get { return maxTextureSizeOverride; }
set { maxTextureSizeOverride = value; }
}
public int MaxTileSizeOverride {
get { return maxTileSizeOverride; }
set { maxTileSizeOverride = value; }
}
public bool SuppressDualSourceBlending {
get { return suppressDualSourceBlending; }
set { suppressDualSourceBlending = value; }
}
public int BufferMapThreshold {
get { return bufferMapThreshold; }
set { bufferMapThreshold = value; }
}
public bool UseDrawInsteadOfPartialRenderTargetWrite {
get { return useDrawInsteadOfPartialRenderTargetWrite; }
set { useDrawInsteadOfPartialRenderTargetWrite = value; }
}
public bool ImmediateMode {
get { return immediateMode; }
set { immediateMode = value; }
}
public bool ClipBatchToBounds {
get { return clipBatchToBounds; }
set { clipBatchToBounds = value; }
}
public bool DrawBatchBounds {
get { return drawBatchBounds; }
set { drawBatchBounds = value; }
}
public int MaxBatchLookback {
get { return maxBatchLookback; }
set { maxBatchLookback = value; }
}
public int MaxBatchLookahead {
get { return maxBatchLookahead; }
set { maxBatchLookahead = value; }
}
public bool UseShaderSwizzling {
get { return useShaderSwizzling; }
set { useShaderSwizzling = value; }
}
public bool DoManualMipmapping {
get { return doManualMipmapping; }
set { doManualMipmapping = value; }
}
}
}

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

@ -0,0 +1,90 @@
//
// Bindings for GRContext
//
// Author:
// Matthew Leibowitz
//
// Copyright 2016 Xamarin Inc
//
using System;
namespace SkiaSharp
{
public class GRContext : SKObject
{
[Preserve]
internal GRContext (IntPtr h, bool owns)
: base (h, owns)
{
}
public static GRContext Create (GRBackend backend)
{
return Create (backend, IntPtr.Zero);
}
public static GRContext Create (GRBackend backend, IntPtr backendContext)
{
return GetObject<GRContext> (SkiaApi.gr_context_create_with_defaults (backend, backendContext));
}
public static GRContext Create (GRBackend backend, GRGlInterface backendContext)
{
return GetObject<GRContext> (SkiaApi.gr_context_create_with_defaults (backend, backendContext.Handle));
}
public static GRContext Create (GRBackend backend, IntPtr backendContext, GRContextOptions options)
{
return GetObject<GRContext> (SkiaApi.gr_context_create (backend, backendContext, ref options));
}
public static GRContext Create (GRBackend backend, GRGlInterface backendContext, GRContextOptions options)
{
return GetObject<GRContext> (SkiaApi.gr_context_create (backend, backendContext.Handle, ref options));
}
public void AbandonContext (bool releaseResources = false)
{
if (releaseResources) {
SkiaApi.gr_context_release_resources_and_abandon_context (Handle);
} else {
SkiaApi.gr_context_abandon_context (Handle);
}
}
public void GetResourceCacheLimits (out int maxResources, out long maxResourceBytes)
{
IntPtr maxResourceBytesPtr;
SkiaApi.gr_context_get_resource_cache_limits (Handle, out maxResources, out maxResourceBytesPtr);
maxResourceBytes = (long)maxResourceBytesPtr;
}
public void SetResourceCacheLimits (int maxResources, long maxResourceBytes)
{
SkiaApi.gr_context_set_resource_cache_limits (Handle, maxResources, (IntPtr)maxResourceBytes);
}
public void GetResourceCacheUsage (out int maxResources, out long maxResourceBytes)
{
IntPtr maxResourceBytesPtr;
SkiaApi.gr_context_get_resource_cache_usage (Handle, out maxResources, out maxResourceBytesPtr);
maxResourceBytes = (long)maxResourceBytesPtr;
}
public int GetRecommendedSampleCount (GRPixelConfig config, float dpi)
{
return SkiaApi.gr_context_get_recommended_sample_count (Handle, config, dpi);
}
protected override void Dispose (bool disposing)
{
if (Handle != IntPtr.Zero && OwnsHandle) {
SkiaApi.gr_context_unref (Handle);
}
base.Dispose (disposing);
}
}
}

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

@ -0,0 +1,169 @@
//
// Bindings for GRContext
//
// Author:
// Matthew Leibowitz
//
// Copyright 2016 Xamarin Inc
//
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
namespace SkiaSharp
{
// public delegates
public delegate IntPtr GRGlGetProcDelegate (object context, string name);
// internal proxy delegates
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
internal delegate IntPtr GRGlGetProcDelegateInternal (IntPtr context, string name);
public class GRGlInterface : SKObject
{
// so the GC doesn't collect the delegate
private static readonly GRGlGetProcDelegateInternal getProcDelegate;
static GRGlInterface ()
{
getProcDelegate = new GRGlGetProcDelegateInternal (GrGLGetProcInternal);
}
[Preserve]
internal GRGlInterface (IntPtr h, bool owns)
: base (h, owns)
{
}
public static GRGlInterface CreateDefaultInterface ()
{
return GetObject<GRGlInterface> (SkiaApi.gr_glinterface_default_interface ());
}
public static GRGlInterface CreateNativeInterface ()
{
return GetObject<GRGlInterface> (SkiaApi.gr_glinterface_create_native_interface ());
}
public static GRGlInterface AssembleInterface (GRGlGetProcDelegate get)
{
return AssembleInterface (null, get);
}
public static GRGlInterface AssembleInterface (object context, GRGlGetProcDelegate get)
{
var del = Marshal.GetFunctionPointerForDelegate (getProcDelegate);
var ctx = new GRGlGetProcDelegateContext (context, get);
var ptr = ctx.Wrap ();
var glInterface = GetObject<GRGlInterface> (SkiaApi.gr_glinterface_assemble_interface (ptr, del));
GRGlGetProcDelegateContext.Free (ptr);
return glInterface;
}
public static GRGlInterface AssembleGlInterface (GRGlGetProcDelegate get)
{
return AssembleGlInterface (null, get);
}
public static GRGlInterface AssembleGlInterface (object context, GRGlGetProcDelegate get)
{
var del = Marshal.GetFunctionPointerForDelegate (getProcDelegate);
var ctx = new GRGlGetProcDelegateContext (context, get);
var ptr = ctx.Wrap ();
var glInterface = GetObject<GRGlInterface> (SkiaApi.gr_glinterface_assemble_gl_interface (ptr, del));
GRGlGetProcDelegateContext.Free (ptr);
return glInterface;
}
public static GRGlInterface AssembleGlesInterface (GRGlGetProcDelegate get)
{
return AssembleGlesInterface (null, get);
}
public static GRGlInterface AssembleGlesInterface (object context, GRGlGetProcDelegate get)
{
var del = Marshal.GetFunctionPointerForDelegate (getProcDelegate);
var ctx = new GRGlGetProcDelegateContext (context, get);
var ptr = ctx.Wrap ();
var glInterface = GetObject<GRGlInterface> (SkiaApi.gr_glinterface_assemble_gles_interface (ptr, del));
GRGlGetProcDelegateContext.Free (ptr);
return glInterface;
}
public GRGlInterface Clone ()
{
return GetObject<GRGlInterface> (SkiaApi.gr_glinterface_clone (Handle));
}
public bool Validate ()
{
return SkiaApi.gr_glinterface_validate (Handle);
}
public bool HasExtension (string extension)
{
return SkiaApi.gr_glinterface_has_extension (Handle, extension);
}
protected override void Dispose (bool disposing)
{
if (Handle != IntPtr.Zero && OwnsHandle) {
SkiaApi.gr_context_unref (Handle);
}
base.Dispose (disposing);
}
// internal proxy
#if __IOS__
[ObjCRuntime.MonoPInvokeCallback (typeof (GRGlGetProcDelegateInternal))]
#endif
private static IntPtr GrGLGetProcInternal (IntPtr context, string name)
{
var ctx = GRGlGetProcDelegateContext.Unwrap (context);
return ctx.GetProc (ctx.Context, name);
}
// This is the actual context passed to native code.
// Instead of marshalling the user's data as an IntPtr and requiring
// him to wrap/unwarp, we do it via a proxy class. This also prevents
// us from having to marshal the user's callback too.
private struct GRGlGetProcDelegateContext
{
// the "managed version" of the callback
public readonly GRGlGetProcDelegate GetProc;
public readonly object Context;
public GRGlGetProcDelegateContext (object context, GRGlGetProcDelegate get)
{
Context = context;
GetProc = get;
}
// wrap this context into a "native" pointer
public IntPtr Wrap ()
{
var gc = GCHandle.Alloc (this, GCHandleType.Pinned);
return GCHandle.ToIntPtr (gc);
}
// unwrap the "native" pointer into a managed context
public static GRGlGetProcDelegateContext Unwrap (IntPtr ptr)
{
var gchandle = GCHandle.FromIntPtr (ptr);
return (GRGlGetProcDelegateContext) gchandle.Target;
}
// unwrap and free the context
public static void Free (IntPtr ptr)
{
var gchandle = GCHandle.FromIntPtr (ptr);
gchandle.Free ();
}
}
}
}

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

@ -1,4 +1,4 @@
//
//
// Bindings for SKCanvas
//
// Author:
@ -357,6 +357,11 @@ namespace SkiaSharp
SkiaApi.sk_canvas_draw_text_on_path (Handle, bytes, bytes.Length, path.Handle, hOffset, vOffset, paint.Handle);
}
public void Flush ()
{
SkiaApi.sk_canvas_flush (Handle);
}
public void DrawBitmapNinePatch (SKBitmap bitmap, SKRectI center, SKRect dst, SKPaint paint = null)
{
if (bitmap == null)

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

@ -44,6 +44,51 @@ namespace SkiaSharp
return GetObject<SKSurface> (SkiaApi.sk_surface_new_raster_direct (ref info, pixels, (IntPtr)rowBytes, ref props));
}
public static SKSurface Create (GRContext context, GRBackendRenderTargetDesc desc, SKSurfaceProps props)
{
return GetObject<SKSurface> (SkiaApi.sk_surface_new_backend_render_target (context.Handle, ref desc, ref props));
}
public static SKSurface Create (GRContext context, GRBackendRenderTargetDesc desc)
{
return GetObject<SKSurface> (SkiaApi.sk_surface_new_backend_render_target (context.Handle, ref desc, IntPtr.Zero));
}
public static SKSurface Create (GRContext context, GRBackendTextureDesc desc, SKSurfaceProps props)
{
return GetObject<SKSurface> (SkiaApi.sk_surface_new_backend_texture (context.Handle, ref desc, ref props));
}
public static SKSurface Create (GRContext context, GRBackendTextureDesc desc)
{
return GetObject<SKSurface> (SkiaApi.sk_surface_new_backend_texture (context.Handle, ref desc, IntPtr.Zero));
}
public static SKSurface CreateAsRenderTarget (GRContext context, GRBackendTextureDesc desc, SKSurfaceProps props)
{
return GetObject<SKSurface> (SkiaApi.sk_surface_new_backend_texture_as_render_target (context.Handle, ref desc, ref props));
}
public static SKSurface CreateAsRenderTarget (GRContext context, GRBackendTextureDesc desc)
{
return GetObject<SKSurface> (SkiaApi.sk_surface_new_backend_texture_as_render_target (context.Handle, ref desc, IntPtr.Zero));
}
public static SKSurface Create (GRContext context, bool budgeted, SKImageInfo info, int sampleCount, SKSurfaceProps props)
{
return GetObject<SKSurface> (SkiaApi.sk_surface_new_render_target (context.Handle, budgeted, ref info, sampleCount, ref props));
}
public static SKSurface Create (GRContext context, bool budgeted, SKImageInfo info, int sampleCount)
{
return GetObject<SKSurface> (SkiaApi.sk_surface_new_render_target (context.Handle, budgeted, ref info, sampleCount, IntPtr.Zero));
}
public static SKSurface Create (GRContext context, bool budgeted, SKImageInfo info)
{
return GetObject<SKSurface> (SkiaApi.sk_surface_new_render_target (context.Handle, budgeted, ref info, 0, IntPtr.Zero));
}
protected override void Dispose (bool disposing)
{
if (Handle != IntPtr.Zero && OwnsHandle) {

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

@ -9,6 +9,9 @@
using System;
using System.Runtime.InteropServices;
using GRBackendObject = System.IntPtr;
using GRBackendContext = System.IntPtr;
using sk_surface_t = System.IntPtr;
using sk_canvas_t = System.IntPtr;
using sk_image_t = System.IntPtr;
@ -42,6 +45,8 @@ using sk_path_iterator_t = System.IntPtr;
using sk_path_effect_t = System.IntPtr;
using sk_pixelref_factory_t = System.IntPtr;
using sk_colortable_t = System.IntPtr;
using gr_context_t = System.IntPtr;
using gr_glinterface_t = System.IntPtr;
namespace SkiaSharp
{
@ -77,6 +82,26 @@ namespace SkiaSharp
public extern static sk_canvas_t sk_surface_get_canvas(sk_surface_t t);
[DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
public extern static sk_image_t sk_surface_new_image_snapshot(sk_surface_t t);
[DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
public extern static sk_surface_t sk_surface_new_backend_render_target (gr_context_t context, ref GRBackendRenderTargetDesc desc, ref SKSurfaceProps props);
[DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
public extern static sk_surface_t sk_surface_new_backend_render_target (gr_context_t context, ref GRBackendRenderTargetDesc desc, IntPtr propsZero);
[DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
public extern static sk_surface_t sk_surface_new_backend_texture (gr_context_t context, ref GRBackendTextureDesc desc, ref SKSurfaceProps props);
[DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
public extern static sk_surface_t sk_surface_new_backend_texture (gr_context_t context, ref GRBackendTextureDesc desc, IntPtr propsZero);
[DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
public extern static sk_surface_t sk_surface_new_backend_texture_as_render_target (gr_context_t context, ref GRBackendTextureDesc desc, ref SKSurfaceProps props);
[DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
public extern static sk_surface_t sk_surface_new_backend_texture_as_render_target (gr_context_t context, ref GRBackendTextureDesc desc, IntPtr propsZero);
[DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
public extern static sk_surface_t sk_surface_new_render_target (gr_context_t context, bool budgeted, ref SKImageInfo info, int sampleCount, ref SKSurfaceProps props);
[DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
public extern static sk_surface_t sk_surface_new_render_target (gr_context_t context, bool budgeted, ref SKImageInfo info, int sampleCount, IntPtr propsZero);
// Canvas
[DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
public extern static int sk_canvas_save(sk_canvas_t t);
@ -178,10 +203,14 @@ namespace SkiaSharp
[DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
public extern static sk_canvas_t sk_canvas_new_from_bitmap(sk_bitmap_t bitmap);
[DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
public extern static void sk_canvas_flush (sk_canvas_t canvas);
[DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
public extern static void sk_canvas_draw_bitmap_lattice(sk_canvas_t t, sk_bitmap_t bitmap, int[] xDivs, int xCount, int[] yDivs, int yCount, ref SKRect dst, sk_paint_t paint);
[DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
public extern static void sk_canvas_draw_image_lattice(sk_canvas_t t, sk_image_t image, int[] xDivs, int xCount, int[] yDivs, int yCount, ref SKRect dst, sk_paint_t paint);
// Paint
[DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
public extern static sk_paint_t sk_paint_new();
[DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
@ -1013,6 +1042,51 @@ namespace SkiaSharp
public extern static void sk_colortable_read_colors (sk_colortable_t ctable, [Out] SKColor[] colors);
[DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
public extern static void sk_colortable_read_colors (sk_colortable_t ctable, out IntPtr colors);
// GRContext
[DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
public extern static gr_context_t gr_context_create (GRBackend backend, GRBackendContext backendContext, ref GRContextOptions options);
[DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
public extern static gr_context_t gr_context_create_with_defaults (GRBackend backend, GRBackendContext backendContext);
[DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
public extern static void gr_context_unref (gr_context_t context);
[DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
public extern static void gr_context_abandon_context (gr_context_t context);
[DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
public extern static void gr_context_release_resources_and_abandon_context (gr_context_t context);
[DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
public extern static void gr_context_get_resource_cache_limits (gr_context_t context, out int maxResources, out IntPtr maxResourceBytes);
[DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
public extern static void gr_context_set_resource_cache_limits (gr_context_t context, int maxResources, IntPtr maxResourceBytes);
[DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
public extern static void gr_context_get_resource_cache_usage (gr_context_t context, out int maxResources, out IntPtr maxResourceBytes);
[DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
public extern static int gr_context_get_recommended_sample_count (gr_context_t context, GRPixelConfig config, float dpi);
// GLInterface
[DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
public extern static gr_glinterface_t gr_glinterface_assemble_interface (IntPtr ctx, IntPtr get);
[DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
public extern static gr_glinterface_t gr_glinterface_assemble_gl_interface (IntPtr ctx, IntPtr get);
[DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
public extern static gr_glinterface_t gr_glinterface_assemble_gles_interface (IntPtr ctx, IntPtr get);
[DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
public extern static gr_glinterface_t gr_glinterface_default_interface ();
[DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
public extern static gr_glinterface_t gr_glinterface_create_native_interface ();
[DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
public extern static void gr_glinterface_interface_unref (gr_glinterface_t glInterface);
[DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
public extern static gr_glinterface_t gr_glinterface_clone (gr_glinterface_t glInterface);
[DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
[return: MarshalAs(UnmanagedType.I1)]
public extern static bool gr_glinterface_validate (gr_glinterface_t glInterface);
[DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
[return: MarshalAs(UnmanagedType.I1)]
public extern static bool gr_glinterface_has_extension (gr_glinterface_t glInterface, string extension);
}
}

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

@ -385,7 +385,7 @@ Task ("externals-windows")
.Does (() =>
{
var buildArch = new Action<string, string, string> ((platform, skiaArch, dir) => {
RunGyp ("skia_arch_type='" + skiaArch + "'", "ninja,msvs");
RunGyp ("skia_arch_type='" + skiaArch + "' skia_gpu=1", "ninja,msvs");
VisualStudioPathFixup ();
DotNetBuild ("native-builds/libSkiaSharp_windows/libSkiaSharp_" + dir + ".sln", c => {
c.Configuration = "Release";
@ -544,7 +544,7 @@ Task ("externals-osx")
.Does (() =>
{
var buildArch = new Action<string, string> ((arch, skiaArch) => {
RunGyp ("skia_arch_type='" + skiaArch + "'", "ninja,xcode");
RunGyp ("skia_arch_type='" + skiaArch + "' skia_gpu=1", "ninja,xcode");
XCodeBuild (new XCodeBuildSettings {
Project = "native-builds/libSkiaSharp_osx/libSkiaSharp.xcodeproj",
@ -596,7 +596,7 @@ Task ("externals-ios")
// set up the gyp environment variables
AppendEnvironmentVariable ("PATH", DEPOT_PATH.FullPath);
RunGyp ("skia_os='ios' skia_arch_type='arm' armv7=1 arm_neon=0", "ninja,xcode");
RunGyp ("skia_os='ios' skia_arch_type='arm' armv7=1 arm_neon=0 skia_gpu=1", "ninja,xcode");
buildArch ("iphonesimulator", "i386");
buildArch ("iphonesimulator", "x86_64");
@ -647,7 +647,7 @@ Task ("externals-tvos")
// set up the gyp environment variables
AppendEnvironmentVariable ("PATH", DEPOT_PATH.FullPath);
RunGyp ("skia_os='ios' skia_arch_type='arm' armv7=1 arm_neon=0", "ninja,xcode");
RunGyp ("skia_os='ios' skia_arch_type='arm' armv7=1 arm_neon=0 skia_gpu=1", "ninja,xcode");
convertIOSToTVOS();
buildArch ("appletvsimulator", "x86_64");
@ -691,13 +691,13 @@ Task ("externals-android")
SetEnvironmentVariable ("ANDROID_SDK_ROOT", ANDROID_SDK_ROOT);
SetEnvironmentVariable ("ANDROID_NDK_HOME", ANDROID_NDK_HOME);
SetEnvironmentVariable ("GYP_DEFINES", "");
SetEnvironmentVariable ("GYP_DEFINES", "skia_gpu=1");
buildArch ("x86", "x86");
SetEnvironmentVariable ("GYP_DEFINES", "");
SetEnvironmentVariable ("GYP_DEFINES", "skia_gpu=1");
buildArch ("x86_64", "x86_64");
SetEnvironmentVariable ("GYP_DEFINES", "arm_neon=1 arm_version=7");
SetEnvironmentVariable ("GYP_DEFINES", "arm_neon=1 arm_version=7 skia_gpu=1");
buildArch ("arm_v7_neon", "armeabi-v7a");
SetEnvironmentVariable ("GYP_DEFINES", "arm_neon=0 arm_version=8");
SetEnvironmentVariable ("GYP_DEFINES", "arm_neon=0 arm_version=8 skia_gpu=1");
buildArch ("arm64", "arm64-v8a");
var ndkbuild = MakeAbsolute (Directory (ANDROID_NDK_HOME)).CombineWithFilePath ("ndk-build").FullPath;
@ -859,6 +859,10 @@ Task ("samples")
c.Configuration = "Release";
c.Properties ["Platform"] = new [] { "iPhoneSimulator" };
});
RunNuGetRestore ("./samples/Skia.OSX.GLDemo/Skia.OSX.GLDemo.sln");
DotNetBuild ("./samples/Skia.OSX.GLDemo/Skia.OSX.GLDemo.sln", c => {
c.Configuration = "Release";
});
}
if (IsRunningOnWindows ()) {
@ -875,6 +879,11 @@ Task ("samples")
DotNetBuild ("./samples/Skia.Forms.Demo/Skia.Forms.Demo.Windows.sln", c => {
c.Configuration = "Release";
});
RunNuGetRestore ("./samples/Skia.WindowsDesktop.GLDemo/Skia.WindowsDesktop.GLDemo.sln");
DotNetBuild ("./samples/Skia.WindowsDesktop.GLDemo/Skia.WindowsDesktop.GLDemo.sln", c => {
c.Configuration = "Release";
c.Properties ["Platform"] = new [] { "x86" };
});
}
RunNuGetRestore ("./samples/Skia.WindowsDesktop.Demo/Skia.WindowsDesktop.Demo.sln");

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

@ -26,7 +26,9 @@ LOCAL_C_INCLUDES := ../../skia/src/c \
../../skia/include/core \
../../skia/include/codec \
../../skia/include/effects \
../../skia/include/gpu \
../../skia/include/config \
../../skia/include/utils \
../../skia/include/images
LOCAL_CFLAGS := -DSK_INTERNAL -DSK_GAMMA_APPLY_TO_A8 \

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

@ -1935,6 +1935,8 @@
../../skia/include/core,
../../skia/include/codec,
../../skia/include/effects,
../../skia/include/utils,
../../skia/include/gpu,
../../skia/include/config,
);
INFOPLIST_FILE = libSkiaSharp/Info.plist;
@ -1968,6 +1970,8 @@
../../skia/include/core,
../../skia/include/codec,
../../skia/include/effects,
../../skia/include/utils,
../../skia/include/gpu,
../../skia/include/config,
);
INFOPLIST_FILE = libSkiaSharp/Info.plist;

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

@ -1633,6 +1633,8 @@
../../skia/include/core,
../../skia/include/codec,
../../skia/include/effects,
../../skia/include/gpu,
../../skia/include/utils,
../../skia/include/config,
);
OTHER_CPLUSPLUSFLAGS = (
@ -1657,6 +1659,8 @@
../../skia/include/core,
../../skia/include/codec,
../../skia/include/effects,
../../skia/include/gpu,
../../skia/include/utils,
../../skia/include/config,
);
OTHER_CPLUSPLUSFLAGS = (

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

@ -1930,6 +1930,8 @@
../../skia/include/core,
../../skia/include/codec,
../../skia/include/effects,
../../skia/include/gpu,
../../skia/include/utils,
../../skia/include/config,
);
INFOPLIST_FILE = libSkiaSharp/Info.plist;
@ -1962,6 +1964,8 @@
../../skia/include/core,
../../skia/include/codec,
../../skia/include/effects,
../../skia/include/utils,
../../skia/include/gpu,
../../skia/include/config,
);
INFOPLIST_FILE = libSkiaSharp/Info.plist;

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

@ -29,6 +29,7 @@
#include "sk_string.h"
#include "sk_surface.h"
#include "sk_typeface.h"
#include "gr_context.h"
// Xamarin
#include "sk_managedstream.h"
@ -80,6 +81,7 @@ void** KeepSkiaCSymbols ()
(void*)sk_matrix_map_radius,
(void*)sk_matrix_try_invert,
(void*)sk_colortable_new,
(void*)gr_context_unref,
// Xamarin
(void*)sk_managedstream_new,

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

@ -1079,7 +1079,8 @@ namespace SkiaSharp
WindowsDesktop = 8,
UWP = 16,
tvOS = 32,
All = 0xFFFF,
OpenGL = 64,
All = iOS | Android | OSX | WindowsDesktop | UWP | tvOS | OpenGL,
}
public class Sample
@ -1092,7 +1093,7 @@ namespace SkiaSharp
public static string [] SamplesForPlatform (Platform platform)
{
return sampleList.Where (s => 0 != (s.Platform & platform)).Select (s => s.Title).ToArray ();
return sampleList.Where (s => s.Platform.HasFlag (platform)).Select (s => s.Title).ToArray ();
}
public static Sample GetSample (string title)
@ -1124,7 +1125,7 @@ namespace SkiaSharp
new Sample {Title="Turbulence Perlin Noise Shader", Method = TurbulencePerlinNoiseShader, Platform = Platform.All},
new Sample {Title="Compose Shader", Method = ComposeShader, Platform = Platform.All},
new Sample {Title="Blur Mask Filter", Method = BlurMaskFilter, Platform = Platform.All},
new Sample {Title="Emboss Mask Filter", Method = EmbossMaskFilter, Platform = Platform.All},
new Sample {Title="Emboss Mask Filter", Method = EmbossMaskFilter, Platform = Platform.All & ~Platform.OpenGL},
new Sample {Title="Color Matrix Color Filter", Method = ColorMatrixColorFilter, Platform = Platform.All},
new Sample {Title="Color Table Color Filter", Method = ColorTableColorFilter, Platform = Platform.All},
new Sample {Title="Luma Color Filter", Method = LumaColorFilter, Platform = Platform.All},

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

@ -0,0 +1,29 @@
using AppKit;
using Foundation;
namespace Skia.OSX.Demo
{
[Register ("AppDelegate")]
public partial class AppDelegate : NSApplicationDelegate
{
public AppDelegate ()
{
}
public override void DidFinishLaunching (NSNotification notification)
{
// Insert code here to initialize your application
}
public override void WillTerminate (NSNotification notification)
{
// Insert code here to tear down your application
}
public override bool ApplicationShouldTerminateAfterLastWindowClosed (NSApplication sender)
{
return true;
}
}
}

19
samples/Skia.OSX.GLDemo/AppDelegate.designer.cs сгенерированный Normal file
Просмотреть файл

@ -0,0 +1,19 @@
// WARNING
//
// This file has been generated automatically by Xamarin Studio to store outlets and
// actions made in the UI designer. If it is removed, they will be lost.
// Manual changes to this file may not be handled correctly.
//
using Foundation;
using System.CodeDom.Compiler;
namespace Skia.OSX.Demo
{
partial class AppDelegate
{
void ReleaseDesignerOutlets ()
{
}
}
}

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

@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleName</key>
<string>Skia.OSX.Demo</string>
<key>CFBundleIdentifier</key>
<string>com.xamarin.skia-osx-demo</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>LSMinimumSystemVersion</key>
<string>10.10</string>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>NSHumanReadableCopyright</key>
<string>billholmes</string>
<key>NSPrincipalClass</key>
<string>NSApplication</string>
<key>NSMainStoryboardFile</key>
<string>Main</string>
<key>XSAppIconAssets</key>
<string>Resources/Images.xcassets/AppIcons.appiconset</string>
</dict>
</plist>

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

@ -0,0 +1,13 @@
using AppKit;
namespace Skia.OSX.Demo
{
static class MainClass
{
static void Main (string[] args)
{
NSApplication.Init ();
NSApplication.Main (args);
}
}
}

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

@ -0,0 +1,107 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.Storyboard.XIB" version="3.0" toolsVersion="10116" systemVersion="15E65" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" initialViewController="B8D-0N-5wS">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="10116"/>
</dependencies>
<scenes>
<!--Application-->
<scene sceneID="JPo-4y-FX3">
<objects>
<application id="hnw-xV-0zn" sceneMemberID="viewController">
<menu key="mainMenu" title="Main Menu" systemMenu="main" id="AYu-sK-qS6">
<items>
<menuItem title="Skia.OSX.Demo" id="1Xt-HY-uBw">
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="Skia.OSX.Demo" systemMenu="apple" id="uQy-DD-JDr">
<items>
<menuItem title="About Skia.OSX.Demo" id="5kV-Vb-QxS">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="orderFrontStandardAboutPanel:" target="Ady-hI-5gd" id="Exp-CZ-Vem"/>
</connections>
</menuItem>
<menuItem isSeparatorItem="YES" id="eHP-pT-vMg"/>
<menuItem title="Quit Skia.OSX.Demo" keyEquivalent="q" id="4sb-4s-VLi">
<connections>
<action selector="terminate:" target="Ady-hI-5gd" id="Te7-pn-YzF"/>
</connections>
</menuItem>
</items>
</menu>
</menuItem>
</items>
</menu>
<connections>
<outlet property="delegate" destination="Voe-Tx-rLC" id="PrD-fu-P6m"/>
</connections>
</application>
<customObject id="Voe-Tx-rLC" customClass="AppDelegate"/>
<customObject id="Ady-hI-5gd" userLabel="First Responder" customClass="NSResponder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="75" y="0.0"/>
</scene>
<!--Window Controller-->
<scene sceneID="R2V-B0-nI4">
<objects>
<windowController id="B8D-0N-5wS" sceneMemberID="viewController">
<window key="window" title="Window" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" oneShot="NO" releasedWhenClosed="NO" showsToolbarButton="NO" visibleAtLaunch="NO" animationBehavior="default" id="IQv-IB-iLA">
<windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES" resizable="YES"/>
<windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
<rect key="contentRect" x="196" y="240" width="480" height="270"/>
<rect key="screenRect" x="0.0" y="0.0" width="1680" height="1027"/>
</window>
<connections>
<segue destination="XfG-lQ-9wD" kind="relationship" relationship="window.shadowedContentViewController" id="cq2-FE-JQM"/>
</connections>
</windowController>
<customObject id="Oky-zY-oP4" userLabel="First Responder" customClass="NSResponder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="75" y="250"/>
</scene>
<!--View Controller-->
<scene sceneID="hIz-AP-VOD">
<objects>
<viewController id="XfG-lQ-9wD" customClass="ViewController" sceneMemberID="viewController">
<customView key="view" id="QUA-QF-Q3f">
<rect key="frame" x="0.0" y="0.0" width="450" height="300"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<subviews>
<view translatesAutoresizingMaskIntoConstraints="NO" id="m2S-Jp-Qdl" customClass="SkiaView">
<rect key="frame" x="0.0" y="0.0" width="450" height="300"/>
</view>
<popUpButton verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="mnJ-8z-WRI">
<rect key="frame" x="228" y="17" width="205" height="26"/>
<constraints>
<constraint firstAttribute="width" constant="200" id="3Ya-mE-NFc"/>
<constraint firstAttribute="height" constant="21" id="PW1-2o-QII"/>
</constraints>
<popUpButtonCell key="cell" type="push" bezelStyle="rounded" alignment="left" lineBreakMode="truncatingTail" borderStyle="borderAndBezel" imageScaling="proportionallyDown" inset="2" id="5te-c2-WKW">
<behavior key="behavior" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="menu"/>
<menu key="menu" id="LKv-bG-q8C"/>
</popUpButtonCell>
<connections>
<action selector="PopUpButtonAction:" target="XfG-lQ-9wD" id="lmM-6c-sIb"/>
</connections>
</popUpButton>
</subviews>
<constraints>
<constraint firstAttribute="bottom" secondItem="mnJ-8z-WRI" secondAttribute="bottom" constant="20" id="A3L-Bb-rlF"/>
<constraint firstAttribute="trailing" secondItem="mnJ-8z-WRI" secondAttribute="trailing" constant="20" id="DYI-UX-Zkb"/>
<constraint firstAttribute="bottom" secondItem="m2S-Jp-Qdl" secondAttribute="bottom" id="Gw9-r7-0Df"/>
<constraint firstItem="m2S-Jp-Qdl" firstAttribute="top" secondItem="QUA-QF-Q3f" secondAttribute="top" id="Uut-tC-oBU"/>
<constraint firstItem="m2S-Jp-Qdl" firstAttribute="leading" secondItem="QUA-QF-Q3f" secondAttribute="leading" id="Xcr-Wg-5ia"/>
<constraint firstAttribute="trailing" secondItem="m2S-Jp-Qdl" secondAttribute="trailing" id="rZp-9d-Lpb"/>
</constraints>
</customView>
<connections>
<outlet property="PopUpButton" destination="mnJ-8z-WRI" id="mEQ-lK-fod"/>
<outlet property="SkiaView" destination="m2S-Jp-Qdl" id="8ta-WW-AHG"/>
</connections>
</viewController>
<customObject id="rPt-NT-nkU" userLabel="First Responder" customClass="NSResponder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="75" y="655"/>
</scene>
</scenes>
</document>

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 7.9 KiB

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 20 KiB

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 711 B

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 1.4 KiB

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 20 KiB

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 58 KiB

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 1.4 KiB

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 3.3 KiB

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 58 KiB

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 174 KiB

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

@ -0,0 +1,222 @@
{
"images": [
{
"size": "29x29",
"scale": "1x",
"idiom": "iphone"
},
{
"size": "29x29",
"scale": "2x",
"idiom": "iphone"
},
{
"size": "29x29",
"scale": "3x",
"idiom": "iphone"
},
{
"size": "40x40",
"scale": "2x",
"idiom": "iphone"
},
{
"size": "40x40",
"scale": "3x",
"idiom": "iphone"
},
{
"size": "57x57",
"scale": "1x",
"idiom": "iphone"
},
{
"size": "57x57",
"scale": "2x",
"idiom": "iphone"
},
{
"size": "60x60",
"scale": "2x",
"idiom": "iphone"
},
{
"size": "60x60",
"scale": "3x",
"idiom": "iphone"
},
{
"size": "29x29",
"scale": "1x",
"idiom": "ipad"
},
{
"size": "29x29",
"scale": "2x",
"idiom": "ipad"
},
{
"size": "40x40",
"scale": "1x",
"idiom": "ipad"
},
{
"size": "40x40",
"scale": "2x",
"idiom": "ipad"
},
{
"size": "50x50",
"scale": "1x",
"idiom": "ipad"
},
{
"size": "50x50",
"scale": "2x",
"idiom": "ipad"
},
{
"size": "83.5x83.5",
"scale": "2x",
"idiom": "ipad"
},
{
"size": "72x72",
"scale": "1x",
"idiom": "ipad"
},
{
"size": "72x72",
"scale": "2x",
"idiom": "ipad"
},
{
"size": "76x76",
"scale": "1x",
"idiom": "ipad"
},
{
"size": "76x76",
"scale": "2x",
"idiom": "ipad"
},
{
"role": "notificationCenter",
"size": "24x24",
"subtype": "38mm",
"scale": "2x",
"idiom": "watch"
},
{
"role": "notificationCenter",
"size": "27.5x27.5",
"subtype": "42mm",
"scale": "2x",
"idiom": "watch"
},
{
"role": "companionSettings",
"size": "29x29",
"scale": "2x",
"idiom": "watch"
},
{
"role": "companionSettings",
"size": "29x29",
"scale": "3x",
"idiom": "watch"
},
{
"role": "appLauncher",
"size": "40x40",
"subtype": "38mm",
"scale": "2x",
"idiom": "watch"
},
{
"role": "longLook",
"size": "44x44",
"subtype": "42mm",
"scale": "2x",
"idiom": "watch"
},
{
"role": "quickLook",
"size": "86x86",
"subtype": "38mm",
"scale": "2x",
"idiom": "watch"
},
{
"role": "quickLook",
"size": "98x98",
"subtype": "42mm",
"scale": "2x",
"idiom": "watch"
},
{
"filename": "skia_16x16.png",
"size": "16x16",
"scale": "1x",
"idiom": "mac"
},
{
"filename": "skia_32x32.png",
"size": "16x16",
"scale": "2x",
"idiom": "mac"
},
{
"filename": "skia_32x32.png",
"size": "32x32",
"scale": "1x",
"idiom": "mac"
},
{
"filename": "skia_64x64.png",
"size": "32x32",
"scale": "2x",
"idiom": "mac"
},
{
"filename": "skia_128x128.png",
"size": "128x128",
"scale": "1x",
"idiom": "mac"
},
{
"filename": "skia_256x256.png",
"size": "128x128",
"scale": "2x",
"idiom": "mac"
},
{
"filename": "skia_256x256.png",
"size": "256x256",
"scale": "1x",
"idiom": "mac"
},
{
"filename": "skia_512x512.png",
"size": "256x256",
"scale": "2x",
"idiom": "mac"
},
{
"filename": "skia_512x512.png",
"size": "512x512",
"scale": "1x",
"idiom": "mac"
},
{
"filename": "skia_1024x1024.png",
"size": "512x512",
"scale": "2x",
"idiom": "mac"
}
],
"info": {
"version": 1,
"author": "xcode"
}
}

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 28 KiB

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 3.1 KiB

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 935 B

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 5.9 KiB

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 1.5 KiB

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 13 KiB

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 2.7 KiB

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

@ -0,0 +1,130 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectTypeGuids>{A3F8F2AB-B479-4A4A-A458-A89E7DC349F1};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<ProjectGuid>{1730229c-f631-4ba9-86b3-d62828d8815b}</ProjectGuid>
<OutputType>Exe</OutputType>
<RootNamespace>Skia.OSX.GLDemo</RootNamespace>
<MonoMacResourcePrefix>Resources</MonoMacResourcePrefix>
<AssemblyName>Skia.OSX.GLDemo</AssemblyName>
<TargetFrameworkIdentifier>Xamarin.Mac</TargetFrameworkIdentifier>
<TargetFrameworkVersion>v2.0</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug</OutputPath>
<DefineConstants>DEBUG;</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>false</ConsolePause>
<Profiling>true</Profiling>
<UseRefCounting>true</UseRefCounting>
<UseSGen>true</UseSGen>
<IncludeMonoRuntime>false</IncludeMonoRuntime>
<CreatePackage>false</CreatePackage>
<CodeSigningKey>Mac Developer</CodeSigningKey>
<EnableCodeSigning>false</EnableCodeSigning>
<EnablePackageSigning>false</EnablePackageSigning>
<XamMacArch>x86_64</XamMacArch>
<PackageSigningKey>Developer ID Installer</PackageSigningKey>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>full</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>false</ConsolePause>
<Profiling>false</Profiling>
<UseRefCounting>true</UseRefCounting>
<UseSGen>true</UseSGen>
<IncludeMonoRuntime>true</IncludeMonoRuntime>
<CreatePackage>true</CreatePackage>
<CodeSigningKey>Mac Developer</CodeSigningKey>
<EnableCodeSigning>true</EnableCodeSigning>
<EnablePackageSigning>false</EnablePackageSigning>
<XamMacArch>x86_64</XamMacArch>
<LinkMode>Full</LinkMode>
<PackageSigningKey>Developer ID Installer</PackageSigningKey>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="Xamarin.Mac" />
<Reference Include="SkiaSharp">
<HintPath>packages\SkiaSharp.1.53.2-gpu2\lib\XamarinMac\SkiaSharp.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="OpenTK" />
</ItemGroup>
<ItemGroup>
<ImageAsset Include="Resources\Images.xcassets\AppIcons.appiconset\Contents.json" />
<ImageAsset Include="Resources\Images.xcassets\AppIcons.appiconset\AppIcon-128.png" />
<ImageAsset Include="Resources\Images.xcassets\AppIcons.appiconset\AppIcon-128%402x.png" />
<ImageAsset Include="Resources\Images.xcassets\AppIcons.appiconset\AppIcon-16.png" />
<ImageAsset Include="Resources\Images.xcassets\AppIcons.appiconset\AppIcon-16%402x.png" />
<ImageAsset Include="Resources\Images.xcassets\AppIcons.appiconset\AppIcon-256.png" />
<ImageAsset Include="Resources\Images.xcassets\AppIcons.appiconset\AppIcon-256%402x.png" />
<ImageAsset Include="Resources\Images.xcassets\AppIcons.appiconset\AppIcon-32.png" />
<ImageAsset Include="Resources\Images.xcassets\AppIcons.appiconset\AppIcon-32%402x.png" />
<ImageAsset Include="Resources\Images.xcassets\AppIcons.appiconset\AppIcon-512.png" />
<ImageAsset Include="Resources\Images.xcassets\AppIcons.appiconset\AppIcon-512%402x.png" />
<ImageAsset Include="Resources\Images.xcassets\AppIcons.appiconset\skia_16x16.png" />
<ImageAsset Include="Resources\Images.xcassets\AppIcons.appiconset\skia_32x32.png" />
<ImageAsset Include="Resources\Images.xcassets\AppIcons.appiconset\skia_64x64.png" />
<ImageAsset Include="Resources\Images.xcassets\AppIcons.appiconset\skia_128x128.png" />
<ImageAsset Include="Resources\Images.xcassets\AppIcons.appiconset\skia_256x256.png" />
<ImageAsset Include="Resources\Images.xcassets\AppIcons.appiconset\skia_512x512.png" />
<ImageAsset Include="Resources\Images.xcassets\AppIcons.appiconset\skia_1024x1024.png" />
</ItemGroup>
<ItemGroup>
<None Include="Info.plist" />
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<Compile Include="Main.cs" />
<Compile Include="AppDelegate.cs" />
<Compile Include="ViewController.cs" />
<Compile Include="ViewController.designer.cs">
<DependentUpon>ViewController.cs</DependentUpon>
</Compile>
<Compile Include="SkiaView.cs" />
<Compile Include="SkiaView.designer.cs">
<DependentUpon>SkiaView.cs</DependentUpon>
</Compile>
<Compile Include="AppDelegate.designer.cs">
<DependentUpon>AppDelegate.cs</DependentUpon>
</Compile>
<Compile Include="..\SharedDemo\SkiaSharp.Demos.cs">
<Link>SkiaSharp.Demos.cs</Link>
</Compile>
</ItemGroup>
<ItemGroup>
<InterfaceDefinition Include="Main.storyboard" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="..\SharedDemo\embedded-font.ttf">
<Link>embedded-font.ttf</Link>
</EmbeddedResource>
<EmbeddedResource Include="..\SharedDemo\baboon.png">
<Link>baboon.png</Link>
</EmbeddedResource>
<EmbeddedResource Include="..\SharedDemo\color-wheel.png">
<Link>color-wheel.png</Link>
</EmbeddedResource>
<EmbeddedResource Include="..\SharedDemo\adobe-dng.dng">
<Link>adobe-dng.dng</Link>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<BundleResource Include="..\SharedDemo\content-font.ttf">
<Link>Resources\content-font.ttf</Link>
</BundleResource>
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath)\Xamarin\Mac\Xamarin.Mac.CSharp.targets" />
<Import Project="packages\SkiaSharp.1.53.2-gpu2\build\XamarinMac\SkiaSharp.targets" Condition="Exists('packages\SkiaSharp.1.53.2-gpu2\build\XamarinMac\SkiaSharp.targets')" />
</Project>

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

@ -0,0 +1,17 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2012
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Skia.OSX.GLDemo", "Skia.OSX.GLDemo.csproj", "{1730229c-f631-4ba9-86b3-d62828d8815b}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{1730229c-f631-4ba9-86b3-d62828d8815b}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1730229c-f631-4ba9-86b3-d62828d8815b}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1730229c-f631-4ba9-86b3-d62828d8815b}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1730229c-f631-4ba9-86b3-d62828d8815b}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
EndGlobal

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

@ -0,0 +1,74 @@
using System;
using AppKit;
using OpenTK.Graphics.OpenGL;
using SkiaSharp;
namespace Skia.OSX.Demo
{
public partial class SkiaView : NSOpenGLView
{
Demos.Sample sample;
GRContext grContext;
public SkiaView (IntPtr handle) : base (handle)
{
AddGestureRecognizer (new NSClickGestureRecognizer (OnClicked));
}
public override void PrepareOpenGL ()
{
base.PrepareOpenGL ();
grContext = GRContext.Create (GRBackend.OpenGL);
}
public override void DrawRect (CoreGraphics.CGRect dirtyRect)
{
base.DrawRect (dirtyRect);
if (grContext != null)
{
var sampleCount = grContext.GetRecommendedSampleCount(GRPixelConfig.Rgba8888, 96.0f);
var desc = new GRBackendRenderTargetDesc
{
Width = (int)Bounds.Width,
Height = (int)Bounds.Height,
Config = GRPixelConfig.Rgba8888,
Origin = GRSurfaceOrigin.TopLeft,
SampleCount = sampleCount,
StencilBits = 0,
RenderTargetHandle = IntPtr.Zero,
};
using (var surface = SKSurface.Create (grContext, desc))
{
var skcanvas = surface.Canvas;
sample.Method (skcanvas, (int)Bounds.Width, (int)Bounds.Height);
skcanvas.Flush ();
}
GL.Flush();
}
}
void OnClicked ()
{
Sample?.TapMethod?.Invoke ();
}
public Demos.Sample Sample {
get {
return sample;
}
set {
sample = value;
SetNeedsDisplayInRect (Bounds);
}
}
}
}

20
samples/Skia.OSX.GLDemo/SkiaView.designer.cs сгенерированный Normal file
Просмотреть файл

@ -0,0 +1,20 @@
// WARNING
//
// This file has been generated automatically by Xamarin Studio to store outlets and
// actions made in the UI designer. If it is removed, they will be lost.
// Manual changes to this file may not be handled correctly.
//
using Foundation;
using System.CodeDom.Compiler;
namespace Skia.OSX.Demo
{
[Register ("SkiaView")]
partial class SkiaView
{
void ReleaseDesignerOutlets ()
{
}
}
}

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

@ -0,0 +1,56 @@
using System;
using AppKit;
using Foundation;
using System.IO;
namespace Skia.OSX.Demo
{
public partial class ViewController : NSViewController
{
public ViewController (IntPtr handle) : base (handle)
{
}
public override void ViewDidLoad ()
{
base.ViewDidLoad ();
// set up resource paths
string fontName = "content-font.ttf";
SkiaSharp.Demos.CustomFontPath = NSBundle.MainBundle.PathForResource (Path.GetFileNameWithoutExtension (fontName), Path.GetExtension (fontName));
var dir = Path.Combine (Path.GetTempPath (), "SkiaSharp.Demos", Path.GetRandomFileName ());
if (!Directory.Exists (dir))
{
Directory.CreateDirectory (dir);
}
SkiaSharp.Demos.WorkingDirectory = dir;
SkiaSharp.Demos.OpenFileDelegate = path =>
{
if (!NSWorkspace.SharedWorkspace.OpenFile (Path.Combine (dir, path)))
{
NSAlert.WithMessage ("SkiaSharp", "OK", null, null, "Unable to open file.").RunSheetModal (View.Window);
}
};
PopUpButton.AddItems (SkiaSharp.Demos.SamplesForPlatform (SkiaSharp.Demos.Platform.OSX | SkiaSharp.Demos.Platform.OpenGL));
PopUpButton.SelectItem (0);
SkiaView.Sample = SkiaSharp.Demos.GetSample (PopUpButton.SelectedItem.Title);
}
partial void PopUpButtonAction (NSObject sender)
{
SkiaView.Sample = SkiaSharp.Demos.GetSample (PopUpButton.SelectedItem.Title);
}
public override NSObject RepresentedObject {
get {
return base.RepresentedObject;
}
set {
base.RepresentedObject = value;
// Update the view, if already loaded.
}
}
}
}

37
samples/Skia.OSX.GLDemo/ViewController.designer.cs сгенерированный Normal file
Просмотреть файл

@ -0,0 +1,37 @@
// WARNING
//
// This file has been generated automatically by Xamarin Studio to store outlets and
// actions made in the UI designer. If it is removed, they will be lost.
// Manual changes to this file may not be handled correctly.
//
using Foundation;
using System.CodeDom.Compiler;
namespace Skia.OSX.Demo
{
[Register ("ViewController")]
partial class ViewController
{
[Outlet]
AppKit.NSPopUpButton PopUpButton { get; set; }
[Outlet]
Skia.OSX.Demo.SkiaView SkiaView { get; set; }
[Action ("PopUpButtonAction:")]
partial void PopUpButtonAction (Foundation.NSObject sender);
void ReleaseDesignerOutlets ()
{
if (PopUpButton != null) {
PopUpButton.Dispose ();
PopUpButton = null;
}
if (SkiaView != null) {
SkiaView.Dispose ();
SkiaView = null;
}
}
}
}

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

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="SkiaSharp" version="1.53.2-gpu2" targetFramework="xamarinmac20" />
</packages>

74
samples/Skia.WindowsDesktop.GLDemo/Form1.Designer.cs сгенерированный Normal file
Просмотреть файл

@ -0,0 +1,74 @@
namespace Skia.WindowsDesktop.GLDemo
{
partial class Form1
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.comboBox = new System.Windows.Forms.ComboBox();
this.skiaView = new Skia.WindowsDesktop.GLDemo.SkiaGLControl();
this.SuspendLayout();
//
// comboBox
//
this.comboBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.comboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.comboBox.FormattingEnabled = true;
this.comboBox.Location = new System.Drawing.Point(466, 504);
this.comboBox.Name = "comboBox";
this.comboBox.Size = new System.Drawing.Size(300, 28);
this.comboBox.TabIndex = 0;
this.comboBox.SelectedIndexChanged += new System.EventHandler(this.comboBox1_SelectedIndexChanged);
//
// skiaView
//
this.skiaView.Dock = System.Windows.Forms.DockStyle.Fill;
this.skiaView.Location = new System.Drawing.Point(0, 0);
this.skiaView.Name = "skiaView";
this.skiaView.Size = new System.Drawing.Size(778, 544);
this.skiaView.TabIndex = 1;
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(144F, 144F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
this.ClientSize = new System.Drawing.Size(778, 544);
this.Controls.Add(this.comboBox);
this.Controls.Add(this.skiaView);
this.Name = "Form1";
this.Text = "Form1";
this.Load += new System.EventHandler(this.Form1_Load);
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.ComboBox comboBox;
private SkiaGLControl skiaView;
}
}

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

@ -0,0 +1,38 @@
using System;
using System.IO;
using System.Windows.Forms;
namespace Skia.WindowsDesktop.GLDemo
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
string fontName = "content-font.ttf";
var dir = Path.Combine(Path.GetTempPath(), "SkiaSharp.Demos", Path.GetRandomFileName());
if (!Directory.Exists(dir))
{
Directory.CreateDirectory(dir);
}
SkiaSharp.Demos.CustomFontPath = Path.Combine(Path.GetDirectoryName(typeof(Form1).Assembly.Location), "Content", fontName);
SkiaSharp.Demos.WorkingDirectory = dir;
SkiaSharp.Demos.OpenFileDelegate = path =>
{
System.Diagnostics.Process.Start(Path.Combine(dir, path));
};
comboBox.Items.AddRange(SkiaSharp.Demos.SamplesForPlatform(SkiaSharp.Demos.Platform.WindowsDesktop | SkiaSharp.Demos.Platform.OpenGL));
comboBox.SelectedIndex = 0;
}
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
{
skiaView.Sample = SkiaSharp.Demos.GetSample((string)comboBox.SelectedItem);
}
}
}

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

@ -0,0 +1,22 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Skia.WindowsDesktop.GLDemo
{
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
}
}
}

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

@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Skia.WindowsDesktop.GLDemo")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Skia.WindowsDesktop.GLDemo")]
[assembly: AssemblyCopyright("Copyright © 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("0315044e-207e-466e-84fd-c6add0c53e2d")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

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

@ -0,0 +1,148 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{0315044E-207E-466E-84FD-C6ADD0C53E2D}</ProjectGuid>
<OutputType>WinExe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Skia.WindowsDesktop.GLDemo</RootNamespace>
<AssemblyName>Skia.WindowsDesktop.GLDemo</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x86\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x86</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>true</Prefer32Bit>
<WarningLevel>4</WarningLevel>
<Optimize>false</Optimize>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x64\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x64</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
<OutputPath>bin\x86\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x86</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>true</Prefer32Bit>
<WarningLevel>4</WarningLevel>
<Optimize>false</Optimize>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<OutputPath>bin\x64\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x64</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>true</Prefer32Bit>
<WarningLevel>4</WarningLevel>
<Optimize>false</Optimize>
</PropertyGroup>
<PropertyGroup>
<ApplicationManifest>app.manifest</ApplicationManifest>
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.CSharp" />
<Reference Include="SkiaSharp">
<HintPath>packages\SkiaSharp.1.53.2-gpu2\lib\net45\SkiaSharp.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="OpenTK, Version=1.1.0.0, Culture=neutral, PublicKeyToken=bad199fe84eb3df4, processorArchitecture=MSIL">
<HintPath>packages\OpenTK.1.1.2349.61993\lib\NET40\OpenTK.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="OpenTK.GLControl, Version=1.1.0.0, Culture=neutral, PublicKeyToken=bad199fe84eb3df4, processorArchitecture=MSIL">
<HintPath>packages\OpenTK.GLControl.1.1.2349.61993\lib\NET40\OpenTK.GLControl.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="..\SharedDemo\SkiaSharp.Demos.cs">
<Link>SkiaSharp.Demos.cs</Link>
</Compile>
<Compile Include="Form1.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Form1.Designer.cs">
<DependentUpon>Form1.cs</DependentUpon>
</Compile>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="SkiaGLControl.cs">
<SubType>UserControl</SubType>
</Compile>
<EmbeddedResource Include="..\SharedDemo\color-wheel.png">
<Link>color-wheel.png</Link>
</EmbeddedResource>
<EmbeddedResource Include="..\SharedDemo\baboon.png">
<Link>baboon.png</Link>
</EmbeddedResource>
<EmbeddedResource Include="..\SharedDemo\embedded-font.ttf">
<Link>embedded-font.ttf</Link>
</EmbeddedResource>
<EmbeddedResource Include="..\SharedDemo\adobe-dng.dng">
<Link>adobe-dng.dng</Link>
</EmbeddedResource>
<Content Include="..\SharedDemo\content-font.ttf">
<Link>Content\content-font.ttf</Link>
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup>
<None Include="app.manifest" />
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="packages\SkiaSharp.1.53.2-gpu2\build\net45\SkiaSharp.targets" Condition="Exists('packages\SkiaSharp.1.53.2-gpu2\build\net45\SkiaSharp.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('packages\SkiaSharp.1.53.2-gpu2\build\net45\SkiaSharp.targets')" Text="$([System.String]::Format('$(ErrorText)', 'packages\SkiaSharp.1.53.2-gpu2\build\net45\SkiaSharp.targets'))" />
</Target>
</Project>

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

@ -0,0 +1,34 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.25420.1
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Skia.WindowsDesktop.GLDemo", "Skia.WindowsDesktop.GLDemo.csproj", "{0315044E-207E-466E-84FD-C6ADD0C53E2D}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|Any CPU = Release|Any CPU
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{0315044E-207E-466E-84FD-C6ADD0C53E2D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0315044E-207E-466E-84FD-C6ADD0C53E2D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0315044E-207E-466E-84FD-C6ADD0C53E2D}.Debug|x64.ActiveCfg = Debug|x64
{0315044E-207E-466E-84FD-C6ADD0C53E2D}.Debug|x64.Build.0 = Debug|x64
{0315044E-207E-466E-84FD-C6ADD0C53E2D}.Debug|x86.ActiveCfg = Debug|x86
{0315044E-207E-466E-84FD-C6ADD0C53E2D}.Debug|x86.Build.0 = Debug|x86
{0315044E-207E-466E-84FD-C6ADD0C53E2D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0315044E-207E-466E-84FD-C6ADD0C53E2D}.Release|Any CPU.Build.0 = Release|Any CPU
{0315044E-207E-466E-84FD-C6ADD0C53E2D}.Release|x64.ActiveCfg = Release|x64
{0315044E-207E-466E-84FD-C6ADD0C53E2D}.Release|x64.Build.0 = Release|x64
{0315044E-207E-466E-84FD-C6ADD0C53E2D}.Release|x86.ActiveCfg = Release|x86
{0315044E-207E-466E-84FD-C6ADD0C53E2D}.Release|x86.Build.0 = Release|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

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

@ -0,0 +1,105 @@
using System;
using System.Windows.Forms;
using OpenTK;
using OpenTK.Graphics.OpenGL;
using SkiaSharp;
namespace Skia.WindowsDesktop.GLDemo
{
public class SkiaGLControl : GLControl
{
private Demos.Sample sample;
private GRContext grContext = null;
public SkiaGLControl()
{
//// something else
//var glInterface = GRGlInterface.CreateNativeInterface();
//var secondContext = GRContext.Create(GRBackend.OpenGL, glInterface);
//var secondSurface = SKSurface.Create(secondContext, false, new SKImageInfo(Width, Height));
}
public Demos.Sample Sample
{
get { return sample; }
set
{
sample = value;
Invalidate();
}
}
private void Reshape()
{
GL.MatrixMode(MatrixMode.Projection);
GL.LoadIdentity();
GL.Ortho(0, Width, 0, Height, -1, 1);
GL.Viewport(0, 0, Width, Height);
}
protected override void Dispose(bool disposing)
{
grContext.Dispose();
base.Dispose(disposing);
}
protected override void OnMouseClick(MouseEventArgs e)
{
base.OnMouseClick(e);
sample?.TapMethod?.Invoke();
}
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
if (DesignMode) return;
Reshape();
grContext = GRContext.Create(GRBackend.OpenGL);
}
protected override void OnResize(EventArgs e)
{
base.OnResize(e);
if (grContext != null)
{
Reshape();
Invalidate();
}
}
protected override void OnPaint(PaintEventArgs e)
{
base.OnPaint(e);
if (grContext != null)
{
var desc = new GRBackendRenderTargetDesc
{
Width = Width,
Height = Height,
Config = GRPixelConfig.Bgra8888,
Origin = GRSurfaceOrigin.TopLeft,
SampleCount = 1,
StencilBits = 0,
RenderTargetHandle = IntPtr.Zero,
};
using (var surface = SKSurface.Create(grContext, desc))
{
var skcanvas = surface.Canvas;
sample.Method(skcanvas, Width, Height);
skcanvas.Flush();
}
SwapBuffers();
}
}
}
}

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

@ -0,0 +1,74 @@
<?xml version="1.0" encoding="utf-8"?>
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
<assemblyIdentity version="1.0.0.0" name="MyApplication.app"/>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
<security>
<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
<!-- UAC Manifest Options
If you want to change the Windows User Account Control level replace the
requestedExecutionLevel node with one of the following.
<requestedExecutionLevel level="asInvoker" uiAccess="false" />
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
<requestedExecutionLevel level="highestAvailable" uiAccess="false" />
Specifying requestedExecutionLevel element will disable file and registry virtualization.
Remove this element if your application requires this virtualization for backwards
compatibility.
-->
<requestedExecutionLevel level="asInvoker" uiAccess="false" />
</requestedPrivileges>
</security>
</trustInfo>
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
<application>
<!-- A list of the Windows versions that this application has been tested on and is
is designed to work with. Uncomment the appropriate elements and Windows will
automatically selected the most compatible environment. -->
<!-- Windows Vista -->
<!--<supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}" />-->
<!-- Windows 7 -->
<!--<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}" />-->
<!-- Windows 8 -->
<!--<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}" />-->
<!-- Windows 8.1 -->
<!--<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}" />-->
<!-- Windows 10 -->
<!--<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}" />-->
</application>
</compatibility>
<!-- Indicates that the application is DPI-aware and will not be automatically scaled by Windows at higher
DPIs. Windows Presentation Foundation (WPF) applications are automatically DPI-aware and do not need
to opt in. Windows Forms applications targeting .NET Framework 4.6 that opt into this setting, should
also set the 'EnableWindowsFormsHighDpiAutoResizing' setting to 'true' in their app.config. -->
<application xmlns="urn:schemas-microsoft-com:asm.v3">
<windowsSettings>
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true</dpiAware>
</windowsSettings>
</application>
<!-- Enable themes for Windows common controls and dialogs (Windows XP and later) -->
<!--
<dependency>
<dependentAssembly>
<assemblyIdentity
type="win32"
name="Microsoft.Windows.Common-Controls"
version="6.0.0.0"
processorArchitecture="*"
publicKeyToken="6595b64144ccf1df"
language="*"
/>
</dependentAssembly>
</dependency>
-->
</assembly>

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

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="OpenTK" version="1.1.2349.61993" targetFramework="net45" />
<package id="OpenTK.GLControl" version="1.1.2349.61993" targetFramework="net45" />
<package id="SkiaSharp" version="1.53.2-gpu2" targetFramework="net45" />
</packages>

2
skia

@ -1 +1 @@
Subproject commit 66b97f55fe30c3d6b6d9aa10f1dc01ac98ff68b6
Subproject commit 5a28ee5e40d9f96d005b572beedfb3c199a604b2