* Fixed crash bug where id was incorrectly passed instead pointer to evt.GetToolType().
* Added stylus pressure for Android
* Added eraser handling - to map to middle button.
* Release the skia objects when the view is unloaded
This was originally changed in 8039d0d0bb
for the AngleSwapChainPanel view. But, this was not also extended to include
the skia objects in SKSwapChainPanel.
Nothing needs to be re-created because it is all done in the first paint operation.
macOS and iOS draw immediately, so rather queue the redraw.
Not only does this fix the stack overflow, but is now more consistent with the other platforms.
For some reason, some controls (such as the ScrollViewer's LeftHeader, TopHeader, TopLeftHeader) are loaded twice.
We work around this by just adding a counter.
This will also fix any other controls that are a bit weird.
* Make more members readonly (the generator now makes the equality members readonly)
* split the SKMatrix file into SKMatrix44, SKRotationScaleMatrix, SK3dView
* split the SKColorSpace structs/classes into a separate file
* reworked/renamed all the poorly designed SKMatrix (and related) members to be actually useful
* Make sure the obsolete items are invisible
* Make sure everything implements IEquatable<T>
* Update docs and changelogs
* ISKGLViewController is public
* Adding GTK extension methods
* Add initial implementation for Xamarin.Forms GTK
* Better exceptions
* GTK v2 does not build on Windows CI
This is because of mono not being installed. I could install it, but typically
this is not available on normal dev boxes. So, to make things easier, just
build on mac and linux.
* Upgraded a good few things
- multitargeting for netstandard1.3, netstandard2.0, netcoreapp3.0 and net45
- iOS, tvOS, macOS, watchOS now builds on non-macOS (not embedded binaries)
- removed empty assembly infos
- using Directory.Build.* to clean up a few things
- improved the msbuild tasks to properly skip
* Add the targets file to the nuget
* Let all the tests run before failing the build
* Pack and validate in one go
* Update the samples to use the new projects
* Use VS 2017 for native builds for now
* Update Dockerfiles
* removed references from Views.WPF to OpenTK #1029 (#1078)
* Install the type redirector
* Update depot_tools
* Don't do any signing for macOS
Co-authored-by: Tyson Williams <34664007+bender2k14@users.noreply.github.com>
* PRs should use a custom prerelease label
* Update some docs
* Release the mouse when the button is released
We must not require that the Handled == true because in many
cases it is not an action that is really handled. Especially if the
mouse is captured - nobody else is receiving events.
* Adding back some methods to reduce the breaking changes.
* Making sure to force the use of VS2017
* Update all the docs
* Keep the diff in the output
* List the exported symbols on Linux
Changes:
- Added `GCHandleProxy` to debug builds
- this is used to track all `GCHandle` `Alloc` and `Free` calls to ensure that all allocations are freed.
- added some unit tests to make sure this is actually enforced
- as a result, several object are now freed correctly
- Added `ISKReferenceCounted` and `ISKNonVirtualReferenceCounted` interfaces to represent the reference counting types used in the native library
- this helps with automatically de-referencing objects
- `SKAbstractManagedStream`, `SKAbstractManagedWStream` and `SKDrawable` have been re-written to use better delegates
- instead of passing each of the delegates as parameters, they are now a struct that is passed as a single object
- better for extensions (which there shouldn't be) and only a single static field on the type
- removed the usage of `Marshal.GetFunctionPointerForDelegate`, which should help out with WASM (see #876)
- the objects now only keep weak references, meaning that they can now be garbage collected
- instead of trying to resolve the instances with a dictionary, a delegate is used and passed as "user context"
- Moved some of the repetitive logic from the types into the base `SKObject` and `SKNativeObject`
- some logic is automatically executed if the concrete type is `ISKReferenceCounted` or `ISKNonVirtualReferenceCounted`
- with the more centralized logic and stricter patterns, better tests can be written to make sure all memory is freed correctly and timely
- `SKData`, `SKFontManager` and `SKTypeface` now correctly prevent disposal of the "static" instances
- `SKPaint` now references the `Shader`, `MaskFilter`, `ColorFilter`, `ImageFilter`, `Typeface` and `PathEffect` properties
- this prevents accidental collection, or non-collection when the object goes out of scope
- the `SKPath` iterators (`Iterator` and `RawIterator`) and op builder (`OpBuilder`) now correctly own and dispose their native objects
- `SKRegion` objects are now disposed on the native side
- `SKTypeface` construction from a `SKManagedStream` (via both `SKTypeface` and `SKFontManager`) now copy the contents of the .NET `Stream` into a native memory
- typeface construction requires multiple seeks (previously, the stream was copied only if it was non-seekable)
- it also requires "duplicating" the stream, which is not supported on .NET streams
- duplicates or forks of a stream means that each of the streams need to be read concurrently from different locations
- .NET streams can only have a single position
- Updated the NuGets used for the tests
- using the `Xunit.AssemblyFixture` and `Xunit.SkippableFact` NuGets instead of using the code directly
- removed the `Xunit.Categories` NuGet as it was preventing tests from running
This PR has a big set of changes that may be breaking due to bug fixes:
- The `SKAbstractManagedStream`, `SKAbstractManagedWStream` and `SKDrawable` no longer prevent the GC from collecting them. This means that if code no longer references them, they will be disposed.
- As far as I can tell, this should not be a problem for the streams as they are never kept around - they are just used for reading and writing and typically only need to live for as long as a single method, and then need to be disposed by the caller. The `SKTypeface` and `SKDocument` do keep it around for a bit, but then they also take ownership of the stream and keep a hard reference to the streams themselves. They will dispose the streams when they are disposed.
- `SKDrawable` is never kept around and is entirely a user-controlled object. If it goes out of scope, skia doesn't have a reference anyway.
- The `SKFontManager` and `SKTypeface` no longer use the managed streams (`SKManagedStream` or `Stream`) directly
- they make a copy.
- This is simply because skia streams can do things that are not possible for .NET - they can be read concurrently from different positions. If a `SKFileStream` or `SKMemoryStream` are passed, then the streams are not copied.
- Further optimizations can be made in the case of a `MemoryStream` or `byte[]` to not actually copy but use GC pinning to get a handle to the managed data and work with pointers. But this can be done later so that this PR can be merged and tested.
Add a new NuGet
- add a targets file to the nuget to warn if the platform packages were not installed
Update the pipeline:
- use build artifacts everywhere
- just disable tizen for Windows
* Removed v2.3.1 and renamed Flags to BufferFlags
* Updated some API and Doc
* Add Gtk3 views
* Reworked the samples logic
- handle the more varied project structure
- build the generated zip to test it
- always use the local nuget cache
* macOS is always Any CPU
* Rename SKWidget to SKDrawingArea for GTK#3
- this allows us to have a single moniker for docs
- it indicates that it is not quite the same as the widget in GTK#2
- is is more specific so we can have more GTK# controls
* merge all the views (except forms) into a single moniker so it is better for browsing in the docs portal
* SK3dView is not actually obsolete :)
* Add readmes to the samples
- `dotnet build` will fail because `CodeTaskFactory` factory is not supported, so use regular MSBuild properties
- use the new stages feature
- .net core tests now use libraries instead of nugets
- changed a few things in the pipeline yaml
* Initial implementation of font funcs
* Add a method to reduce verbosity for multi-delegates
* Add missing unit tests
* Remove the concept of "user data"
- this is not really useful to C# and delegates
- it adds complexity
* Remove context from delegates
* Implement UserDataDelegate
* Add the calling convention to the delegates.
* Moved some files around and improved tests
- moved the font functions interop into a new file to help separate logic from interop (helpful for wasm)
- added the various interop and [MarshalAs] attributes for Windows
- reworked the interop api tests to include the harfbuzz apis
- the font name delegates now use strings
- removed single line if braces to reduce code
* Throw correct extensions
* Face can now also use the UserDataDelegate
* Add hb_face_create_for_tables support
* Fix net core build
* Make sure blobs are reused
* Support cleanup for TableLoader
* Remove extension
* Fix dispose handler and add unit test
* Rework unit tests to reduce file access
* Keep delegate alive
* Improve font usage in unit tests
* Support for iOS
* Remove typeface extension
* Cleanup
* Add unit test
* update the docs before re-gen
* A few tweaks:
- use Parse instead of FromString
- create a "static" Blob type
- remove default param values
- fix tests namespaces and base tests
* More changes:
- unified the destroy delegates
- NativeDelegateContext now supports multiple delegates and contexts for a single pointer
- public Face delegates no longer use pointers
* Reuse the code
* Added lower-level members to SKTypeface
- get the table data without copying to array
- added some TryXXX to avoid exceptions
* Revert parameter name change
* The empty Face is a static face that cannot be disposed
* Make sure to return the same managed instance
* Remove the duplicate iOS build run
- converted default arguments into overloads
- fixed a few whitespaces in unchanged files
- updated all the projects to C# 7.3
- the Buffer propertes are now arrays again, but added methods for the spans
- reduce breaking changes
- the values can be broken if the buffer changes, so use a better named method
- removed the new Point type
- don't want to add another point type to the world
- will use the .net standard 2.0 Point type when we upgrade
- the Font.Scale property is removed for now, but we will add it back with the drawing point type
- the Font GetAdvances are now returning arrays
- the spans were not necessary as the type is an explicit array
- changed the casing of the various script properties