These are chat archives for AvaloniaUI/Avalonia

20th
Jan 2019
Steven Kirk
@grokys
Jan 20 00:05 UTC
i am 100% fine with degraded functionality on platforms that don't support something. so we could just say "transparency works only on win8+"
Jeremy Koritzinsky
@jkoritzinsky
Jan 20 00:13 UTC
👍
looks like it's got some good ideas
json data source is something i've thought about many times
Nikita Tsukanov
@kekekeks
Jan 20 05:09 UTC
"Only works on win7 with aero enabled"
We'll need to change our rendering logic a bit though
So it would be possible to set window background to #00ffffff
Or a similar value
We need to pass it to Clear call, not FillRectangle one
Nikita Tsukanov
@kekekeks
Jan 20 05:15 UTC
This would provide a fallback background color for cases where transparency doesn't work
Nikita Tsukanov
@kekekeks
Jan 20 05:28 UTC
It seems that dwm api allows to have a transparent window with blurbehind effect
Does DirectComposition allow to have transparency without blurbehind?
Like UpdateLayeredWindow does
Nikita Tsukanov
@kekekeks
Jan 20 05:45 UTC
Transparency without blurbehind seems to be available using a combination of using DWM API, WS_EX_LAYERED and LWA_ALPHA
Nikita Tsukanov
@kekekeks
Jan 20 06:04 UTC
@danwalmsley Could you check if setting opaque to false on both NSWindow and NSView and then applying Background="Transparent" to MainWindow.xaml and MainView.xaml produces a window with transparency?
Taras Kovtun
@grimcoder
Jan 20 09:55 UTC
Hi guys. I was unable to find examples of using Avalonia.Controls.Shapes namespace in XAML. All examples I've found add Ellipses and Rectangles to the cs codebehind. I cannot find how to properly import it.
Naeron1984
@Naeron1984
Jan 20 12:00 UTC
Hi guys and thanks for help in advance! I'm considering using Avalonia since I have WPF experience and also it looks very cool :). Nice effort, I really admire guys who take on these types of projects! About AvaloniaUI/Avalonia#2185
My goal is to develop a 2D vector drawing program. (with the capability of procedural generation / node based like Bret Victor's Drawing Dynamic Visualizations - i'm the founder of deepui.io / website is outdated BTW) Anyway I need an area in my application where I can render many shapes and those can change in every frame since the user can change function graph and that would produce an entirely new scene. So I've tried the above method and it seems to work (but using 8 year old radeon HD 6900 - 6000 lines around 20 FPS). I would like to know if this is a reasonable performance and if this method is going to be merged into the master branch or will it be abandoned.
Also I'm not sure if I'm asking the right question. Basically I need a high performance rendering area inside an Avalonia application without a loss of significant performance.
Nikita Tsukanov
@kekekeks
Jan 20 12:36 UTC

My goal is to develop a 2D vector drawing program

https://github.com/wieslawsoltes/Core2D/

Naeron1984
@Naeron1984
Jan 20 12:38 UTC
:)
Nikita Tsukanov
@kekekeks
Jan 20 12:38 UTC
It has WPF and Avalonia backends
So it would be a good source of info
Naeron1984
@Naeron1984
Jan 20 12:39 UTC
Is there video of what it can do?
You can try using CoreRT for better performance
and SkiaSharp+ANGLE for HW acceleration
Nikita Tsukanov
@kekekeks
Jan 20 12:41 UTC
Regarding #2185
It's currently blocked by #2244
Basically our current layer system is broken
Wiesław Šoltés
@wieslawsoltes
Jan 20 12:42 UTC
@Naeron1984 The Avalonia rendering is pretty smart too https://www.youtube.com/watch?v=SAVUDnajMV4
Nikita Tsukanov
@kekekeks
Jan 20 12:42 UTC
#2185 provides an immediate DrawingContext, not deferred one
Which ideal if your scene changes by a lot
I think the API would be changed a bit to support other things, but I'm definitely planning to merge it to master at some point
Naeron1984
@Naeron1984
Jan 20 12:47 UTC
So much info, thank you! I have questions but I have to think about them :) Can you tell me for now that in your opinion how much performance can I expect using this versus using Skia in itself?
Nikita Tsukanov
@kekekeks
Jan 20 12:53 UTC
Immediate drawing context passes your calls directly to Skia
It recreates SkPaint for each call, but the impact should be negligible
Naeron1984
@Naeron1984
Jan 20 12:58 UTC
Yes I know that (that file is open in VS right now) but what I'm concerned with is that when the rendering happens. So like we have a time interval for rendering a frame and at some point the UI gets rendered and at some other point my immediate draw calls are made. Are these put in a queue or something and what if i put in too much rendering commands? The UI skips a frame? The problem is that I'm not an expert so perhaps this is the wrong question
I hope you get what I mean
Nikita Tsukanov
@kekekeks
Jan 20 12:59 UTC
There are two different types of drawing contexts in Avalonia (both sharing the same API)
And immediate one and deferred one
Immediate one passes drawing calls to underlying drawing API immediately
When context is disposed, the underlying rendering session is flushed (it it was GPU-accelerated, drawing commands are sent to GPU if they weren't already)
It is used for stuff like RenderTargetBitmap, #2185 and for cases when deferred renderer is not available (usually platforms where we haven't yet figured out how to enable it to work properly)
Deferred rendering context records all drawing commands and builds a scene graph
Which is later used by the render thread to redraw only the changed parts
If UI thread fails to produce a new scene in time, render thread skips a frame
That was one of the reasons for #2185, there are things that don't want to be blocked by UI thread
Like video output, GIF animations or rendering engines that are foreign to Avalonia (e. g. game engine)
So it gets called on every render timer tick
Nikita Tsukanov
@kekekeks
Jan 20 13:05 UTC
Of course in some cases the underlying drawing engine fails to render frame in time due to hardware limitations
Naeron1984
@Naeron1984
Jan 20 13:05 UTC
I almost get it only 1 question. So the time critical rendering calls and rendering the scene graph occurs serialized?
Nikita Tsukanov
@kekekeks
Jan 20 13:05 UTC
Then we skip a frame too
Naeron1984
@Naeron1984
Jan 20 13:06 UTC

like this:
while(true)
{
renderDefferedSceneGraph();
renderTimeCritical();
}

and if time critical takes too long a frame is skipped?

Nikita Tsukanov
@kekekeks
Jan 20 13:07 UTC
RenderDeferredSceneGraph isn't even called most of the time
If there are no changes
Naeron1984
@Naeron1984
Jan 20 13:07 UTC
BTW thank you for doing this for free! Do you have a Patreon account or similar?
Nikita Tsukanov
@kekekeks
Jan 20 13:07 UTC

and if time critical takes too long a frame is skipped

The frame that is already being drawn will never be skipped

We have a team account here: https://opencollective.com/avalonia
Some members of the project are doing individual consulting on ad-hoc basis
Naeron1984
@Naeron1984
Jan 20 13:10 UTC
I if decide to go with Avalonia I'm definitely going to support you!
Nikita Tsukanov
@kekekeks
Jan 20 13:11 UTC
If you need help with porting your application that won't be solved by a gitter chat discussion or need a particular feature that's not planned for the immediate future, it's possible to negotiate some paid work for your particular needs
Naeron1984
@Naeron1984
Jan 20 13:11 UTC
I suspected it ;)
First i want to make sure that Avalonia is a match for my requirements
So far with this immediate mode rendering it looks good :)
Thanks again
Milosz Kukla
@miloszkukla
Jan 20 13:20 UTC
Hi, I wanted to start with Android and when try to run ControlCatalog.Android I get exception with message "You are referencing the Portable version of ReactiveUI in an App. Please change your reference to the specific version for your platform found here: ..."
I can see both Avalonia.Android and sample app targets quite old version 4.4 of Android SDK
the old 4.4 emulator starts but no app is deployed and when try on new 8.0 emulator I get this exception above
Nikita Tsukanov
@kekekeks
Jan 20 13:22 UTC
Mobile backends aren't currently supported, I'm planning to re-do them after getting touch support in the framework itself
Milosz Kukla
@miloszkukla
Jan 20 13:24 UTC
by re-do you mean kind of big changes so there no point for me to try fix it myself at the moment?
Nikita Tsukanov
@kekekeks
Jan 20 13:24 UTC
iOS/Android backends were implemented in 2016 as an experimental feature, there weren't a lot of interest in them until very recently
Milosz Kukla
@miloszkukla
Jan 20 13:25 UTC
I see, ok, thanks, will wait then :)
Nikita Tsukanov
@kekekeks
Jan 20 13:25 UTC
Help with backends would be really appreciated, but it's kinda chicken and egg problem at the current point
Also, since you are interested in mobile backends, you might want to leave some feedback on AvaloniaUI/Avalonia#2242
Milosz Kukla
@miloszkukla
Jan 20 13:28 UTC
ok, I will look into this, it's great to see some motion in the mobile area
Nikita Tsukanov
@kekekeks
Jan 20 13:28 UTC
There is a thing that could be done without much knowledge of Avalonia internals
Touch textbox controls
Our current textbox implementation is mouse/keyboard centric
While on mobile there is a special support for text selection via touch events
Another problem with Android is that you probably need to enable AOT+LLVM
Since pretty much everything is implemented in C# we can't really afford JIT with poor optimizations on mobile
JIT time alone would be tremendous
Xamarin.iOS does AOT+LLVM by default when deploying to device, that's why it's much faster there
braca
@braca
Jan 20 13:42 UTC
I'm trying to run ControlCatalog.NetCore on MacOs, I've followed the build instructions, but I get this error:
ClipboardImpl.cs(30,20): error CS1674: 'IntPtr': type used in a using statement must be implicitly convertible to 'System.IDisposable' [/Users/braca/Projects/Avalonia/src/Avalonia.Native/Avalonia.Native.csproj]
what am I missing?
Nikita Tsukanov
@kekekeks
Jan 20 13:46 UTC
run regen.sh from src/Avalonia.Native directory
This happens because SharpGenTools don't track changes in C/C++ files and don't regenerate bindings when you update sources
braca
@braca
Jan 20 13:55 UTC

Got it, it seems to have done something as now I have a different error

Avalonia/src/Shared/PlatformSupport/StandardRuntimePlatform.cs(18,24): error CS0246: The type or namespace name 'Timer' could not be found (are you missing a using directive or an assembly reference?) [/Users/braca/Projects/Avalonia/src/Avalonia.DesktopRuntime/Avalonia.DesktopRuntime.csproj]

Nikita Tsukanov
@kekekeks
Jan 20 13:59 UTC
git checkout master
git reset --hard HEAD
git pull origin master
git submodule update --init --recursive
find .|egrep '(bin|obj)$'|xargs rm -rf
cd samples/ControlCatalog.NetCore
msbuild /t:Restore
msbuild /t:Build
dotnet bin/Debug/netcoreapp2.0/ControlCatalog.NetCore.dll
You'll also need the latest Mono installed
braca
@braca
Jan 20 14:14 UTC
Tks, but I still get the same error, I'm using Mono 5.16 I'll try to update to 5.18
braca
@braca
Jan 20 15:19 UTC
Don't know why, can't make it work :/
Anyway can anyone confirm the issue #2207 still occurs in MacOs?
In my app, it worked properly in Windows, but not on MacOs.
Unfortunately I cannot make ControlCatalog run in my MacOs, so I cannot confirm it
James Burnside
@JCBurnside
Jan 20 16:15 UTC
Is there a way to add stuff to a Canvas using code?
ahopper
@ahopper
Jan 20 17:29 UTC
just add to the Children of canvas and use canvas.SetTop etc. to position