These are chat archives for AvaloniaUI/Avalonia

22nd
Jun 2018
Jumar Macato
@jmacato
Jun 22 2018 10:45
@Gillibald @nc4rrillo we can close #1623 now?
danwalmsley
@danwalmsley
Jun 22 2018 11:07
@Gillibald you around?
did we manage to fix the issue with font loading on Linux?
@jmacato perhaps you also know what happened here
I think we had to wait for update to skiasharp?
is that done now?
Jumar Macato
@jmacato
Jun 22 2018 11:13
I'll retest when i get back home in 2hrs but the last time i checked the PR that @nc4rrillo made it fixed the font shenanigans on linux
danwalmsley
@danwalmsley
Jun 22 2018 11:14
is that merged?
Jumar Macato
@jmacato
Jun 22 2018 11:16
yep
danwalmsley
@danwalmsley
Jun 22 2018 11:22
thank you that is fixed
just in time for me :)
Jumar Macato
@jmacato
Jun 22 2018 11:22
Yes! Also alot of structural fixes on Skia backend
thanks to @MarchingCube & @nc4rrillo
cant wait to have GLX/EGL
so that we can have Skia HW Accel on linux
Nelson Carrillo
@nc4rrillo
Jun 22 2018 12:09
Working on it :)
Wiesław Šoltés
@wieslawsoltes
Jun 22 2018 12:13
:+1:
danwalmsley
@danwalmsley
Jun 22 2018 12:19
@grokys whats the ETA on the TextElements stuff?
Benedikt Schroeder
@Gillibald
Jun 22 2018 12:25
As long as the Skia package got updated everything should work
Jumar Macato
@jmacato
Jun 22 2018 12:26
Yup can confirm #1623 fixed :))
Benedikt Schroeder
@Gillibald
Jun 22 2018 12:27
Is it possible to access all the native stuff with skia? For example the used direct2d device?
danwalmsley
@danwalmsley
Jun 22 2018 12:47
was there a recent issue with checkbox not displaying border?
Rayyan Tahir
@RayyanTahir
Jun 22 2018 12:48
Yes
but it was fixed
danwalmsley
@danwalmsley
Jun 22 2018 12:49
thanks
Rayyan Tahir
@RayyanTahir
Jun 22 2018 12:49
Thanks to @jkoritzinsky
Nelson Carrillo
@nc4rrillo
Jun 22 2018 12:49
When going through ANGLE yes
ANGLE has extensions to provide a d3d device for it to use
It will be useful for dcomp
Rayyan Tahir
@RayyanTahir
Jun 22 2018 12:52
@danwalmsley did you mean this? AvaloniaUI/Avalonia#1635
danwalmsley
@danwalmsley
Jun 22 2018 12:53
well I put a checkbox in a view somewhere and it didn't display
so I thought it might have been
but it was some kind of layout issue
its working now thanks
Rayyan Tahir
@RayyanTahir
Jun 22 2018 12:54
Oh okay. Good for you :smile:
Steven Kirk
@grokys
Jun 22 2018 12:58
@danwalmsley depends on what you need from the textelements
basic runs are working, just need to support the extra FormattedText properties on skia
not got Spans yet though
or InlineUIContainer or anything
danwalmsley
@danwalmsley
Jun 22 2018 13:12
ok cool
I just had to write this...
<CheckBox IsChecked="{Binding TermsAccepted,Mode=TwoWay}">
                <StackPanel Orientation="Horizontal">
                    <TextBlock Text="I agree to the " />
                    <TextBlock Text="Terms and Conditions" Classes="hyperLink" />
                    <TextBlock Text=" and " />
                    <TextBlock Text="Privacy Policy" Classes="hyperLink" />
                    <TextBlock Text="." />
                </StackPanel>
            </CheckBox>
Jumar Macato
@jmacato
Jun 22 2018 13:13
Everyone reads that meticulously, right? ;)
danwalmsley
@danwalmsley
Jun 22 2018 13:14
yeah of course, dont you :P
Jumar Macato
@jmacato
Jun 22 2018 13:15
:laughing:
Though that code will definitely benefit with TextElements
Benedikt Schroeder
@Gillibald
Jun 22 2018 13:26
I am planning to use WS_EX_COMPOSITED to enable transparency
Nelson Carrillo
@nc4rrillo
Jun 22 2018 13:26
Nice
Benedikt Schroeder
@Gillibald
Jun 22 2018 13:27
That should be supported since vista
Rayyan Tahir
@RayyanTahir
Jun 22 2018 13:27
:thumbsup:
@Gillibald will you be using UpdateLayeredWindow?
Benedikt Schroeder
@Gillibald
Jun 22 2018 13:30
No. You can either use a composition window or a layered window you can't combine them.
WS_EX_COMPOSITED makes it possible to render directly to a D3D surface provided by the window manager if I understood that correctly.
Nelson Carrillo
@nc4rrillo
Jun 22 2018 13:33
All that does is double buffer child windows to avoid flcikering
You’ll still need a layered window to achieve transparency or to call into dcomp yourself
Rayyan Tahir
@RayyanTahir
Jun 22 2018 13:35
That's great!
Can't wait till there is a ready PR :)
Nelson Carrillo
@nc4rrillo
Jun 22 2018 13:36
M
Benedikt Schroeder
@Gillibald
Jun 22 2018 13:36
DWM somehow gives you access to the surface it creates to draw the window. This should support transparency if I am not mistaken. That stuff is used to support aero.
Nelson Carrillo
@nc4rrillo
Jun 22 2018 13:39
Alpha transparency incurs a perf penalty on Windows since the DWM was added because you need to do an extra read back from GPU memory
Win8 added an API to make this better by using the system compositor
Nelson Carrillo
@nc4rrillo
Jun 22 2018 13:45
WS_EX_NOREDIRECTIONBITMAP is what you want on Win8+ coupled with the dcomp APIs for drawing into it
WS_EX_LAYERED for anything below win7
Conceptually you’ll need to create a swap chain for use with composition, and pass that to Skia via ANGLE
That part is blocked on hw accelerated Skia. Can probably be done on the d2d backend with minimal changes though
Benedikt Schroeder
@Gillibald
Jun 22 2018 15:25
Need to figure out how to implement alpha blending. This part needs to be integrated in the WindowFramebuffer to update the layered window
Nelson Carrillo
@nc4rrillo
Jun 22 2018 15:37
You can just use ULW_ALPHA can’t you?
To have it just use the alpha channel of the window background
Benedikt Schroeder
@Gillibald
Jun 22 2018 15:42
All pixels have to have to the right alpha values not sure if thats the case. My initial test fails but that is most likly because something is wrong in my code
Jumar Macato
@jmacato
Jun 22 2018 15:51
@Gillibald AvaloniaUI/Avalonia#1067 this is fixed right?
Nelson Carrillo
@nc4rrillo
Jun 22 2018 16:08
I got window transparency working with direct composition
image.png
Jumar Macato
@jmacato
Jun 22 2018 16:09
🎉🎉🎉
Nelson Carrillo
@nc4rrillo
Jun 22 2018 16:15
I had to switch the swapchain to sequential flip and create it for Composition instead of from Hwnd, create a Dcomp device, create a Dcomp target from hwnd, create a visual based on the swap chain and attach the dcomp visual to the target, then commit the changes
then things just worked (tm)
we should also look at moving to flip sequential and supplying the dirty rect, may help memory bandwidth when compositing the window
Benedikt Schroeder
@Gillibald
Jun 22 2018 16:59
@jmacato Yes that is implemented
Jumar Macato
@jmacato
Jun 22 2018 16:59
Right, closing that one up!
Jumar Macato
@jmacato
Jun 22 2018 17:04
@danwalmsley AvaloniaUI/Avalonia#1614 is this still an issue?
Jeremy Koritzinsky
@jkoritzinsky
Jun 22 2018 17:22
@nc4rrillo I think FlipSequential isn't available in Windows 7 and that's why we aren't using it rn.
Nelson Carrillo
@nc4rrillo
Jun 22 2018 17:39
We can probably do GetProcAddress checks against DComp to see if it exists if not fall back
In fact we can likely just try to LoadLibrary dcomp
Benedikt Schroeder
@Gillibald
Jun 22 2018 17:54
A fallback is always possible. Thats the common way to consume DirectX apis
Benedikt Schroeder
@Gillibald
Jun 22 2018 18:03
I have tried to call UpdateLayeredWindow on DrawToWindow but that seems not to work
Nelson Carrillo
@nc4rrillo
Jun 22 2018 18:12
How are you calling it?
Benedikt Schroeder
@Gillibald
Jun 22 2018 18:18
            UnmanagedMethods.BLENDFUNCTION bf;

            bf.BlendOp = 0x00; //AC_SRC_OVER;

            bf.BlendFlags = 0;

            bf.AlphaFormat = 0x01;

            bf.SourceConstantAlpha = 0xff;

            var size = new Size(width, height);

            var pointSource = new Point(srcX, srcY);

            var topPos = new Point(0, 0);

            var screenDc = UnmanagedMethods.GetDC(IntPtr.Zero);

            UnmanagedMethods.UpdateLayeredWindow(_handle, screenDc, ref topPos, ref size, hDC, ref pointSource, 0, ref bf, 2);
not sure about the source
and destination
Nelson Carrillo
@nc4rrillo
Jun 22 2018 18:19
This is with the Skia backend right?
Benedikt Schroeder
@Gillibald
Jun 22 2018 18:20
This is with SharpDX backend
Nelson Carrillo
@nc4rrillo
Jun 22 2018 18:21
I don’t think the d2d backend uses the frame buffer surface
Benedikt Schroeder
@Gillibald
Jun 22 2018 18:22
The WindowImpl constructs one hmm
Hmm
Nelson Carrillo
@nc4rrillo
Jun 22 2018 18:22
Also you may want to use SetLayeredWindowAttrivute otherwise you need to render into a bitmap and use that as the source to UpdateLayeredWindow
Right but the Render backend only uses the hand surface, the Framebuffer support is for Skia
Hwnd *
Benedikt Schroeder
@Gillibald
Jun 22 2018 18:23
SetLayeredWindowAttribute doesn't support per pixel alpha
Nelson Carrillo
@nc4rrillo
Jun 22 2018 18:23
Blah you’re right
Try your same code with the askia backend
skia*
The mobile site for gutter is awful
Benedikt Schroeder
@Gillibald
Jun 22 2018 18:27
It is not used with skia either. Don't know why. Thats why I get no results :smile: My bad
Benedikt Schroeder
@Gillibald
Jun 22 2018 18:32
Ahh it most likly uses the Handle to render. The WindowFramebuffer is just a fallback.
Benedikt Schroeder
@Gillibald
Jun 22 2018 19:01
DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL : "This enumeration value is supported starting with Windows 8. "
Is it possible to fallback to DXGI_SWAP_EFFECT_SEQUENTIAL and use DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL on Windows 8 and above?
danwalmsley
@danwalmsley
Jun 22 2018 19:35
@jmacato i beleive so, im not aware of any work to resolve it
Nelson Carrillo
@nc4rrillo
Jun 22 2018 20:10
That’s what I’m thinking
Steven Kirk
@grokys
Jun 22 2018 21:57
@danwalmsley AvaloniaUI/Avalonia#1689 - PR for text elements
also :point_up: @nc4rrillo
needs some skia work ;)