示例#1
0
        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();
            }
        }
示例#2
0
        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();
            }
        }
        public static SKSurface Create(GRContext context, GRBackendRenderTargetDesc desc, SKSurfaceProps props)
        {
            if (context == null)
            {
                throw new ArgumentNullException(nameof(context));
            }

            var renderTarget = new GRBackendRenderTarget(context.Backend, desc);

            return(Create(context, renderTarget, desc.Origin, desc.Config.ToColorType(), null, new SKSurfaceProperties(props)));
        }
        public GRBackendRenderTarget(GRBackend backend, GRBackendRenderTargetDesc desc)
            : this(IntPtr.Zero, true)
        {
            switch (backend)
            {
            case GRBackend.Metal:
                throw new NotSupportedException();

            case GRBackend.OpenGL:
                var glInfo = new GRGlFramebufferInfo((uint)desc.RenderTargetHandle, desc.Config.ToGlSizedFormat());
                CreateGl(desc.Width, desc.Height, desc.SampleCount, desc.StencilBits, glInfo);
                break;

            case GRBackend.Vulkan:
                throw new NotSupportedException();

            default:
                throw new ArgumentOutOfRangeException(nameof(backend));
            }
        }
示例#5
0
 public static SKSurface Create(GRContext context, GRBackendRenderTargetDesc desc)
 {
     return(GetObject <SKSurface> (SkiaApi.sk_surface_new_backend_render_target(context.Handle, ref desc, IntPtr.Zero)));
 }
示例#6
0
		public static SKSurface Create (GRContext context, GRBackendRenderTargetDesc desc)
		{
			return GetObject<SKSurface> (SkiaApi.sk_surface_new_backend_render_target (context.Handle, ref desc, IntPtr.Zero));
		}
示例#7
0
		public extern static sk_surface_t sk_surface_new_backend_render_target (gr_context_t context, ref GRBackendRenderTargetDesc desc, IntPtr propsZero);
示例#8
0
		public extern static sk_surface_t sk_surface_new_backend_render_target (gr_context_t context, ref GRBackendRenderTargetDesc desc, ref SKSurfaceProps props);