168 Commits

Author SHA1 Message Date
Nikita Tsukanov 30b451da52 Fix Border clip regression (#20648) 2026-02-09 15:08:59 +00:00
Nikita Tsukanov 697cba7193 Composition system SP1 (#20497)
* baseline benchmark

* Composition system SP1

* Allow reusing the same BitmapCache object for multiple visuals

* Fix warnings

* Address review

* API suppressions

---------

Co-authored-by: Julien Lebosquain <julien@lebosquain.net>
2026-02-06 11:15:47 +00:00
Javier Suárez 424863d5ff Add PlaceholderForeground property to TextBox, AutoCompleteBox, CalendarDatePicker, NumericUpDown (#20303)
* Added WatermarkForeground property

* Added samples

* Added unit tests

* Added render tests

* Fix merge issues

* Updated render tests

* Standardize watermark foreground naming

* Pending changes

* More changes

* Use UseFloatingPlaceholder

* Fix tests
2026-02-05 16:35:47 +00:00
Benedikt Stebner 1bce702bd4 Introduce TextOptions (#20107)
* Introduce TextOptions API

* Store BaselinePixelAlignment as byte. Move to a dedicated file.

* Update API suppressions

---------

Co-authored-by: Julien Lebosquain <julien@lebosquain.net>
2026-01-23 11:22:27 +00:00
Julien Lebosquain 8215194f32 Reset cached transform on PopEffect (#20474) 2026-01-15 15:17:07 +00:00
Julien Lebosquain 71ce62ae32 Remove legacy Diagnostics project (#20332)
* Remove legacy Diagnostics project

* Remove DataGrid submodule
2026-01-07 01:24:28 +00:00
Tom Edwards f1703dd784 Add DrawingImage.Viewbox (#18913)
* Added DrawingImage.Frame: a rectangular region of `Drawing`, in device independent pixels, to display when rendering the image

* Renamed Frame to Viewbox
Added test
2026-01-06 13:40:21 +00:00
Julien Lebosquain ee748802b3 Enable nullability in various test projects (#20374)
* Enable nullability in RenderTests

* Enable nullability in LeakTests

* Enable nullability in Skia.UnitTests

* Enable nullability in Generators.Tests

* Enable nullability in DesignerSupport.Tests

* Enable nullability in Build.Tasks.UnitTests
2025-12-30 09:10:50 +00:00
Julien Lebosquain a7f09f4315 Delete Direct2D1 test files (#20333) 2025-12-23 06:37:00 +00:00
Javier Suárez b66f5ada75 [Feature] Add FillRule property for Polyline/Polygon (#20159)
* Implement FillRuleProperty on Polyline

* Implement FillRule Property on Polygon

* Add tests

* Added comments to new public APIs

* Added more comments

* More tests

* More tests

* Updated API

* Added render tests

* More render tests

* Reintroducing the original PolylineGeometry constructor

* Updated API file

---------

Co-authored-by: Julien Lebosquain <julien@lebosquain.net>
2025-12-16 16:12:31 +00:00
snowflysky c7bc7e92a5 Enable antialiasing based on EdgeMode in DrawBitmap (#20116)
* Enable antialiasing based on EdgeMode in DrawBitmap

* Update expected image for ImageBrush Tile UniformToFill test

* Add tests for rotated image with EdgeMode options

* Add expected images for Direct2D1 image rotation tests

* Revert "Add expected images for Direct2D1 image rotation tests"

This reverts commit 63dd6717b0ff4488ee7b453f220e3329202ec9d2.

* Remove Direct2D1 in ImageTests

---------

Co-authored-by: Julien Lebosquain <julien@lebosquain.net>
2025-11-24 19:23:31 +00:00
Julien Lebosquain 246cbfc566 Remove Direct2D1 (#20132) 2025-11-24 11:50:03 +00:00
Julien Lebosquain 40a3af4aa5 Remove netstandard2.0 from almost all projects (#20111)
* Remove netstandard2.0 from almost all projects

* Fix duplicated target frameworks in unit tests

* Fix DesignerSupport tests

* Fix Designer.HostApp packaging

* Build ControlCatalog.Desktop on CI

* Fix another bad auto merge

* Fix LeakTests duplicated target frameworks

* Don't hardcode target framework in DesignerSupportTests
2025-11-21 09:59:39 +00:00
Julien Lebosquain 9ee57c5616 Fix BitmapInterpolationMode.HighQuality when downscaling (#19513)
* Fix BitmapInterpolationMode.HighQuality when downscaling

* Fix SkiaSharpExtensions.ToSKSamplingOptions public API change
2025-08-23 08:30:04 +00:00
Alexandre Mutel 46d4735868 Fix issue with OverhangLeading (#18438)
* Fix issue with MinTextWidth (Fixes #18372)

* Make sure that MeasureOverride for TextPresenter and TextBlock are using same textWidth

* Revert #16601 that is introducing an invalid calculation for the OverhangLeading

Add tests for OverhangLeading and OverhangTrailing

* Revert MinTextWidth

* Fix tests to not rely on fixed values

* Fix remaining issues

* Fix comment in Direct2D1 GlyphRunImpl.cs

* Fix Direct2D1 rendering

* Fix gold images

* Restore TextLineImpl

* Update gold image

* Restore Math.Max on OverhangLeading and Trailing

* Adopt similar behavior to WPF: don't use OverhangLeading/Trailing for measuring and remove clip by default.

But it requires further support with NeedsClipBounds

* Remove MinTextWidth
Keep ClipToBounds=true default for TextBlock

* Revert change

---------

Co-authored-by: Benedikt Stebner <Gillibald@users.noreply.github.com>
2025-04-04 09:34:56 +00:00
Leo Bottaro 9441362dcc Add missing Blend Modes and expose BlendMode on Image Control (#17903)
* Add missing Bitmap Blend Modes supported by Skia

* Expose Blend Mode on Image Control

* Fix image render options "push" not being disposed
Fix image blendMode change not triggering a re-render

* Add Image Blend Tests

* Remove Modulate Blend mode

* Add Composition Blend Modes Tests

---------

Co-authored-by: Benedikt Stebner <Gillibald@users.noreply.github.com>
2025-02-01 13:49:38 +00:00
Benedikt Stebner d3b61cd75e [Skia] Fix RadialGradientBrush for non center origin (#17925)
* Skia - Only reverse radial gradient stops if we cover the whole content bounds

* Skia - Only reverse radial gradient stops if we reach cover the whole content bounds

* Add some new lines
2025-01-20 20:55:10 +00:00
Benedikt Stebner 19394e062b Skia - Add a unit test for the dash array calculation (#18001) 2025-01-20 12:50:05 +00:00
Benedikt Stebner d411bd2156 Fix TextBlock TextAlignment issues when a HorizontalAlignment is defined (#17402)
* Always measure TextBlock with infinite width

* Make sure the constraint is always fulfilled

* Add some tests

* Adjust tests because we no longer retain the TextLayout in the arrange pass
2024-11-10 14:06:32 +01:00
Nikita Tsukanov 04e76a9265 Make our TileBrush code a bit less byzantine (#17098)
* Use scalable rasterization for visual brush

* Make ConfigureSceneBrushContentWithPicture less byzantine

---------

Co-authored-by: Benedikt Stebner <Gillibald@users.noreply.github.com>
2024-09-24 09:05:41 +00:00
Nikita Tsukanov 2299d96f98 Enable VisualBrush to be used as Visual's OpacityMask (#17072)
* Enable VisualBrush to be used as Visual's OpacityMask

* Add missing test file

---------

Co-authored-by: Benedikt Stebner <Gillibald@users.noreply.github.com>
2024-09-20 10:56:19 +00:00
Benedikt Stebner 7da58ba205 Fix transform desync (#16363)
* Make sure wrapper and platform DrawingContext have the same transform after Flush

* Add some tests

* Update Avalonia.RenderTests.WpfCompare.csproj

* Remove comments

* Use test font
2024-09-12 08:27:04 +00:00
workgroupengineering 6e35fd2bbe feat(Geometries): PolyBezierSegment (#16664)
* feat(Geometries): PolyBezierSegment

* fix: warning

* add PolyBezierSegment to CrossUI Test

* test: AddPolyBezierSegment CrossUI test
2024-08-15 04:27:09 +00:00
Benedikt Stebner e55dfcd1a2 Fixes ShapedTextRun background rendering (#16594)
* Add failing test

* Fix ShapedTextRun background rendering
2024-08-05 16:19:38 +00:00
Emmanuel Hansen e8c3bf593f Fix tile mode used in SkShader for a TileBrush with None TileMode (#16021)
* add cross test for tile brush with None tile mode

* use Decal skshader tile mode for tile brush tilemode None
2024-06-13 19:42:57 +00:00
Steven Kirk eb4f575aa8 Fix some issues with strokeless geometry segments (#16019)
* Added failing cross test.

For polyline segment with `IsStroked = false`.

* Fixed some issues with non-stroked segments

* Fix CombinedGeometryImpl with empty paths.

If an empty (but non-null) stroke was passed to `CombinedGeometryImpl` then its empty bounds would be used and the fill bounds ignored. Added a test and fixed that.

---------

Co-authored-by: Nikita Tsukanov <keks9n@gmail.com>
2024-06-13 13:06:40 +00:00
Emmanuel Hansen 861c0e4c42 Apply Alignments to TileBrushes with uniform stretch (#15846)
* add tiled brush alignment cross tests

* apply Alignments to TileBrushes with uniform stretch
2024-05-29 14:31:20 +00:00
Emmanuel Hansen 0aaa59165d Add isStroked overload for IGeometryContext (#15430)
* add isStroked overload for IGeometryContext

* move IGeometryContextEx

* fix Fill Path line

* remove added whitespaces

* close a figure to non-stroke lines with a line

* add geometry tests

* add wpf test files

* Added a test for tracking path closure with missing strokes for various line caps/joins

* add IsStroke overload for other segments

* update tests

* Skip line join test for closed geometry with holes for now

---------

Co-authored-by: Nikita Tsukanov <keks9n@gmail.com>
2024-04-29 17:41:45 -07:00
Benedikt Stebner 544d5372e3 Fix TileBrush Source/DestinationRect handling (#15289)
* Fix TileBrush Source/DestinationRect handling

* Add unit test

* Add cross render tests

* Add missing test image
2024-04-10 13:47:37 +00:00
Benedikt Stebner 23b3a767dc Rework tile brush calculation (#15157) 2024-04-02 04:49:37 +00:00
Nikita Tsukanov ba7405aead Initial support for cross-testing against WPF (#15150)
* Initial support for cross-testing against WPF

* More cross-tests
2024-03-29 17:03:49 -07:00
Benedikt Stebner 4f8f46cb5d Fix TransformOrigin for brushes (#15037) 2024-03-19 18:15:05 +00:00
Benedikt Stebner 6eb9d7a17e Fixes/drawing brush transform (#14978)
* Apply brush transform to SKPicture instead to the local matrix of the resulting SKShader

* Add unit test
Implement Direct2D1
2024-03-15 08:12:30 +00:00
Nikita Tsukanov 086fe5267f Don't create a layer if the previous frame is retained by the render target (#14924)
* Don't create a layer if the previous frame is retained by the render target

* D2D

* compile

* Only check PreviousFrameIsRetained if not using layer

* ABI
2024-03-12 12:23:24 -07:00
Max Katz 326ef7c9fd Add .NET 8 target (Avalonia 11.1) (#14535)
* Add .NET 8 target to packable projects

* Update test projects

* Update sample projects to target .NET 8

* Update main Avalonia package to target .NET 8 as well

* Remove MSBuildEnableWorkloadResolver hack and some minor change

* Use net8.0 in nuke build as well

* Pin 8.0.0 SDK

* Adjust API validation

* Pin a valid version

* Remove net461 target from Avalonia package

* Remove unused net6.0 target from Avalonia.Designer.HostApp

* Adjust API diff

* Update ControlCatalog.Android.csproj

* Remove MSBuildEnableWorkloadResolver

* Fix Browser issues on .NET 8

* Fix .NET 8 error

* Fix merge conflicts

* Replace explicit TFMs in .csproj files with a centralized registry

* Fix merge conflict

* Fix AvsLegacyWindowsTargetFrameworks and add hacks for the tests

* Update XCode project CommandLineArgument

---------

Co-authored-by: Nikita Tsukanov <keks9n@gmail.com>
2024-03-05 13:37:26 -08:00
Nikita Tsukanov 8329efddd3 Fixes relative brush mapping mode (#14598)
* Fixed relative mapping mode for brushes (skia only, pending radial)

* Implemented separate RadiusX/RadiusY with proper mapping modes for RadialGradientBrush

* tests for conic brush

* Added tests for geometry drawing

* Updated DrawingBrush test image since it now matches WPF

* Update obsolete property usage

* Fixed D2D, updated radial test with D2D results that actually match WPF ones

* Fixed RadiusX/Y for radial gradients with non-centered origin

* Updated obsolete property usage

* Code cleanup

* Typo

* ApiDiff suppression

* Removed files for skipped test

* More info in obsoletion warning

* clarify

---------

Co-authored-by: Jumar Macato <16554748+jmacato@users.noreply.github.com>
2024-02-13 12:02:42 +00:00
Benedikt Stebner b94b011c94 [WIP]Fix overhang leading calculation for negative values (#13672)
* [macOS] Fix overhand leading calculation

* Adjust TextLineMetrics

* Update expected result
2023-11-21 23:29:10 +00:00
Benedikt Stebner 520d9d631a Properly handle overhang with RTL FlowDirection (#13631) 2023-11-17 04:39:46 +00:00
Benedikt Stebner da3d4ca5c2 Fix TextLayout.OverhandLeading calculation (#13287)
* Fix overhand leading calculation

* Fix test on Mac

* Fix tests
2023-10-24 03:46:28 +00:00
workgroupengineering 1cb271fb37 fix: Xaml Compiler error when code-behind class contains a DllImport method (#12882)
* fix: Avalonia.Generators not found

if you put SourceGenerators.props in a project with path are like this:"C:\GitHub\Avalonia\sample\mobile\android\ANoteSample\ANoteSample.csproj", the Compiler is not able to found `Avalonia.Generators`

* test: Add test #10046 Xaml Compiler error when code-behind class contains a DllImport method

* fix: Xaml Compiler error when code-behind class contains a DllImport method

* fix: Address Review

* fix: ValidateApiDiff has thrown an exception
2023-09-18 03:04:03 +00:00
Steven Kirk 45e5d25ccf Implemented Geometry.GetWidenedGeometry. 2023-08-30 14:25:48 +02:00
Nikita Tsukanov b46db50140 Merge pull request #11397 from Gillibald/fixBitmapBlendingModeDefault
Fix BitmapInterpolationMode default value
2023-05-17 06:07:31 +00:00
Benedikt Stebner 0b072f4d0d Update test files 2023-05-17 07:07:28 +02:00
Benedikt Stebner f153c626f8 Fix TextLineImpl.GetCharacterHitFromDistance for lines that include a TextEndOfLine run
Fix overhang handling to prevent clipped text for slanted glyphs
Fix TextBox selection issues
2023-05-17 06:33:40 +02:00
Benedikt Stebner 0442c3b337 Introduce advanced render options 2023-04-19 12:00:12 +02:00
Nikita Tsukanov cf28998a46 Bitmap effects support 2023-04-14 15:16:31 +06:00
Nikita Tsukanov fc96e2949f Fixed #10539 2023-04-08 19:25:49 +06:00
Nikita Tsukanov a9ef92bbeb Implemented BeginFigure(isFilled: false) 2023-02-26 23:22:52 +06:00
Nikita Tsukanov ae1fcfed51 Refactored DrawingContext and VisualBrush, added DrawingBrush (#10419)
Refactored DrawingContext and VisualBrush, added DrawingBrush
2023-02-23 08:07:51 +00:00
Nikita Tsukanov 95b6343f8f Respect AdornerLayer.IsClipEnabled 2023-02-16 13:02:20 +06:00