committed by
GitHub
138 changed files with 3638 additions and 1583 deletions
@ -1,5 +1,5 @@ |
|||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
|||
<ItemGroup> |
|||
<PackageReference Include="System.Reactive" Version="4.4.1" /> |
|||
<PackageReference Include="System.Reactive" Version="5.0" /> |
|||
</ItemGroup> |
|||
</Project> |
|||
|
|||
@ -0,0 +1,34 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Text; |
|||
|
|||
namespace Avalonia.Data.Core |
|||
{ |
|||
public class TypeCastNode : ExpressionNode |
|||
{ |
|||
public override string Description => $"as {TargetType.FullName}"; |
|||
|
|||
public Type TargetType { get; } |
|||
|
|||
public TypeCastNode(Type type) |
|||
{ |
|||
TargetType = type; |
|||
} |
|||
|
|||
protected virtual object Cast(object value) |
|||
{ |
|||
return TargetType.IsInstanceOfType(value) ? value : null; |
|||
} |
|||
|
|||
protected override void StartListeningCore(WeakReference<object> reference) |
|||
{ |
|||
if (reference.TryGetTarget(out object target)) |
|||
{ |
|||
target = Cast(target); |
|||
reference = target == null ? NullReference : new WeakReference<object>(target); |
|||
} |
|||
|
|||
base.StartListeningCore(reference); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,8 @@ |
|||
namespace Avalonia.Native |
|||
{ |
|||
internal static class Extensions |
|||
{ |
|||
public static int AsComBool(this bool b) => b ? 1 : 0; |
|||
public static bool FromComBool(this int b) => b != 0; |
|||
} |
|||
} |
|||
@ -0,0 +1,3 @@ |
|||
Compat issues with assembly Avalonia.Styling: |
|||
MembersMustExist : Member 'public System.IObservable<System.Object> Avalonia.Controls.ResourceNodeExtensions.GetResourceObservable(Avalonia.IStyledElement, System.Object, System.Func<System.Object, System.Object>)' does not exist in the implementation but it does exist in the contract. |
|||
Total Issues: 1 |
|||
@ -1,39 +1,5 @@ |
|||
Compat issues with assembly Avalonia.Visuals: |
|||
MembersMustExist : Member 'public void Avalonia.Media.DrawingContext.DrawGlyphRun(Avalonia.Media.IBrush, Avalonia.Media.GlyphRun, Avalonia.Point)' does not exist in the implementation but it does exist in the contract. |
|||
MembersMustExist : Member 'public Avalonia.Media.Typeface Avalonia.Media.FontManager.GetOrAddTypeface(Avalonia.Media.FontFamily, Avalonia.Media.FontStyle, Avalonia.Media.FontWeight)' does not exist in the implementation but it does exist in the contract. |
|||
MembersMustExist : Member 'public Avalonia.Media.Typeface Avalonia.Media.FontManager.MatchCharacter(System.Int32, Avalonia.Media.FontStyle, Avalonia.Media.FontWeight, Avalonia.Media.FontFamily, System.Globalization.CultureInfo)' does not exist in the implementation but it does exist in the contract. |
|||
MembersMustExist : Member 'public Avalonia.Rect Avalonia.Media.Geometry.GetRenderBounds(Avalonia.Media.Pen)' does not exist in the implementation but it does exist in the contract. |
|||
MembersMustExist : Member 'public System.Boolean Avalonia.Media.Geometry.StrokeContains(Avalonia.Media.Pen, Avalonia.Point)' does not exist in the implementation but it does exist in the contract. |
|||
MembersMustExist : Member 'public Avalonia.Rect Avalonia.Media.GlyphRun.Bounds.get()' does not exist in the implementation but it does exist in the contract. |
|||
MembersMustExist : Member 'public Avalonia.StyledProperty<Avalonia.Point> Avalonia.StyledProperty<Avalonia.Point> Avalonia.Media.GlyphRunDrawing.BaselineOriginProperty' does not exist in the implementation but it does exist in the contract. |
|||
MembersMustExist : Member 'public Avalonia.Point Avalonia.Media.GlyphRunDrawing.BaselineOrigin.get()' does not exist in the implementation but it does exist in the contract. |
|||
MembersMustExist : Member 'public void Avalonia.Media.GlyphRunDrawing.BaselineOrigin.set(Avalonia.Point)' does not exist in the implementation but it does exist in the contract. |
|||
CannotSealType : Type 'Avalonia.Media.Typeface' is actually (has the sealed modifier) sealed in the implementation but not sealed in the contract. |
|||
TypeCannotChangeClassification : Type 'Avalonia.Media.Typeface' is a 'struct' in the implementation but is a 'class' in the contract. |
|||
CannotMakeMemberNonVirtual : Member 'public System.Boolean Avalonia.Media.Typeface.Equals(System.Object)' is non-virtual in the implementation but is virtual in the contract. |
|||
CannotMakeMemberNonVirtual : Member 'public System.Int32 Avalonia.Media.Typeface.GetHashCode()' is non-virtual in the implementation but is virtual in the contract. |
|||
TypesMustExist : Type 'Avalonia.Media.Fonts.FontKey' does not exist in the implementation but it does exist in the contract. |
|||
CannotAddAbstractMembers : Member 'public Avalonia.Size Avalonia.Media.TextFormatting.DrawableTextRun.Size' is abstract in the implementation but is missing in the contract. |
|||
MembersMustExist : Member 'public Avalonia.Rect Avalonia.Media.TextFormatting.DrawableTextRun.Bounds.get()' does not exist in the implementation but it does exist in the contract. |
|||
CannotAddAbstractMembers : Member 'public void Avalonia.Media.TextFormatting.DrawableTextRun.Draw(Avalonia.Media.DrawingContext)' is abstract in the implementation but is missing in the contract. |
|||
MembersMustExist : Member 'public void Avalonia.Media.TextFormatting.DrawableTextRun.Draw(Avalonia.Media.DrawingContext, Avalonia.Point)' does not exist in the implementation but it does exist in the contract. |
|||
CannotAddAbstractMembers : Member 'public Avalonia.Size Avalonia.Media.TextFormatting.DrawableTextRun.Size.get()' is abstract in the implementation but is missing in the contract. |
|||
MembersMustExist : Member 'public Avalonia.Rect Avalonia.Media.TextFormatting.ShapedTextCharacters.Bounds.get()' does not exist in the implementation but it does exist in the contract. |
|||
MembersMustExist : Member 'public void Avalonia.Media.TextFormatting.ShapedTextCharacters.Draw(Avalonia.Media.DrawingContext, Avalonia.Point)' does not exist in the implementation but it does exist in the contract. |
|||
MembersMustExist : Member 'public void Avalonia.Media.TextFormatting.TextLayout.Draw(Avalonia.Media.DrawingContext, Avalonia.Point)' does not exist in the implementation but it does exist in the contract. |
|||
CannotAddAbstractMembers : Member 'public Avalonia.Media.TextFormatting.TextLineBreak Avalonia.Media.TextFormatting.TextLine.TextLineBreak' is abstract in the implementation but is missing in the contract. |
|||
CannotAddAbstractMembers : Member 'public void Avalonia.Media.TextFormatting.TextLine.Draw(Avalonia.Media.DrawingContext)' is abstract in the implementation but is missing in the contract. |
|||
MembersMustExist : Member 'public void Avalonia.Media.TextFormatting.TextLine.Draw(Avalonia.Media.DrawingContext, Avalonia.Point)' does not exist in the implementation but it does exist in the contract. |
|||
MembersMustExist : Member 'public Avalonia.Media.TextFormatting.TextLineBreak Avalonia.Media.TextFormatting.TextLine.LineBreak.get()' does not exist in the implementation but it does exist in the contract. |
|||
CannotAddAbstractMembers : Member 'public Avalonia.Media.TextFormatting.TextLineBreak Avalonia.Media.TextFormatting.TextLine.TextLineBreak.get()' is abstract in the implementation but is missing in the contract. |
|||
InterfacesShouldHaveSameMembers : Interface member 'public Avalonia.Platform.IDrawingContextLayerImpl Avalonia.Platform.IDrawingContextImpl.CreateLayer(Avalonia.Size)' is present in the implementation but not in the contract. |
|||
InterfacesShouldHaveSameMembers : Interface member 'public Avalonia.Platform.IRenderTargetBitmapImpl Avalonia.Platform.IDrawingContextImpl.CreateLayer(Avalonia.Size)' is present in the contract but not in the implementation. |
|||
MembersMustExist : Member 'public Avalonia.Platform.IRenderTargetBitmapImpl Avalonia.Platform.IDrawingContextImpl.CreateLayer(Avalonia.Size)' does not exist in the implementation but it does exist in the contract. |
|||
InterfacesShouldHaveSameMembers : Interface member 'public void Avalonia.Platform.IDrawingContextImpl.DrawGlyphRun(Avalonia.Media.IBrush, Avalonia.Media.GlyphRun)' is present in the implementation but not in the contract. |
|||
InterfacesShouldHaveSameMembers : Interface member 'public void Avalonia.Platform.IDrawingContextImpl.DrawGlyphRun(Avalonia.Media.IBrush, Avalonia.Media.GlyphRun, Avalonia.Point)' is present in the contract but not in the implementation. |
|||
MembersMustExist : Member 'public void Avalonia.Platform.IDrawingContextImpl.DrawGlyphRun(Avalonia.Media.IBrush, Avalonia.Media.GlyphRun, Avalonia.Point)' does not exist in the implementation but it does exist in the contract. |
|||
InterfacesShouldHaveSameMembers : Interface member 'public System.Boolean Avalonia.Platform.IFontManagerImpl.TryMatchCharacter(System.Int32, Avalonia.Media.FontStyle, Avalonia.Media.FontWeight, Avalonia.Media.FontFamily, System.Globalization.CultureInfo, Avalonia.Media.Fonts.FontKey)' is present in the contract but not in the implementation. |
|||
MembersMustExist : Member 'public System.Boolean Avalonia.Platform.IFontManagerImpl.TryMatchCharacter(System.Int32, Avalonia.Media.FontStyle, Avalonia.Media.FontWeight, Avalonia.Media.FontFamily, System.Globalization.CultureInfo, Avalonia.Media.Fonts.FontKey)' does not exist in the implementation but it does exist in the contract. |
|||
InterfacesShouldHaveSameMembers : Interface member 'public System.Boolean Avalonia.Platform.IFontManagerImpl.TryMatchCharacter(System.Int32, Avalonia.Media.FontStyle, Avalonia.Media.FontWeight, Avalonia.Media.FontFamily, System.Globalization.CultureInfo, Avalonia.Media.Typeface)' is present in the implementation but not in the contract. |
|||
MembersMustExist : Member 'public Avalonia.Utilities.IRef<Avalonia.Platform.IRenderTargetBitmapImpl> Avalonia.Rendering.RenderLayer.Bitmap.get()' does not exist in the implementation but it does exist in the contract. |
|||
Total Issues: 37 |
|||
MembersMustExist : Member 'public Avalonia.StyledProperty<System.Collections.Generic.IReadOnlyList<System.Double>> Avalonia.StyledProperty<System.Collections.Generic.IReadOnlyList<System.Double>> Avalonia.Media.DashStyle.DashesProperty' does not exist in the implementation but it does exist in the contract. |
|||
MembersMustExist : Member 'public System.Collections.Generic.IReadOnlyList<System.Double> Avalonia.Media.DashStyle.Dashes.get()' does not exist in the implementation but it does exist in the contract. |
|||
MembersMustExist : Member 'public void Avalonia.Media.DashStyle.Dashes.set(System.Collections.Generic.IReadOnlyList<System.Double>)' does not exist in the implementation but it does exist in the contract. |
|||
Total Issues: 3 |
|||
|
|||
@ -0,0 +1,39 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using Avalonia.Markup.Xaml.XamlIl.CompilerExtensions.Transformers; |
|||
using XamlX.Ast; |
|||
using XamlX.Emit; |
|||
using XamlX.IL; |
|||
using XamlX.TypeSystem; |
|||
|
|||
namespace Avalonia.Markup.Xaml.XamlIl.CompilerExtensions.AstNodes |
|||
{ |
|||
class AvaloniaXamlIlFontFamilyAstNode: XamlAstNode, IXamlAstValueNode, IXamlAstILEmitableNode |
|||
{ |
|||
private readonly AvaloniaXamlIlWellKnownTypes _types; |
|||
private readonly string _text; |
|||
|
|||
public IXamlAstTypeReference Type { get; } |
|||
|
|||
public AvaloniaXamlIlFontFamilyAstNode(AvaloniaXamlIlWellKnownTypes types, |
|||
string text, |
|||
IXamlLineInfo lineInfo) : base(lineInfo) |
|||
{ |
|||
_types = types; |
|||
_text = text; |
|||
Type = new XamlAstClrTypeReference(lineInfo, types.FontFamily, false); |
|||
} |
|||
|
|||
public XamlILNodeEmitResult Emit(XamlEmitContext<IXamlILEmitter, XamlILNodeEmitResult> context, IXamlILEmitter codeGen) |
|||
{ |
|||
codeGen |
|||
.Ldloc(context.ContextLocal) |
|||
.Castclass(context.Configuration.TypeMappings.UriContextProvider) |
|||
.EmitCall(context.Configuration.TypeMappings.UriContextProvider.FindMethod( |
|||
"get_BaseUri", _types.Uri, false)) |
|||
.Ldstr(_text) |
|||
.Newobj(_types.FontFamilyConstructorUriName); |
|||
return XamlILNodeEmitResult.Type(0, _types.FontFamily); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,34 @@ |
|||
using Avalonia.Controls; |
|||
using Avalonia.Markup.Xaml.XamlIl.CompilerExtensions.Transformers; |
|||
using XamlX.Ast; |
|||
using XamlX.Emit; |
|||
using XamlX.IL; |
|||
|
|||
namespace Avalonia.Markup.Xaml.XamlIl.CompilerExtensions.AstNodes |
|||
{ |
|||
class AvaloniaXamlIlGridLengthAstNode : XamlAstNode, IXamlAstValueNode, IXamlAstILEmitableNode |
|||
{ |
|||
private readonly AvaloniaXamlIlWellKnownTypes _types; |
|||
private readonly GridLength _gridLength; |
|||
|
|||
public AvaloniaXamlIlGridLengthAstNode(IXamlLineInfo lineInfo, AvaloniaXamlIlWellKnownTypes types, GridLength gridLength) : base(lineInfo) |
|||
{ |
|||
_types = types; |
|||
_gridLength = gridLength; |
|||
|
|||
Type = new XamlAstClrTypeReference(lineInfo, types.GridLength, false); |
|||
} |
|||
|
|||
public IXamlAstTypeReference Type { get; } |
|||
|
|||
public XamlILNodeEmitResult Emit(XamlEmitContext<IXamlILEmitter, XamlILNodeEmitResult> context, IXamlILEmitter codeGen) |
|||
{ |
|||
codeGen |
|||
.Ldc_R8(_gridLength.Value) |
|||
.Ldc_I4((int)_gridLength.GridUnitType) |
|||
.Newobj(_types.GridLengthConstructorValueType); |
|||
|
|||
return XamlILNodeEmitResult.Type(0, Type.GetClrType()); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,54 @@ |
|||
using Avalonia.Markup.Xaml.XamlIl.CompilerExtensions.Transformers; |
|||
using XamlX; |
|||
using XamlX.Ast; |
|||
using XamlX.Emit; |
|||
using XamlX.IL; |
|||
using XamlX.TypeSystem; |
|||
|
|||
namespace Avalonia.Markup.Xaml.XamlIl.CompilerExtensions.AstNodes |
|||
{ |
|||
class AvaloniaXamlIlVectorLikeConstantAstNode : XamlAstNode, IXamlAstValueNode, IXamlAstILEmitableNode |
|||
{ |
|||
private readonly IXamlConstructor _constructor; |
|||
private readonly double[] _values; |
|||
|
|||
public AvaloniaXamlIlVectorLikeConstantAstNode(IXamlLineInfo lineInfo, AvaloniaXamlIlWellKnownTypes types, IXamlType type, IXamlConstructor constructor, double[] values) : base(lineInfo) |
|||
{ |
|||
var parameters = constructor.Parameters; |
|||
|
|||
if (parameters.Count != values.Length) |
|||
{ |
|||
throw new XamlTypeSystemException($"Constructor that takes {values.Length} parameters is expected, got {parameters.Count} instead."); |
|||
} |
|||
|
|||
var elementType = types.XamlIlTypes.Double; |
|||
|
|||
foreach (var parameter in parameters) |
|||
{ |
|||
if (parameter != elementType) |
|||
{ |
|||
throw new XamlTypeSystemException($"Expected parameter of type {elementType}, got {parameter} instead."); |
|||
} |
|||
} |
|||
|
|||
_constructor = constructor; |
|||
_values = values; |
|||
|
|||
Type = new XamlAstClrTypeReference(lineInfo, type, false); |
|||
} |
|||
|
|||
public IXamlAstTypeReference Type { get; } |
|||
|
|||
public XamlILNodeEmitResult Emit(XamlEmitContext<IXamlILEmitter, XamlILNodeEmitResult> context, IXamlILEmitter codeGen) |
|||
{ |
|||
foreach (var value in _values) |
|||
{ |
|||
codeGen.Ldc_R8(value); |
|||
} |
|||
|
|||
codeGen.Newobj(_constructor); |
|||
|
|||
return XamlILNodeEmitResult.Type(0, Type.GetClrType()); |
|||
} |
|||
} |
|||
} |
|||
@ -1 +1 @@ |
|||
Subproject commit 5420df861ce6f2be5ead9efa078fe7242ce88f18 |
|||
Subproject commit ea80a607c5e9d8f000160dbbb48c27ed4cfafbc9 |
|||
@ -0,0 +1,18 @@ |
|||
using System; |
|||
using Avalonia.Data.Core; |
|||
|
|||
namespace Avalonia.Markup.Xaml.MarkupExtensions.CompiledBindings |
|||
{ |
|||
public class StrongTypeCastNode : TypeCastNode |
|||
{ |
|||
private Func<object, object> _cast; |
|||
|
|||
public StrongTypeCastNode(Type type, Func<object, object> cast) : base(type) |
|||
{ |
|||
_cast = cast; |
|||
} |
|||
|
|||
protected override object Cast(object value) |
|||
=> _cast(value); |
|||
} |
|||
} |
|||
@ -0,0 +1 @@ |
|||
*.Generated.cs |
|||
@ -1,18 +0,0 @@ |
|||
namespace Avalonia.Win32 |
|||
{ |
|||
internal class CompositionBlurHost : IBlurHost |
|||
{ |
|||
Windows.UI.Composition.Visual _blurVisual; |
|||
|
|||
public CompositionBlurHost(Windows.UI.Composition.Visual blurVisual) |
|||
{ |
|||
_blurVisual = blurVisual; |
|||
} |
|||
|
|||
public void SetBlur(bool enabled) |
|||
{ |
|||
_blurVisual.IsVisible = enabled; |
|||
} |
|||
} |
|||
} |
|||
|
|||
@ -1,171 +0,0 @@ |
|||
using System; |
|||
using System.Runtime.InteropServices; |
|||
using Avalonia.Logging; |
|||
using Avalonia.OpenGL; |
|||
using Avalonia.OpenGL.Angle; |
|||
using Avalonia.OpenGL.Egl; |
|||
using Windows.UI.Composition; |
|||
using Windows.UI.Composition.Interop; |
|||
using WinRT; |
|||
|
|||
namespace Avalonia.Win32 |
|||
{ |
|||
internal class CompositionConnector |
|||
{ |
|||
private Compositor _compositor; |
|||
private Windows.System.DispatcherQueueController _dispatcherQueueController; |
|||
private CompositionGraphicsDevice _graphicsDevice; |
|||
|
|||
internal enum DISPATCHERQUEUE_THREAD_APARTMENTTYPE |
|||
{ |
|||
DQTAT_COM_NONE = 0, |
|||
DQTAT_COM_ASTA = 1, |
|||
DQTAT_COM_STA = 2 |
|||
}; |
|||
|
|||
internal enum DISPATCHERQUEUE_THREAD_TYPE |
|||
{ |
|||
DQTYPE_THREAD_DEDICATED = 1, |
|||
DQTYPE_THREAD_CURRENT = 2, |
|||
}; |
|||
|
|||
[StructLayout(LayoutKind.Sequential)] |
|||
internal struct DispatcherQueueOptions |
|||
{ |
|||
public int dwSize; |
|||
|
|||
[MarshalAs(UnmanagedType.I4)] |
|||
public DISPATCHERQUEUE_THREAD_TYPE threadType; |
|||
|
|||
[MarshalAs(UnmanagedType.I4)] |
|||
public DISPATCHERQUEUE_THREAD_APARTMENTTYPE apartmentType; |
|||
}; |
|||
|
|||
[DllImport("coremessaging.dll", EntryPoint = "CreateDispatcherQueueController", CharSet = CharSet.Unicode)] |
|||
internal static extern IntPtr CreateDispatcherQueueController(DispatcherQueueOptions options, out IntPtr dispatcherQueueController); |
|||
|
|||
public static CompositionConnector TryCreate(EglPlatformOpenGlInterface egl) |
|||
{ |
|||
const int majorRequired = 10; |
|||
const int buildRequired = 16299; |
|||
|
|||
var majorInstalled = Win32Platform.WindowsVersion.Major; |
|||
var buildInstalled = Win32Platform.WindowsVersion.Build; |
|||
|
|||
if (majorInstalled >= majorRequired && |
|||
buildInstalled >= buildRequired) |
|||
{ |
|||
try |
|||
{ |
|||
return new CompositionConnector(egl); |
|||
} |
|||
catch (Exception e) |
|||
{ |
|||
Logger.TryGet(LogEventLevel.Error, "WinUIComposition")?.Log(null, "Unable to initialize WinUI compositor: {0}", e); |
|||
|
|||
return null; |
|||
} |
|||
} |
|||
|
|||
var osVersionNotice = $"Windows {majorRequired} Build {buildRequired} is required. Your machine has Windows {majorInstalled} Build {buildInstalled} installed."; |
|||
|
|||
Logger.TryGet(LogEventLevel.Warning, "WinUIComposition")?.Log(null, |
|||
$"Unable to initialize WinUI compositor: {osVersionNotice}"); |
|||
|
|||
return null; |
|||
} |
|||
|
|||
public CompositionConnector(EglPlatformOpenGlInterface egl) |
|||
{ |
|||
EnsureDispatcherQueue(); |
|||
|
|||
if (_dispatcherQueueController != null) |
|||
_compositor = new Compositor(); |
|||
|
|||
var interop = _compositor.As<ICompositorInterop>(); |
|||
|
|||
var display = egl.Display as AngleWin32EglDisplay; |
|||
|
|||
_graphicsDevice = interop.CreateGraphicsDevice(display.GetDirect3DDevice()); |
|||
} |
|||
|
|||
public ICompositionDrawingSurfaceInterop InitialiseWindowCompositionTree(IntPtr hwnd, out Windows.UI.Composition.Visual surfaceVisual, out IBlurHost blurHost) |
|||
{ |
|||
var target = CreateDesktopWindowTarget(hwnd); |
|||
|
|||
var surface = _graphicsDevice.CreateDrawingSurface(new Windows.Foundation.Size(0, 0), |
|||
Windows.Graphics.DirectX.DirectXPixelFormat.B8G8R8A8UIntNormalized, |
|||
Windows.Graphics.DirectX.DirectXAlphaMode.Premultiplied); |
|||
|
|||
var surfaceInterop = surface.As<ICompositionDrawingSurfaceInterop>(); |
|||
|
|||
var brush = _compositor.CreateSurfaceBrush(surface); |
|||
var visual = _compositor.CreateSpriteVisual(); |
|||
|
|||
visual.Brush = brush; |
|||
visual.RelativeSizeAdjustment = new System.Numerics.Vector2(1, 1); |
|||
|
|||
var container = _compositor.CreateContainerVisual(); |
|||
|
|||
target.Root = container; |
|||
|
|||
var blur = CreateBlur(); |
|||
|
|||
blurHost = new CompositionBlurHost(blur); |
|||
|
|||
container.Children.InsertAtTop(blur); |
|||
|
|||
container.Children.InsertAtTop(visual); |
|||
|
|||
visual.CompositeMode = CompositionCompositeMode.SourceOver; |
|||
|
|||
surfaceVisual = container; |
|||
|
|||
return surfaceInterop; |
|||
} |
|||
|
|||
private SpriteVisual CreateBlur() |
|||
{ |
|||
var blurEffect = new GaussianBlurEffect(new CompositionEffectSourceParameter("backdrop")); |
|||
|
|||
var backDropBrush = _compositor.CreateBackdropBrush(); |
|||
|
|||
var saturateEffect = new SaturationEffect(blurEffect); |
|||
var satEffectFactory = _compositor.CreateEffectFactory(saturateEffect); |
|||
var satBrush = satEffectFactory.CreateBrush(); |
|||
|
|||
satBrush.SetSourceParameter("backdrop", backDropBrush); |
|||
|
|||
var visual = _compositor.CreateSpriteVisual(); |
|||
visual.IsVisible = false; |
|||
|
|||
visual.RelativeSizeAdjustment = new System.Numerics.Vector2(1.0f, 1.0f); |
|||
visual.Brush = satBrush; |
|||
|
|||
return visual; |
|||
} |
|||
|
|||
private CompositionTarget CreateDesktopWindowTarget(IntPtr window) |
|||
{ |
|||
var interop = _compositor.As<global::Windows.UI.Composition.Desktop.ICompositorDesktopInterop>(); |
|||
|
|||
interop.CreateDesktopWindowTarget(window, false, out var windowTarget); |
|||
return Windows.UI.Composition.Desktop.DesktopWindowTarget.FromAbi(windowTarget); |
|||
} |
|||
|
|||
private void EnsureDispatcherQueue() |
|||
{ |
|||
if (_dispatcherQueueController == null) |
|||
{ |
|||
DispatcherQueueOptions options = new DispatcherQueueOptions(); |
|||
options.apartmentType = DISPATCHERQUEUE_THREAD_APARTMENTTYPE.DQTAT_COM_NONE; |
|||
options.threadType = DISPATCHERQUEUE_THREAD_TYPE.DQTYPE_THREAD_CURRENT; |
|||
options.dwSize = Marshal.SizeOf(typeof(DispatcherQueueOptions)); |
|||
|
|||
CreateDispatcherQueueController(options, out var queue); |
|||
_dispatcherQueueController = Windows.System.DispatcherQueueController.FromAbi(queue); |
|||
} |
|||
} |
|||
} |
|||
} |
|||
|
|||
@ -1,96 +0,0 @@ |
|||
using System; |
|||
using System.Runtime.InteropServices; |
|||
using Avalonia.OpenGL; |
|||
using Avalonia.OpenGL.Angle; |
|||
using Avalonia.OpenGL.Egl; |
|||
using Avalonia.OpenGL.Surfaces; |
|||
using Windows.UI.Composition.Interop; |
|||
|
|||
namespace Avalonia.Win32 |
|||
{ |
|||
internal class CompositionEglGlPlatformSurface : EglGlPlatformSurfaceBase |
|||
{ |
|||
private EglPlatformOpenGlInterface _egl; |
|||
private readonly IEglWindowGlPlatformSurfaceInfo _info; |
|||
private ICompositionDrawingSurfaceInterop _surfaceInterop; |
|||
private Windows.UI.Composition.Visual _surface; |
|||
|
|||
public CompositionEglGlPlatformSurface(EglPlatformOpenGlInterface egl, IEglWindowGlPlatformSurfaceInfo info) : base() |
|||
{ |
|||
_egl = egl; |
|||
_info = info; |
|||
} |
|||
|
|||
public IBlurHost AttachToCompositionTree(CompositionConnector connector, IntPtr hwnd) |
|||
{ |
|||
using (_egl.PrimaryContext.MakeCurrent()) |
|||
{ |
|||
_surfaceInterop = connector.InitialiseWindowCompositionTree(hwnd, out _surface, out var blurHost); |
|||
return blurHost; |
|||
} |
|||
} |
|||
|
|||
public override IGlPlatformSurfaceRenderTarget CreateGlRenderTarget() |
|||
{ |
|||
return new CompositionRenderTarget(_egl, _surface, _surfaceInterop, _info); |
|||
} |
|||
|
|||
class CompositionRenderTarget : EglPlatformSurfaceRenderTargetBase |
|||
{ |
|||
private readonly EglPlatformOpenGlInterface _egl; |
|||
private readonly IEglWindowGlPlatformSurfaceInfo _info; |
|||
private PixelSize _currentSize; |
|||
private readonly ICompositionDrawingSurfaceInterop _surfaceInterop; |
|||
private static Guid s_Iid = Guid.Parse("6f15aaf2-d208-4e89-9ab4-489535d34f9c"); |
|||
private Windows.UI.Composition.Visual _compositionVisual; |
|||
|
|||
public CompositionRenderTarget(EglPlatformOpenGlInterface egl, |
|||
Windows.UI.Composition.Visual compositionVisual, |
|||
ICompositionDrawingSurfaceInterop interopSurface, |
|||
IEglWindowGlPlatformSurfaceInfo info) |
|||
: base(egl) |
|||
{ |
|||
_egl = egl; |
|||
_surfaceInterop = interopSurface; |
|||
_info = info; |
|||
_currentSize = info.Size; |
|||
_compositionVisual = compositionVisual; |
|||
|
|||
using (_egl.PrimaryContext.MakeCurrent()) |
|||
{ |
|||
_surfaceInterop.Resize(new POINT { X = _info.Size.Width, Y = _info.Size.Height }); |
|||
} |
|||
|
|||
_compositionVisual.Size = new System.Numerics.Vector2(_info.Size.Width, _info.Size.Height); |
|||
} |
|||
|
|||
public override IGlPlatformSurfaceRenderingSession BeginDraw() |
|||
{ |
|||
IntPtr texture; |
|||
EglSurface surface; |
|||
|
|||
using (_egl.PrimaryEglContext.EnsureCurrent()) |
|||
{ |
|||
if (_info.Size != _currentSize) |
|||
{ |
|||
_surfaceInterop.Resize(new POINT { X = _info.Size.Width, Y = _info.Size.Height }); |
|||
_compositionVisual.Size = new System.Numerics.Vector2(_info.Size.Width, _info.Size.Height); |
|||
_currentSize = _info.Size; |
|||
} |
|||
|
|||
var offset = new POINT(); |
|||
|
|||
_surfaceInterop.BeginDraw( |
|||
IntPtr.Zero, |
|||
ref s_Iid, |
|||
out texture, ref offset); |
|||
|
|||
surface = (_egl.Display as AngleWin32EglDisplay).WrapDirect3D11Texture(_egl, texture, offset.X, offset.Y, _info.Size.Width, _info.Size.Height); |
|||
} |
|||
|
|||
return base.BeginDraw(surface, _info, () => { _surfaceInterop.EndDraw(); Marshal.Release(texture); surface.Dispose(); }, true); |
|||
} |
|||
} |
|||
} |
|||
} |
|||
|
|||
@ -1,91 +0,0 @@ |
|||
using System; |
|||
|
|||
|
|||
namespace Avalonia.Win32 |
|||
{ |
|||
class D2DEffects |
|||
{ |
|||
public static readonly Guid CLSID_D2D12DAffineTransform = new Guid(0x6AA97485, 0x6354, 0x4CFC, 0x90, 0x8C, 0xE4, 0xA7, 0x4F, 0x62, 0xC9, 0x6C); |
|||
|
|||
public static readonly Guid CLSID_D2D13DPerspectiveTransform = new Guid(0xC2844D0B, 0x3D86, 0x46E7, 0x85, 0xBA, 0x52, 0x6C, 0x92, 0x40, 0xF3, 0xFB); |
|||
|
|||
public static readonly Guid CLSID_D2D13DTransform = new Guid(0xE8467B04, 0xEC61, 0x4B8A, 0xB5, 0xDE, 0xD4, 0xD7, 0x3D, 0xEB, 0xEA, 0x5A); |
|||
|
|||
public static readonly Guid CLSID_D2D1ArithmeticComposite = new Guid(0xFC151437, 0x049A, 0x4784, 0xA2, 0x4A, 0xF1, 0xC4, 0xDA, 0xF2, 0x09, 0x87); |
|||
|
|||
public static readonly Guid CLSID_D2D1Atlas = new Guid(0x913E2BE4, 0xFDCF, 0x4FE2, 0xA5, 0xF0, 0x24, 0x54, 0xF1, 0x4F, 0xF4, 0x08); |
|||
|
|||
public static readonly Guid CLSID_D2D1BitmapSource = new Guid(0x5FB6C24D, 0xC6DD, 0x4231, 0x94, 0x4, 0x50, 0xF4, 0xD5, 0xC3, 0x25, 0x2D); |
|||
|
|||
public static readonly Guid CLSID_D2D1Blend = new Guid(0x81C5B77B, 0x13F8, 0x4CDD, 0xAD, 0x20, 0xC8, 0x90, 0x54, 0x7A, 0xC6, 0x5D); |
|||
|
|||
public static readonly Guid CLSID_D2D1Border = new Guid(0x2A2D49C0, 0x4ACF, 0x43C7, 0x8C, 0x6A, 0x7C, 0x4A, 0x27, 0x87, 0x4D, 0x27); |
|||
|
|||
public static readonly Guid CLSID_D2D1Brightness = new Guid(0x8CEA8D1E, 0x77B0, 0x4986, 0xB3, 0xB9, 0x2F, 0x0C, 0x0E, 0xAE, 0x78, 0x87); |
|||
|
|||
public static readonly Guid CLSID_D2D1ColorManagement = new Guid(0x1A28524C, 0xFDD6, 0x4AA4, 0xAE, 0x8F, 0x83, 0x7E, 0xB8, 0x26, 0x7B, 0x37); |
|||
|
|||
public static readonly Guid CLSID_D2D1ColorMatrix = new Guid(0x921F03D6, 0x641C, 0x47DF, 0x85, 0x2D, 0xB4, 0xBB, 0x61, 0x53, 0xAE, 0x11); |
|||
|
|||
public static readonly Guid CLSID_D2D1Composite = new Guid(0x48FC9F51, 0xF6AC, 0x48F1, 0x8B, 0x58, 0x3B, 0x28, 0xAC, 0x46, 0xF7, 0x6D); |
|||
|
|||
public static readonly Guid CLSID_D2D1ConvolveMatrix = new Guid(0x407F8C08, 0x5533, 0x4331, 0xA3, 0x41, 0x23, 0xCC, 0x38, 0x77, 0x84, 0x3E); |
|||
|
|||
public static readonly Guid CLSID_D2D1Crop = new Guid(0xE23F7110, 0x0E9A, 0x4324, 0xAF, 0x47, 0x6A, 0x2C, 0x0C, 0x46, 0xF3, 0x5B); |
|||
|
|||
public static readonly Guid CLSID_D2D1DirectionalBlur = new Guid(0x174319A6, 0x58E9, 0x49B2, 0xBB, 0x63, 0xCA, 0xF2, 0xC8, 0x11, 0xA3, 0xDB); |
|||
|
|||
public static readonly Guid CLSID_D2D1DiscreteTransfer = new Guid(0x90866FCD, 0x488E, 0x454B, 0xAF, 0x06, 0xE5, 0x04, 0x1B, 0x66, 0xC3, 0x6C); |
|||
|
|||
public static readonly Guid CLSID_D2D1DisplacementMap = new Guid(0xEDC48364, 0x417, 0x4111, 0x94, 0x50, 0x43, 0x84, 0x5F, 0xA9, 0xF8, 0x90); |
|||
|
|||
public static readonly Guid CLSID_D2D1DistantDiffuse = new Guid(0x3E7EFD62, 0xA32D, 0x46D4, 0xA8, 0x3C, 0x52, 0x78, 0x88, 0x9A, 0xC9, 0x54); |
|||
|
|||
public static readonly Guid CLSID_D2D1DistantSpecular = new Guid(0x428C1EE5, 0x77B8, 0x4450, 0x8A, 0xB5, 0x72, 0x21, 0x9C, 0x21, 0xAB, 0xDA); |
|||
|
|||
public static readonly Guid CLSID_D2D1DpiCompensation = new Guid(0x6C26C5C7, 0x34E0, 0x46FC, 0x9C, 0xFD, 0xE5, 0x82, 0x37, 0x6, 0xE2, 0x28); |
|||
|
|||
public static readonly Guid CLSID_D2D1Flood = new Guid(0x61C23C20, 0xAE69, 0x4D8E, 0x94, 0xCF, 0x50, 0x07, 0x8D, 0xF6, 0x38, 0xF2); |
|||
|
|||
public static readonly Guid CLSID_D2D1GammaTransfer = new Guid(0x409444C4, 0xC419, 0x41A0, 0xB0, 0xC1, 0x8C, 0xD0, 0xC0, 0xA1, 0x8E, 0x42); |
|||
|
|||
public static readonly Guid CLSID_D2D1GaussianBlur = new Guid(0x1FEB6D69, 0x2FE6, 0x4AC9, 0x8C, 0x58, 0x1D, 0x7F, 0x93, 0xE7, 0xA6, 0xA5); |
|||
|
|||
public static readonly Guid CLSID_D2D1Scale = new Guid(0x9DAF9369, 0x3846, 0x4D0E, 0xA4, 0x4E, 0xC, 0x60, 0x79, 0x34, 0xA5, 0xD7); |
|||
|
|||
public static readonly Guid CLSID_D2D1Histogram = new Guid(0x881DB7D0, 0xF7EE, 0x4D4D, 0xA6, 0xD2, 0x46, 0x97, 0xAC, 0xC6, 0x6E, 0xE8); |
|||
|
|||
public static readonly Guid CLSID_D2D1HueRotation = new Guid(0x0F4458EC, 0x4B32, 0x491B, 0x9E, 0x85, 0xBD, 0x73, 0xF4, 0x4D, 0x3E, 0xB6); |
|||
|
|||
public static readonly Guid CLSID_D2D1LinearTransfer = new Guid(0xAD47C8FD, 0x63EF, 0x4ACC, 0x9B, 0x51, 0x67, 0x97, 0x9C, 0x03, 0x6C, 0x06); |
|||
|
|||
public static readonly Guid CLSID_D2D1LuminanceToAlpha = new Guid(0x41251AB7, 0x0BEB, 0x46F8, 0x9D, 0xA7, 0x59, 0xE9, 0x3F, 0xCC, 0xE5, 0xDE); |
|||
|
|||
public static readonly Guid CLSID_D2D1Morphology = new Guid(0xEAE6C40D, 0x626A, 0x4C2D, 0xBF, 0xCB, 0x39, 0x10, 0x01, 0xAB, 0xE2, 0x02); |
|||
|
|||
public static readonly Guid CLSID_D2D1OpacityMetadata = new Guid(0x6C53006A, 0x4450, 0x4199, 0xAA, 0x5B, 0xAD, 0x16, 0x56, 0xFE, 0xCE, 0x5E); |
|||
|
|||
public static readonly Guid CLSID_D2D1PointDiffuse = new Guid(0xB9E303C3, 0xC08C, 0x4F91, 0x8B, 0x7B, 0x38, 0x65, 0x6B, 0xC4, 0x8C, 0x20); |
|||
|
|||
public static readonly Guid CLSID_D2D1PointSpecular = new Guid(0x09C3CA26, 0x3AE2, 0x4F09, 0x9E, 0xBC, 0xED, 0x38, 0x65, 0xD5, 0x3F, 0x22); |
|||
|
|||
public static readonly Guid CLSID_D2D1Premultiply = new Guid(0x06EAB419, 0xDEED, 0x4018, 0x80, 0xD2, 0x3E, 0x1D, 0x47, 0x1A, 0xDE, 0xB2); |
|||
|
|||
public static readonly Guid CLSID_D2D1Saturation = new Guid(0x5CB2D9CF, 0x327D, 0x459F, 0xA0, 0xCE, 0x40, 0xC0, 0xB2, 0x08, 0x6B, 0xF7); |
|||
|
|||
public static readonly Guid CLSID_D2D1Shadow = new Guid(0xC67EA361, 0x1863, 0x4E69, 0x89, 0xDB, 0x69, 0x5D, 0x3E, 0x9A, 0x5B, 0x6B); |
|||
|
|||
public static readonly Guid CLSID_D2D1SpotDiffuse = new Guid(0x818A1105, 0x7932, 0x44F4, 0xAA, 0x86, 0x08, 0xAE, 0x7B, 0x2F, 0x2C, 0x93); |
|||
|
|||
public static readonly Guid CLSID_D2D1SpotSpecular = new Guid(0xEDAE421E, 0x7654, 0x4A37, 0x9D, 0xB8, 0x71, 0xAC, 0xC1, 0xBE, 0xB3, 0xC1); |
|||
|
|||
public static readonly Guid CLSID_D2D1TableTransfer = new Guid(0x5BF818C3, 0x5E43, 0x48CB, 0xB6, 0x31, 0x86, 0x83, 0x96, 0xD6, 0xA1, 0xD4); |
|||
|
|||
public static readonly Guid CLSID_D2D1Tile = new Guid(0xB0784138, 0x3B76, 0x4BC5, 0xB1, 0x3B, 0x0F, 0xA2, 0xAD, 0x02, 0x65, 0x9F); |
|||
|
|||
public static readonly Guid CLSID_D2D1Turbulence = new Guid(0xCF2BB6AE, 0x889A, 0x4AD7, 0xBA, 0x29, 0xA2, 0xFD, 0x73, 0x2C, 0x9F, 0xC9); |
|||
|
|||
public static readonly Guid CLSID_D2D1UnPremultiply = new Guid(0xFB9AC489, 0xAD8D, 0x41ED, 0x99, 0x99, 0xBB, 0x63, 0x47, 0xD1, 0x10, 0xF7); |
|||
} |
|||
} |
|||
|
|||
@ -1,45 +0,0 @@ |
|||
using System; |
|||
using Windows.Graphics.Effects; |
|||
using Windows.Graphics.Effects.Interop; |
|||
|
|||
|
|||
namespace Avalonia.Win32 |
|||
{ |
|||
abstract class EffectBase : IGraphicsEffect, IGraphicsEffectSource, global::Windows.Graphics.Effects.Interop.IGraphicsEffectD2D1Interop |
|||
{ |
|||
private IGraphicsEffectSource[] _sources; |
|||
|
|||
public EffectBase(params IGraphicsEffectSource[] sources) |
|||
{ |
|||
_sources = sources; |
|||
} |
|||
|
|||
private IGraphicsEffectSource _source; |
|||
|
|||
public virtual string Name { get; set; } |
|||
|
|||
public abstract Guid EffectId { get; } |
|||
|
|||
public abstract uint PropertyCount { get; } |
|||
|
|||
public uint SourceCount => (uint)_sources.Length; |
|||
|
|||
public IGraphicsEffectSource GetSource(uint index) |
|||
{ |
|||
if(index < _sources.Length) |
|||
{ |
|||
return _sources[index]; |
|||
} |
|||
|
|||
return null; |
|||
} |
|||
|
|||
public uint GetNamedPropertyMapping(string name, out GRAPHICS_EFFECT_PROPERTY_MAPPING mapping) |
|||
{ |
|||
throw new NotImplementedException(); |
|||
} |
|||
|
|||
public abstract object GetProperty(uint index); |
|||
} |
|||
} |
|||
|
|||
@ -1,18 +0,0 @@ |
|||
namespace Windows.Graphics.Effects.Interop |
|||
{ |
|||
public enum GRAPHICS_EFFECT_PROPERTY_MAPPING |
|||
{ |
|||
GRAPHICS_EFFECT_PROPERTY_MAPPING_UNKNOWN, |
|||
GRAPHICS_EFFECT_PROPERTY_MAPPING_DIRECT, |
|||
GRAPHICS_EFFECT_PROPERTY_MAPPING_VECTORX, |
|||
GRAPHICS_EFFECT_PROPERTY_MAPPING_VECTORY, |
|||
GRAPHICS_EFFECT_PROPERTY_MAPPING_VECTORZ, |
|||
GRAPHICS_EFFECT_PROPERTY_MAPPING_VECTORW, |
|||
GRAPHICS_EFFECT_PROPERTY_MAPPING_RECT_TO_VECTOR4, |
|||
GRAPHICS_EFFECT_PROPERTY_MAPPING_RADIANS_TO_DEGREES, |
|||
GRAPHICS_EFFECT_PROPERTY_MAPPING_COLORMATRIX_ALPHA_MODE, |
|||
GRAPHICS_EFFECT_PROPERTY_MAPPING_COLOR_TO_VECTOR3, |
|||
GRAPHICS_EFFECT_PROPERTY_MAPPING_COLOR_TO_VECTOR4 |
|||
}; |
|||
} |
|||
|
|||
@ -1,57 +0,0 @@ |
|||
using System; |
|||
using Windows.Graphics.Effects; |
|||
|
|||
namespace Avalonia.Win32 |
|||
{ |
|||
class GaussianBlurEffect : EffectBase |
|||
{ |
|||
public GaussianBlurEffect(IGraphicsEffectSource source) : base(source) |
|||
{ |
|||
} |
|||
|
|||
enum D2D1_GAUSSIANBLUR_OPTIMIZATION |
|||
{ |
|||
D2D1_GAUSSIANBLUR_OPTIMIZATION_SPEED, |
|||
D2D1_GAUSSIANBLUR_OPTIMIZATION_BALANCED, |
|||
D2D1_GAUSSIANBLUR_OPTIMIZATION_QUALITY, |
|||
D2D1_GAUSSIANBLUR_OPTIMIZATION_FORCE_DWORD |
|||
}; |
|||
|
|||
enum D2D1_BORDER_MODE |
|||
{ |
|||
D2D1_BORDER_MODE_SOFT, |
|||
D2D1_BORDER_MODE_HARD, |
|||
D2D1_BORDER_MODE_FORCE_DWORD |
|||
}; |
|||
|
|||
enum D2D1GaussianBlurProp |
|||
{ |
|||
D2D1_GAUSSIANBLUR_PROP_STANDARD_DEVIATION, |
|||
D2D1_GAUSSIANBLUR_PROP_OPTIMIZATION, |
|||
D2D1_GAUSSIANBLUR_PROP_BORDER_MODE, |
|||
D2D1_GAUSSIANBLUR_PROP_FORCE_DWORD |
|||
}; |
|||
|
|||
public override Guid EffectId => D2DEffects.CLSID_D2D1GaussianBlur; |
|||
|
|||
public override uint PropertyCount => 3; |
|||
|
|||
public override object GetProperty(uint index) |
|||
{ |
|||
switch ((D2D1GaussianBlurProp)index) |
|||
{ |
|||
case D2D1GaussianBlurProp.D2D1_GAUSSIANBLUR_PROP_STANDARD_DEVIATION: |
|||
return 30.0f; |
|||
|
|||
case D2D1GaussianBlurProp.D2D1_GAUSSIANBLUR_PROP_OPTIMIZATION: |
|||
return (uint)D2D1_GAUSSIANBLUR_OPTIMIZATION.D2D1_GAUSSIANBLUR_OPTIMIZATION_BALANCED; |
|||
|
|||
case D2D1GaussianBlurProp.D2D1_GAUSSIANBLUR_PROP_BORDER_MODE: |
|||
return (uint)D2D1_BORDER_MODE.D2D1_BORDER_MODE_HARD; |
|||
} |
|||
|
|||
return null; |
|||
} |
|||
} |
|||
} |
|||
|
|||
@ -1,8 +0,0 @@ |
|||
namespace Avalonia.Win32 |
|||
{ |
|||
internal interface IBlurHost |
|||
{ |
|||
void SetBlur(bool enabled); |
|||
} |
|||
} |
|||
|
|||
@ -1,152 +0,0 @@ |
|||
using System; |
|||
using System.Runtime.InteropServices; |
|||
using WinRT; |
|||
|
|||
namespace Windows.UI.Composition.Interop |
|||
{ |
|||
public struct POINT |
|||
{ |
|||
public int X; |
|||
public int Y; |
|||
} |
|||
|
|||
public struct RECT |
|||
{ |
|||
public int left; |
|||
public int top; |
|||
public int right; |
|||
public int bottom; |
|||
|
|||
public int Width => right - left; |
|||
public int Height => bottom - top; |
|||
} |
|||
|
|||
[WindowsRuntimeType] |
|||
[Guid("FD04E6E3-FE0C-4C3C-AB19-A07601A576EE")] |
|||
public interface ICompositionDrawingSurfaceInterop |
|||
{ |
|||
void BeginDraw(IntPtr updateRect, ref Guid iid, out IntPtr updateObject, ref POINT point); |
|||
|
|||
void EndDraw(); |
|||
|
|||
void Resize(POINT sizePixels); |
|||
|
|||
void ResumeDraw(); |
|||
|
|||
void Scroll(RECT scrollRect, RECT clipRect, int offsetX, int offsetY); |
|||
|
|||
void SuspendDraw(); |
|||
} |
|||
} |
|||
|
|||
namespace ABI.Windows.UI.Composition.Interop |
|||
{ |
|||
using global::System; |
|||
using global::System.Runtime.InteropServices; |
|||
using global::Windows.UI.Composition; |
|||
using global::Windows.UI.Composition.Interop; |
|||
|
|||
[Guid("FD04E6E3-FE0C-4C3C-AB19-A07601A576EE")] |
|||
internal class ICompositionDrawingSurfaceInterop : global::Windows.UI.Composition.Interop.ICompositionDrawingSurfaceInterop |
|||
|
|||
{ |
|||
[Guid("FD04E6E3-FE0C-4C3C-AB19-A07601A576EE")] |
|||
public unsafe struct Vftbl |
|||
{ |
|||
public delegate int _BeginDraw(IntPtr ThisPtr, IntPtr updateRect, ref Guid iid, out IntPtr updateObject, ref POINT updateOffset); |
|||
public delegate int _EndDraw(IntPtr ThisPtr); |
|||
public delegate int _Resize(IntPtr ThisPtr, POINT sizePixels); |
|||
public delegate int _ResumeDraw(IntPtr ThisPtr); |
|||
public delegate int _Scroll(IntPtr ThisPtr, RECT scrollRect, RECT clipRect, int offsetX, int offsetY); |
|||
public delegate int _SuspendDraw(IntPtr ThisPtr); |
|||
|
|||
internal global::WinRT.Interop.IUnknownVftbl IUnknownVftbl; |
|||
public _BeginDraw BeginDraw; |
|||
public _EndDraw EndDraw; |
|||
public _Resize Resize; |
|||
public _ResumeDraw ResumeDraw; |
|||
public _Scroll Scroll; |
|||
public _SuspendDraw SuspendDraw; |
|||
|
|||
public static readonly Vftbl AbiToProjectionVftable; |
|||
public static readonly IntPtr AbiToProjectionVftablePtr; |
|||
|
|||
static Vftbl() |
|||
{ |
|||
AbiToProjectionVftable = new Vftbl |
|||
{ |
|||
IUnknownVftbl = global::WinRT.Interop.IUnknownVftbl.AbiToProjectionVftbl, |
|||
|
|||
BeginDraw = Do_Abi_BeginDraw, |
|||
EndDraw = Do_Abi_EndDraw, |
|||
Resize = Do_Abi_Resize |
|||
|
|||
|
|||
}; |
|||
AbiToProjectionVftablePtr = Marshal.AllocHGlobal(Marshal.SizeOf<Vftbl>()); |
|||
Marshal.StructureToPtr(AbiToProjectionVftable, AbiToProjectionVftablePtr, false); |
|||
} |
|||
|
|||
private static int Do_Abi_BeginDraw(IntPtr ThisPtr, IntPtr updateRect, ref Guid iid, out IntPtr updateObject, ref POINT updateOffset) |
|||
{ |
|||
updateObject = IntPtr.Zero; |
|||
return 0; |
|||
} |
|||
|
|||
private static int Do_Abi_EndDraw(IntPtr ThisPtr) |
|||
{ |
|||
return 0; |
|||
} |
|||
|
|||
private static int Do_Abi_Resize(IntPtr ThisPtr, POINT sizePixels) |
|||
{ |
|||
return 0; |
|||
} |
|||
} |
|||
internal static ObjectReference<Vftbl> FromAbi(IntPtr thisPtr) => ObjectReference<Vftbl>.FromAbi(thisPtr); |
|||
|
|||
public static implicit operator ICompositionDrawingSurfaceInterop(IObjectReference obj) => (obj != null) ? new ICompositionDrawingSurfaceInterop(obj) : null; |
|||
protected readonly ObjectReference<Vftbl> _obj; |
|||
public IObjectReference ObjRef { get => _obj; } |
|||
public IntPtr ThisPtr => _obj.ThisPtr; |
|||
public ObjectReference<I> AsInterface<I>() => _obj.As<I>(); |
|||
public A As<A>() => _obj.AsType<A>(); |
|||
|
|||
public ICompositionDrawingSurfaceInterop(IObjectReference obj) : this(obj.As<Vftbl>()) { } |
|||
internal ICompositionDrawingSurfaceInterop(ObjectReference<Vftbl> obj) |
|||
{ |
|||
_obj = obj; |
|||
} |
|||
|
|||
public void BeginDraw(IntPtr updateRect, ref Guid iid, out IntPtr updateObject, ref POINT point) |
|||
{ |
|||
Marshal.ThrowExceptionForHR(_obj.Vftbl.BeginDraw(ThisPtr, updateRect, ref iid, out updateObject, ref point)); |
|||
} |
|||
|
|||
public void EndDraw() |
|||
{ |
|||
Marshal.ThrowExceptionForHR(_obj.Vftbl.EndDraw(ThisPtr)); |
|||
} |
|||
|
|||
public void Resize(POINT sizePixels) |
|||
{ |
|||
Marshal.ThrowExceptionForHR(_obj.Vftbl.Resize(ThisPtr, sizePixels)); |
|||
} |
|||
|
|||
public void ResumeDraw() |
|||
{ |
|||
throw new NotImplementedException(); |
|||
} |
|||
|
|||
public void Scroll(RECT scrollRect, RECT clipRect, int offsetX, int offsetY) |
|||
{ |
|||
throw new NotImplementedException(); |
|||
} |
|||
|
|||
public void SuspendDraw() |
|||
{ |
|||
throw new NotImplementedException(); |
|||
} |
|||
} |
|||
} |
|||
|
|||
Some files were not shown because too many files changed in this diff
Loading…
Reference in new issue