From 6a1dbaea6587a7800180cb1986916b1a591b2155 Mon Sep 17 00:00:00 2001 From: Dan Walmsley Date: Mon, 19 Apr 2021 19:23:15 +0100 Subject: [PATCH 01/59] initial implementation for skia. --- .../Media/Imaging/WriteableBitmap.cs | 45 +++++++++++++ .../Platform/IPlatformRenderInterface.cs | 32 +++++++++ .../Avalonia.Skia/PlatformRenderInterface.cs | 25 +++++++ src/Skia/Avalonia.Skia/WriteableBitmapImpl.cs | 65 +++++++++++++++++++ 4 files changed, 167 insertions(+) diff --git a/src/Avalonia.Visuals/Media/Imaging/WriteableBitmap.cs b/src/Avalonia.Visuals/Media/Imaging/WriteableBitmap.cs index b86444bc2f..d10c743894 100644 --- a/src/Avalonia.Visuals/Media/Imaging/WriteableBitmap.cs +++ b/src/Avalonia.Visuals/Media/Imaging/WriteableBitmap.cs @@ -1,5 +1,8 @@ using System; +using System.IO; +using System.Threading.Tasks; using Avalonia.Platform; +using Avalonia.Visuals.Media.Imaging; namespace Avalonia.Media.Imaging { @@ -34,8 +37,50 @@ namespace Avalonia.Media.Imaging { } + private WriteableBitmap(IWriteableBitmapImpl impl) : base(impl) + { + + } + public ILockedFramebuffer Lock() => ((IWriteableBitmapImpl) PlatformImpl.Item).Lock(); + public static WriteableBitmap Decode(Stream stream) + { + var ri = AvaloniaLocator.Current.GetService(); + + return new WriteableBitmap(ri.LoadWriteableBitmap(stream)); + } + + /// + /// Loads a WriteableBitmap from a stream and decodes at the desired width. Aspect ratio is maintained. + /// This is more efficient than loading and then resizing. + /// + /// The stream to read the bitmap from. This can be any supported image format. + /// The desired width of the resulting bitmap. + /// The to use should any scaling be required. + /// An instance of the class. + public static Bitmap DecodeToWidth(Stream stream, int width, BitmapInterpolationMode interpolationMode = BitmapInterpolationMode.HighQuality) + { + var ri = AvaloniaLocator.Current.GetService(); + + return new WriteableBitmap(ri.LoadWriteableBitmapToWidth(stream, width, interpolationMode)); + } + + /// + /// Loads a Bitmap from a stream and decodes at the desired height. Aspect ratio is maintained. + /// This is more efficient than loading and then resizing. + /// + /// The stream to read the bitmap from. This can be any supported image format. + /// The desired height of the resulting bitmap. + /// The to use should any scaling be required. + /// An instance of the class. + public static Bitmap DecodeToHeight(Stream stream, int height, BitmapInterpolationMode interpolationMode = BitmapInterpolationMode.HighQuality) + { + var ri = AvaloniaLocator.Current.GetService(); + + return new WriteableBitmap(ri.LoadWriteableBitmapToHeight(stream, height, interpolationMode)); + } + private static IBitmapImpl CreatePlatformImpl(PixelSize size, in Vector dpi, PixelFormat? format, AlphaFormat? alphaFormat) { var ri = AvaloniaLocator.Current.GetService(); diff --git a/src/Avalonia.Visuals/Platform/IPlatformRenderInterface.cs b/src/Avalonia.Visuals/Platform/IPlatformRenderInterface.cs index fb4a4427b7..c141f2024f 100644 --- a/src/Avalonia.Visuals/Platform/IPlatformRenderInterface.cs +++ b/src/Avalonia.Visuals/Platform/IPlatformRenderInterface.cs @@ -100,6 +100,38 @@ namespace Avalonia.Platform /// An . IBitmapImpl LoadBitmap(Stream stream); + /// + /// Loads a WriteableBitmap implementation from a stream to a specified width maintaining aspect ratio. + /// + /// The stream to read the bitmap from. + /// The desired width of the resulting bitmap. + /// The to use should resizing be required. + /// An . + IWriteableBitmapImpl LoadWriteableBitmapToWidth(Stream stream, int width, BitmapInterpolationMode interpolationMode = BitmapInterpolationMode.HighQuality); + + /// + /// Loads a WriteableBitmap implementation from a stream to a specified height maintaining aspect ratio. + /// + /// The stream to read the bitmap from. + /// The desired height of the resulting bitmap. + /// The to use should resizing be required. + /// An . + IWriteableBitmapImpl LoadWriteableBitmapToHeight(Stream stream, int height, BitmapInterpolationMode interpolationMode = BitmapInterpolationMode.HighQuality); + + /// + /// Loads a WriteableBitmap implementation from a file.. + /// + /// The filename of the bitmap. + /// An . + IWriteableBitmapImpl LoadWriteableBitmap(string fileName); + + /// + /// Loads a WriteableBitmap implementation from a file.. + /// + /// The stream to read the bitmap from. + /// An . + IWriteableBitmapImpl LoadWriteableBitmap(Stream stream); + /// /// Loads a bitmap implementation from a stream to a specified width maintaining aspect ratio. /// diff --git a/src/Skia/Avalonia.Skia/PlatformRenderInterface.cs b/src/Skia/Avalonia.Skia/PlatformRenderInterface.cs index 6d0be9f64d..2ed4948d41 100644 --- a/src/Skia/Avalonia.Skia/PlatformRenderInterface.cs +++ b/src/Skia/Avalonia.Skia/PlatformRenderInterface.cs @@ -77,6 +77,31 @@ namespace Avalonia.Skia return new ImmutableBitmap(stream); } + public IWriteableBitmapImpl LoadWriteableBitmapToWidth(Stream stream, int width, + BitmapInterpolationMode interpolationMode = BitmapInterpolationMode.HighQuality) + { + return new WriteableBitmapImpl(stream, width, true, interpolationMode); + } + + public IWriteableBitmapImpl LoadWriteableBitmapToHeight(Stream stream, int height, + BitmapInterpolationMode interpolationMode = BitmapInterpolationMode.HighQuality) + { + return new WriteableBitmapImpl(stream, height, false, interpolationMode); + } + + public IWriteableBitmapImpl LoadWriteableBitmap(string fileName) + { + using (var stream = File.OpenRead(fileName)) + { + return LoadWriteableBitmap(stream); + } + } + + public IWriteableBitmapImpl LoadWriteableBitmap(Stream stream) + { + return new WriteableBitmapImpl(stream); + } + /// public IBitmapImpl LoadBitmap(PixelFormat format, AlphaFormat alphaFormat, IntPtr data, PixelSize size, Vector dpi, int stride) { diff --git a/src/Skia/Avalonia.Skia/WriteableBitmapImpl.cs b/src/Skia/Avalonia.Skia/WriteableBitmapImpl.cs index d48e7d10e6..c06bd0d057 100644 --- a/src/Skia/Avalonia.Skia/WriteableBitmapImpl.cs +++ b/src/Skia/Avalonia.Skia/WriteableBitmapImpl.cs @@ -1,8 +1,10 @@ using System; using System.IO; using System.Threading; +using Avalonia.Media.Imaging; using Avalonia.Platform; using Avalonia.Skia.Helpers; +using Avalonia.Visuals.Media.Imaging; using SkiaSharp; namespace Avalonia.Skia @@ -15,7 +17,70 @@ namespace Avalonia.Skia private static readonly SKBitmapReleaseDelegate s_releaseDelegate = ReleaseProc; private readonly SKBitmap _bitmap; private readonly object _lock = new object(); + + /// + /// Create immutable bitmap from given stream. + /// + /// Stream containing encoded data. + public WriteableBitmapImpl(Stream stream) + { + using (var skiaStream = new SKManagedStream(stream)) + { + _bitmap = SKBitmap.Decode(skiaStream); + + if (_bitmap == null) + { + throw new ArgumentException("Unable to load bitmap from provided data"); + } + + PixelSize = new PixelSize(_bitmap.Width, _bitmap.Height); + Dpi = new Vector(96, 96); + } + } + + public WriteableBitmapImpl(Stream stream, int decodeSize, bool horizontal, BitmapInterpolationMode interpolationMode) + { + using (var skStream = new SKManagedStream(stream)) + using (var codec = SKCodec.Create(skStream)) + { + var info = codec.Info; + // get the scale that is nearest to what we want (eg: jpg returned 512) + var supportedScale = codec.GetScaledDimensions(horizontal ? ((float)decodeSize / info.Width) : ((float)decodeSize / info.Height)); + + // decode the bitmap at the nearest size + var nearest = new SKImageInfo(supportedScale.Width, supportedScale.Height); + var bmp = SKBitmap.Decode(codec, nearest); + + // now scale that to the size that we want + var realScale = horizontal ? ((double)info.Height / info.Width) : ((double)info.Width / info.Height); + + SKImageInfo desired; + + + if (horizontal) + { + desired = new SKImageInfo(decodeSize, (int)(realScale * decodeSize)); + } + else + { + desired = new SKImageInfo((int)(realScale * decodeSize), decodeSize); + } + + if (bmp.Width != desired.Width || bmp.Height != desired.Height) + { + var scaledBmp = bmp.Resize(desired, interpolationMode.ToSKFilterQuality()); + bmp.Dispose(); + bmp = scaledBmp; + } + + _bitmap = bmp; + + PixelSize = new PixelSize(bmp.Width, bmp.Height); + Dpi = new Vector(96, 96); + } + } + /// /// Create new writeable bitmap. /// From a4ebe5dbb51d5a1370724c41a6913e1eeafcdb8e Mon Sep 17 00:00:00 2001 From: Dan Walmsley Date: Mon, 19 Apr 2021 20:32:48 +0100 Subject: [PATCH 02/59] add direct2d implementation. --- .../HeadlessPlatformRenderInterface.cs | 22 +++++++++++++++++++ .../Avalonia.Direct2D1/Direct2D1Platform.cs | 22 +++++++++++++++++++ .../Media/Imaging/WriteableWicBitmapImpl.cs | 17 ++++++++++++++ .../MockPlatformRenderInterface.cs | 22 +++++++++++++++++++ 4 files changed, 83 insertions(+) diff --git a/src/Avalonia.Headless/HeadlessPlatformRenderInterface.cs b/src/Avalonia.Headless/HeadlessPlatformRenderInterface.cs index 62cac378d7..7b68a0250f 100644 --- a/src/Avalonia.Headless/HeadlessPlatformRenderInterface.cs +++ b/src/Avalonia.Headless/HeadlessPlatformRenderInterface.cs @@ -70,6 +70,28 @@ namespace Avalonia.Headless return new HeadlessBitmapStub(new Size(1, 1), new Vector(96, 96)); } + public IWriteableBitmapImpl LoadWriteableBitmapToWidth(Stream stream, int width, + BitmapInterpolationMode interpolationMode = BitmapInterpolationMode.HighQuality) + { + return new HeadlessBitmapStub(new Size(1, 1), new Vector(96, 96)); + } + + public IWriteableBitmapImpl LoadWriteableBitmapToHeight(Stream stream, int height, + BitmapInterpolationMode interpolationMode = BitmapInterpolationMode.HighQuality) + { + return new HeadlessBitmapStub(new Size(1, 1), new Vector(96, 96)); + } + + public IWriteableBitmapImpl LoadWriteableBitmap(string fileName) + { + return new HeadlessBitmapStub(new Size(1, 1), new Vector(96, 96)); + } + + public IWriteableBitmapImpl LoadWriteableBitmap(Stream stream) + { + return new HeadlessBitmapStub(new Size(1, 1), new Vector(96, 96)); + } + public IBitmapImpl LoadBitmap(PixelFormat format, AlphaFormat alphaFormat, IntPtr data, PixelSize size, Vector dpi, int stride) { return new HeadlessBitmapStub(new Size(1, 1), new Vector(96, 96)); diff --git a/src/Windows/Avalonia.Direct2D1/Direct2D1Platform.cs b/src/Windows/Avalonia.Direct2D1/Direct2D1Platform.cs index 6ae27870e8..e8757bbb34 100644 --- a/src/Windows/Avalonia.Direct2D1/Direct2D1Platform.cs +++ b/src/Windows/Avalonia.Direct2D1/Direct2D1Platform.cs @@ -188,6 +188,28 @@ namespace Avalonia.Direct2D1 return new WicBitmapImpl(stream); } + public IWriteableBitmapImpl LoadWriteableBitmapToWidth(Stream stream, int width, + BitmapInterpolationMode interpolationMode = BitmapInterpolationMode.HighQuality) + { + return new WriteableWicBitmapImpl(stream, width, true, interpolationMode); + } + + public IWriteableBitmapImpl LoadWriteableBitmapToHeight(Stream stream, int height, + BitmapInterpolationMode interpolationMode = BitmapInterpolationMode.HighQuality) + { + return new WriteableWicBitmapImpl(stream, height, false, interpolationMode); + } + + public IWriteableBitmapImpl LoadWriteableBitmap(string fileName) + { + return new WriteableWicBitmapImpl(fileName); + } + + public IWriteableBitmapImpl LoadWriteableBitmap(Stream stream) + { + return new WriteableWicBitmapImpl(stream); + } + /// public IBitmapImpl LoadBitmapToWidth(Stream stream, int width, BitmapInterpolationMode interpolationMode = BitmapInterpolationMode.HighQuality) { diff --git a/src/Windows/Avalonia.Direct2D1/Media/Imaging/WriteableWicBitmapImpl.cs b/src/Windows/Avalonia.Direct2D1/Media/Imaging/WriteableWicBitmapImpl.cs index 3261c45f15..fef6a9aa82 100644 --- a/src/Windows/Avalonia.Direct2D1/Media/Imaging/WriteableWicBitmapImpl.cs +++ b/src/Windows/Avalonia.Direct2D1/Media/Imaging/WriteableWicBitmapImpl.cs @@ -1,4 +1,5 @@ using System; +using System.IO; using Avalonia.Platform; using SharpDX.WIC; using PixelFormat = Avalonia.Platform.PixelFormat; @@ -7,11 +8,27 @@ namespace Avalonia.Direct2D1.Media.Imaging { class WriteableWicBitmapImpl : WicBitmapImpl, IWriteableBitmapImpl { + public WriteableWicBitmapImpl(Stream stream, int decodeSize, bool horizontal, + Avalonia.Visuals.Media.Imaging.BitmapInterpolationMode interpolationMode) + : base(stream, decodeSize, horizontal, interpolationMode) + { + } + public WriteableWicBitmapImpl(PixelSize size, Vector dpi, PixelFormat? pixelFormat, AlphaFormat? alphaFormat) : base(size, dpi, pixelFormat, alphaFormat) { } + public WriteableWicBitmapImpl(Stream stream) + : base(stream) + { + } + + public WriteableWicBitmapImpl(string fileName) + : base(fileName) + { + } + class LockedBitmap : ILockedFramebuffer { private readonly WriteableWicBitmapImpl _parent; diff --git a/tests/Avalonia.UnitTests/MockPlatformRenderInterface.cs b/tests/Avalonia.UnitTests/MockPlatformRenderInterface.cs index e73a76357a..b7f9cc34ca 100644 --- a/tests/Avalonia.UnitTests/MockPlatformRenderInterface.cs +++ b/tests/Avalonia.UnitTests/MockPlatformRenderInterface.cs @@ -66,6 +66,28 @@ namespace Avalonia.UnitTests return Mock.Of(); } + public IWriteableBitmapImpl LoadWriteableBitmapToWidth(Stream stream, int width, + BitmapInterpolationMode interpolationMode = BitmapInterpolationMode.HighQuality) + { + throw new NotImplementedException(); + } + + public IWriteableBitmapImpl LoadWriteableBitmapToHeight(Stream stream, int height, + BitmapInterpolationMode interpolationMode = BitmapInterpolationMode.HighQuality) + { + throw new NotImplementedException(); + } + + public IWriteableBitmapImpl LoadWriteableBitmap(string fileName) + { + throw new NotImplementedException(); + } + + public IWriteableBitmapImpl LoadWriteableBitmap(Stream stream) + { + throw new NotImplementedException(); + } + public IBitmapImpl LoadBitmap(string fileName) { return Mock.Of(); From f9173594aeb884f19af3ffc80694950c0dede021 Mon Sep 17 00:00:00 2001 From: Dan Walmsley Date: Mon, 19 Apr 2021 20:39:11 +0100 Subject: [PATCH 03/59] add api diff. --- src/Avalonia.Controls/ApiCompatBaseline.txt | 2 +- src/Avalonia.Visuals/ApiCompatBaseline.txt | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/Avalonia.Controls/ApiCompatBaseline.txt b/src/Avalonia.Controls/ApiCompatBaseline.txt index 3a6810eed9..613858056c 100644 --- a/src/Avalonia.Controls/ApiCompatBaseline.txt +++ b/src/Avalonia.Controls/ApiCompatBaseline.txt @@ -7,4 +7,4 @@ EnumValuesMustMatch : Enum value 'Avalonia.Platform.ExtendClientAreaChromeHints InterfacesShouldHaveSameMembers : Interface member 'public void Avalonia.Platform.ITopLevelImpl.SetCursor(Avalonia.Platform.ICursorImpl)' is present in the implementation but not in the contract. InterfacesShouldHaveSameMembers : Interface member 'public void Avalonia.Platform.ITopLevelImpl.SetCursor(Avalonia.Platform.IPlatformHandle)' is present in the contract but not in the implementation. MembersMustExist : Member 'public void Avalonia.Platform.ITopLevelImpl.SetCursor(Avalonia.Platform.IPlatformHandle)' does not exist in the implementation but it does exist in the contract. -Total Issues: 7 +Total Issues: 8 diff --git a/src/Avalonia.Visuals/ApiCompatBaseline.txt b/src/Avalonia.Visuals/ApiCompatBaseline.txt index 805d1955ea..a39a8600eb 100644 --- a/src/Avalonia.Visuals/ApiCompatBaseline.txt +++ b/src/Avalonia.Visuals/ApiCompatBaseline.txt @@ -6,4 +6,8 @@ InterfacesShouldHaveSameMembers : Interface member 'public System.Double Avaloni InterfacesShouldHaveSameMembers : Interface member 'public System.Boolean Avalonia.Platform.IGeometryImpl.TryGetPointAndTangentAtDistance(System.Double, Avalonia.Point, Avalonia.Point)' is present in the implementation but not in the contract. InterfacesShouldHaveSameMembers : Interface member 'public System.Boolean Avalonia.Platform.IGeometryImpl.TryGetPointAtDistance(System.Double, Avalonia.Point)' is present in the implementation but not in the contract. InterfacesShouldHaveSameMembers : Interface member 'public System.Boolean Avalonia.Platform.IGeometryImpl.TryGetSegment(System.Double, System.Double, System.Boolean, Avalonia.Platform.IGeometryImpl)' is present in the implementation but not in the contract. -Total Issues: 7 +InterfacesShouldHaveSameMembers : Interface member 'public Avalonia.Platform.IWriteableBitmapImpl Avalonia.Platform.IPlatformRenderInterface.LoadWriteableBitmap(System.IO.Stream)' is present in the implementation but not in the contract. +InterfacesShouldHaveSameMembers : Interface member 'public Avalonia.Platform.IWriteableBitmapImpl Avalonia.Platform.IPlatformRenderInterface.LoadWriteableBitmap(System.String)' is present in the implementation but not in the contract. +InterfacesShouldHaveSameMembers : Interface member 'public Avalonia.Platform.IWriteableBitmapImpl Avalonia.Platform.IPlatformRenderInterface.LoadWriteableBitmapToHeight(System.IO.Stream, System.Int32, Avalonia.Visuals.Media.Imaging.BitmapInterpolationMode)' is present in the implementation but not in the contract. +InterfacesShouldHaveSameMembers : Interface member 'public Avalonia.Platform.IWriteableBitmapImpl Avalonia.Platform.IPlatformRenderInterface.LoadWriteableBitmapToWidth(System.IO.Stream, System.Int32, Avalonia.Visuals.Media.Imaging.BitmapInterpolationMode)' is present in the implementation but not in the contract. +Total Issues: 11 From 79d96ca891fdc38be519255a5985f71354c65c67 Mon Sep 17 00:00:00 2001 From: Dan Walmsley Date: Mon, 19 Apr 2021 20:45:35 +0100 Subject: [PATCH 04/59] implement missing stubs. --- .../NullRenderingPlatform.cs | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/tests/Avalonia.Benchmarks/NullRenderingPlatform.cs b/tests/Avalonia.Benchmarks/NullRenderingPlatform.cs index 1570205456..eb5c031fd1 100644 --- a/tests/Avalonia.Benchmarks/NullRenderingPlatform.cs +++ b/tests/Avalonia.Benchmarks/NullRenderingPlatform.cs @@ -61,6 +61,28 @@ namespace Avalonia.Benchmarks throw new NotImplementedException(); } + public IWriteableBitmapImpl LoadWriteableBitmapToWidth(Stream stream, int width, + BitmapInterpolationMode interpolationMode = BitmapInterpolationMode.HighQuality) + { + throw new NotImplementedException(); + } + + public IWriteableBitmapImpl LoadWriteableBitmapToHeight(Stream stream, int height, + BitmapInterpolationMode interpolationMode = BitmapInterpolationMode.HighQuality) + { + throw new NotImplementedException(); + } + + public IWriteableBitmapImpl LoadWriteableBitmap(string fileName) + { + throw new NotImplementedException(); + } + + public IWriteableBitmapImpl LoadWriteableBitmap(Stream stream) + { + throw new NotImplementedException(); + } + public IBitmapImpl LoadBitmap(PixelFormat format, AlphaFormat alphaFormat, IntPtr data, PixelSize size, Vector dpi, int stride) { throw new NotImplementedException(); From 57cbf67879dc8db19f440846679cce249efddf99 Mon Sep 17 00:00:00 2001 From: Dan Walmsley Date: Mon, 19 Apr 2021 20:46:46 +0100 Subject: [PATCH 05/59] more missing stubs. --- .../VisualTree/MockRenderInterface.cs | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/tests/Avalonia.Visuals.UnitTests/VisualTree/MockRenderInterface.cs b/tests/Avalonia.Visuals.UnitTests/VisualTree/MockRenderInterface.cs index 6d0683e699..6ce7f16d40 100644 --- a/tests/Avalonia.Visuals.UnitTests/VisualTree/MockRenderInterface.cs +++ b/tests/Avalonia.Visuals.UnitTests/VisualTree/MockRenderInterface.cs @@ -42,6 +42,28 @@ namespace Avalonia.Visuals.UnitTests.VisualTree throw new NotImplementedException(); } + public IWriteableBitmapImpl LoadWriteableBitmapToWidth(Stream stream, int width, + BitmapInterpolationMode interpolationMode = BitmapInterpolationMode.HighQuality) + { + throw new NotImplementedException(); + } + + public IWriteableBitmapImpl LoadWriteableBitmapToHeight(Stream stream, int height, + BitmapInterpolationMode interpolationMode = BitmapInterpolationMode.HighQuality) + { + throw new NotImplementedException(); + } + + public IWriteableBitmapImpl LoadWriteableBitmap(string fileName) + { + throw new NotImplementedException(); + } + + public IWriteableBitmapImpl LoadWriteableBitmap(Stream stream) + { + throw new NotImplementedException(); + } + public IBitmapImpl LoadBitmap(string fileName) { throw new NotImplementedException(); From d068e1b4fa0d2a94236b4ea659e9ba71a0b60ccf Mon Sep 17 00:00:00 2001 From: amwx Date: Sun, 2 May 2021 18:27:57 -0500 Subject: [PATCH 06/59] Clean fluent light --- .../Accents/AccentColors.xaml | 15 ++ src/Avalonia.Themes.Fluent/Accents/Base.xaml | 8 + .../Accents/BaseLight.xaml | 58 ++++- .../Accents/FluentBaseLight.xaml | 82 +++--- .../Accents/FluentControlResourcesLight.xaml | 242 ++++++++++++------ src/Avalonia.Themes.Fluent/FluentLight.xaml | 1 + 6 files changed, 260 insertions(+), 146 deletions(-) create mode 100644 src/Avalonia.Themes.Fluent/Accents/AccentColors.xaml diff --git a/src/Avalonia.Themes.Fluent/Accents/AccentColors.xaml b/src/Avalonia.Themes.Fluent/Accents/AccentColors.xaml new file mode 100644 index 0000000000..1cf2f7e43d --- /dev/null +++ b/src/Avalonia.Themes.Fluent/Accents/AccentColors.xaml @@ -0,0 +1,15 @@ + diff --git a/src/Avalonia.Themes.Fluent/Accents/Base.xaml b/src/Avalonia.Themes.Fluent/Accents/Base.xaml index 0e34eb3f3b..8597c76998 100644 --- a/src/Avalonia.Themes.Fluent/Accents/Base.xaml +++ b/src/Avalonia.Themes.Fluent/Accents/Base.xaml @@ -22,5 +22,13 @@ 10,6,6,5 20 20 + + + 3 + 5 + + + scaleX(0.125) translateX(-2px) + scaleY(0.125) translateY(-2px) diff --git a/src/Avalonia.Themes.Fluent/Accents/BaseLight.xaml b/src/Avalonia.Themes.Fluent/Accents/BaseLight.xaml index 6c8d16ddfa..d25d437e03 100644 --- a/src/Avalonia.Themes.Fluent/Accents/BaseLight.xaml +++ b/src/Avalonia.Themes.Fluent/Accents/BaseLight.xaml @@ -2,16 +2,6 @@ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:sys="clr-namespace:System;assembly=netstandard"> - - - #FF0078D7 - #FF005A9E - #FF004275 - #FF002642 - #FF429CE3 - #FF76B9ED - #FFA6D8FF - #FFFFFFFF #33FFFFFF @@ -40,6 +30,9 @@ #33000000 #C50500 + #17000000 + #2E000000 + @@ -135,7 +128,7 @@ - + @@ -150,9 +143,48 @@ - False + + + + + + + + + + + #FFFFFFFF + + + + 374 + 0,2,0,2 + 1 + -1,0,-1,0 + 32 + 64 + 456 + 0 + 1 + 0 + + 12,11,12,12 + 96 + 40 + 758 + + + 0 + + + 0,4,0,4 + + 12,0,12,0 + + + diff --git a/src/Avalonia.Themes.Fluent/Accents/FluentBaseLight.xaml b/src/Avalonia.Themes.Fluent/Accents/FluentBaseLight.xaml index ad23955776..7e048fe029 100644 --- a/src/Avalonia.Themes.Fluent/Accents/FluentBaseLight.xaml +++ b/src/Avalonia.Themes.Fluent/Accents/FluentBaseLight.xaml @@ -2,20 +2,9 @@ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:sys="clr-namespace:System;assembly=netstandard"> - #17000000 - #2E000000 - - - - - - - - 3 - 5 - + - 1,1,1,1 + - - #FFFFFFFF - - + - + - + - + - 0 + - + - + - + - + - + - + - 12 + - XamlAutoFontFamily + - + - + - + diff --git a/src/Avalonia.Themes.Fluent/Accents/FluentControlResourcesLight.xaml b/src/Avalonia.Themes.Fluent/Accents/FluentControlResourcesLight.xaml index 5af24f57a8..e569b2a825 100644 --- a/src/Avalonia.Themes.Fluent/Accents/FluentControlResourcesLight.xaml +++ b/src/Avalonia.Themes.Fluent/Accents/FluentControlResourcesLight.xaml @@ -28,6 +28,7 @@ + - 1 @@ -53,6 +53,8 @@ + + 1 @@ -100,6 +103,7 @@ + - 21 - 64 - 80 - 240 + 64 1 - 1 - 0,0,0,4 - 2 - 11,5,11,7 - 11,11,11,13 - 11,11,11,13 + 1 + 11,5,11,7 Normal - SemiLight - @@ -147,16 +142,13 @@ - - - @@ -182,10 +174,26 @@ - + 0 + 0,4,0,4 + + 0 + - 0.6 + --> + + 4 0 + 1 @@ -276,7 +284,6 @@ - @@ -286,8 +293,46 @@ 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1 - 0 @@ -361,7 +401,7 @@ - + @@ -393,6 +433,10 @@ + + - @@ -417,12 +460,9 @@ - - - @@ -430,11 +470,16 @@ - + @@ -482,6 +527,7 @@ + 4 2 0 - 0,0,0,4 Normal @@ -525,6 +570,8 @@ + 0 1 - - - - @@ -583,6 +626,13 @@ + + 12 @@ -613,16 +663,16 @@ + 8,5,8,7 + - @@ -631,17 +681,14 @@ - - - @@ -651,7 +698,13 @@ - + + + @@ -665,30 +718,35 @@ - - + + - XamlAutoFontFamily 24 - 40 - -25 12,0,12,0 12,0,12,0 SemiLight + + + @@ -704,23 +762,20 @@ - + + 0 - 1 - - - - @@ -729,18 +784,29 @@ - - - - + + + 16 + 8 + + + @@ -794,11 +857,15 @@ - - - 1 32 + + + + @@ -810,7 +877,12 @@ - + + + + + + diff --git a/src/Avalonia.Themes.Fluent/FluentLight.xaml b/src/Avalonia.Themes.Fluent/FluentLight.xaml index 1bc51f655e..31cff6def1 100644 --- a/src/Avalonia.Themes.Fluent/FluentLight.xaml +++ b/src/Avalonia.Themes.Fluent/FluentLight.xaml @@ -1,6 +1,7 @@ + From 7ff30a7d2b57ad6cc29fb871af2959a3c959c324 Mon Sep 17 00:00:00 2001 From: amwx Date: Sun, 2 May 2021 18:28:20 -0500 Subject: [PATCH 07/59] Clean fluent dark --- .../Accents/BaseDark.xaml | 70 +++-- .../Accents/FluentBaseDark.xaml | 84 +++--- .../Accents/FluentControlResourcesDark.xaml | 268 +++++++++++------- src/Avalonia.Themes.Fluent/FluentDark.xaml | 3 +- 4 files changed, 253 insertions(+), 172 deletions(-) diff --git a/src/Avalonia.Themes.Fluent/Accents/BaseDark.xaml b/src/Avalonia.Themes.Fluent/Accents/BaseDark.xaml index fb08b97b47..4c2022e2ce 100644 --- a/src/Avalonia.Themes.Fluent/Accents/BaseDark.xaml +++ b/src/Avalonia.Themes.Fluent/Accents/BaseDark.xaml @@ -2,16 +2,6 @@ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:sys="clr-namespace:System;assembly=netstandard"> - - - #FF0078D7 - #FF005A9E - #FF004275 - #FF002642 - #FF429CE3 - #FF76B9ED - #FFA6D8FF - #FF000000 #33000000 @@ -40,6 +30,9 @@ #33FFFFFF #FFF000 + #18FFFFFF + #30FFFFFF + @@ -135,7 +128,7 @@ - + @@ -150,10 +143,45 @@ - False + + + + + + + + + #FF000000 + + + 374 + 0,2,0,2 + 1 + -1,0,-1,0 + 32 + 64 + 456 + 0 + 1 + 0 + 12,11,12,12 + 96 + 40 + 758 + + + 0 + + 0,4,0,4 + + + 12,0,12,0 + + + diff --git a/src/Avalonia.Themes.Fluent/Accents/FluentBaseDark.xaml b/src/Avalonia.Themes.Fluent/Accents/FluentBaseDark.xaml index 1c65911593..b4d4d93dc4 100644 --- a/src/Avalonia.Themes.Fluent/Accents/FluentBaseDark.xaml +++ b/src/Avalonia.Themes.Fluent/Accents/FluentBaseDark.xaml @@ -2,20 +2,9 @@ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:sys="clr-namespace:System;assembly=netstandard"> - #18FFFFFF - #30FFFFFF - - - - - - - - 3 - 5 - + - 1,1,1,1 + + - #FF000000 - - + - + - + - + - 0 + + - + - + - + - + - + - + - 12 + - XamlAutoFontFamily + + - + - + - + diff --git a/src/Avalonia.Themes.Fluent/Accents/FluentControlResourcesDark.xaml b/src/Avalonia.Themes.Fluent/Accents/FluentControlResourcesDark.xaml index ae1fe42031..81ce7dfe1b 100644 --- a/src/Avalonia.Themes.Fluent/Accents/FluentControlResourcesDark.xaml +++ b/src/Avalonia.Themes.Fluent/Accents/FluentControlResourcesDark.xaml @@ -28,6 +28,7 @@ + - - 1 + @@ -53,6 +53,8 @@ + 1 @@ -101,6 +103,7 @@ + - 21 64 - 80 - 240 1 1 - 0,0,0,4 - 2 11,5,11,7 - 11,11,11,13 - 11,11,11,13 - Normal - SemiLight + Normal - - + @@ -147,17 +141,14 @@ - - + - - + - - + @@ -182,11 +173,32 @@ - - + + 0 + 0,4,0,4 + + 0 + + + + 4 + 0 + 1 @@ -268,8 +283,7 @@ - - + @@ -279,17 +293,45 @@ 1 - - - 0.6 - 4 - 0 - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1 - 0 @@ -363,7 +400,7 @@ - + @@ -395,6 +432,10 @@ + + - @@ -419,12 +459,9 @@ - - - @@ -432,12 +469,17 @@ - - + + @@ -484,6 +526,7 @@ + 4 2 0 - 0,0,0,4 Normal @@ -527,6 +569,8 @@ + 0 1 - - - - @@ -585,6 +625,13 @@ + + 12 @@ -615,16 +662,16 @@ + 8,5,8,7 + - @@ -633,17 +680,14 @@ - - - @@ -654,6 +698,12 @@ + + @@ -667,30 +717,35 @@ - - + + - XamlAutoFontFamily 24 - 40 - -25 12,0,12,0 12,0,12,0 SemiLight - + + + @@ -705,24 +760,21 @@ - - + + + 0 - 1 - - - - @@ -731,20 +783,29 @@ - - - - + 16 + 8 + + + @@ -796,11 +856,14 @@ - - - 1 32 + + + @@ -812,7 +875,10 @@ - + + + + diff --git a/src/Avalonia.Themes.Fluent/FluentDark.xaml b/src/Avalonia.Themes.Fluent/FluentDark.xaml index 74b583a240..dbd25f5a1d 100644 --- a/src/Avalonia.Themes.Fluent/FluentDark.xaml +++ b/src/Avalonia.Themes.Fluent/FluentDark.xaml @@ -1,6 +1,7 @@ + xmlns:sys="clr-namespace:System;assembly=netstandard"> + From d0865f36d7b33a503787ef9b572e5c3304b33759 Mon Sep 17 00:00:00 2001 From: amwx Date: Sun, 2 May 2021 18:28:38 -0500 Subject: [PATCH 08/59] Various controls --- src/Avalonia.Themes.Fluent/Controls/ContextMenu.xaml | 8 +++++++- .../Controls/EmbeddableControlRoot.xaml | 2 +- src/Avalonia.Themes.Fluent/Controls/FlyoutPresenter.xaml | 1 - src/Avalonia.Themes.Fluent/Controls/Menu.xaml | 1 - src/Avalonia.Themes.Fluent/Controls/MenuItem.xaml | 3 +-- src/Avalonia.Themes.Fluent/Controls/Window.xaml | 2 +- 6 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/Avalonia.Themes.Fluent/Controls/ContextMenu.xaml b/src/Avalonia.Themes.Fluent/Controls/ContextMenu.xaml index a4e716c7f6..5110d70a80 100644 --- a/src/Avalonia.Themes.Fluent/Controls/ContextMenu.xaml +++ b/src/Avalonia.Themes.Fluent/Controls/ContextMenu.xaml @@ -1,4 +1,5 @@ - - + x:Class="Avalonia.Diagnostics.Views.EventsPageView" + Margin="2"> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +