These are chat archives for AvaloniaUI/Avalonia

3rd
Jun 2017
Matthijs ter Woord
@mterwoord
Jun 03 2017 11:02
@galvesribeiro I now get the error /usr/bin/ld: cannot find crti.o: No such file or directory
same for crtbeginS.o
this is when linking together the skiasharp and skia objects and .a files on the raspberry
YaakovDavis
@YaakovDavis
Jun 03 2017 11:26
Hi, I have a few questions regarding Avalonia. Can someone help me?
Nikita Tsukanov
@kekekeks
Jun 03 2017 11:33
@YaakovDavis Sure
YaakovDavis
@YaakovDavis
Jun 03 2017 11:36

OK, thanks.

  1. Does Avalonia has a notion of DIP? or does it use device pixels?
  2. I have a WPF application that uses D2D (via SharpDX). I need to place some controls on top of the D2D surface, and the different metrics cause complexities.
    I consider using Avalonia on top of winforms, and ditching WPF. Any opinions about this route?

The app is currently targeted for Windows only, but supporting Mac is a possibilty in the future.

Nikita Tsukanov
@kekekeks
Jun 03 2017 11:37
Avalonia uses logical pixels
YaakovDavis
@YaakovDavis
Jun 03 2017 11:37
I should clarify that I don't want to use GDI, of winforms controls, just the windowing aspects of it
Nikita Tsukanov
@kekekeks
Jun 03 2017 11:37
Display DPI is detected automatically
YaakovDavis
@YaakovDavis
Jun 03 2017 11:38
So what conversion is done between physical & logical pixels?
I mean, what's the ratio?
Nikita Tsukanov
@kekekeks
Jun 03 2017 11:39
We consider 96dpi to be standard one
(just like windows does)
YaakovDavis
@YaakovDavis
Jun 03 2017 11:39
OK. Is there support for pixel snapping?
Nikita Tsukanov
@kekekeks
Jun 03 2017 11:39
So if you have 200% scaling on windows, dpi would be 192
There is SnapToPixels property
Or something like that, don't remember exact name
UI is rendered on top of directx swap chain
YaakovDavis
@YaakovDavis
Jun 03 2017 11:41
OK, great.
I'll take a look.
Is there any advantage, in terms of performance/otherwise for using Avalonia instead of WPF for the interactive parts, where the main area is rendered using DX (D2D)?
Nikita Tsukanov
@kekekeks
Jun 03 2017 11:46
It's probably better to use approach from the sample
The idea was to create a window using Avalonia, attach DirectX to it manually and then integrate Avalonia's rendering system to the render loop
This way you'll get UI rendered directly on top of Direct3D scene
That will be sent to the screen by flipping the swap chain immediately after that
Here you can see a regular direct3d render pass followed by a call to our renderer (base.HandlePaint)
Nikita Tsukanov
@kekekeks
Jun 03 2017 11:51
I'm not sure if you could get better performance by other means
YaakovDavis
@YaakovDavis
Jun 03 2017 11:52
Yes, I see.
I'll take a deeper look.
Nikita Tsukanov
@kekekeks
Jun 03 2017 11:53
Since you are using Direct2D already, it might be even easier
YaakovDavis
@YaakovDavis
Jun 03 2017 11:53
How mature are the Avalonia controls, in terms of interactivity, functionality, etc?
Nikita Tsukanov
@kekekeks
Jun 03 2017 11:54
https://www.youtube.com/watch?v=ke25j4adfww - latest video with our control catalog (ignore OSX part)
The main problem with interactivity would be the lack of support for XAML-defined animations
i. e. visual state changes happen immediately instead of smooth transitions
YaakovDavis
@YaakovDavis
Jun 03 2017 11:57
BTW, I played for with a ScrollViewer some time ago, and noticed that clicking on the "page down" area (bellow the thumb) doesn't cause a scroll. Perhaps it's been fixed since
Nikita Tsukanov
@kekekeks
Jun 03 2017 11:57
Well, it shouldn't be that hard to fix
YaakovDavis
@YaakovDavis
Jun 03 2017 11:57
Is animation being worked on?
Nikita Tsukanov
@kekekeks
Jun 03 2017 11:59
Current efforts are focused on deferred renderer (we are using immediate one atm) and better platform support
No ongoing work on animation support, unfortunately
You still can define them manually (properties being able to bind to IObservable helps a lot)
YaakovDavis
@YaakovDavis
Jun 03 2017 12:00
OK. I skimmed over the roadmap. Is there a target date for beta/release?
Nikita Tsukanov
@kekekeks
Jun 03 2017 12:00
The next version will probably be considered "beta"
Since framework is stable enough to be used in production apps
YaakovDavis
@YaakovDavis
Jun 03 2017 12:02
Good news! Is there a date set for it (even a rough one)?
Nikita Tsukanov
@kekekeks
Jun 03 2017 12:02
I'd say somewhere around September or October
Our major goals for the next version are:
  • finish deferred renderer
  • docs
  • native OSX backend (i. e. remove dependency on GTK)
  • packaging tools for Linux/OSX
YaakovDavis
@YaakovDavis
Jun 03 2017 12:03
OK.
Thank you so much for your detailed & informative answers!
Nikita Tsukanov
@kekekeks
Jun 03 2017 18:10
@grokys what exactly prevents us from using Texture2D instead of WIC?
Jeremy Koritzinsky
@jkoritzinsky
Jun 03 2017 18:35
I don't think Texture2D has support for loading from JPEG/PNG/etc. If you're referring to the DeferredRenderer render layers, I think that can be changed to use Texture2D with no issues.
Nikita Tsukanov
@kekekeks
Jun 03 2017 19:01
RenderTargetBitmap also uses WicBitmap for some reason
I need to render to Texture2D for integration with WPF's Image3D
Steven Kirk
@grokys
Jun 03 2017 19:12
yeah, i want to add something like CompositeRenderTargetBitmap which will allow you to create non-WIC bitmap layers
Nikita Tsukanov
@kekekeks
Jun 03 2017 19:13
Why not use Texture2D for regular RenderTargetBitmap?
Steven Kirk
@grokys
Jun 03 2017 19:15
tbh can't remember why exactly - there might be no reason
it was probably just that we started with Bitmap and when we came to implement RenderTargetBitmap we started from the same code
Nikita Tsukanov
@kekekeks
Jun 03 2017 19:18
Mkay, why Bitmap uses WIC bitmap instead of Texture2D?
It would only make sense for WritableBitmap, I think
Steven Kirk
@grokys
Jun 03 2017 19:20
i think that one is, like @jkoritzinsky says, because that's the supported way to load from jpg/png/etc
also Texture2D is tied to a render surface or something if i remember correctly?
Nikita Tsukanov
@kekekeks
Jun 03 2017 19:21
Well, WIC bitmap could be an intermediate representation
for load/save
Jeremy Koritzinsky
@jkoritzinsky
Jun 03 2017 19:21
Take a look at the D2DBitmap class we have. I've messed with it in AvaloniaAV and it works, so we can do something like that for most of our bitmap stuff.
Steven Kirk
@grokys
Jun 03 2017 19:22
yeah, it's definitely ready for an overhaul - it is causing performance problems for scenegraph too
as using WIC bitmaps for render layers is super-inefficient
Nikita Tsukanov
@kekekeks
Jun 03 2017 19:24
Hm
ID2DBitmap is bound to ID2D1RenderTarget
Hm
It's created using device context
not render target
Nikita Tsukanov
@kekekeks
Jun 03 2017 19:30
Well, it seems, that for my needs DXGIRenderTarget would be sufficient
But for bitmaps we need to use ID2DBitmap
Wiesław Šoltés
@wieslawsoltes
Jun 03 2017 19:33
@grokys I have run into Bitmap related performance issue AvaloniaUI/Avalonia#1006, is this also related to scengraph perf problems?
Steven Kirk
@grokys
Jun 03 2017 19:34
yeah, not sure really
i need to look into it more deeply. the whole bitmap situation on D2D is really complicated
Wiesław Šoltés
@wieslawsoltes
Jun 03 2017 19:35
Did you try running scengraph with Skia renderer
Steven Kirk
@grokys
Jun 03 2017 19:35
like, sometimes they can be shared, sometimes not, and the rules for it aren't simple
yeah, it's a lot faster, though i know why that is
it's mentioned in the PR description:
Performance on D2D with controls with transparency is bad (such as disabled buttons). This is because we currently use RenderTargetBitmaps for render layers and in D2D they are backed with WIC bitmaps, which need to be format converted on every frame
btw @wieslawsoltes any idea why the cake build is failing when i build locally?
does it build for you locally?
Wiesław Šoltés
@wieslawsoltes
Jun 03 2017 19:36
did not try latetly
maybe dotnet restore is messing nuget
I had this issue with my project, but not using cake
I have run dotnet restore on entire solution and than run VS2017 build command and it failed
not sure if this is related
Steven Kirk
@grokys
Jun 03 2017 19:37
i don't think it's that
Wiesław Šoltés
@wieslawsoltes
Jun 03 2017 19:38
let me try on my machine
Steven Kirk
@grokys
Jun 03 2017 19:38
thanks - i would like to know if it's just me
Wiesław Šoltés
@wieslawsoltes
Jun 03 2017 19:38
Did you run Build task only
Steven Kirk
@grokys
Jun 03 2017 19:38
i tried various things
it always seemed to fail in the same place
Wiesław Šoltés
@wieslawsoltes
Jun 03 2017 19:40
@grokys
Task                          Duration
--------------------------------------------------
Clean                         00:00:01.0024281
Restore-NuGet-Packages        00:00:16.9725818
Build                         00:01:04.5929708
--------------------------------------------------
Total:                        00:01:22.5679807
its building ok on my machine
Steven Kirk
@grokys
Jun 03 2017 19:41
what command line did you use for that? it's really fast!
Wiesław Šoltés
@wieslawsoltes
Jun 03 2017 19:41
.\build.ps1 -Target Build
Steven Kirk
@grokys
Jun 03 2017 19:41
ok, let me try
Nikita Tsukanov
@kekekeks
Jun 03 2017 19:41
That was with VS2017.3 and warm nuget cache, I guess
Wiesław Šoltés
@wieslawsoltes
Jun 03 2017 19:41
15.2
stable version
probably most files were cached in memory as I'm running VS2017
and building on SSD may helped too
Steven Kirk
@grokys
Jun 03 2017 19:44
ah it's building here now too!
i did update VS today, maybe that fixed it?
it's a lot faster than it was too
Task                          Duration
--------------------------------------------------
Clean                         00:00:02.0521038
Restore-NuGet-Packages        00:00:03.4600087
Build                         00:02:18.3960786
--------------------------------------------------
Total:                        00:02:23.9081911
i'm not running on SSD though
let me try creating the nuget packages
Wiesław Šoltés
@wieslawsoltes
Jun 03 2017 19:46
yeah I have 4.3Ghz CPU that also helps
Desktop CPU
Steven Kirk
@grokys
Jun 03 2017 19:46
yeah, that will help ;) i'm on a laptop
Wiesław Šoltés
@wieslawsoltes
Jun 03 2017 19:47
and lot of fast RAM helps too :wink:
Steven Kirk
@grokys
Jun 03 2017 19:49
still 2:23 is a lot faster than it was before i think. and it's working, which is a plus
Steven Kirk
@grokys
Jun 03 2017 19:57
ah no, .\build.ps1 -Target Create-NuGet-Packages is still failing
does it fail for you @wieslawsoltes ?
Wiesław Šoltés
@wieslawsoltes
Jun 03 2017 20:00
what error do you get
Steven Kirk
@grokys
Jun 03 2017 20:00
just
An error occurred when executing task 'Build'.

----------------------------------------
Teardown
----------------------------------------
Executing custom teardown action...
Finished running tasks.
Error: MSBuild: Process returned an error (exit code 1).
the only error i can see in the output is
Found references: D:\projects\Avalonia\src\Shared\nuget.workaround.targets(14,5): error : Your project.json doesn't have a runtimes section. You should add '"runtimes": { "win": { } }' to your project.json and then re-run NuGet restore. [D:\projects\Avalonia\src\Avalonia.DotNetFrameworkRuntime\Avalonia.DotNetFrameworkRuntime.csproj]
but that is way above the point of failure, so i'm not sure if it's that
Wiesław Šoltés
@wieslawsoltes
Jun 03 2017 20:01
I have seen this error
this what I was describing earlier with dotnet restore
Steven Kirk
@grokys
Jun 03 2017 20:02
oh really?
so if i do dotnet restore before build.sh it will fix it?
Wiesław Šoltés
@wieslawsoltes
Jun 03 2017 20:03
no
but my issue was with VS2017 not building
did not see this with cake, but think that may be related
Steven Kirk
@grokys
Jun 03 2017 20:15
no, still fails with the same error. are you not seeing the same?
Wiesław Šoltés
@wieslawsoltes
Jun 03 2017 20:16
try restoring nuget from VS2017 and then run again build script
Steven Kirk
@grokys
Jun 03 2017 20:19
thing is the build script does a clean, do i need to disable that?
or does the clean not remove the packages?
Wiesław Šoltés
@wieslawsoltes
Jun 03 2017 20:19
it cleans bin/obj folders
appveyor fails
Steven Kirk
@grokys
Jun 03 2017 20:20
yeah that test fails every now and again
it's a different problem
rebuilding that commit now - it should pass
one sec, need to eat!
Wiesław Šoltés
@wieslawsoltes
Jun 03 2017 20:21
it failed twice in row :wink:
Wiesław Šoltés
@wieslawsoltes
Jun 03 2017 20:26
@grokys
Finished running tasks.

Task                          Duration
--------------------------------------------------
Clean                         00:00:00.9002262
Run-Net-Core-Unit-Tests       00:01:47.6402656
Restore-NuGet-Packages        00:00:10.6826505
Build                         00:01:01.2186262
Run-Unit-Tests                00:01:07.9456250
Inspect                       00:02:28.5620078
Create-NuGet-Packages         00:00:05.6268189
--------------------------------------------------
Total:                        00:06:42.5762202
Result of running .\build.ps1 -Target Create-NuGet-Packages on latest master without any changes to build.cake script
Steven Kirk
@grokys
Jun 03 2017 20:35
Hmm so looks like it's only on my machine?
Wiesław Šoltés
@wieslawsoltes
Jun 03 2017 20:38
Try cleaning repo or nuget cache
I think I have cloned repo again to be sure
Steven Kirk
@grokys
Jun 03 2017 20:51
wow - got a whole lot of errors this time. like hundreds of them
D:\projects\Avalonia\src\Shared\nuget.workaround.targets(14,5): error : Your project.json doesn't have a runtimes section. You should add '"runtimes": { "win": { } }' to your project.json and then re-run NuGet restore. [D:\projects\Avalonia\src\Avalonia.DotNetFrameworkRuntime\Avalonia.DotNetFrameworkRuntime.csproj]
D:\projects\Avalonia\src\Skia\Avalonia.Skia\BitmapImpl.cs(9,7): error CS0246: The type or namespace name 'SkiaSharp' could not be found (are you missing a using directive or an assembly reference?) [D:\projects\Avalonia\src\Skia\Avalonia.Skia.Desktop\Avalonia.Skia.Desktop.csproj]
D:\projects\Avalonia\src\Skia\Avalonia.Skia\DrawingContextImpl.cs(2,7): error CS0246: The type or namespace name 'SkiaSharp' could not be found (are you missing a using directive or an assembly reference?) [D:\projects\Avalonia\src\Skia\Avalonia.Skia.Desktop\Avalonia.Skia.Desktop.csproj]
D:\projects\Avalonia\src\Skia\Avalonia.Skia\FormattedTextImpl.cs(6,7): error CS0246: The type or namespace name 'SkiaSharp' could not be found (are you missing a using directive or an assembly reference?) [D:\projects\Avalonia\src\Skia\Avalonia.Skia.Desktop\Avalonia.Skia.Desktop.csproj]
D:\projects\Avalonia\src\Skia\Avalonia.Skia\FramebufferRenderTarget.cs(8,7): error CS0246: The type or namespace name 'SkiaSharp' could not be found (are you missing a using directive or an assembly reference?) [D:\projects\Avalonia\src\Skia\Avalonia.Skia.Desktop\Avalonia.Skia.Desktop.csproj]
D:\projects\Avalonia\src\Skia\Avalonia.Skia\PlatformRenderInterface.cs(8,7): error CS0246: The type or namespace name 'SkiaSharp' could not be found (are you missing a using directive or an assembly reference?) [D:\projects\Avalonia\src\Skia\Avalonia.Skia.Desktop\Avalonia.Skia.Desktop.csproj]
D:\projects\Avalonia\src\Skia\Avalonia.Skia\SkiaSharpExtensions.cs(4,7): error CS0246: The type or namespace name 'SkiaSharp' could not be found (are you missing a using directive or an assembly reference?) [D:\projects\Avalonia\src\Skia\Avalonia.Skia.Desktop\Avalonia.Skia.Desktop.csproj]
D:\projects\Avalonia\src\Skia\Avalonia.Skia\StreamGeometryImpl.cs(9,7): error CS0246: The type or namespace name 'SkiaSharp' could not be found (are you missing a using directive or an assembly reference?) [D:\projects\Avalonia\src\Skia\Avalonia.Skia.Desktop\Avalonia.Skia.Desktop.csproj]
NativeUnsafeMethods.cs(76,16): error CS0518: Predefined type 'System.ValueType' is not defined or imported [D:\projects\Avalonia\src\Linux\Avalonia.LinuxFramebuffer\Avalonia.LinuxFramebuffer.csproj]
NativeUnsafeMethods.cs(76,16): error CS0518: Predefined type 'System.Object' is not defined or imported [D:\projects\Avalonia\src\Linux\Avalonia.LinuxFramebuffer\Avalonia.LinuxFramebuffer.csproj]
NativeUnsafeMethods.cs(222,21): error CS0518: Predefined type 'System.Int32' is not defined or imported [D:\projects\Avalonia\src\Linux\Avalonia.LinuxFramebuffer\Avalonia.LinuxFramebuffer.csproj]
EvDevDevice.cs(56,16): error CS0518: Predefined type 'System.Nullable`1' is not defined or imported [D:\projects\Avalonia\src\Linux\Avalonia.LinuxFramebuffer\Avalonia.LinuxFramebuffer.csproj]
EvDevDevice.cs(56,16): error CS0518: Predefined type 'System.Object' is not defined or imported [D:\projects\Avalonia\src\Linux\Avalonia.LinuxFramebuffer\Avalonia.LinuxFramebuffer.csproj]
Mice.cs(18,26): error CS0518: Predefined type 'System.Double' is not defined or imported [D:\projects\Avalonia\src\Linux\Avalonia.LinuxFramebuffer\Avalonia.LinuxFramebuffer.csproj]
EvDevDevice.cs(64,16): error CS0518: Predefined type 'System.Boolean' is not defined or imported [D:\projects\Avalonia\src\Linux\Avalonia.LinuxFramebuffer\Avalonia.LinuxFramebuffer.csproj]
NativeUnsafeMethods.cs(223,21): error CS0518: Predefined type 'System.Int32' is not defined or imported [D:\projects\Avalonia\src\Linux\Avalonia.LinuxFramebuffer\Avalonia.LinuxFramebuffer.csproj]
LinuxFramebuffer.cs(42,9): error CS0518: Predefined type 'System.Void' is not defined or imported [D:\projects\Avalonia\src\Linux\Avalonia.LinuxFramebuffer\Avalonia.LinuxFramebuffer.csproj]
Mice.cs(19,17): error CS0518: Predefined type 'System.Double' is not defined or imported [D:\projects\Avalonia\src\Linux\Avalonia.LinuxFramebuffer\Avalonia.LinuxFramebuffer.csproj]
NativeUnsafeMethods.cs(77,9): error CS0518: Predefined type 'System.ValueType' is not defined or imported [D:\projects\Avalonia\src\Linux\Avalonia.LinuxFramebuffer\Avalonia.LinuxFramebuffer.csproj]
etc etc
Wiesław Šoltés
@wieslawsoltes
Jun 03 2017 20:55
could you try building AvaloniaUI/Avalonia#983
Nikita Tsukanov
@kekekeks
Jun 03 2017 21:00
We probably need a portable msbuild package or something like that
I think rider ships with something like that
So it won't depend on the mess installed on user's system
Steven Kirk
@grokys
Jun 03 2017 21:05
@wieslawsoltes no it's doing the same - hundreds of errors :(
Wiesław Šoltés
@wieslawsoltes
Jun 03 2017 21:09
No idea whats going on here
Steven Kirk
@grokys
Jun 03 2017 21:09
me neither - really strange there are all those errors after i cleared the nuget cache
Wiesław Šoltés
@wieslawsoltes
Jun 03 2017 21:09
did you clone repo and start clean
Steven Kirk
@grokys
Jun 03 2017 21:10
no, but i did a git clean -xdf and git reset --hard which should be the same as a fresh clone
Wiesław Šoltés
@wieslawsoltes
Jun 03 2017 21:10
try building Avalonia first from VS2017 and than build from script
Steven Kirk
@grokys
Jun 03 2017 21:11
will do - i have to got away for a little bit - will try when i get back