These are chat archives for AvaloniaUI/Avalonia

22nd
Sep 2017
Jeremy Koritzinsky
@jkoritzinsky
Sep 22 2017 00:48
I like it!
JonKAS
@jonkas2211
Sep 22 2017 07:49
Hello guys, is it possible to use Avalonia like Xamarin.Forms? Meaning that you have the opportunity to share your buisness logic and UI code across plattfroms?
Nikita Tsukanov
@kekekeks
Sep 22 2017 07:55
Yes, it's meant to be used like that
The key difference between Xamarin.Forms and Avalonia is that you can also reuse entire UI across platforms
Whatever customizations you do, UI will look exactly same on all platforms
JonKAS
@jonkas2211
Sep 22 2017 07:58
Okay i dont know how deep you are in Xamarin.Froms, but does Avalonia support something like custom renderes as Xamarin does? So that i can create my own Control like a button that acts different and looks different e.g. a circular button?
Nikita Tsukanov
@kekekeks
Sep 22 2017 07:59
Yes, but you don't need to write code to do that
(you still can, but that sounds like work)
Like with WPF/UWP, you can completely change control appearance from markup
Matthijs ter Woord
@mterwoord
Sep 22 2017 08:01
@kekekeks @jkoritzinsky didn't completely follow, but i guess the new mode is needed for some features?
JonKAS
@jonkas2211
Sep 22 2017 08:02
okay that sounds great, is there any opportunity to communicate native for example for other gestures or to target the camera to do something?
<Button Width="100" Height="100" Classes="circle">I'm a button</Button>

target the camera to do something

You need to use platform API to do that

Matthijs ter Woord
@mterwoord
Sep 22 2017 08:18
@kekekeks Cool!
Nikita Tsukanov
@kekekeks
Sep 22 2017 08:18
BTW, our support for mobile platforms is currently experimental, i. e. noone is actively using it, so it's probalbly broken
Matthijs ter Woord
@mterwoord
Sep 22 2017 08:19
@kekekeks @jkoritzinsky if that's the case, please make a way to have it also fail if needed: ie, if my app needs it but somehow the api isn't there (and stuff will fail later on, make itoptinoally fail on fallback)
JonKAS
@jonkas2211
Sep 22 2017 08:19
Okay thats sad to me, because i want an alternative gui system to Xamarin.Forms and that looks like the thing im looking for since months
Matthijs ter Woord
@mterwoord
Sep 22 2017 08:20
@kekekeks awesome snippet for button: i need that. Thanks! :)
JonKAS
@jonkas2211
Sep 22 2017 08:20
But its open source so we can create the api for it
Nikita Tsukanov
@kekekeks
Sep 22 2017 08:22
Two main issues with mobile platforms are rendering performance and text input
JonKAS
@jonkas2211
Sep 22 2017 08:23
Okay hm and how about to communicate with native functionality?
Nikita Tsukanov
@kekekeks
Sep 22 2017 08:23
You still have access to Xamarin APIs
JonKAS
@jonkas2211
Sep 22 2017 08:23
sry for my bad english by the way, cause german is my native tongue
JonKAS
@jonkas2211
Sep 22 2017 08:24
So i could use avalonia for UI and things like that mixed up with hardware communication through xamarin
Nikita Tsukanov
@kekekeks
Sep 22 2017 08:24
That's how bootstrapping avalonia app looks like on iOS for example
We are providing a UIWindow to host your avalonia-based content (and UIView if you want to embed it somewhere)
JonKAS
@jonkas2211
Sep 22 2017 08:25
okay so the nativ magic is done by mon
ill give it an try as soon as i got time to read some docs
Nikita Tsukanov
@kekekeks
Sep 22 2017 08:26
I think there were some issues with popups being not properly implemented on ios...
So try Android for now
At least it can run all widgets from our controlcatalog
JonKAS
@jonkas2211
Sep 22 2017 08:27
okay thank your very much
Nikita Tsukanov
@kekekeks
Sep 22 2017 08:29
BTW, Android backend also uses the same approach with custom activity and view
So you can either use our activity or embed view somewhere else
I've created a custom view renderer for Xamarin.Forms to host avalonia content inside a couple of months ago
Nikita Tsukanov
@kekekeks
Sep 22 2017 08:39
@mterwoord regarding button snippet. We really need a separate repo with samples for people to play around
Which should use nuget packages, so it would be actually possible to build it
Nikita Tsukanov
@kekekeks
Sep 22 2017 15:17
@grokys why are we using StreamGeometry for simple stuff like lines, rectangles and ellipses?
It's AWFULLY slow
Steven Kirk
@grokys
Sep 22 2017 15:18
Yeah, because it was quick to implement. We should do it better
Nikita Tsukanov
@kekekeks
Sep 22 2017 15:18
I have an APP that uses Direct2D and needs to render tons of lines
At first I've tried to implement that using stream geometry, because "one rendering call should be better"
Guess what, it spent 2 seconds of CPU time each frame
To tesselate that stuff, probably
BTW, this crashes our renderer with Skia and introduces glitches with Direct2D:
<Line Height="5"
          Stroke="Red"
          Stretch="Fill"
          StrokeThickness="10"
          Fill="Red"
          Width="10"/>
Which is a regression from 0.5
Steven Kirk
@grokys
Sep 22 2017 15:26
Oh interesting, I would have thought that rendering lots of lines in one call would be better too
It is probably something we're doing wrong
Nikita Tsukanov
@kekekeks
Sep 22 2017 15:27
It's was also quite counter-intuitive to me
But Direct2D doc states that we should use predefined shapes if possible
Instead of using StreamGeometry
Since they are already known to the renderer, so it can skip tesselation
basically, I've got a speed up from 2+ sec to 0.015 sec by replacing StreamGeometry with 5K DrawLinecalls
Nikita Tsukanov
@kekekeks
Sep 22 2017 15:41
@grokys Can we drop support for GTK2/Cairo already?
It kinda makes it harder to change anything in the rendering infrastructure
When we have a backend that we kinda support, but actually not
The only real case where we need GTK2 is embedding to existing apps, but it should be possible to add GTK2 support to our new P/Invoke-based backend if it's really needed by someone
Steven Kirk
@grokys
Sep 22 2017 16:03
As far as Cairo, yeah we can drop it. Gtk2 I find useful as an alternative windowing backend on Windows, is there any way we can get gtk3 working with Windows?
Nikita Tsukanov
@kekekeks
Sep 22 2017 16:05
You need to download GTK3 binaries
And add them to PATH
Or pass the path to them to UseGtk3
You can probably obtain a newer version somewhere, but that's the one I was using during gtk3 backend development
Steven Kirk
@grokys
Sep 22 2017 16:11
ah ok - for some reason i thought that it didn't work at all on windows
yeah, in that case lets remove cairo and gtk2 then
rconde01
@rconde01
Sep 22 2017 17:58
Have you guys considered an opengl backend?
rconde01
@rconde01
Sep 22 2017 18:08
nm - I see there's a bug for it
Nikita Tsukanov
@kekekeks
Sep 22 2017 18:09
TL;DR: Skia can use OpenGL and Vulkan
So there is no point of implementing our own one
At least at this stage
rconde01
@rconde01
Sep 22 2017 18:12
just read the bug...so sure, if skia sits in between that makes sense...I was more thinking hardware acceleration on linux plus potentially the added benefit on a consistent base technology (if you ignore driver issues)
Nikita Tsukanov
@kekekeks
Sep 22 2017 18:13
Last time I've tried to get it working it was crashing with bumblebee
Was working fine on Intel GPU and in "discrete graphics only" mode with nVidia though
BTW, software rendering is fine unless you want to draw a few bazillion of graphics primitives for some reason
And for sw-rendering we'll need Skia anyway, since llvmpipe is just awful
rconde01
@rconde01
Sep 22 2017 18:15
right
what do you hate about llvmpipe?
Nikita Tsukanov
@kekekeks
Sep 22 2017 18:19
It's slow
Better than their older swrast backend, but still slow
rconde01
@rconde01
Sep 22 2017 18:20
right - I don't know a better option for opengl sw rendering though - but if you more generally need a 2d renderer there are better options
Nikita Tsukanov
@kekekeks
Sep 22 2017 18:20
Skia has an efficient software rasterizer optimized for 2D graphics
So for sw-rendering we'd better use it instead of software OpenGL
rconde01
@rconde01
Sep 22 2017 18:23
on a different topic...when designing your controls, are you using a particular platform as a reference...both in terms of features and behaviors? I know WPF is an inspiration, but you're not cloning it AFAIK
Nikita Tsukanov
@kekekeks
Sep 22 2017 18:41
We are planning to have different themes to provide native look&feel for each OS
Not sure what to do with Linux, to be honest
There are a lot of distros
And people tend to use custom themes
So we'll probably have ones matching default themes of Ubuntu and RHEL
I was thinking about importing theme settings from GTK like Qt does
But I'm not sure that it's a reliable solution
Since GTK has at least 4 different theme engines
rconde01
@rconde01
Sep 22 2017 18:50
what about behaviors/features? There can be idiosyncrasies of the various platforms. How are you thinking of handling that?
Nikita Tsukanov
@kekekeks
Sep 22 2017 18:55
For now I think we are aiming to get the same feature set as WPF
And may be get something from UWP
Definitely need something for hamburger-button navigation to properly support mobile platforms