These are chat archives for AvaloniaUI/Avalonia

7th
Feb 2017
Jeremy Koritzinsky
@jkoritzinsky
Feb 07 2017 00:11
I got video playback from a file (in a Win32+D2D setup) working in AvaloniaAV.
Nikita Tsukanov
@kekekeks
Feb 07 2017 05:57
:+1:
Nikita Tsukanov
@kekekeks
Feb 07 2017 07:38
Are you using something portable and compatible (e. g. ffmpeg) or consuming some windows-specific API?
Andrea Del Signore
@sejerpz
Feb 07 2017 11:44
Hi newbie here, sorry for the supid question, but reading the sources I don't find the answer: is there any way to customize tab stop inside a ListItem element?
I don't think we have a specific TabStop property
I guess you could set TabNavigation to None to prevent focus transfer by pressing tab
Andrea Del Signore
@sejerpz
Feb 07 2017 11:59
Ok I'll try thanks
Jeremy Koritzinsky
@jkoritzinsky
Feb 07 2017 14:11
MediaFoundation (windows specific) right now. Gives me GPU acceleration. I'll have an ffmpeg backend for Linux prob.
Nikita Tsukanov
@kekekeks
Feb 07 2017 14:13
Is it win10 only or also supported by win7?
Nikita Tsukanov
@kekekeks
Feb 07 2017 14:39
@grokys have something changed in layout code recently?
Steven Kirk
@grokys
Feb 07 2017 14:39
nothing i can think of, no
Nikita Tsukanov
@kekekeks
Feb 07 2017 14:43
Nvm, it was a bug in my code
Could you please enlighten me
Why do we need ExecuteInitialLayoutPass
And why everything is so broken without it
(I have no idea how our layout system actually works)
Steven Kirk
@grokys
Feb 07 2017 15:01
it ensures the layout is run immediately rather than on the next layout pass
Nikita Tsukanov
@kekekeks
Feb 07 2017 15:05
Well, the problem is that if I don't call it
Layout passes just don't work at all
i. e. resize handler has no effect, window is black, etc
BTW, are we using some fancy well-known layout algorithm?
Steven Kirk
@grokys
Feb 07 2017 15:10
we use the same layout algorithm as WPF, mostly
the reason layout passes don't work if you don't call it is that you need an initial layout pass as a kind of "baseline"
otherwise measure/arrange invalidations won't be registered as they're already invalid
Nikita Tsukanov
@kekekeks
Feb 07 2017 15:11
Even if initial size is (0,0) ?
Ah, got it
Steven Kirk
@grokys
Feb 07 2017 15:12
if you don't want to call ExecuteInitialLayoutPass you can just call measure/arrange on the root
that won't handle certain situations with scrollbars correctly, but it'll usually be fine for e.g. unit tests
Andrea Del Signore
@sejerpz
Feb 07 2017 15:43
again, newbie here, sorry if the question is very basic, but I can't subscribe to Tapped event of the ListBox control.
from xaml
<ListBox Name="listBox" Items="{Binding Items}" SelectedItem="{Binding SelectedItem, Mode=TwoWay}" Tapped="OnListItemTapped" >
Andrea Del Signore
@sejerpz
Feb 07 2017 15:58
I get this exception at runtime
Error loading XAML: OmniXaml.ParseException: Cannot find a property named "Tapped" in the type Avalonia.Controls.ListBox
Is subscribing to event supported?
Nikita Tsukanov
@kekekeks
Feb 07 2017 15:59
@SuperJMN @grokys
soerendd
@soerendd
Feb 07 2017 16:38
Hi, somebody has an idea what could be the problem which is #694 about?
Andrea Del Signore
@sejerpz
Feb 07 2017 16:42
just from seeing the image, pixels are missing in the circle border, rendering artifacts?
soerendd
@soerendd
Feb 07 2017 16:45
The render code is rather simple. I have a very simple setup which is simply create a window and renders that arc in SharpDX. I have played already with the line caps. But that not seem to be the problem. After that i thought it could be something related to blending. But currently i cant get the same output as the wpf one (which is correct in my opinion)
Jeremy Koritzinsky
@jkoritzinsky
Feb 07 2017 16:45
Events aren't supported in OmniXAML v1. We have @SuperJMN working on integrating v2, which has event support.
soerendd
@soerendd
Feb 07 2017 16:47
There is also a lighter line in the right half of the arc (the end or the start of the arc)
Jeremy Koritzinsky
@jkoritzinsky
Feb 07 2017 16:47
@kekekeks it's win8+. I tried doing a win7 MediaFoundation compatible version but I couldn't get it working. I'll probably add a win7 embedded native control for people to use if they need support on win7. Or just fallback to ffmpeg.
I picked a platform specific API mainly for video streaming from webcams. This way I can get a user friendly name instead of just a number. And I can get it working in UWP really easily too.
Nikita Tsukanov
@kekekeks
Feb 07 2017 16:51
I think on Linux people just open /dev/video0 and get an uncompressed data stream from there
Steven Kirk
@grokys
Feb 07 2017 16:52
yeah @sejerpz sorry, our XAML parser doesn't currently handle hooking up events :( you have to do it in code currently
Andrea Del Signore
@sejerpz
Feb 07 2017 16:53
@grokys ok, no problem
Steven Kirk
@grokys
Feb 07 2017 16:54
@sejerpz this is the XAML library we use: https://github.com/SuperJMN/OmniXAML/issues - as @jkoritzinsky says there should be a v2 coming soon with event support
Andrea Del Signore
@sejerpz
Feb 07 2017 16:54
right now I'm trying to build a multiplatform app with netcore profile, what's backend should I use? Skia cairo ?
Jeremy Koritzinsky
@jkoritzinsky
Feb 07 2017 16:55
For USB cameras on Linux I'm planning on hooking into V4L2's file system level API to pull frames and camera info.
Andrea Del Signore
@sejerpz
Feb 07 2017 16:57
@grokys where do you see event support mentioned in the bug list?
Steven Kirk
@grokys
Feb 07 2017 16:58
i don't think there's even a bug filed, as it's such an obvious omission ;)
please file one!
Jeremy Koritzinsky
@jkoritzinsky
Feb 07 2017 17:01
There is support in OmniXAML v2. I added it myself.
SuperJMN/OmniXAML#118
Andrea Del Signore
@sejerpz
Feb 07 2017 17:05
oh great! Thanks
Nikita Tsukanov
@kekekeks
Feb 07 2017 17:07
popups.gif
I hate android
It took 4 hours of my life to display an overlay
I've discovered that PopupWindow doesn't work with SurfaceView
At all
Then tried to translate some "working code example"
With predictable results
Now it still doesn't position that overlay properly
And all that constantly fighting with xamarin's tooling
Well, at least I've got something on the screen
danwalmsley
@danwalmsley
Feb 07 2017 17:26

right now I'm trying to build a multiplatform app with netcore profile, what's backend should I use? Skia cairo ?

skia only for .net core

@sejerpz
@grokys if scenegraph gets master merged into it, then I could probably get time to finally test it on Avalon studio tonight
Andrea Del Signore
@sejerpz
Feb 07 2017 17:36
@danwalmsley ok, I'm already trying with skia, but now I've this exception: This operation is only valid in the context of an app container. the clr can't find the native dll library
really I'm not sure is the native dll, the exception says: Unable to load DLL 'libSkiaSharp'. This operation is only valid in the context of an app container. Exception from HRESULT: 0x8007109A
Steven Kirk
@grokys
Feb 07 2017 17:45
@danwalmsley will merge asap!
danwalmsley
@danwalmsley
Feb 07 2017 18:13
@sejerpz ok you on Linux I guess
you need our custom build of libskiasharp.so
I put it on dropbox use this link
and rename to libSkiaSharp.dylib.so
you need it to go in same dir as the application
and you also need this file
next to it
but no rename required
this is temporary until skiasharp do an official Linux release
@grokys :)
Nikita Tsukanov
@kekekeks
Feb 07 2017 18:17

and rename to libSkiaSharp.dylib.so

That's only for M0ИO

For .NET Core it has to be named libSkiaSharp.so
Andrea Del Signore
@sejerpz
Feb 07 2017 18:21
@danwalmsley thanks, but I'm on windows 10
danwalmsley
@danwalmsley
Feb 07 2017 18:21
on windows you shouldn't have that problem
hmmm I did get this the other day
what are you targeting?
x86 or any cpu or 64?
make sure the is a file libSkiaSharp.dll
in the application directory
Andrea Del Signore
@sejerpz
Feb 07 2017 18:22
no there isn't
danwalmsley
@danwalmsley
Feb 07 2017 18:23
that's the problem
Andrea Del Signore
@sejerpz
Feb 07 2017 18:23
yes I know, but I can't understand why is not copied
danwalmsley
@danwalmsley
Feb 07 2017 18:23
make sure its install Avalonia.Skia nugget package to you executable
and also make sure that is installed SkiaSharp nugget package
too
if the problem persists
uninstall avalonia nuget
and re-install
you are using the nightly build feed right?
Andrea Del Signore
@sejerpz
Feb 07 2017 18:24
yes
danwalmsley
@danwalmsley
Feb 07 2017 18:24
I think a reinstall will sort you out
Andrea Del Signore
@sejerpz
Feb 07 2017 18:24
I've the same error on a minimal skia project without avalona
I bet my project.json is not right

{
"version": "1.0.0-*",
"buildOptions": {
"emitEntryPoint": true,
"platform": "x64"
},

"dependencies": {
"Microsoft.NETCore.App": "1.1.0",
"SkiaSharp": "1.56.1-beta"
},

"frameworks": {
"netcoreapp1.1": {
"imports": [ "dnxcore50" ]
}
},

"runtimes": {
"win10-x64": {},
"win8-x64": {}
}
}

Eric Mellino
@mellinoe
Feb 07 2017 18:25
That error suggest to me that you're making a UWP app,
"This operation is only valid in the context of an app container"
danwalmsley
@danwalmsley
Feb 07 2017 18:25
platform x64
it definitely wont work with that
you need any
or x86 for skiasharp to work
Nikita Tsukanov
@kekekeks
Feb 07 2017 18:26
Are you trying to use skia directly or something?
danwalmsley
@danwalmsley
Feb 07 2017 18:26
the native lib is 32bit!
Andrea Del Signore
@sejerpz
Feb 07 2017 18:26
@mellinoe just doing some test, net core 1.1 app
Nikita Tsukanov
@kekekeks
Feb 07 2017 18:26
popups.gif
danwalmsley
@danwalmsley
Feb 07 2017 18:26
you should use rc4 tooling
Nikita Tsukanov
@kekekeks
Feb 07 2017 18:26
Eons have passed: now then at last
API walls break, popups awake
Andrea Del Signore
@sejerpz
Feb 07 2017 18:26
I'll try with 32bit and rc4 tooling
Nikita Tsukanov
@kekekeks
Feb 07 2017 18:27
RC4 doesn't work with project.json
danwalmsley
@danwalmsley
Feb 07 2017 18:27
if you put it to any
it will use 64 bit but will be able to
to call into the 32bit native dll
@kekekeks does avalonia work with project.json?
Instructions are there
danwalmsley
@danwalmsley
Feb 07 2017 18:28
ah
I thought we had to be on new tooling
Nikita Tsukanov
@kekekeks
Feb 07 2017 18:28
You either use VS2015 with project.json
Or VS2017 with latest tooling
Andrea Del Signore
@sejerpz
Feb 07 2017 18:28
@kekekeks hey thanks
danwalmsley
@danwalmsley
Feb 07 2017 18:28
@kekekeks is that android?
Nikita Tsukanov
@kekekeks
Feb 07 2017 18:28
yep
Eric Mellino
@mellinoe
Feb 07 2017 18:34
Interesting that libskiasharp is 32-bit. Just a point-in-time thing?
Andrea Del Signore
@sejerpz
Feb 07 2017 18:34
@kekekeks it worked! the project.json was wrong for some reason... but I don't know which :)
Nikita Tsukanov
@kekekeks
Feb 07 2017 18:35
.NET Core tooling is currently a mess
Nobody knows which one to use
danwalmsley
@danwalmsley
Feb 07 2017 18:37
csproj is the future
so ...
@mellinoe I wondered the same
Nikita Tsukanov
@kekekeks
Feb 07 2017 18:37
Well, for new projects it's better to use VS2017
At least you won't need to learn how to deal with now obsolete project.json
Andrea Del Signore
@sejerpz
Feb 07 2017 18:38
the problem was this key
"runtimes": {
"win7-x64": {}
}
Nikita Tsukanov
@kekekeks
Feb 07 2017 18:39
Yep, win7-x64 is your go-to runtime
Andrea Del Signore
@sejerpz
Feb 07 2017 18:39
using win10-x64 doesn't work
@kekekeks yes
danwalmsley
@danwalmsley
Feb 07 2017 18:40
ah this is true
that's when I got the same error
I knew id seen similar other day
but forgotten about it
it works
until you publish it right?
Nikita Tsukanov
@kekekeks
Feb 07 2017 18:41
Mkay, so our android support is now somewhat usable
I've got rid of that single-window emulation that haven't worked properly anyway
danwalmsley
@danwalmsley
Feb 07 2017 18:42
@kekekeks when can we get window state support in gtk3?
Nikita Tsukanov
@kekekeks
Feb 07 2017 18:42
Yes
No...
May be...
Do you need it?
danwalmsley
@danwalmsley
Feb 07 2017 18:43
I'm assuming its probably a really quick thing?
Nikita Tsukanov
@kekekeks
Feb 07 2017 18:43
It should be
Andrea Del Signore
@sejerpz
Feb 07 2017 18:43
@danwalmsley the published app doesn't work, null reference exception
danwalmsley
@danwalmsley
Feb 07 2017 18:43
its the main thing holding back my mac and Linux release
Nikita Tsukanov
@kekekeks
Feb 07 2017 18:43
It's just GTK2 code looked a bit weird
So I haven't touched that yet
danwalmsley
@danwalmsley
Feb 07 2017 18:43
@sejerpz I thought it might work when you debug and compile from vs
but not when published
@kekekeks ah ok
is that the only thing missing from backend
Andrea Del Signore
@sejerpz
Feb 07 2017 18:45
@danwalmsley do you have an idea on why it doens't run (after the null reference netcore runtime crash)=
?
danwalmsley
@danwalmsley
Feb 07 2017 18:50
no I think we need to report it as an issue on dotnet cli
repo
Nikita Tsukanov
@kekekeks
Feb 07 2017 18:51
dotnet.exe is constantly crashing
Just ignore that
Andrea Del Signore
@sejerpz
Feb 07 2017 18:54
@danwalmsley wait wait, my code fault... somewhat :)
bah... using (var surface = SKSurface.Create(100, 100, SKColorType.Gray8, SKAlphaType.Opaque)) Create returns null with this code :)
Andrea Del Signore
@sejerpz
Feb 07 2017 19:03
changing to this fixed the nullreference using (var surface = SKSurface.Create(100, 100, SKColorType.RgbaF16, SKAlphaType.Premul))
@danwalmsley it also works when published
thanks you!
Andrea Del Signore
@sejerpz
Feb 07 2017 19:11
also the avalonia test works when published
danwalmsley
@danwalmsley
Feb 07 2017 19:12
even on Win10-x64 REL?
Andrea Del Signore
@sejerpz
Feb 07 2017 19:12
I just tried with win7
with win10-x64 runtime it doesn't run even from VS
now I've to go, this evening I'll try the same projects on a linux x64 debian machine
Nikita Tsukanov
@kekekeks
Feb 07 2017 20:02

bah... using (var surface = SKSurface.Create(100, 100, SKColorType.Gray8, SKAlphaType.Opaque)) Create returns null with this code :grinning:

That's a major problem with skia, actually

It will return you null and won't tell why
They've found the perfect middle ground between error codes and exceptions: just swallow errors and go on
Nikita Tsukanov
@kekekeks
Feb 07 2017 20:48
@danwalmsley
AvaloniaUI/Avalonia@f2f30fe
danwalmsley
@danwalmsley
Feb 07 2017 20:54
@kekekeks nice one! :)
vs2017 update just released today
@kekekeks pr?
Nikita Tsukanov
@kekekeks
Feb 07 2017 20:57
pushed directly to master, nothing to review/unit-test
danwalmsley
@danwalmsley
Feb 07 2017 20:58
great
thanks a lot buddy
Steven Kirk
@grokys
Feb 07 2017 21:04
ok @danwalmsley master merged into scenegraph
danwalmsley
@danwalmsley
Feb 07 2017 21:13
ok will give it a go
Steven Kirk
@grokys
Feb 07 2017 21:15
note that only the d2d renderer is working
(for some definition of "working") ;)
danwalmsley
@danwalmsley
Feb 07 2017 21:18
ah that might be a problem
now iv migrated to dotnet core
I think I can no longer use direct2d?
@kekekeks is that correct?
ah yes because of sharpdx
I should have gone for pcl
:(
Nikita Tsukanov
@kekekeks
Feb 07 2017 21:36
You can't use direct2d when targeting .net core
you can however reference .netstandard library from desktop .NET
@grokys how scaling is even supposed to work?
ITopLevelImpl::Scaling is being ignored almost everywhere
Eric Mellino
@mellinoe
Feb 07 2017 21:51
Why can't you use Direct2D when targeting .NET Core?
Nikita Tsukanov
@kekekeks
Feb 07 2017 21:52
no .NETStandard SharpDX build yet
Got HDPI support in GTK3 backend
Eric Mellino
@mellinoe
Feb 07 2017 22:12
It does have a PCL build, though. Aren't some other PCL dependencies being used? Or is everything else already on top of .NET Standard?
Nikita Tsukanov
@kekekeks
Feb 07 2017 22:12
It doesn't have compatible PCL profile, I think
I had no issues with referencing PCL Profile7 which is compatible with almost everything
Hm
3.1.1 seems to have "netcore45" as one of its target frameworks
well, let's wait until tooling release
Since right now we are building our .NET Core support libraries against .NETStandard1.5 using old UWP tooling
Jeremy Koritzinsky
@jkoritzinsky
Feb 07 2017 22:15
netcore45 is actually windows 8 app platform apps
not .NET core
Nikita Tsukanov
@kekekeks
Feb 07 2017 22:15
portable-net45+netcore45+wpa81+MonoAndroid1+MonoTouch1
dunno what profile is that

@grokys

note that only the d2d renderer is working-

We have to decide what to do with backends that don't support drawing at arbitrary moments of time

Nikita Tsukanov
@kekekeks
Feb 07 2017 22:20
And those are at least GTK and Android
Steven Kirk
@grokys
Feb 07 2017 22:20
well we can always fall back to ImmediateRenderer at worst
Nikita Tsukanov
@kekekeks
Feb 07 2017 22:21
I was thinking about some special return code
like "try again later" or something like that
Steven Kirk
@grokys
Feb 07 2017 22:21
well hopefully we can make a render loop for those platforms
Nikita Tsukanov
@kekekeks
Feb 07 2017 22:21
That should pause the renderer until further notice
That's the problem
The fact that you can't draw to particular widget
has absolutely nothing to do with global event loop
For example on Android view may go offscreen and surface will be destroyed
Steven Kirk
@grokys
Feb 07 2017 22:23
every GUI library has a render loop - there must be a way
Nikita Tsukanov
@kekekeks
Feb 07 2017 22:23
And until that view is visible again, we have no framebuffer to draw to
You see, in case of android we are using something that could be painted from another thread
In arbitrary moment of time (if surface is currently available)
Steven Kirk
@grokys
Feb 07 2017 22:24
chrome works on those platforms for instance and i know that chrome has a render loop similar to ours
Nikita Tsukanov
@kekekeks
Feb 07 2017 22:24
So you are free to implement whatever render loop you want
But you need to check that you have a surface allocated
Steven Kirk
@grokys
Feb 07 2017 22:24
right, that's not a problem is it?
Nikita Tsukanov
@kekekeks
Feb 07 2017 22:25
Basically we need a way to pause rendering to particular toplevel
Steven Kirk
@grokys
Feb 07 2017 22:25
yeah, we can add that
Nikita Tsukanov
@kekekeks
Feb 07 2017 22:25
until further notice from that toplevel
Paint event seems to be a good candidate for that notice
Steven Kirk
@grokys
Feb 07 2017 22:26
there's a TopLevel.Renderer property; you could easily do TopLevel.Renderer.Pause()
Nikita Tsukanov
@kekekeks
Feb 07 2017 22:27
Well, that should be implemented in the code that calls CreateDrawingContext
Since it's the point where we know if we can paint or not
Steven Kirk
@grokys
Feb 07 2017 22:27
ok
Nikita Tsukanov
@kekekeks
Feb 07 2017 22:28
BTW, have you decided what to do with that Matrix? hiddenPostTransform?
It's kinda vital for HiDPI support with Skia
Steven Kirk
@grokys
Feb 07 2017 22:30
not yet, no - i'm heading towards thinking it should be done in the rendering assembly rather than in the main assembly
Nikita Tsukanov
@kekekeks
Feb 07 2017 22:30
I could refactor it to be inside Skia backend, if it's not needed elsewhere
Steven Kirk
@grokys
Feb 07 2017 22:30
yeah, that might be good - my thinking is that for D2D it's handled 100% in the renderer, so other platforms should probably do the same
i'm guessing D2D isn't alone in handling DPI scaling itself
Nikita Tsukanov
@kekekeks
Feb 07 2017 22:32
So, for Skia support in scenegraph we have to:
1) implement "direct" rendering in GTK/Mobile backends (should already work with Win32, since it uses SetDIBItsToDevicethere)
2) Move hiddenPostTransform
Jeremy Koritzinsky
@jkoritzinsky
Feb 07 2017 22:32
@grokys I'm having issues with getting the template selector working. Can you take a look?
https://github.com/jkoritzinsky/AvaloniaAV/blob/master/AvaloniaAV/Generic.xaml#L21
I'm trying to select the Slider in the above template and make it visible when a seekable video (a video with a duration) is set as the source.
Steven Kirk
@grokys
Feb 07 2017 22:33
@kekekeks yep, sounds about right
Nikita Tsukanov
@kekekeks
Feb 07 2017 22:33

isn't alone in handling DPI scaling itself

Well, the thing is that Skia does not have any built-in means of drawing to on-screen targets

So we have to implement that manually
Steven Kirk
@grokys
Feb 07 2017 22:34
@jkoritzinsky it's because you're setting <Slider IsVisible="false"/> - that has a higher priority than the setter in the style
Jeremy Koritzinsky
@jkoritzinsky
Feb 07 2017 22:35
Ok. How should I do this then? Two separate styles that select the slider and apply depending on the pseudoclass on the control?
Steven Kirk
@grokys
Feb 07 2017 22:35
yeah... that's how you usually have to do it
it's not ideal
but WPF has the same problem
Jeremy Koritzinsky
@jkoritzinsky
Feb 07 2017 22:36
Ok. Good to know. Thanks!
It works! Thanks dude :)
Steven Kirk
@grokys
Feb 07 2017 22:37
it would be better if properties set in control templates automatically had a Style priority, but i can't think how to do that without essentially having a global variable
glad it worked :)
Nikita Tsukanov
@kekekeks
Feb 07 2017 22:42
@grokys AvaloniaUI/Avalonia#884
Something like that
Steven Kirk
@grokys
Feb 07 2017 22:43
yes!
thanks for fixing that - it's something i've been intending to do for ages
well, i say "fixing" - it wasn't broken on master
but you've fixed it on scenegraph ;)
Nikita Tsukanov
@kekekeks
Feb 07 2017 22:57
@grokys I was thinking about loading fontawesome icons using SVG
But it seems that Direct2D1 support for that is not available
Nikita Tsukanov
@kekekeks
Feb 07 2017 23:02
There is also some library that can draw SVG using WPF's API: https://www.codeproject.com/kb/wpf/sharpvectors.aspx
Steven Kirk
@grokys
Feb 07 2017 23:03
svg support would be nice yeah, though i think in a 3rd party lib initially
i think supporting svg as part of core would be a little ambitious right now!
Nikita Tsukanov
@kekekeks
Feb 07 2017 23:03
Well, it needs to be integrated in rendering backend
Because it should be represented as backend-specific recorded set of commands
Steven Kirk
@grokys
Feb 07 2017 23:04
so how does the library that draws SVGs using WPF's API work?
Nikita Tsukanov
@kekekeks
Feb 07 2017 23:05
Honestly, no idea
But we definitely shouldn't just convert SVG to some raster image
That kills the whole point of having SVG support
Steven Kirk
@grokys
Feb 07 2017 23:08
i assume it maps SVG elements to WPF shapes. SVG elements and WPF shapes are very similar, so ours will be too
Nikita Tsukanov
@kekekeks
Feb 07 2017 23:11
You see, SkiaSharp produces SkPicture from SVG. Which is something that can be used like our Geometry primitive
I don't know much about Direct2D1 internals
But there should be something like SkPicture there
And "saved playback" drawing primitive should be useful in general
Are we reusing ID2D1Device?
Nikita Tsukanov
@kekekeks
Feb 07 2017 23:16
Command list seems to be bound to device context
Jeremy Koritzinsky
@jkoritzinsky
Feb 07 2017 23:19
Yep. We have one global ID2D1Device
As well as a global IDXGIDevice
Nikita Tsukanov
@kekekeks
Feb 07 2017 23:21
But it seems that we have device contexts on per-target basis
Steven Kirk
@grokys
Feb 07 2017 23:21
sorry, i've got to go to bed, but i think the WPF equivalent of what you're looking for would be Drawing
Jeremy Koritzinsky
@jkoritzinsky
Feb 07 2017 23:22
Yep. But you can share device resources across device contexts as long as they were created with the same ID2D1Device
Nikita Tsukanov
@kekekeks
Feb 07 2017 23:22
So it's OK to create a temporary device context, record a command list and then reuse it somewhere else, right?
Jeremy Koritzinsky
@jkoritzinsky
Feb 07 2017 23:23
I believe so. You can do that with ID2D1Bitmaps at least. That's how I set up AvaloniaAV.
I haven't messed with command lists yet but I don't see why they would be singled out to be different.
Nikita Tsukanov
@kekekeks
Feb 07 2017 23:25
So we could have Picture class (which is simular to Bitmap, but can't be used in tile brushes) and RenderTargetPicture
That would allow to record drawing commands
Jeremy Koritzinsky
@jkoritzinsky
Feb 07 2017 23:26
I don't see why not.
I think it's a great idea personally.
Nikita Tsukanov
@kekekeks
Feb 07 2017 23:29
Mkay, let's model API with WinForms as a reference. So Bitmap would inherit Picture (since Bitmap can be used in same contexts)
But we need some consistency
Currently we have ImageBrush that wants a Bitmap
It seems to be possible to load using our StreamingGeometry