These are chat archives for AvaloniaUI/Avalonia

8th
May 2016
Gutemberg Ribeiro
@galvesribeiro
May 08 2016 01:49
ok
thanks
Gutemberg Ribeiro
@galvesribeiro
May 08 2016 02:05
@danwalmsley
C:\Development\Repos\Perspex>git submodule update --init
Submodule 'src/Markup/Perspex.Markup.Xaml/OmniXAML' (https://github.com/Perspex/OmniXAML.git) registered for path 'src/Markup/Perspex.Markup.Xaml/OmniXAML'
Submodule 'src/Perspex.HtmlRenderer/external' (https://github.com/Perspex/HTML-Renderer.git) registered for path 'src/Perspex.HtmlRenderer/external'
Submodule 'src/Perspex.ReactiveUI/src' (https://github.com/reactiveui/ReactiveUI.git) registered for path 'src/Perspex.ReactiveUI/src'
fatal: destination path 'src/Markup/Perspex.Markup.Xaml/OmniXAML' already exists and is not an empty directory.
fatal: clone of 'https://github.com/Perspex/OmniXAML.git' into submodule path 'src/Markup/Perspex.Markup.Xaml/OmniXAML' failed
danwalmsley
@danwalmsley
May 08 2016 09:08
@galvesribeiro delete the omnicaml directory and try again
Matthijs ter Woord
@mterwoord
May 08 2016 11:22
@Dorus on rx.net gitter says rx.net work on .net core...
Darnell Williams
@Seeker1437
May 08 2016 11:26
Cool, at the time we did the assessment they weren't, now we just have to update our stuff to have the .net core readiness :D
Oh, right sorry :( what about RxUI?
Matthijs ter Woord
@mterwoord
May 08 2016 11:27
no clue, is that used for ggtk# stuff as well?
it would be awesome to be able to use perspex and .net core to dev for linux, that way you can debug using vs
Darnell Williams
@Seeker1437
May 08 2016 11:28
No, but it's integrated into Perspex currently
Gutemberg Ribeiro
@galvesribeiro
May 08 2016 12:21
@danwalmsley thanks! that worked :)
Gutemberg Ribeiro
@galvesribeiro
May 08 2016 12:28
worried about 1 thing...
@jazzay mentioned that there is no direct framebuffer access and there is a copy between the window -> perspex -> skia
that would be neutralize our options to run perspex on our devices
Darnell Williams
@Seeker1437
May 08 2016 12:35
You mean how we render offscreen then bad over?
You can have direct frame buffer access through the Platform impl for your device
What I mean is that when you develop your platform, you can wrap th
e frame buffer as the drawing context and such
Darnell Williams
@Seeker1437
May 08 2016 12:42
For example on Android the drawing context was the canvas that belonged to the Perspex activity
You can write something that passes the frame buffer to Per
Spex as if it's just an object and do the required rendering that wag
Way*
Gutemberg Ribeiro
@galvesribeiro
May 08 2016 12:58
@Seeker1437 the framebuffer is behind Skia in my case
Skia writes to the framebuffer, not me
Darnell Williams
@Seeker1437
May 08 2016 13:19
Aaaah
I wonder how hard it would be to get direct access
Matthijs ter Woord
@mterwoord
May 08 2016 13:30
@Seeker1437 Most of the time getting direct access is possible, but it is then hard to do it in a generic way
Gutemberg Ribeiro
@galvesribeiro
May 08 2016 13:31
guys, perspex don't need to have direct access to FB
it just need use someone who already has... for instance, Skia
I already have skia talking to the framebuffer
Darnell Williams
@Seeker1437
May 08 2016 13:39
Ah okay I see
Yeah I know nothing on that front then.
Gutemberg Ribeiro
@galvesribeiro
May 08 2016 13:39
my biggest problem now is understand where things are plugged into what in perspex
and what exactly should I implement and what I shouldn't on our platform
Darnell Williams
@Seeker1437
May 08 2016 13:43
Do you have something I can look at?
Gutemberg Ribeiro
@galvesribeiro
May 08 2016 13:44
I'm looking at the iOS sample as @jazzay suggested
trying to figure out exactly what I need to implement
Darnell Williams
@Seeker1437
May 08 2016 13:45
What is talking to the FB right now?
Gutemberg Ribeiro
@galvesribeiro
May 08 2016 13:45
SkiaSharp
for instance
Darnell Williams
@Seeker1437
May 08 2016 13:46
Right whatever object in SkiaSharp that is responsible for the communication will be the drawingContext
Gutemberg Ribeiro
@galvesribeiro
May 08 2016 13:46
var width = 320;
            var heigth = 240;
            var fb = new ProlinRenderer(width, heigth, 90);
            var imgInfo = new SKImageInfo(width, heigth, SKColorType.Rgb_565, SKAlphaType.Unpremul);
            using (var surface = SKSurface.Create(imgInfo, fb.FBPointer, imgInfo.RowBytes))
            {
...
the surface is what we get
Darnell Williams
@Seeker1437
May 08 2016 13:46
hmmm
Gutemberg Ribeiro
@galvesribeiro
May 08 2016 13:46
than surfave.Canvas, is a SkCanvas where we actually draw into
the fb.FBPointer is a IntPtr to the framebuffer`s buffer
so whenever Skia draw something it is directly to the device framebuffer
there is no copy
Darnell Williams
@Seeker1437
May 08 2016 13:47
Ah okay
Gutemberg Ribeiro
@galvesribeiro
May 08 2016 13:48
which means faster drawing and lower memory usage
Darnell Williams
@Seeker1437
May 08 2016 13:48
I feel like I can visualize the changes but I should instead see if I can like do it and show more than tell you
Darnell Williams
@Seeker1437
May 08 2016 14:03
Oooh wow.... Okay Im sorry @mterwoord now I understand
.... I meant @galvesribeiro
Jason Jarvis
@jazzay
May 08 2016 18:50
@galvesribeiro hope you're figuring it out. As i mentioned earlier we do not currently write directly to frame buffer on any Skia platforms. We need to do some work to get HW accel/direct access implemented across all platforms. Somehow we have to figure out how to make the Surface created within RenderTarget.FixSize pluggable. For you, maybe it is as simple as creating your own implementation of WindowRenderTarget and then returning that in PlatformRenderInterface's CreateRenderer - which you likely have to override. Most of the Perspex Skia code is platform agnostic, except the creation of this render target. I hope this helps.
Gutemberg Ribeiro
@galvesribeiro
May 08 2016 20:39
back
@jazzay ok will try that
Gutemberg Ribeiro
@galvesribeiro
May 08 2016 20:51
the big problem with the "copy" is the memory usage
we are with a very restricted device
Jason Jarvis
@jazzay
May 08 2016 21:18
yah I understand. We just haven't had time to implement the more efficient hw/framebuffer implementations across all platforms. Step 1 for us was to get SkiaSharp even working as a rendering backend. In your case it should not be too hard to eliminate the copy as Skia native already supports that for you I believe.
Gutemberg Ribeiro
@galvesribeiro
May 08 2016 21:18
ok but
I dont understood something...
Jason Jarvis
@jazzay
May 08 2016 21:19
ok shoot your question. i will try to assist...
Gutemberg Ribeiro
@galvesribeiro
May 08 2016 21:20
Imagine that my device don't have a Draw() method... it only returns a pointer to the buffer, which I hand over to Skia while creating the surface like this:
            var width = 320;
            var heigth = 240;
            var fb = new ProlinRenderer(width, heigth, 90);
            var imgInfo = new SKImageInfo(width, heigth, SKColorType.Rgb_565, SKAlphaType.Unpremul);
            using (var surface = SKSurface.Create(imgInfo, fb.FBPointer, imgInfo.RowBytes))
the ProlinRenderer is the class that wraps the framebuffer
and expose the fb pointer
how can it work on Perspex?
Jason Jarvis
@jazzay
May 08 2016 21:25
So you need to either create your own WindowRenderTarget implementation (as that is where it creates the Surface inside FixSize() and you need to override that.
Gutemberg Ribeiro
@galvesribeiro
May 08 2016 21:26
assuming that I'm following this, the SkSurface.Canvas returned by this method will be a canvas that if you draw anything to skia it will be automatically drawing to the screen
Jason Jarvis
@jazzay
May 08 2016 21:26
Yes. The canvas in your case will be linked directly to the framebuffer. Assuming SkiaSharp/Native lets you set that up correctly
Gutemberg Ribeiro
@galvesribeiro
May 08 2016 21:27
that code I pasted is using SkiaSharp
it already works perfectly
Jason Jarvis
@jazzay
May 08 2016 21:28
Ok cool. so the only trick is to get that injected into the IPlatformRenderInterface implementation. Probably you can make your own for this - CreateRenderer needs to be new for your platform
you want to return your own WindowRenderTarget or whatever you want to call it. Overriding the base RenderTarget and setting the Surface
This code probably needs a refactor to make it easier to plug different Surface creation implementations per platform
Jason Jarvis
@jazzay
May 08 2016 21:34

If you can replace

Bind<IPlatformRenderInterface>

with your own concrete implementation you should be able to do all this without touching Perspex code I think

Gutemberg Ribeiro
@galvesribeiro
May 08 2016 21:34
thats the idea
I want to use the current nugets
Jason Jarvis
@jazzay
May 08 2016 21:35
But it would also be nice to re-use as much of the existing Perspex.Skia code for your implementation
Gutemberg Ribeiro
@galvesribeiro
May 08 2016 21:35
and have just a new dll for my devices
ok
as much as that is for windows
Jason Jarvis
@jazzay
May 08 2016 21:39
Perhaps we can add some configuration members to the SkiaPlatform class, where you can provide your own Surface allocator
Gutemberg Ribeiro
@galvesribeiro
May 08 2016 21:40
a simple Func<SkSurface> would be all you need
Jason Jarvis
@jazzay
May 08 2016 21:40
Exactly
And then there would also be a custom Present method perhaps. In your case it's a noop
Darnell Williams
@Seeker1437
May 08 2016 22:03
@jazzay @galvesribeiro ah I started actually reading the iOS things, the entire thing changed... :( I'm sorry for telling you such off information. I will always let the involved people talk instead I think.
Probably means I won't talk too much more.
Gutemberg Ribeiro
@galvesribeiro
May 08 2016 22:06
@Seeker1437 nah
always glad to hear from everyone
:)
@jazzay from the current Skia core, looks like I have only to implement https://github.com/Perspex/Perspex/blob/master/src/Skia/Perspex.Skia/RenderTarget.cs
and the WindowRenderTarget
understood
let me try first create a new dll by having most of the code copied from Skia project
Jason Jarvis
@jazzay
May 08 2016 22:10
Yes and you will need to change the PlatformRenderInterface to return your implemenetation.
Gutemberg Ribeiro
@galvesribeiro
May 08 2016 22:16
ok
lets try that
since our current debugger works only on Xamarin Studio, I probably will dont have the designer
but its ok for now
Jason Jarvis
@jazzay
May 08 2016 22:28
do you use an emulator/vm for your device dev?
Gutemberg Ribeiro
@galvesribeiro
May 08 2016 22:33
nah
there none
we have to develop on the device
altough as soon as we have the UI framework in place, I plan to make a VS addin for that
including the debugger integration and a PC simmulator
Gutemberg Ribeiro
@galvesribeiro
May 08 2016 22:59
0.2.0-alpha3 is the latest nuget right?
Jeremy Koritzinsky
@jkoritzinsky
May 08 2016 23:08
Yep
Gutemberg Ribeiro
@galvesribeiro
May 08 2016 23:10
alright
lets try that platform thing with that
Jason Jarvis
@jazzay
May 08 2016 23:15
The public Nuget is really old and has none of the Skia stuff. You need tobiild source or nightly feed
Gutemberg Ribeiro
@galvesribeiro
May 08 2016 23:35
humm
ok
lets try from source
still, I actually don't need the skia stuff hehehe
I'm building it again actually
better use nugets
there are tons of references
so, what is that nightly feed @jazzay ?
found on gh page
Gutemberg Ribeiro
@galvesribeiro
May 08 2016 23:47
Attempting to gather dependencies information for package 'Perspex.9999.0.1475-nightly' with respect to project 'PI.SDK.UI', targeting '.NETFramework,Version=v4.5.1'
Attempting to resolve dependencies for package 'Perspex.9999.0.1475-nightly' with DependencyBehavior 'Lowest'
Unable to resolve dependency 'Rx-Core'. Source(s) used: 'nuget.org', 'PI', 'Local', 'OWIN', 'AspNet', 'Perspex - Nightly'.
:(