Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Ink support #1477

Open
lindexi opened this issue Apr 8, 2018 · 19 comments
Open

Add Ink support #1477

lindexi opened this issue Apr 8, 2018 · 19 comments

Comments

@lindexi
Copy link
Contributor

lindexi commented Apr 8, 2018

I cant find Ink in Avalonia and me working on an Ink app.

I want to add Ink support to Avalonia. At least, copy the dot net framework code to Avalonia.

https://referencesource.microsoft.com/#PresentationFramework/src/Framework/System/Windows/Controls/InkCanvas.cs

@jkoritzinsky
Copy link
Collaborator

We can't copy the .NET Framework Reference Source since it is not correctly licensed. We have to do a clean-room implementation or we can be sued.

@jkoritzinsky
Copy link
Collaborator

I've been looking through the support for InkPresenter, and it looks like it we might be able to directly render to a D2DRenderContext, but I think we might need a DirectComposition Visual to render to (See the InkDesktopHost class).

@jkoritzinsky jkoritzinsky added this to the Post-1.0 milestone Apr 10, 2018
@lindexi
Copy link
Contributor Author

lindexi commented Apr 12, 2018

@jkoritzinsky For dot net framework it converts the Stylus to geometry and then renders the geometry that we should only render the geometry.

@jkoritzinsky
Copy link
Collaborator

I was looking at hooking into the OS support so we can get handwriting and shape recognition automatically.

We could always just manually capture the input and draw as a first step. Though, I'd definitely prefer eventually adding OS native support.

@lindexi
Copy link
Contributor Author

lindexi commented Apr 12, 2018

@jkoritzinsky I dont think all the os can do it.

@jkoritzinsky
Copy link
Collaborator

jkoritzinsky commented Apr 12, 2018

That's all supported within the UWP classes which are also available on Desktop as far as I can tell. They all work through the UWP InkPresenter class (and related classes which rely on data stored in an InkPresenter), which can be hosted in a UWP canvas, a DirectComposition visual, or a Windows.UI.Composition visual: https://docs.microsoft.com/en-us/uwp/api/windows.ui.input.inking.inkpresenter.activatecustomdrying#Windows_UI_Input_Inking_InkPresenter_ActivateCustomDrying.

@lindexi
Copy link
Contributor Author

lindexi commented Apr 12, 2018

@jkoritzinsky Thx for your docs but I mean that some OS like Gentoo cant do it.

@jkoritzinsky
Copy link
Collaborator

Yeah we'd need to have fallback support for a basic ink canvas without hooking into OS support.

@lindexi
Copy link
Contributor Author

lindexi commented Apr 12, 2018

@jkoritzinsky May we should provide two systems that the one run in win32(win10) use UWP api and another run in other systems render the geometry.

@jkoritzinsky
Copy link
Collaborator

That works for me! We can push back the Windows 10 based one for a while since we'd need to add native layer (DirectComposition) support into Avalonia, which might take a bit.

@lindexi
Copy link
Contributor Author

lindexi commented Apr 12, 2018

@jkoritzinsky by the way how can we use UWP api in WPF without package to store.

@jkoritzinsky
Copy link
Collaborator

Some UWP APIs can be used by traditional desktop applications. Docs used to say which ones, but I can't find the support tables in the new docs system.

Also, please don't copy the WPF source code. Please do a clean room implementation without looking at their code. If you copy their code we'll have to decline the pull request for legal reasons. We had to do that a while back for some Grid speed improvements.

@lindexi
Copy link
Contributor Author

lindexi commented Apr 12, 2018

@jkoritzinsky Thx. Now I am discussing with my partner to open our code to Avalonia. But I dont think my Ink render scheme is superior.

@Takoooooo Takoooooo removed this from the Post-1.0 milestone Feb 12, 2022
@lindexi
Copy link
Contributor Author

lindexi commented Aug 8, 2022

Now wpf is open source with MIT license. Can we copy the code from WPF ? @jkoritzinsky

@maxkatz6
Copy link
Member

maxkatz6 commented Feb 1, 2023

We have pen and touch input support including pressure and tilt parameters. PointerMoved even has GetIntermediatePoints() information.
All of this is necessary to create a custom ink control. Like we have oversimplified version here https://github.com/AvaloniaUI/Avalonia/blob/master/samples/ControlCatalog/Pages/PointerCanvas.cs

Saying that, I wouldn't expect specialized Ink Control to be part of the core avalonia framework.

@ivoryguard
Copy link

Great work! Does it work on Android as well as Windows?

@AtomKing
Copy link

so ,any update for this?

@timunie
Copy link
Contributor

timunie commented Mar 21, 2023

@AtomKing as written above, this control will most likely not a control that we ship via Avalonia. Either search for a 3rd party control (I've not seen any yet) or develop such a control on your own.

@lindexi
Copy link
Contributor Author

lindexi commented Jul 17, 2024

@AtomKing I am currently returning to this project, where I have recently successfully added touch pressure support for Avalonia, see #15283 and #15297 . The support for touch pressure is a fundamental prerequisite for writing applications.

I still believe that the Ink module requires built-in support from the UI framework, as the entire UI framework must be adjusted around the goals of high performance and responsiveness during the implementation of Ink. This will enhance the capabilities of the Avalonia framework, making Avalonia more powerful. I have been working on writing applications for the past decade, especially on large-size touch screen devices. Writing applications encompass a wealth of professional knowledge. I am acutely aware that to create a competent writing application, the support of the UI framework is indispensable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants