committed by
GitHub
140 changed files with 1460 additions and 862 deletions
@ -0,0 +1,32 @@ |
|||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
|||
<ItemGroup> |
|||
<InternalsVisibleTo Include="AvaloniaUI.Xpf.WinApiShim, PublicKey=0024000004800000940000000602000000240000525341310004000001000100a7f4b8b7db0bfb8d74992dc94ecafae031019197ff4263d87ac0a5835fab101c973ccab6fa6e7d90e8f987374f7c6de18dd0b5cd7d6c41e574a8bc66b64836b7c7e707e1aa393d27e33a08f372c1c9965be81658937c85698f4a1c0f73be68a61ffce06d49d1366bf18464c20a29859ccf105fc2d5e35c7ae68919eab668bf8e" /> |
|||
<InternalsVisibleTo Include="System.Windows.Forms, PublicKey=00000000000000000400000000000000" /> |
|||
<InternalsVisibleTo Include="System.Windows.Forms.Primitives, PublicKey=00000000000000000400000000000000" /> |
|||
<InternalsVisibleTo Include="PresentationFramework-SystemData, PublicKey=00000000000000000400000000000000" /> |
|||
<InternalsVisibleTo Include="PresentationFramework.Aero, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9" /> |
|||
<InternalsVisibleTo Include="System.Xaml, PublicKey=00000000000000000400000000000000" /> |
|||
<InternalsVisibleTo Include="PresentationFramework, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9" /> |
|||
<InternalsVisibleTo Include="PresentationFramework-SystemDrawing, PublicKey=00000000000000000400000000000000" /> |
|||
<InternalsVisibleTo Include="PresentationFramework-SystemCore, PublicKey=00000000000000000400000000000000" /> |
|||
<InternalsVisibleTo Include="WindowsFormsIntegration, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9" /> |
|||
<InternalsVisibleTo Include="PresentationFramework.AeroLite, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9" /> |
|||
<InternalsVisibleTo Include="PresentationFramework.Aero2, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9" /> |
|||
<InternalsVisibleTo Include="UIAutomationClient, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9" /> |
|||
<InternalsVisibleTo Include="PresentationFramework.Luna, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9" /> |
|||
<InternalsVisibleTo Include="UIAutomationTypes, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9" /> |
|||
<InternalsVisibleTo Include="PresentationFramework.Royale, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9" /> |
|||
<InternalsVisibleTo Include="System.Windows.Input.Manipulations, PublicKey=00000000000000000400000000000000" /> |
|||
<InternalsVisibleTo Include="System.Windows.Controls.Ribbon, PublicKey=00000000000000000400000000000000" /> |
|||
<InternalsVisibleTo Include="PresentationFramework-SystemXml, PublicKey=00000000000000000400000000000000" /> |
|||
<InternalsVisibleTo Include="ReachFramework, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9" /> |
|||
<InternalsVisibleTo Include="System.Printing, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9" /> |
|||
<InternalsVisibleTo Include="PresentationFramework-SystemXmlLinq, PublicKey=00000000000000000400000000000000" /> |
|||
<InternalsVisibleTo Include="PresentationUI, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9" /> |
|||
<InternalsVisibleTo Include="Atlantis, PublicKey=0024000004800000940000000602000000240000525341310004000001000100a7f4b8b7db0bfb8d74992dc94ecafae031019197ff4263d87ac0a5835fab101c973ccab6fa6e7d90e8f987374f7c6de18dd0b5cd7d6c41e574a8bc66b64836b7c7e707e1aa393d27e33a08f372c1c9965be81658937c85698f4a1c0f73be68a61ffce06d49d1366bf18464c20a29859ccf105fc2d5e35c7ae68919eab668bf8e" /> |
|||
<InternalsVisibleTo Include="WindowsBase, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9" /> |
|||
<InternalsVisibleTo Include="PresentationFramework.Classic, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9" /> |
|||
<InternalsVisibleTo Include="UIAutomationProvider, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9" /> |
|||
<InternalsVisibleTo Include="PresentationCore, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9" /> |
|||
</ItemGroup> |
|||
</Project> |
|||
@ -0,0 +1,10 @@ |
|||
namespace Avalonia.Media |
|||
{ |
|||
public enum EdgeMode : byte |
|||
{ |
|||
Unspecified, |
|||
|
|||
Antialias, |
|||
Aliased |
|||
} |
|||
} |
|||
@ -1,36 +1,131 @@ |
|||
using Avalonia.Media.Imaging; |
|||
|
|||
namespace Avalonia.Media |
|||
{ |
|||
public class RenderOptions |
|||
{ |
|||
public readonly record struct RenderOptions |
|||
{ |
|||
public BitmapInterpolationMode BitmapInterpolationMode { get; init; } |
|||
public EdgeMode EdgeMode { get; init; } |
|||
public TextRenderingMode TextRenderingMode { get; init; } |
|||
public BitmapBlendingMode BitmapBlendingMode { get; init; } |
|||
|
|||
/// <summary>
|
|||
/// Gets the value of the BitmapInterpolationMode attached property for a visual.
|
|||
/// </summary>
|
|||
/// <param name="visual">The control.</param>
|
|||
/// <returns>The control's left coordinate.</returns>
|
|||
public static BitmapInterpolationMode GetBitmapInterpolationMode(Visual visual) |
|||
{ |
|||
return visual.RenderOptions.BitmapInterpolationMode; |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Defines the <see cref="BitmapInterpolationMode"/> property.
|
|||
/// Sets the value of the BitmapInterpolationMode attached property for a visual.
|
|||
/// </summary>
|
|||
public static readonly StyledProperty<BitmapInterpolationMode> BitmapInterpolationModeProperty = |
|||
AvaloniaProperty.RegisterAttached<RenderOptions, AvaloniaObject, BitmapInterpolationMode>( |
|||
"BitmapInterpolationMode", |
|||
BitmapInterpolationMode.MediumQuality, |
|||
inherits: true); |
|||
/// <param name="visual">The control.</param>
|
|||
/// <param name="value">The left value.</param>
|
|||
public static void SetBitmapInterpolationMode(Visual visual, BitmapInterpolationMode value) |
|||
{ |
|||
visual.RenderOptions = visual.RenderOptions with { BitmapInterpolationMode = value }; |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Gets the value of the BitmapInterpolationMode attached property for a control.
|
|||
/// Gets the value of the BitmapBlendingMode attached property for a visual.
|
|||
/// </summary>
|
|||
/// <param name="element">The control.</param>
|
|||
/// <param name="visual">The control.</param>
|
|||
/// <returns>The control's left coordinate.</returns>
|
|||
public static BitmapInterpolationMode GetBitmapInterpolationMode(AvaloniaObject element) |
|||
public static BitmapBlendingMode GetBitmapBlendingMode(Visual visual) |
|||
{ |
|||
return element.GetValue(BitmapInterpolationModeProperty); |
|||
return visual.RenderOptions.BitmapBlendingMode; |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Sets the value of the BitmapInterpolationMode attached property for a control.
|
|||
/// Sets the value of the BitmapBlendingMode attached property for a visual.
|
|||
/// </summary>
|
|||
/// <param name="element">The control.</param>
|
|||
/// <param name="visual">The control.</param>
|
|||
/// <param name="value">The left value.</param>
|
|||
public static void SetBitmapInterpolationMode(AvaloniaObject element, BitmapInterpolationMode value) |
|||
public static void SetBitmapBlendingMode(Visual visual, BitmapBlendingMode value) |
|||
{ |
|||
element.SetValue(BitmapInterpolationModeProperty, value); |
|||
visual.RenderOptions = visual.RenderOptions with { BitmapBlendingMode = value }; |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Gets the value of the EdgeMode attached property for a visual.
|
|||
/// </summary>
|
|||
/// <param name="visual">The control.</param>
|
|||
/// <returns>The control's left coordinate.</returns>
|
|||
public static EdgeMode GetEdgeMode(Visual visual) |
|||
{ |
|||
return visual.RenderOptions.EdgeMode; |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Sets the value of the EdgeMode attached property for a visual.
|
|||
/// </summary>
|
|||
/// <param name="visual">The control.</param>
|
|||
/// <param name="value">The left value.</param>
|
|||
public static void SetEdgeMode(Visual visual, EdgeMode value) |
|||
{ |
|||
visual.RenderOptions = visual.RenderOptions with { EdgeMode = value }; |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Gets the value of the TextRenderingMode attached property for a visual.
|
|||
/// </summary>
|
|||
/// <param name="visual">The control.</param>
|
|||
/// <returns>The control's left coordinate.</returns>
|
|||
public static TextRenderingMode GetTextRenderingMode(Visual visual) |
|||
{ |
|||
return visual.RenderOptions.TextRenderingMode; |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Sets the value of the TextRenderingMode attached property for a visual.
|
|||
/// </summary>
|
|||
/// <param name="visual">The control.</param>
|
|||
/// <param name="value">The left value.</param>
|
|||
public static void SetTextRenderingMode(Visual visual, TextRenderingMode value) |
|||
{ |
|||
visual.RenderOptions = visual.RenderOptions with { TextRenderingMode = value }; |
|||
} |
|||
|
|||
public RenderOptions MergeWith(RenderOptions other) |
|||
{ |
|||
var bitmapInterpolationMode = BitmapInterpolationMode; |
|||
|
|||
if (bitmapInterpolationMode == BitmapInterpolationMode.Unspecified) |
|||
{ |
|||
bitmapInterpolationMode = other.BitmapInterpolationMode; |
|||
} |
|||
|
|||
var edgeMode = EdgeMode; |
|||
|
|||
if (edgeMode == EdgeMode.Unspecified) |
|||
{ |
|||
edgeMode = other.EdgeMode; |
|||
} |
|||
|
|||
var textRenderingMode = TextRenderingMode; |
|||
|
|||
if (textRenderingMode == TextRenderingMode.Unspecified) |
|||
{ |
|||
textRenderingMode = other.TextRenderingMode; |
|||
} |
|||
|
|||
var bitmapBlendingMode = BitmapBlendingMode; |
|||
|
|||
if (bitmapBlendingMode == BitmapBlendingMode.Unspecified) |
|||
{ |
|||
bitmapBlendingMode = other.BitmapBlendingMode; |
|||
} |
|||
|
|||
return new RenderOptions |
|||
{ |
|||
BitmapInterpolationMode = bitmapInterpolationMode, |
|||
EdgeMode = edgeMode, |
|||
TextRenderingMode = textRenderingMode, |
|||
BitmapBlendingMode = bitmapBlendingMode |
|||
}; |
|||
} |
|||
} |
|||
} |
|||
|
|||
@ -0,0 +1,11 @@ |
|||
namespace Avalonia.Media |
|||
{ |
|||
public enum TextRenderingMode : byte |
|||
{ |
|||
Unspecified, |
|||
|
|||
SubpixelAntialias, |
|||
Antialias, |
|||
Alias |
|||
} |
|||
} |
|||
@ -1,22 +0,0 @@ |
|||
using System; |
|||
using System.Drawing; |
|||
|
|||
namespace Avalonia.Platform |
|||
{ |
|||
public interface IGlyphRunBuffer |
|||
{ |
|||
Span<ushort> GlyphIndices { get; } |
|||
|
|||
IGlyphRunImpl Build(); |
|||
} |
|||
|
|||
public interface IHorizontalGlyphRunBuffer : IGlyphRunBuffer |
|||
{ |
|||
Span<float> GlyphPositions { get; } |
|||
} |
|||
|
|||
public interface IPositionedGlyphRunBuffer : IGlyphRunBuffer |
|||
{ |
|||
Span<PointF> GlyphPositions { get; } |
|||
} |
|||
} |
|||
@ -1,68 +0,0 @@ |
|||
using Avalonia.Platform; |
|||
using Avalonia.Media.Imaging; |
|||
|
|||
namespace Avalonia.Rendering.SceneGraph |
|||
{ |
|||
/// <summary>
|
|||
/// A node in the scene graph which represents an bitmap blending mode push or pop.
|
|||
/// </summary>
|
|||
internal class BitmapBlendModeNode : IDrawOperation |
|||
{ |
|||
/// <summary>
|
|||
/// Initializes a new instance of the <see cref="BitmapBlendModeNode"/> class that represents an
|
|||
/// <see cref="BitmapBlendingMode"/> push.
|
|||
/// </summary>
|
|||
/// <param name="bitmapBlend">The <see cref="BitmapBlendingMode"/> to push.</param>
|
|||
public BitmapBlendModeNode(BitmapBlendingMode bitmapBlend) |
|||
{ |
|||
BlendingMode = bitmapBlend; |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Initializes a new instance of the <see cref="BitmapBlendModeNode"/> class that represents an
|
|||
/// <see cref="BitmapBlendingMode"/> pop.
|
|||
/// </summary>
|
|||
public BitmapBlendModeNode() |
|||
{ |
|||
} |
|||
|
|||
/// <inheritdoc/>
|
|||
public Rect Bounds => default; |
|||
|
|||
/// <summary>
|
|||
/// Gets the BitmapBlend to be pushed or null if the operation represents a pop.
|
|||
/// </summary>
|
|||
public BitmapBlendingMode? BlendingMode { get; } |
|||
|
|||
/// <inheritdoc/>
|
|||
public bool HitTest(Point p) => false; |
|||
|
|||
/// <summary>
|
|||
/// Determines if this draw operation equals another.
|
|||
/// </summary>
|
|||
/// <param name="blendingMode">the <see cref="BitmapBlendModeNode"/> how to compare</param>
|
|||
/// <returns>True if the draw operations are the same, otherwise false.</returns>
|
|||
/// <remarks>
|
|||
/// The properties of the other draw operation are passed in as arguments to prevent
|
|||
/// allocation of a not-yet-constructed draw operation object.
|
|||
/// </remarks>
|
|||
public bool Equals(BitmapBlendingMode? blendingMode) => BlendingMode == blendingMode; |
|||
|
|||
/// <inheritdoc/>
|
|||
public void Render(IDrawingContextImpl context) |
|||
{ |
|||
if (BlendingMode.HasValue) |
|||
{ |
|||
context.PushBitmapBlendMode(BlendingMode.Value); |
|||
} |
|||
else |
|||
{ |
|||
context.PopBitmapBlendMode(); |
|||
} |
|||
} |
|||
|
|||
public void Dispose() |
|||
{ |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,31 @@ |
|||
using System.IO; |
|||
using Avalonia.Controls.Platform.Surfaces; |
|||
using Avalonia.Media.Imaging; |
|||
using Avalonia.Platform; |
|||
using SkiaSharp; |
|||
|
|||
namespace Avalonia.Skia; |
|||
|
|||
internal class RenderTargetBitmapImpl : WriteableBitmapImpl, |
|||
IRenderTargetBitmapImpl, |
|||
IFramebufferPlatformSurface |
|||
{ |
|||
private readonly FramebufferRenderTarget _renderTarget; |
|||
|
|||
public RenderTargetBitmapImpl(PixelSize size, Vector dpi) : base(size, dpi, |
|||
SKImageInfo.PlatformColorType == SKColorType.Rgba8888 ? PixelFormats.Rgba8888 : PixelFormat.Bgra8888, |
|||
AlphaFormat.Premul) |
|||
{ |
|||
_renderTarget = new FramebufferRenderTarget(this); |
|||
} |
|||
|
|||
public IDrawingContextImpl CreateDrawingContext() => _renderTarget.CreateDrawingContext(); |
|||
|
|||
public bool IsCorrupted => false; |
|||
|
|||
public override void Dispose() |
|||
{ |
|||
_renderTarget.Dispose(); |
|||
base.Dispose(); |
|||
} |
|||
} |
|||
Some files were not shown because too many files changed in this diff
Loading…
Reference in new issue