Merge branch 'master' into dispatcher-priority
# Conflicts: # src/Gtk/Avalonia.Gtk/GtkPlatform.cs # tests/Avalonia.RenderTests/TestBase.cs
168
Avalonia.sln
|
@ -50,8 +50,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Avalonia.Input.UnitTests",
|
|||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Avalonia.Direct2D1.UnitTests", "tests\Avalonia.Direct2D1.UnitTests\Avalonia.Direct2D1.UnitTests.csproj", "{EFB11458-9CDF-41C0-BE4F-44AF45A4CAB8}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Avalonia.Cairo.RenderTests", "tests\Avalonia.RenderTests\Avalonia.Cairo.RenderTests.csproj", "{E106CF37-4066-4615-B684-172A6D30B058}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Avalonia.Markup.Xaml.UnitTests", "tests\Avalonia.Markup.Xaml.UnitTests\Avalonia.Markup.Xaml.UnitTests.csproj", "{99135EAB-653D-47E4-A378-C96E1278CA44}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Markup", "Markup", "{8B6A8209-894F-4BA1-B880-965FD453982C}"
|
||||
|
@ -67,10 +65,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Shared", "Shared", "{A689DE
|
|||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Gtk", "Gtk", "{B9894058-278A-46B5-B6ED-AD613FCC03B3}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Avalonia.Gtk", "src\Gtk\Avalonia.Gtk\Avalonia.Gtk.csproj", "{54F237D5-A70A-4752-9656-0C70B1A7B047}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Avalonia.Cairo", "src\Gtk\Avalonia.Cairo\Avalonia.Cairo.csproj", "{FB05AC90-89BA-4F2F-A924-F37875FB547C}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Avalonia.ReactiveUI", "src\Avalonia.ReactiveUI\Avalonia.ReactiveUI.csproj", "{6417B24E-49C2-4985-8DB2-3AB9D898EC91}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Avalonia.HtmlRenderer", "src\Avalonia.HtmlRenderer\Avalonia.HtmlRenderer.csproj", "{5FB2B005-0A7F-4DAD-ADD4-3ED01444E63D}"
|
||||
|
@ -127,8 +121,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Interop", "Interop", "{A0CC
|
|||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WindowsInteropTest", "samples\interop\WindowsInteropTest\WindowsInteropTest.csproj", "{C7A69145-60B6-4882-97D6-A3921DD43978}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GtkInteropDemo", "samples\interop\GtkInteropDemo\GtkInteropDemo.csproj", "{BD7F352C-6DC1-4740-BAF2-2D34A038728C}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Avalonia.DotNetFrameworkRuntime", "src\Avalonia.DotNetFrameworkRuntime\Avalonia.DotNetFrameworkRuntime.csproj", "{4A1ABB09-9047-4BD5-A4AD-A055E52C5EE0}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RenderTest", "samples\RenderTest\RenderTest.csproj", "{F1FDC5B0-4654-416F-AE69-E3E9BBD87801}"
|
||||
|
@ -204,9 +196,7 @@ Global
|
|||
src\Windows\Avalonia.Win32\Avalonia.Win32.Shared.projitems*{811a76cf-1cf6-440f-963b-bbe31bd72a82}*SharedItemsImports = 4
|
||||
src\Windows\Avalonia.Win32\Avalonia.Win32.Shared.projitems*{9defc6b7-845b-4d8f-afc0-d32bf0032b8c}*SharedItemsImports = 13
|
||||
tests\Avalonia.RenderTests\Avalonia.RenderTests.projitems*{dabfd304-d6a4-4752-8123-c2ccf7ac7831}*SharedItemsImports = 4
|
||||
tests\Avalonia.RenderTests\Avalonia.RenderTests.projitems*{e106cf37-4066-4615-b684-172a6d30b058}*SharedItemsImports = 4
|
||||
src\Shared\PlatformSupport\PlatformSupport.projitems*{e4d9629c-f168-4224-3f51-a5e482ffbc42}*SharedItemsImports = 13
|
||||
src\Shared\RenderHelpers\RenderHelpers.projitems*{fb05ac90-89ba-4f2f-a924-f37875fb547c}*SharedItemsImports = 4
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Ad-Hoc|Any CPU = Ad-Hoc|Any CPU
|
||||
|
@ -1053,44 +1043,6 @@ Global
|
|||
{EFB11458-9CDF-41C0-BE4F-44AF45A4CAB8}.Release|Mono.ActiveCfg = Release|Any CPU
|
||||
{EFB11458-9CDF-41C0-BE4F-44AF45A4CAB8}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{EFB11458-9CDF-41C0-BE4F-44AF45A4CAB8}.Release|x86.Build.0 = Release|Any CPU
|
||||
{E106CF37-4066-4615-B684-172A6D30B058}.Ad-Hoc|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{E106CF37-4066-4615-B684-172A6D30B058}.Ad-Hoc|Any CPU.Build.0 = Release|Any CPU
|
||||
{E106CF37-4066-4615-B684-172A6D30B058}.Ad-Hoc|iPhone.ActiveCfg = Release|Any CPU
|
||||
{E106CF37-4066-4615-B684-172A6D30B058}.Ad-Hoc|iPhone.Build.0 = Release|Any CPU
|
||||
{E106CF37-4066-4615-B684-172A6D30B058}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Release|Any CPU
|
||||
{E106CF37-4066-4615-B684-172A6D30B058}.Ad-Hoc|iPhoneSimulator.Build.0 = Release|Any CPU
|
||||
{E106CF37-4066-4615-B684-172A6D30B058}.Ad-Hoc|Mono.ActiveCfg = Debug|Any CPU
|
||||
{E106CF37-4066-4615-B684-172A6D30B058}.Ad-Hoc|x86.ActiveCfg = Debug|Any CPU
|
||||
{E106CF37-4066-4615-B684-172A6D30B058}.Ad-Hoc|x86.Build.0 = Debug|Any CPU
|
||||
{E106CF37-4066-4615-B684-172A6D30B058}.AppStore|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{E106CF37-4066-4615-B684-172A6D30B058}.AppStore|Any CPU.Build.0 = Release|Any CPU
|
||||
{E106CF37-4066-4615-B684-172A6D30B058}.AppStore|iPhone.ActiveCfg = Release|Any CPU
|
||||
{E106CF37-4066-4615-B684-172A6D30B058}.AppStore|iPhone.Build.0 = Release|Any CPU
|
||||
{E106CF37-4066-4615-B684-172A6D30B058}.AppStore|iPhoneSimulator.ActiveCfg = Release|Any CPU
|
||||
{E106CF37-4066-4615-B684-172A6D30B058}.AppStore|iPhoneSimulator.Build.0 = Release|Any CPU
|
||||
{E106CF37-4066-4615-B684-172A6D30B058}.AppStore|Mono.ActiveCfg = Debug|Any CPU
|
||||
{E106CF37-4066-4615-B684-172A6D30B058}.AppStore|x86.ActiveCfg = Debug|Any CPU
|
||||
{E106CF37-4066-4615-B684-172A6D30B058}.AppStore|x86.Build.0 = Debug|Any CPU
|
||||
{E106CF37-4066-4615-B684-172A6D30B058}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{E106CF37-4066-4615-B684-172A6D30B058}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{E106CF37-4066-4615-B684-172A6D30B058}.Debug|iPhone.ActiveCfg = Debug|Any CPU
|
||||
{E106CF37-4066-4615-B684-172A6D30B058}.Debug|iPhone.Build.0 = Debug|Any CPU
|
||||
{E106CF37-4066-4615-B684-172A6D30B058}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
|
||||
{E106CF37-4066-4615-B684-172A6D30B058}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
|
||||
{E106CF37-4066-4615-B684-172A6D30B058}.Debug|Mono.ActiveCfg = Debug|Any CPU
|
||||
{E106CF37-4066-4615-B684-172A6D30B058}.Debug|Mono.Build.0 = Debug|Any CPU
|
||||
{E106CF37-4066-4615-B684-172A6D30B058}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{E106CF37-4066-4615-B684-172A6D30B058}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{E106CF37-4066-4615-B684-172A6D30B058}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{E106CF37-4066-4615-B684-172A6D30B058}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{E106CF37-4066-4615-B684-172A6D30B058}.Release|iPhone.ActiveCfg = Release|Any CPU
|
||||
{E106CF37-4066-4615-B684-172A6D30B058}.Release|iPhone.Build.0 = Release|Any CPU
|
||||
{E106CF37-4066-4615-B684-172A6D30B058}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
|
||||
{E106CF37-4066-4615-B684-172A6D30B058}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
|
||||
{E106CF37-4066-4615-B684-172A6D30B058}.Release|Mono.ActiveCfg = Release|Any CPU
|
||||
{E106CF37-4066-4615-B684-172A6D30B058}.Release|Mono.Build.0 = Release|Any CPU
|
||||
{E106CF37-4066-4615-B684-172A6D30B058}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{E106CF37-4066-4615-B684-172A6D30B058}.Release|x86.Build.0 = Release|Any CPU
|
||||
{99135EAB-653D-47E4-A378-C96E1278CA44}.Ad-Hoc|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{99135EAB-653D-47E4-A378-C96E1278CA44}.Ad-Hoc|Any CPU.Build.0 = Release|Any CPU
|
||||
{99135EAB-653D-47E4-A378-C96E1278CA44}.Ad-Hoc|iPhone.ActiveCfg = Release|Any CPU
|
||||
|
@ -1167,82 +1119,6 @@ Global
|
|||
{3E53A01A-B331-47F3-B828-4A5717E77A24}.Release|Mono.Build.0 = Release|Any CPU
|
||||
{3E53A01A-B331-47F3-B828-4A5717E77A24}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{3E53A01A-B331-47F3-B828-4A5717E77A24}.Release|x86.Build.0 = Release|Any CPU
|
||||
{54F237D5-A70A-4752-9656-0C70B1A7B047}.Ad-Hoc|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{54F237D5-A70A-4752-9656-0C70B1A7B047}.Ad-Hoc|Any CPU.Build.0 = Release|Any CPU
|
||||
{54F237D5-A70A-4752-9656-0C70B1A7B047}.Ad-Hoc|iPhone.ActiveCfg = Release|Any CPU
|
||||
{54F237D5-A70A-4752-9656-0C70B1A7B047}.Ad-Hoc|iPhone.Build.0 = Release|Any CPU
|
||||
{54F237D5-A70A-4752-9656-0C70B1A7B047}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Release|Any CPU
|
||||
{54F237D5-A70A-4752-9656-0C70B1A7B047}.Ad-Hoc|iPhoneSimulator.Build.0 = Release|Any CPU
|
||||
{54F237D5-A70A-4752-9656-0C70B1A7B047}.Ad-Hoc|Mono.ActiveCfg = Debug|Any CPU
|
||||
{54F237D5-A70A-4752-9656-0C70B1A7B047}.Ad-Hoc|x86.ActiveCfg = Debug|Any CPU
|
||||
{54F237D5-A70A-4752-9656-0C70B1A7B047}.Ad-Hoc|x86.Build.0 = Debug|Any CPU
|
||||
{54F237D5-A70A-4752-9656-0C70B1A7B047}.AppStore|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{54F237D5-A70A-4752-9656-0C70B1A7B047}.AppStore|Any CPU.Build.0 = Release|Any CPU
|
||||
{54F237D5-A70A-4752-9656-0C70B1A7B047}.AppStore|iPhone.ActiveCfg = Release|Any CPU
|
||||
{54F237D5-A70A-4752-9656-0C70B1A7B047}.AppStore|iPhone.Build.0 = Release|Any CPU
|
||||
{54F237D5-A70A-4752-9656-0C70B1A7B047}.AppStore|iPhoneSimulator.ActiveCfg = Release|Any CPU
|
||||
{54F237D5-A70A-4752-9656-0C70B1A7B047}.AppStore|iPhoneSimulator.Build.0 = Release|Any CPU
|
||||
{54F237D5-A70A-4752-9656-0C70B1A7B047}.AppStore|Mono.ActiveCfg = Debug|Any CPU
|
||||
{54F237D5-A70A-4752-9656-0C70B1A7B047}.AppStore|x86.ActiveCfg = Debug|Any CPU
|
||||
{54F237D5-A70A-4752-9656-0C70B1A7B047}.AppStore|x86.Build.0 = Debug|Any CPU
|
||||
{54F237D5-A70A-4752-9656-0C70B1A7B047}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{54F237D5-A70A-4752-9656-0C70B1A7B047}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{54F237D5-A70A-4752-9656-0C70B1A7B047}.Debug|iPhone.ActiveCfg = Debug|Any CPU
|
||||
{54F237D5-A70A-4752-9656-0C70B1A7B047}.Debug|iPhone.Build.0 = Debug|Any CPU
|
||||
{54F237D5-A70A-4752-9656-0C70B1A7B047}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
|
||||
{54F237D5-A70A-4752-9656-0C70B1A7B047}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
|
||||
{54F237D5-A70A-4752-9656-0C70B1A7B047}.Debug|Mono.ActiveCfg = Debug|Any CPU
|
||||
{54F237D5-A70A-4752-9656-0C70B1A7B047}.Debug|Mono.Build.0 = Debug|Any CPU
|
||||
{54F237D5-A70A-4752-9656-0C70B1A7B047}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{54F237D5-A70A-4752-9656-0C70B1A7B047}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{54F237D5-A70A-4752-9656-0C70B1A7B047}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{54F237D5-A70A-4752-9656-0C70B1A7B047}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{54F237D5-A70A-4752-9656-0C70B1A7B047}.Release|iPhone.ActiveCfg = Release|Any CPU
|
||||
{54F237D5-A70A-4752-9656-0C70B1A7B047}.Release|iPhone.Build.0 = Release|Any CPU
|
||||
{54F237D5-A70A-4752-9656-0C70B1A7B047}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
|
||||
{54F237D5-A70A-4752-9656-0C70B1A7B047}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
|
||||
{54F237D5-A70A-4752-9656-0C70B1A7B047}.Release|Mono.ActiveCfg = Release|Any CPU
|
||||
{54F237D5-A70A-4752-9656-0C70B1A7B047}.Release|Mono.Build.0 = Release|Any CPU
|
||||
{54F237D5-A70A-4752-9656-0C70B1A7B047}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{54F237D5-A70A-4752-9656-0C70B1A7B047}.Release|x86.Build.0 = Release|Any CPU
|
||||
{FB05AC90-89BA-4F2F-A924-F37875FB547C}.Ad-Hoc|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{FB05AC90-89BA-4F2F-A924-F37875FB547C}.Ad-Hoc|Any CPU.Build.0 = Release|Any CPU
|
||||
{FB05AC90-89BA-4F2F-A924-F37875FB547C}.Ad-Hoc|iPhone.ActiveCfg = Release|Any CPU
|
||||
{FB05AC90-89BA-4F2F-A924-F37875FB547C}.Ad-Hoc|iPhone.Build.0 = Release|Any CPU
|
||||
{FB05AC90-89BA-4F2F-A924-F37875FB547C}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Release|Any CPU
|
||||
{FB05AC90-89BA-4F2F-A924-F37875FB547C}.Ad-Hoc|iPhoneSimulator.Build.0 = Release|Any CPU
|
||||
{FB05AC90-89BA-4F2F-A924-F37875FB547C}.Ad-Hoc|Mono.ActiveCfg = Debug|Any CPU
|
||||
{FB05AC90-89BA-4F2F-A924-F37875FB547C}.Ad-Hoc|x86.ActiveCfg = Debug|Any CPU
|
||||
{FB05AC90-89BA-4F2F-A924-F37875FB547C}.Ad-Hoc|x86.Build.0 = Debug|Any CPU
|
||||
{FB05AC90-89BA-4F2F-A924-F37875FB547C}.AppStore|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{FB05AC90-89BA-4F2F-A924-F37875FB547C}.AppStore|Any CPU.Build.0 = Release|Any CPU
|
||||
{FB05AC90-89BA-4F2F-A924-F37875FB547C}.AppStore|iPhone.ActiveCfg = Release|Any CPU
|
||||
{FB05AC90-89BA-4F2F-A924-F37875FB547C}.AppStore|iPhone.Build.0 = Release|Any CPU
|
||||
{FB05AC90-89BA-4F2F-A924-F37875FB547C}.AppStore|iPhoneSimulator.ActiveCfg = Release|Any CPU
|
||||
{FB05AC90-89BA-4F2F-A924-F37875FB547C}.AppStore|iPhoneSimulator.Build.0 = Release|Any CPU
|
||||
{FB05AC90-89BA-4F2F-A924-F37875FB547C}.AppStore|Mono.ActiveCfg = Debug|Any CPU
|
||||
{FB05AC90-89BA-4F2F-A924-F37875FB547C}.AppStore|x86.ActiveCfg = Debug|Any CPU
|
||||
{FB05AC90-89BA-4F2F-A924-F37875FB547C}.AppStore|x86.Build.0 = Debug|Any CPU
|
||||
{FB05AC90-89BA-4F2F-A924-F37875FB547C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{FB05AC90-89BA-4F2F-A924-F37875FB547C}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{FB05AC90-89BA-4F2F-A924-F37875FB547C}.Debug|iPhone.ActiveCfg = Debug|Any CPU
|
||||
{FB05AC90-89BA-4F2F-A924-F37875FB547C}.Debug|iPhone.Build.0 = Debug|Any CPU
|
||||
{FB05AC90-89BA-4F2F-A924-F37875FB547C}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
|
||||
{FB05AC90-89BA-4F2F-A924-F37875FB547C}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
|
||||
{FB05AC90-89BA-4F2F-A924-F37875FB547C}.Debug|Mono.ActiveCfg = Debug|Any CPU
|
||||
{FB05AC90-89BA-4F2F-A924-F37875FB547C}.Debug|Mono.Build.0 = Debug|Any CPU
|
||||
{FB05AC90-89BA-4F2F-A924-F37875FB547C}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{FB05AC90-89BA-4F2F-A924-F37875FB547C}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{FB05AC90-89BA-4F2F-A924-F37875FB547C}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{FB05AC90-89BA-4F2F-A924-F37875FB547C}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{FB05AC90-89BA-4F2F-A924-F37875FB547C}.Release|iPhone.ActiveCfg = Release|Any CPU
|
||||
{FB05AC90-89BA-4F2F-A924-F37875FB547C}.Release|iPhone.Build.0 = Release|Any CPU
|
||||
{FB05AC90-89BA-4F2F-A924-F37875FB547C}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
|
||||
{FB05AC90-89BA-4F2F-A924-F37875FB547C}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
|
||||
{FB05AC90-89BA-4F2F-A924-F37875FB547C}.Release|Mono.ActiveCfg = Release|Any CPU
|
||||
{FB05AC90-89BA-4F2F-A924-F37875FB547C}.Release|Mono.Build.0 = Release|Any CPU
|
||||
{FB05AC90-89BA-4F2F-A924-F37875FB547C}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{FB05AC90-89BA-4F2F-A924-F37875FB547C}.Release|x86.Build.0 = Release|Any CPU
|
||||
{6417B24E-49C2-4985-8DB2-3AB9D898EC91}.Ad-Hoc|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{6417B24E-49C2-4985-8DB2-3AB9D898EC91}.Ad-Hoc|Any CPU.Build.0 = Release|Any CPU
|
||||
{6417B24E-49C2-4985-8DB2-3AB9D898EC91}.Ad-Hoc|iPhone.ActiveCfg = Release|Any CPU
|
||||
|
@ -1985,46 +1861,6 @@ Global
|
|||
{C7A69145-60B6-4882-97D6-A3921DD43978}.Release|Mono.ActiveCfg = Release|Any CPU
|
||||
{C7A69145-60B6-4882-97D6-A3921DD43978}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{C7A69145-60B6-4882-97D6-A3921DD43978}.Release|x86.Build.0 = Release|Any CPU
|
||||
{BD7F352C-6DC1-4740-BAF2-2D34A038728C}.Ad-Hoc|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{BD7F352C-6DC1-4740-BAF2-2D34A038728C}.Ad-Hoc|Any CPU.Build.0 = Release|Any CPU
|
||||
{BD7F352C-6DC1-4740-BAF2-2D34A038728C}.Ad-Hoc|iPhone.ActiveCfg = Release|Any CPU
|
||||
{BD7F352C-6DC1-4740-BAF2-2D34A038728C}.Ad-Hoc|iPhone.Build.0 = Release|Any CPU
|
||||
{BD7F352C-6DC1-4740-BAF2-2D34A038728C}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Release|Any CPU
|
||||
{BD7F352C-6DC1-4740-BAF2-2D34A038728C}.Ad-Hoc|iPhoneSimulator.Build.0 = Release|Any CPU
|
||||
{BD7F352C-6DC1-4740-BAF2-2D34A038728C}.Ad-Hoc|Mono.ActiveCfg = Release|Any CPU
|
||||
{BD7F352C-6DC1-4740-BAF2-2D34A038728C}.Ad-Hoc|Mono.Build.0 = Release|Any CPU
|
||||
{BD7F352C-6DC1-4740-BAF2-2D34A038728C}.Ad-Hoc|x86.ActiveCfg = Release|Any CPU
|
||||
{BD7F352C-6DC1-4740-BAF2-2D34A038728C}.Ad-Hoc|x86.Build.0 = Release|Any CPU
|
||||
{BD7F352C-6DC1-4740-BAF2-2D34A038728C}.AppStore|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{BD7F352C-6DC1-4740-BAF2-2D34A038728C}.AppStore|Any CPU.Build.0 = Release|Any CPU
|
||||
{BD7F352C-6DC1-4740-BAF2-2D34A038728C}.AppStore|iPhone.ActiveCfg = Release|Any CPU
|
||||
{BD7F352C-6DC1-4740-BAF2-2D34A038728C}.AppStore|iPhone.Build.0 = Release|Any CPU
|
||||
{BD7F352C-6DC1-4740-BAF2-2D34A038728C}.AppStore|iPhoneSimulator.ActiveCfg = Release|Any CPU
|
||||
{BD7F352C-6DC1-4740-BAF2-2D34A038728C}.AppStore|iPhoneSimulator.Build.0 = Release|Any CPU
|
||||
{BD7F352C-6DC1-4740-BAF2-2D34A038728C}.AppStore|Mono.ActiveCfg = Release|Any CPU
|
||||
{BD7F352C-6DC1-4740-BAF2-2D34A038728C}.AppStore|Mono.Build.0 = Release|Any CPU
|
||||
{BD7F352C-6DC1-4740-BAF2-2D34A038728C}.AppStore|x86.ActiveCfg = Release|Any CPU
|
||||
{BD7F352C-6DC1-4740-BAF2-2D34A038728C}.AppStore|x86.Build.0 = Release|Any CPU
|
||||
{BD7F352C-6DC1-4740-BAF2-2D34A038728C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{BD7F352C-6DC1-4740-BAF2-2D34A038728C}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{BD7F352C-6DC1-4740-BAF2-2D34A038728C}.Debug|iPhone.ActiveCfg = Debug|Any CPU
|
||||
{BD7F352C-6DC1-4740-BAF2-2D34A038728C}.Debug|iPhone.Build.0 = Debug|Any CPU
|
||||
{BD7F352C-6DC1-4740-BAF2-2D34A038728C}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
|
||||
{BD7F352C-6DC1-4740-BAF2-2D34A038728C}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
|
||||
{BD7F352C-6DC1-4740-BAF2-2D34A038728C}.Debug|Mono.ActiveCfg = Debug|Any CPU
|
||||
{BD7F352C-6DC1-4740-BAF2-2D34A038728C}.Debug|Mono.Build.0 = Debug|Any CPU
|
||||
{BD7F352C-6DC1-4740-BAF2-2D34A038728C}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{BD7F352C-6DC1-4740-BAF2-2D34A038728C}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{BD7F352C-6DC1-4740-BAF2-2D34A038728C}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{BD7F352C-6DC1-4740-BAF2-2D34A038728C}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{BD7F352C-6DC1-4740-BAF2-2D34A038728C}.Release|iPhone.ActiveCfg = Release|Any CPU
|
||||
{BD7F352C-6DC1-4740-BAF2-2D34A038728C}.Release|iPhone.Build.0 = Release|Any CPU
|
||||
{BD7F352C-6DC1-4740-BAF2-2D34A038728C}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
|
||||
{BD7F352C-6DC1-4740-BAF2-2D34A038728C}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
|
||||
{BD7F352C-6DC1-4740-BAF2-2D34A038728C}.Release|Mono.ActiveCfg = Release|Any CPU
|
||||
{BD7F352C-6DC1-4740-BAF2-2D34A038728C}.Release|Mono.Build.0 = Release|Any CPU
|
||||
{BD7F352C-6DC1-4740-BAF2-2D34A038728C}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{BD7F352C-6DC1-4740-BAF2-2D34A038728C}.Release|x86.Build.0 = Release|Any CPU
|
||||
{4A1ABB09-9047-4BD5-A4AD-A055E52C5EE0}.Ad-Hoc|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{4A1ABB09-9047-4BD5-A4AD-A055E52C5EE0}.Ad-Hoc|Any CPU.Build.0 = Release|Any CPU
|
||||
{4A1ABB09-9047-4BD5-A4AD-A055E52C5EE0}.Ad-Hoc|iPhone.ActiveCfg = Release|Any CPU
|
||||
|
@ -2576,11 +2412,8 @@ Global
|
|||
{DABFD304-D6A4-4752-8123-C2CCF7AC7831} = {C5A00AC3-B34C-4564-9BDD-2DA473EF4D8B}
|
||||
{AC18926A-E784-40FE-B09D-BB0FE2B599F0} = {C5A00AC3-B34C-4564-9BDD-2DA473EF4D8B}
|
||||
{EFB11458-9CDF-41C0-BE4F-44AF45A4CAB8} = {C5A00AC3-B34C-4564-9BDD-2DA473EF4D8B}
|
||||
{E106CF37-4066-4615-B684-172A6D30B058} = {C5A00AC3-B34C-4564-9BDD-2DA473EF4D8B}
|
||||
{99135EAB-653D-47E4-A378-C96E1278CA44} = {C5A00AC3-B34C-4564-9BDD-2DA473EF4D8B}
|
||||
{3E53A01A-B331-47F3-B828-4A5717E77A24} = {8B6A8209-894F-4BA1-B880-965FD453982C}
|
||||
{54F237D5-A70A-4752-9656-0C70B1A7B047} = {B9894058-278A-46B5-B6ED-AD613FCC03B3}
|
||||
{FB05AC90-89BA-4F2F-A924-F37875FB547C} = {B9894058-278A-46B5-B6ED-AD613FCC03B3}
|
||||
{E4D9629C-F168-4224-3F51-A5E482FFBC42} = {A689DEF5-D50F-4975-8B72-124C9EB54066}
|
||||
{6417E941-21BC-467B-A771-0DE389353CE6} = {8B6A8209-894F-4BA1-B880-965FD453982C}
|
||||
{8EF392D5-1416-45AA-9956-7CBBC3229E8A} = {C5A00AC3-B34C-4564-9BDD-2DA473EF4D8B}
|
||||
|
@ -2602,7 +2435,6 @@ Global
|
|||
{FBCAF3D0-2808-4934-8E96-3F607594517B} = {9B9E3891-2366-4253-A952-D08BCEB71098}
|
||||
{A0CC0258-D18C-4AB3-854F-7101680FC3F9} = {9B9E3891-2366-4253-A952-D08BCEB71098}
|
||||
{C7A69145-60B6-4882-97D6-A3921DD43978} = {A0CC0258-D18C-4AB3-854F-7101680FC3F9}
|
||||
{BD7F352C-6DC1-4740-BAF2-2D34A038728C} = {A0CC0258-D18C-4AB3-854F-7101680FC3F9}
|
||||
{F1FDC5B0-4654-416F-AE69-E3E9BBD87801} = {9B9E3891-2366-4253-A952-D08BCEB71098}
|
||||
{29132311-1848-4FD6-AE0C-4FF841151BD3} = {9B9E3891-2366-4253-A952-D08BCEB71098}
|
||||
{9DEFC6B7-845B-4D8F-AFC0-D32BF0032B8C} = {B39A8919-9F95-48FE-AD7B-76E08B509888}
|
||||
|
|
|
@ -375,23 +375,6 @@ public class Packages
|
|||
OutputDirectory = parameters.NugetRoot
|
||||
},
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Avalonia.Gtk
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
new NuGetPackSettings()
|
||||
{
|
||||
Id = "Avalonia.Gtk",
|
||||
Dependencies = new []
|
||||
{
|
||||
new NuSpecDependency() { Id = "Avalonia", Version = parameters.Version }
|
||||
},
|
||||
Files = new []
|
||||
{
|
||||
new NuSpecContent { Source = "Avalonia.Gtk.dll", Target = "lib/net45" }
|
||||
},
|
||||
BasePath = context.Directory("./src/Gtk/Avalonia.Gtk/bin/" + parameters.DirSuffix),
|
||||
OutputDirectory = parameters.NugetRoot
|
||||
},
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Avalonia.Gtk3
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
new NuGetPackSettings()
|
||||
|
@ -409,23 +392,6 @@ public class Packages
|
|||
OutputDirectory = parameters.NugetRoot
|
||||
},
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Avalonia.Cairo
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
new NuGetPackSettings()
|
||||
{
|
||||
Id = "Avalonia.Cairo",
|
||||
Dependencies = new []
|
||||
{
|
||||
new NuSpecDependency() { Id = "Avalonia", Version = parameters.Version }
|
||||
},
|
||||
Files = new []
|
||||
{
|
||||
new NuSpecContent { Source = "Avalonia.Cairo.dll", Target = "lib/net45" }
|
||||
},
|
||||
BasePath = context.Directory("./src/Gtk/Avalonia.Cairo/bin/" + parameters.DirSuffix),
|
||||
OutputDirectory = parameters.NugetRoot
|
||||
},
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Avalonia.Skia
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
new NuGetPackSettings()
|
||||
|
@ -471,19 +437,11 @@ public class Packages
|
|||
Id = "Avalonia.Desktop",
|
||||
Dependencies = new []
|
||||
{
|
||||
//Full .NET
|
||||
new NuSpecDependency() { Id = "Avalonia.Direct2D1", TargetFramework="net45", Version = parameters.Version },
|
||||
new NuSpecDependency() { Id = "Avalonia.Gtk", TargetFramework="net45", Version = parameters.Version },
|
||||
new NuSpecDependency() { Id = "Avalonia.Cairo", TargetFramework="net45", Version = parameters.Version },
|
||||
new NuSpecDependency() { Id = "Avalonia.Win32", TargetFramework="net45", Version = parameters.Version },
|
||||
new NuSpecDependency() { Id = "Avalonia.Skia", TargetFramework="net45", Version = parameters.Version },
|
||||
new NuSpecDependency() { Id = "Avalonia.Gtk3", TargetFramework="net45", Version = parameters.Version },
|
||||
new NuSpecDependency() { Id = "Avalonia.MonoMac", TargetFramework="net45", Version = parameters.Version },
|
||||
//.NET Core
|
||||
new NuSpecDependency() { Id = "Avalonia.Win32", TargetFramework="netcoreapp2.0", Version = parameters.Version },
|
||||
new NuSpecDependency() { Id = "Avalonia.Skia", TargetFramework="netcoreapp2.0", Version = parameters.Version },
|
||||
new NuSpecDependency() { Id = "Avalonia.Gtk3", TargetFramework="netcoreapp2.0", Version = parameters.Version },
|
||||
new NuSpecDependency() { Id = "Avalonia.MonoMac", TargetFramework="netcoreapp2.0", Version = parameters.Version }
|
||||
new NuSpecDependency() { Id = "Avalonia.Direct2D1", Version = parameters.Version },
|
||||
new NuSpecDependency() { Id = "Avalonia.Win32", Version = parameters.Version },
|
||||
new NuSpecDependency() { Id = "Avalonia.Skia", Version = parameters.Version },
|
||||
new NuSpecDependency() { Id = "Avalonia.Gtk3", Version = parameters.Version },
|
||||
new NuSpecDependency() { Id = "Avalonia.MonoMac", Version = parameters.Version }
|
||||
},
|
||||
Files = new NuSpecContent[]
|
||||
{
|
||||
|
|
|
@ -148,14 +148,6 @@
|
|||
<Project>{811a76cf-1cf6-440f-963b-bbe31bd72a82}</Project>
|
||||
<Name>Avalonia.Win32</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\src\Gtk\Avalonia.Gtk\Avalonia.Gtk.csproj">
|
||||
<Project>{54F237D5-A70A-4752-9656-0C70B1A7B047}</Project>
|
||||
<Name>Avalonia.Gtk</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\src\Gtk\Avalonia.Cairo\Avalonia.Cairo.csproj">
|
||||
<Project>{FB05AC90-89BA-4F2F-A924-F37875FB547C}</Project>
|
||||
<Name>Avalonia.Cairo</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<Import Project="..\..\build\Serilog.props" />
|
||||
|
|
|
@ -63,18 +63,10 @@
|
|||
<Project>{4A1ABB09-9047-4BD5-A4AD-A055E52C5EE0}</Project>
|
||||
<Name>Avalonia.DotNetFrameworkRuntime</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\src\Gtk\Avalonia.Cairo\Avalonia.Cairo.csproj">
|
||||
<Project>{FB05AC90-89BA-4F2F-A924-F37875FB547C}</Project>
|
||||
<Name>Avalonia.Cairo</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\src\Gtk\Avalonia.Gtk3\Avalonia.Gtk3.csproj">
|
||||
<Project>{bb1f7bb5-6ad4-4776-94d9-c09d0a972658}</Project>
|
||||
<Name>Avalonia.Gtk3</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\src\Gtk\Avalonia.Gtk\Avalonia.Gtk.csproj">
|
||||
<Project>{54F237D5-A70A-4752-9656-0C70B1A7B047}</Project>
|
||||
<Name>Avalonia.Gtk</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\src\Markup\Avalonia.Markup.Xaml\Avalonia.Markup.Xaml.csproj">
|
||||
<Project>{3E53A01A-B331-47F3-B828-4A5717E77A24}</Project>
|
||||
<Name>Avalonia.Markup.Xaml</Name>
|
||||
|
|
|
@ -1,126 +0,0 @@
|
|||
using Avalonia.Logging.Serilog;
|
||||
using Serilog;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using Avalonia;
|
||||
|
||||
namespace ControlCatalog
|
||||
{
|
||||
internal class Program
|
||||
{
|
||||
static void Main(string[] args)
|
||||
{
|
||||
InitializeLogging();
|
||||
|
||||
new App()
|
||||
.ConfigureRenderSystem(args)
|
||||
.LoadFromXaml()
|
||||
.RunWithMainWindow<MainWindow>();
|
||||
}
|
||||
|
||||
// This will be made into a runtime configuration extension soon!
|
||||
private static void InitializeLogging()
|
||||
{
|
||||
#if DEBUG
|
||||
SerilogLogger.Initialize(new LoggerConfiguration()
|
||||
.MinimumLevel.Warning()
|
||||
.WriteTo.Trace(outputTemplate: "{Area}: {Message}")
|
||||
.CreateLogger());
|
||||
#endif
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Experimental: Would like to move this into a shared location once I figure out the best place for it
|
||||
// considering all common libraries are PCL and do not have access to Environment.OSVersion.Platform
|
||||
// nor do they have access to the platform specific render/subsystem extensions.
|
||||
//
|
||||
// Perhaps via DI we register each system with a priority/rank
|
||||
//
|
||||
public static class RenderSystemExtensions
|
||||
{
|
||||
[Flags]
|
||||
enum RenderSystem
|
||||
{
|
||||
None = 0,
|
||||
GTK = 1,
|
||||
Skia = 2,
|
||||
Direct2D = 4
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// Default (Optimal) render system for a particular platform
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private static RenderSystem DefaultRenderSystem()
|
||||
{
|
||||
switch (Environment.OSVersion.Platform)
|
||||
{
|
||||
case PlatformID.MacOSX:
|
||||
return RenderSystem.GTK;
|
||||
|
||||
case PlatformID.Unix:
|
||||
return RenderSystem.GTK;
|
||||
|
||||
case PlatformID.Win32Windows:
|
||||
return RenderSystem.Direct2D;
|
||||
}
|
||||
|
||||
return RenderSystem.None;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns an array of avalidable rendering systems in priority order
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private static RenderSystem[] AvailableRenderSystems()
|
||||
{
|
||||
switch (Environment.OSVersion.Platform)
|
||||
{
|
||||
case PlatformID.MacOSX:
|
||||
return new RenderSystem[] { RenderSystem.GTK, RenderSystem.Skia };
|
||||
|
||||
case PlatformID.Unix:
|
||||
return new RenderSystem[] { RenderSystem.GTK, RenderSystem.Skia };
|
||||
|
||||
case PlatformID.Win32Windows:
|
||||
return new RenderSystem[] { RenderSystem.Direct2D, RenderSystem.Skia, RenderSystem.GTK };
|
||||
}
|
||||
|
||||
return new RenderSystem[0];
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Selects the optimal render system for desktop platforms. Supports cmd line overrides
|
||||
/// </summary>
|
||||
/// <param name="app"></param>
|
||||
/// <param name="args"></param>
|
||||
public static TApp ConfigureRenderSystem<TApp>(this TApp app, string[] args) where TApp : Application
|
||||
{
|
||||
// So this all works great under Windows where it can support
|
||||
// ALL configurations. But on OSX/Unix we cannot use Direct2D
|
||||
//
|
||||
if (args.Contains("--gtk") || DefaultRenderSystem() == RenderSystem.GTK)
|
||||
{
|
||||
app.UseGtk();
|
||||
app.UseCairo();
|
||||
}
|
||||
else
|
||||
{
|
||||
app.UseWin32();
|
||||
|
||||
if (args.Contains("--skia") || DefaultRenderSystem() == RenderSystem.Skia)
|
||||
{
|
||||
app.UseSkia();
|
||||
}
|
||||
else
|
||||
{
|
||||
app.UseDirect2D();
|
||||
}
|
||||
}
|
||||
|
||||
return app;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -132,14 +132,6 @@
|
|||
<Project>{3e10a5fa-e8da-48b1-ad44-6a5b6cb7750f}</Project>
|
||||
<Name>Avalonia.Themes.Default</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\src\Gtk\Avalonia.Cairo\Avalonia.Cairo.csproj">
|
||||
<Project>{fb05ac90-89ba-4f2f-a924-f37875fb547c}</Project>
|
||||
<Name>Avalonia.Cairo</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\src\Gtk\Avalonia.Gtk\Avalonia.Gtk.csproj">
|
||||
<Project>{54f237d5-a70a-4752-9656-0c70b1a7b047}</Project>
|
||||
<Name>Avalonia.Gtk</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\src\Markup\Avalonia.Markup.Xaml\Avalonia.Markup.Xaml.csproj">
|
||||
<Project>{3e53a01a-b331-47f3-b828-4a5717e77a24}</Project>
|
||||
<Name>Avalonia.Markup.Xaml</Name>
|
||||
|
|
|
@ -134,14 +134,6 @@
|
|||
<Project>{811a76cf-1cf6-440f-963b-bbe31bd72a82}</Project>
|
||||
<Name>Avalonia.Win32</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\src\Gtk\Avalonia.Cairo\Avalonia.Cairo.csproj">
|
||||
<Project>{FB05AC90-89BA-4F2F-A924-F37875FB547C}</Project>
|
||||
<Name>Avalonia.Cairo</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\src\Gtk\Avalonia.Gtk\Avalonia.Gtk.csproj">
|
||||
<Project>{54F237D5-A70A-4752-9656-0C70B1A7B047}</Project>
|
||||
<Name>Avalonia.Gtk</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="App.xaml">
|
||||
|
|
|
@ -1,6 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<configuration>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6" />
|
||||
</startup>
|
||||
</configuration>
|
|
@ -1,154 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{BD7F352C-6DC1-4740-BAF2-2D34A038728C}</ProjectGuid>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>GtkInteropDemo</RootNamespace>
|
||||
<AssemblyName>GtkInteropDemo</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<UseVSHostingProcess>false</UseVSHostingProcess>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="atk-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f, processorArchitecture=MSIL" />
|
||||
<Reference Include="gdk-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f, processorArchitecture=MSIL" />
|
||||
<Reference Include="glib-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f, processorArchitecture=MSIL" />
|
||||
<Reference Include="gtk-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f, processorArchitecture=MSIL" />
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Deployment" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Net.Http" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="MainWindow.cs" />
|
||||
<Compile Include="Program.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<EmbeddedResource Include="Properties\Resources.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
<Compile Include="Properties\Resources.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Resources.resx</DependentUpon>
|
||||
</Compile>
|
||||
<None Include="Properties\Settings.settings">
|
||||
<Generator>SettingsSingleFileGenerator</Generator>
|
||||
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
||||
</None>
|
||||
<Compile Include="Properties\Settings.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Settings.settings</DependentUpon>
|
||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="App.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\..\src\Avalonia.Animation\Avalonia.Animation.csproj">
|
||||
<Project>{d211e587-d8bc-45b9-95a4-f297c8fa5200}</Project>
|
||||
<Name>Avalonia.Animation</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\src\Avalonia.Base\Avalonia.Base.csproj">
|
||||
<Project>{b09b78d8-9b26-48b0-9149-d64a2f120f3f}</Project>
|
||||
<Name>Avalonia.Base</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\src\Avalonia.Controls\Avalonia.Controls.csproj">
|
||||
<Project>{d2221c82-4a25-4583-9b43-d791e3f6820c}</Project>
|
||||
<Name>Avalonia.Controls</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\src\Avalonia.Diagnostics\Avalonia.Diagnostics.csproj">
|
||||
<Project>{7062ae20-5dcc-4442-9645-8195bdece63e}</Project>
|
||||
<Name>Avalonia.Diagnostics</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\src\Avalonia.DotNetFrameworkRuntime\Avalonia.DotNetFrameworkRuntime.csproj">
|
||||
<Project>{4a1abb09-9047-4bd5-a4ad-a055e52c5ee0}</Project>
|
||||
<Name>Avalonia.DotNetFrameworkRuntime</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\src\Avalonia.Input\Avalonia.Input.csproj">
|
||||
<Project>{62024b2d-53eb-4638-b26b-85eeaa54866e}</Project>
|
||||
<Name>Avalonia.Input</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\src\Avalonia.Interactivity\Avalonia.Interactivity.csproj">
|
||||
<Project>{6b0ed19d-a08b-461c-a9d9-a9ee40b0c06b}</Project>
|
||||
<Name>Avalonia.Interactivity</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\src\Avalonia.Layout\Avalonia.Layout.csproj">
|
||||
<Project>{42472427-4774-4c81-8aff-9f27b8e31721}</Project>
|
||||
<Name>Avalonia.Layout</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\src\Avalonia.ReactiveUI\Avalonia.ReactiveUI.csproj">
|
||||
<Project>{6417b24e-49c2-4985-8db2-3ab9d898ec91}</Project>
|
||||
<Name>Avalonia.ReactiveUI</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\src\Avalonia.Visuals\Avalonia.Visuals.csproj">
|
||||
<Project>{eb582467-6abb-43a1-b052-e981ba910e3a}</Project>
|
||||
<Name>Avalonia.Visuals</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\src\Avalonia.Styling\Avalonia.Styling.csproj">
|
||||
<Project>{f1baa01a-f176-4c6a-b39d-5b40bb1b148f}</Project>
|
||||
<Name>Avalonia.Styling</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\src\Avalonia.Themes.Default\Avalonia.Themes.Default.csproj">
|
||||
<Project>{3e10a5fa-e8da-48b1-ad44-6a5b6cb7750f}</Project>
|
||||
<Name>Avalonia.Themes.Default</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\src\Gtk\Avalonia.Cairo\Avalonia.Cairo.csproj">
|
||||
<Project>{fb05ac90-89ba-4f2f-a924-f37875fb547c}</Project>
|
||||
<Name>Avalonia.Cairo</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\src\Gtk\Avalonia.Gtk\Avalonia.Gtk.csproj">
|
||||
<Project>{54f237d5-a70a-4752-9656-0c70b1a7b047}</Project>
|
||||
<Name>Avalonia.Gtk</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\src\Markup\Avalonia.Markup.Xaml\Avalonia.Markup.Xaml.csproj">
|
||||
<Project>{3e53a01a-b331-47f3-b828-4a5717e77a24}</Project>
|
||||
<Name>Avalonia.Markup.Xaml</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\src\Markup\Avalonia.Markup\Avalonia.Markup.csproj">
|
||||
<Project>{6417e941-21bc-467b-a771-0de389353ce6}</Project>
|
||||
<Name>Avalonia.Markup</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\src\Skia\Avalonia.Skia\Avalonia.Skia.csproj">
|
||||
<Project>{7d2d3083-71dd-4cc9-8907-39a0d86fb322}</Project>
|
||||
<Name>Avalonia.Skia</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\ControlCatalog\ControlCatalog.csproj">
|
||||
<Project>{d0a739b9-3c68-4ba6-a328-41606954b6bd}</Project>
|
||||
<Name>ControlCatalog</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="..\..\..\build\Rx.props" />
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
|
@ -1,30 +0,0 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Avalonia.Diagnostics;
|
||||
using Avalonia.Gtk.Embedding;
|
||||
using ControlCatalog;
|
||||
using Gtk;
|
||||
|
||||
namespace GtkInteropDemo
|
||||
{
|
||||
class MainWindow : Window
|
||||
{
|
||||
public MainWindow() : base("Gtk Embedding Demo")
|
||||
{
|
||||
var root = new HBox();
|
||||
var left = new VBox();
|
||||
left.Add(new Button("I'm GTK button"));
|
||||
left.Add(new Calendar());
|
||||
root.PackEnd(left, false, false, 0);
|
||||
var host = new GtkAvaloniaControlHost() {Content = new MainView()};
|
||||
host.SetSizeRequest(600, 600);
|
||||
root.PackStart(host, true, true, 0);
|
||||
Add(root);
|
||||
|
||||
ShowAll();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,24 +0,0 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using ControlCatalog;
|
||||
|
||||
namespace GtkInteropDemo
|
||||
{
|
||||
static class Program
|
||||
{
|
||||
/// <summary>
|
||||
/// The main entry point for the application.
|
||||
/// </summary>
|
||||
[STAThread]
|
||||
static void Main()
|
||||
{
|
||||
AppBuilder.Configure<App>().UseGtk().UseCairo().SetupWithoutStarting();
|
||||
new MainWindow().Show();
|
||||
Gtk.Application.Run();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,36 +0,0 @@
|
|||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("GtkInteropDemo")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("GtkInteropDemo")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2016")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("bd7f352c-6dc1-4740-baf2-2d34a038728c")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
|
@ -1,71 +0,0 @@
|
|||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.42000
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace GtkInteropDemo.Properties
|
||||
{
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// A strongly-typed resource class, for looking up localized strings, etc.
|
||||
/// </summary>
|
||||
// This class was auto-generated by the StronglyTypedResourceBuilder
|
||||
// class via a tool like ResGen or Visual Studio.
|
||||
// To add or remove a member, edit your .ResX file then rerun ResGen
|
||||
// with the /str option, or rebuild your VS project.
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
internal class Resources
|
||||
{
|
||||
|
||||
private static global::System.Resources.ResourceManager resourceMan;
|
||||
|
||||
private static global::System.Globalization.CultureInfo resourceCulture;
|
||||
|
||||
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
internal Resources()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the cached ResourceManager instance used by this class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Resources.ResourceManager ResourceManager
|
||||
{
|
||||
get
|
||||
{
|
||||
if ((resourceMan == null))
|
||||
{
|
||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("GtkInteropDemo.Properties.Resources", typeof(Resources).Assembly);
|
||||
resourceMan = temp;
|
||||
}
|
||||
return resourceMan;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Overrides the current thread's CurrentUICulture property for all
|
||||
/// resource lookups using this strongly typed resource class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Globalization.CultureInfo Culture
|
||||
{
|
||||
get
|
||||
{
|
||||
return resourceCulture;
|
||||
}
|
||||
set
|
||||
{
|
||||
resourceCulture = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,117 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
|
@ -1,30 +0,0 @@
|
|||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.42000
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace GtkInteropDemo.Properties
|
||||
{
|
||||
|
||||
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
|
||||
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
|
||||
{
|
||||
|
||||
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
|
||||
|
||||
public static Settings Default
|
||||
{
|
||||
get
|
||||
{
|
||||
return defaultInstance;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,7 +0,0 @@
|
|||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
|
||||
<Profiles>
|
||||
<Profile Name="(Default)" />
|
||||
</Profiles>
|
||||
<Settings />
|
||||
</SettingsFile>
|
|
@ -21,8 +21,8 @@ namespace Avalonia.Media
|
|||
/// <summary>
|
||||
/// Defines the <see cref="GradientStops"/> property.
|
||||
/// </summary>
|
||||
public static readonly StyledProperty<IReadOnlyList<GradientStop>> GradientStopsProperty =
|
||||
AvaloniaProperty.Register<GradientBrush, IReadOnlyList<GradientStop>>(nameof(Opacity));
|
||||
public static readonly StyledProperty<IList<GradientStop>> GradientStopsProperty =
|
||||
AvaloniaProperty.Register<GradientBrush, IList<GradientStop>>(nameof(Opacity));
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="GradientBrush"/> class.
|
||||
|
@ -46,7 +46,7 @@ namespace Avalonia.Media
|
|||
/// Gets or sets the brush's gradient stops.
|
||||
/// </summary>
|
||||
[Content]
|
||||
public IReadOnlyList<GradientStop> GradientStops
|
||||
public IList<GradientStop> GradientStops
|
||||
{
|
||||
get { return GetValue(GradientStopsProperty); }
|
||||
set { SetValue(GradientStopsProperty, value); }
|
||||
|
|
|
@ -10,7 +10,7 @@ namespace Avalonia.Media
|
|||
/// <summary>
|
||||
/// Gets the brush's gradient stops.
|
||||
/// </summary>
|
||||
IReadOnlyList<GradientStop> GradientStops { get; }
|
||||
IList<GradientStop> GradientStops { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the brush's spread method that defines how to draw a gradient that doesn't fill
|
||||
|
|
|
@ -16,7 +16,7 @@ namespace Avalonia.Media.Immutable
|
|||
/// <param name="opacity">The opacity of the brush.</param>
|
||||
/// <param name="spreadMethod">The spread method.</param>
|
||||
protected ImmutableGradientBrush(
|
||||
IReadOnlyList<GradientStop> gradientStops,
|
||||
IList<GradientStop> gradientStops,
|
||||
double opacity,
|
||||
GradientSpreadMethod spreadMethod)
|
||||
{
|
||||
|
@ -36,7 +36,7 @@ namespace Avalonia.Media.Immutable
|
|||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public IReadOnlyList<GradientStop> GradientStops { get; }
|
||||
public IList<GradientStop> GradientStops { get; }
|
||||
|
||||
/// <inheritdoc/>
|
||||
public double Opacity { get; }
|
||||
|
|
|
@ -20,7 +20,7 @@ namespace Avalonia.Media.Immutable
|
|||
/// <param name="startPoint">The start point for the gradient.</param>
|
||||
/// <param name="endPoint">The end point for the gradient.</param>
|
||||
public ImmutableLinearGradientBrush(
|
||||
IReadOnlyList<GradientStop> gradientStops,
|
||||
IList<GradientStop> gradientStops,
|
||||
double opacity = 1,
|
||||
GradientSpreadMethod spreadMethod = GradientSpreadMethod.Pad,
|
||||
RelativePoint? startPoint = null,
|
||||
|
|
|
@ -22,7 +22,7 @@ namespace Avalonia.Media.Immutable
|
|||
/// The horizontal and vertical radius of the outermost circle of the radial gradient.
|
||||
/// </param>
|
||||
public ImmutableRadialGradientBrush(
|
||||
IReadOnlyList<GradientStop> gradientStops,
|
||||
IList<GradientStop> gradientStops,
|
||||
double opacity = 1,
|
||||
GradientSpreadMethod spreadMethod = GradientSpreadMethod.Pad,
|
||||
RelativePoint? center = null,
|
||||
|
|
|
@ -21,7 +21,10 @@ namespace Avalonia.Media
|
|||
{ 'L', Command.Line },
|
||||
{ 'H', Command.HorizontalLine },
|
||||
{ 'V', Command.VerticalLine },
|
||||
{ 'Q', Command.QuadraticBezierCurve },
|
||||
{ 'T', Command.SmoothQuadraticBezierCurve },
|
||||
{ 'C', Command.CubicBezierCurve },
|
||||
{ 'S', Command.SmoothCubicBezierCurve },
|
||||
{ 'A', Command.Arc },
|
||||
{ 'Z', Command.Close },
|
||||
};
|
||||
|
@ -55,6 +58,9 @@ namespace Avalonia.Media
|
|||
HorizontalLine,
|
||||
VerticalLine,
|
||||
CubicBezierCurve,
|
||||
QuadraticBezierCurve,
|
||||
SmoothCubicBezierCurve,
|
||||
SmoothQuadraticBezierCurve,
|
||||
Arc,
|
||||
Close,
|
||||
}
|
||||
|
@ -71,7 +77,8 @@ namespace Avalonia.Media
|
|||
{
|
||||
Command command = Command.None;
|
||||
Point point = new Point();
|
||||
bool relative = false;
|
||||
bool relative = false;
|
||||
Point? previousControlPoint = null;
|
||||
|
||||
while (ReadCommand(reader, ref command, ref relative))
|
||||
{
|
||||
|
@ -79,6 +86,7 @@ namespace Avalonia.Media
|
|||
{
|
||||
case Command.FillRule:
|
||||
_context.SetFillRule(ReadFillRule(reader));
|
||||
previousControlPoint = null;
|
||||
break;
|
||||
|
||||
case Command.Move:
|
||||
|
@ -90,11 +98,13 @@ namespace Avalonia.Media
|
|||
point = ReadPoint(reader, point, relative);
|
||||
_context.BeginFigure(point, true);
|
||||
openFigure = true;
|
||||
previousControlPoint = null;
|
||||
break;
|
||||
|
||||
case Command.Line:
|
||||
point = ReadPoint(reader, point, relative);
|
||||
_context.LineTo(point);
|
||||
previousControlPoint = null;
|
||||
break;
|
||||
|
||||
case Command.HorizontalLine:
|
||||
|
@ -108,6 +118,7 @@ namespace Avalonia.Media
|
|||
}
|
||||
|
||||
_context.LineTo(point);
|
||||
previousControlPoint = null;
|
||||
break;
|
||||
|
||||
case Command.VerticalLine:
|
||||
|
@ -121,18 +132,57 @@ namespace Avalonia.Media
|
|||
}
|
||||
|
||||
_context.LineTo(point);
|
||||
previousControlPoint = null;
|
||||
break;
|
||||
|
||||
case Command.QuadraticBezierCurve:
|
||||
{
|
||||
Point handle = ReadPoint(reader, point, relative);
|
||||
previousControlPoint = handle;
|
||||
ReadSeparator(reader);
|
||||
point = ReadPoint(reader, point, relative);
|
||||
_context.QuadraticBezierTo(handle, point);
|
||||
break;
|
||||
}
|
||||
|
||||
case Command.SmoothQuadraticBezierCurve:
|
||||
{
|
||||
Point end = ReadPoint(reader, point, relative);
|
||||
|
||||
if(previousControlPoint != null)
|
||||
previousControlPoint = MirrorControlPoint((Point)previousControlPoint, point);
|
||||
|
||||
_context.QuadraticBezierTo(previousControlPoint ?? point, end);
|
||||
point = end;
|
||||
break;
|
||||
}
|
||||
|
||||
case Command.CubicBezierCurve:
|
||||
{
|
||||
Point point1 = ReadPoint(reader, point, relative);
|
||||
ReadSeparator(reader);
|
||||
Point point2 = ReadPoint(reader, point, relative);
|
||||
previousControlPoint = point2;
|
||||
ReadSeparator(reader);
|
||||
point = ReadPoint(reader, point, relative);
|
||||
_context.CubicBezierTo(point1, point2, point);
|
||||
break;
|
||||
}
|
||||
|
||||
case Command.SmoothCubicBezierCurve:
|
||||
{
|
||||
Point point2 = ReadPoint(reader, point, relative);
|
||||
ReadSeparator(reader);
|
||||
Point end = ReadPoint(reader, point, relative);
|
||||
|
||||
if(previousControlPoint != null)
|
||||
previousControlPoint = MirrorControlPoint((Point)previousControlPoint, point);
|
||||
|
||||
_context.CubicBezierTo(previousControlPoint ?? point, point2, end);
|
||||
previousControlPoint = point2;
|
||||
point = end;
|
||||
break;
|
||||
}
|
||||
|
||||
case Command.Arc:
|
||||
{
|
||||
|
@ -147,12 +197,14 @@ namespace Avalonia.Media
|
|||
point = ReadPoint(reader, point, relative);
|
||||
|
||||
_context.ArcTo(point, size, rotationAngle, isLargeArc, sweepDirection);
|
||||
previousControlPoint = null;
|
||||
break;
|
||||
}
|
||||
|
||||
case Command.Close:
|
||||
_context.EndFigure(true);
|
||||
openFigure = false;
|
||||
previousControlPoint = null;
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -167,6 +219,12 @@ namespace Avalonia.Media
|
|||
}
|
||||
}
|
||||
|
||||
private Point MirrorControlPoint(Point controlPoint, Point center)
|
||||
{
|
||||
Point dir = (controlPoint - center);
|
||||
return center + -dir;
|
||||
}
|
||||
|
||||
private static bool ReadCommand(
|
||||
StringReader reader,
|
||||
ref Command command,
|
||||
|
@ -243,6 +301,9 @@ namespace Avalonia.Media
|
|||
(c == 'E' && !readExponent) ||
|
||||
char.IsDigit(c))
|
||||
{
|
||||
if (b.Length != 0 && !readExponent && c == '-')
|
||||
break;
|
||||
|
||||
b.Append(c);
|
||||
reader.Read();
|
||||
|
||||
|
|
|
@ -10,6 +10,5 @@ using Avalonia.Metadata;
|
|||
[assembly: XmlnsDefinition("https://github.com/avaloniaui", "Avalonia.Animation")]
|
||||
[assembly: XmlnsDefinition("https://github.com/avaloniaui", "Avalonia.Media")]
|
||||
|
||||
[assembly: InternalsVisibleTo("Avalonia.Cairo.RenderTests")]
|
||||
[assembly: InternalsVisibleTo("Avalonia.Direct2D1.RenderTests")]
|
||||
[assembly: InternalsVisibleTo("Avalonia.Skia.RenderTests")]
|
|
@ -1,109 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{FB05AC90-89BA-4F2F-A924-F37875FB547C}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>Avalonia.Cairo</RootNamespace>
|
||||
<AssemblyName>Avalonia.Cairo</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<NuGetPackageImportStamp>
|
||||
</NuGetPackageImportStamp>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="gdk-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f, processorArchitecture=MSIL" />
|
||||
<Reference Include="glib-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f, processorArchitecture=MSIL" />
|
||||
<Reference Include="gtk-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f, processorArchitecture=MSIL" />
|
||||
<Reference Include="pango-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f, processorArchitecture=MSIL" />
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="Mono.Cairo" />
|
||||
<Reference Include="atk-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="..\..\Shared\SharedAssemblyInfo.cs">
|
||||
<Link>Properties\SharedAssemblyInfo.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="CairoPlatform.cs" />
|
||||
<Compile Include="Media\DrawingContext.cs" />
|
||||
<Compile Include="Media\FormattedTextImpl.cs" />
|
||||
<Compile Include="Media\Imaging\BitmapImpl.cs" />
|
||||
<Compile Include="Media\Imaging\RenderTargetBitmapImpl.cs" />
|
||||
<Compile Include="Media\RadialGradientBrushImpl.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="RenderTarget.cs" />
|
||||
<Compile Include="CairoExtensions.cs" />
|
||||
<Compile Include="Media\StreamGeometryContextImpl.cs" />
|
||||
<Compile Include="Media\StreamGeometryImpl.cs" />
|
||||
<Compile Include="Media\BrushImpl.cs" />
|
||||
<Compile Include="Media\SolidColorBrushImpl.cs" />
|
||||
<Compile Include="Media\LinearGradientBrushImpl.cs" />
|
||||
<Compile Include="Media\ImageBrushImpl.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\Avalonia.Animation\Avalonia.Animation.csproj">
|
||||
<Project>{D211E587-D8BC-45B9-95A4-F297C8FA5200}</Project>
|
||||
<Name>Avalonia.Animation</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\Avalonia.Base\Avalonia.Base.csproj">
|
||||
<Project>{B09B78D8-9B26-48B0-9149-D64A2F120F3F}</Project>
|
||||
<Name>Avalonia.Base</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\Avalonia.Controls\Avalonia.Controls.csproj">
|
||||
<Project>{d2221c82-4a25-4583-9b43-d791e3f6820c}</Project>
|
||||
<Name>Avalonia.Controls</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\Avalonia.Input\Avalonia.Input.csproj">
|
||||
<Project>{62024b2d-53eb-4638-b26b-85eeaa54866e}</Project>
|
||||
<Name>Avalonia.Input</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\Avalonia.Interactivity\Avalonia.Interactivity.csproj">
|
||||
<Project>{6b0ed19d-a08b-461c-a9d9-a9ee40b0c06b}</Project>
|
||||
<Name>Avalonia.Interactivity</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\Avalonia.Layout\Avalonia.Layout.csproj">
|
||||
<Project>{42472427-4774-4C81-8AFF-9F27B8E31721}</Project>
|
||||
<Name>Avalonia.Layout</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\Avalonia.Visuals\Avalonia.Visuals.csproj">
|
||||
<Project>{EB582467-6ABB-43A1-B052-E981BA910E3A}</Project>
|
||||
<Name>Avalonia.Visuals</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\Avalonia.Styling\Avalonia.Styling.csproj">
|
||||
<Project>{f1baa01a-f176-4c6a-b39d-5b40bb1b148f}</Project>
|
||||
<Name>Avalonia.Styling</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="app.config" />
|
||||
</ItemGroup>
|
||||
<Import Project="..\..\Shared\RenderHelpers\RenderHelpers.projitems" Label="Shared" />
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<Import Project="..\..\..\build\Rx.props" />
|
||||
</Project>
|
|
@ -1,64 +0,0 @@
|
|||
// Copyright (c) The Avalonia Project. All rights reserved.
|
||||
// Licensed under the MIT license. See licence.md file in the project root for full license information.
|
||||
|
||||
namespace Avalonia.Cairo
|
||||
{
|
||||
using Cairo = global::Cairo;
|
||||
|
||||
public static class CairoExtensions
|
||||
{
|
||||
public static Cairo.Color ToCairo(this Avalonia.Media.Color color)
|
||||
{
|
||||
return new Cairo.Color(color.R / 255.0, color.G / 255.0, color.B / 255.0, color.A / 255.0);
|
||||
}
|
||||
|
||||
public static Cairo.Matrix ToCairo(this Matrix m)
|
||||
{
|
||||
return new Cairo.Matrix(m.M11, m.M12, m.M21, m.M22, m.M31, m.M32);
|
||||
}
|
||||
|
||||
public static Cairo.PointD ToCairo(this Point p)
|
||||
{
|
||||
return new Cairo.PointD(p.X, p.Y);
|
||||
}
|
||||
|
||||
public static Cairo.Rectangle ToCairo(this Rect rect)
|
||||
{
|
||||
return new Cairo.Rectangle(rect.X, rect.Y, rect.Width, rect.Height);
|
||||
}
|
||||
|
||||
public static Rect ToAvalonia(this Cairo.Rectangle rect)
|
||||
{
|
||||
return new Rect(rect.X, rect.Y, rect.Width, rect.Height);
|
||||
}
|
||||
|
||||
public static Rect ToAvalonia(this Pango.Rectangle rect)
|
||||
{
|
||||
return new Rect(
|
||||
Pango.Units.ToDouble(rect.X),
|
||||
Pango.Units.ToDouble(rect.Y),
|
||||
Pango.Units.ToDouble(rect.Width),
|
||||
Pango.Units.ToDouble(rect.Height));
|
||||
}
|
||||
|
||||
public static Pango.Weight ToCairo(this Avalonia.Media.FontWeight weight)
|
||||
{
|
||||
return (Pango.Weight)weight;
|
||||
}
|
||||
|
||||
public static Pango.Alignment ToCairo(this Avalonia.Media.TextAlignment alignment)
|
||||
{
|
||||
if (alignment == Avalonia.Media.TextAlignment.Left)
|
||||
{
|
||||
return Pango.Alignment.Left;
|
||||
}
|
||||
|
||||
if (alignment == Avalonia.Media.TextAlignment.Center)
|
||||
{
|
||||
return Pango.Alignment.Center;
|
||||
}
|
||||
|
||||
return Pango.Alignment.Right;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,112 +0,0 @@
|
|||
// Copyright (c) The Avalonia Project. All rights reserved.
|
||||
// Licensed under the MIT license. See licence.md file in the project root for full license information.
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Avalonia.Cairo.Media;
|
||||
using Avalonia.Cairo.Media.Imaging;
|
||||
using Avalonia.Media;
|
||||
using Avalonia.Platform;
|
||||
using Avalonia.Controls;
|
||||
|
||||
namespace Avalonia
|
||||
{
|
||||
public static class GtkApplicationExtensions
|
||||
{
|
||||
public static T UseCairo<T>(this T builder) where T : AppBuilderBase<T>, new()
|
||||
{
|
||||
builder.UseRenderingSubsystem(Cairo.CairoPlatform.Initialize, "Cairo");
|
||||
return builder;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
namespace Avalonia.Cairo
|
||||
{
|
||||
using System.IO;
|
||||
using global::Cairo;
|
||||
using Rendering;
|
||||
|
||||
public class CairoPlatform : IPlatformRenderInterface
|
||||
{
|
||||
private static readonly CairoPlatform s_instance = new CairoPlatform();
|
||||
|
||||
private static readonly Pango.Context s_pangoContext = CreatePangoContext();
|
||||
|
||||
public static void Initialize() => AvaloniaLocator.CurrentMutable.Bind<IPlatformRenderInterface>().ToConstant(s_instance);
|
||||
|
||||
public IBitmapImpl CreateBitmap(int width, int height)
|
||||
{
|
||||
return new BitmapImpl(new Gdk.Pixbuf(Gdk.Colorspace.Rgb, true, 32, width, height));
|
||||
}
|
||||
|
||||
public IFormattedTextImpl CreateFormattedText(
|
||||
string text,
|
||||
Typeface typeface,
|
||||
TextAlignment textAlignment,
|
||||
TextWrapping wrapping,
|
||||
Size constraint,
|
||||
IReadOnlyList<FormattedTextStyleSpan> spans)
|
||||
{
|
||||
return new FormattedTextImpl(
|
||||
s_pangoContext,
|
||||
text,
|
||||
typeface,
|
||||
textAlignment,
|
||||
wrapping,
|
||||
constraint,
|
||||
spans);
|
||||
}
|
||||
|
||||
public IRenderTarget CreateRenderTarget(IEnumerable<object> surfaces)
|
||||
{
|
||||
var accessor = surfaces?.OfType<Func<Gdk.Drawable>>().FirstOrDefault();
|
||||
if(accessor!=null)
|
||||
return new RenderTarget(accessor);
|
||||
|
||||
throw new NotSupportedException(string.Format(
|
||||
"Don't know how to create a Cairo renderer from any of the provided surfaces."));
|
||||
}
|
||||
|
||||
public IRenderTargetBitmapImpl CreateRenderTargetBitmap(int width, int height, double dpiX, double dpiY)
|
||||
{
|
||||
return new RenderTargetBitmapImpl(new ImageSurface(Format.Argb32, width, height));
|
||||
}
|
||||
|
||||
public IStreamGeometryImpl CreateStreamGeometry()
|
||||
{
|
||||
return new StreamGeometryImpl();
|
||||
}
|
||||
|
||||
public IBitmapImpl LoadBitmap(string fileName)
|
||||
{
|
||||
var pixbuf = new Gdk.Pixbuf(fileName);
|
||||
|
||||
return new BitmapImpl(pixbuf);
|
||||
}
|
||||
|
||||
public IBitmapImpl LoadBitmap(Stream stream)
|
||||
{
|
||||
var pixbuf = new Gdk.Pixbuf(stream);
|
||||
|
||||
return new BitmapImpl(pixbuf);
|
||||
}
|
||||
|
||||
private static Pango.Context CreatePangoContext()
|
||||
{
|
||||
Gtk.Application.Init();
|
||||
return new Gtk.Invisible().CreatePangoContext();
|
||||
}
|
||||
|
||||
public IBitmapImpl LoadBitmap(PixelFormat format, IntPtr data, int width, int height, int stride)
|
||||
{
|
||||
throw new NotSupportedException("No proper control over pixel format with Cairo, use Skia backend instead");
|
||||
}
|
||||
|
||||
public IWritableBitmapImpl CreateWritableBitmap(int width, int height, PixelFormat? fmt)
|
||||
{
|
||||
throw new NotSupportedException("No proper support with Cairo, use Skia backend instead");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,17 +0,0 @@
|
|||
using System;
|
||||
using global::Cairo;
|
||||
|
||||
namespace Avalonia.Cairo
|
||||
{
|
||||
public abstract class BrushImpl : IDisposable
|
||||
{
|
||||
public Pattern PlatformBrush { get; protected set; }
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
if (this.PlatformBrush != null)
|
||||
this.PlatformBrush.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,415 +0,0 @@
|
|||
// Copyright (c) The Avalonia Project. All rights reserved.
|
||||
// Licensed under the MIT license. See licence.md file in the project root for full license information.
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reactive.Disposables;
|
||||
using Avalonia.Cairo.Media.Imaging;
|
||||
using Avalonia.Media;
|
||||
using Avalonia.Platform;
|
||||
using Avalonia.Rendering;
|
||||
// ReSharper disable PossibleNullReferenceException
|
||||
|
||||
namespace Avalonia.Cairo.Media
|
||||
{
|
||||
using Cairo = global::Cairo;
|
||||
|
||||
/// <summary>
|
||||
/// Draws using Cairo.
|
||||
/// </summary>
|
||||
public class DrawingContext : IDrawingContextImpl, IDisposable
|
||||
{
|
||||
private readonly Cairo.Context _context;
|
||||
private readonly IVisualBrushRenderer _visualBrushRenderer;
|
||||
private readonly Stack<BrushImpl> _maskStack = new Stack<BrushImpl>();
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="DrawingContext"/> class.
|
||||
/// </summary>
|
||||
/// <param name="surface">The target surface.</param>
|
||||
public DrawingContext(Cairo.Surface surface, IVisualBrushRenderer visualBrushRenderer)
|
||||
{
|
||||
_context = new Cairo.Context(surface);
|
||||
_visualBrushRenderer = visualBrushRenderer;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="DrawingContext"/> class.
|
||||
/// </summary>
|
||||
/// <param name="surface">The GDK drawable.</param>
|
||||
public DrawingContext(Gdk.Drawable drawable, IVisualBrushRenderer visualBrushRenderer)
|
||||
{
|
||||
_context = Gdk.CairoHelper.Create(drawable);
|
||||
_visualBrushRenderer = visualBrushRenderer;
|
||||
}
|
||||
|
||||
private Matrix _transform = Matrix.Identity;
|
||||
/// <summary>
|
||||
/// Gets the current transform of the drawing context.
|
||||
/// </summary>
|
||||
public Matrix Transform
|
||||
{
|
||||
get { return _transform; }
|
||||
set
|
||||
{
|
||||
_transform = value;
|
||||
_context.Matrix = value.ToCairo();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public void Clear(Color color)
|
||||
{
|
||||
_context.SetSourceRGBA(color.R, color.G, color.B, color.A);
|
||||
_context.Paint();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Ends a draw operation.
|
||||
/// </summary>
|
||||
public void Dispose()
|
||||
{
|
||||
_context.Dispose();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Draws a bitmap image.
|
||||
/// </summary>
|
||||
/// <param name="source">The bitmap image.</param>
|
||||
/// <param name="opacity">The opacity to draw with.</param>
|
||||
/// <param name="sourceRect">The rect in the image to draw.</param>
|
||||
/// <param name="destRect">The rect in the output to draw to.</param>
|
||||
public void DrawImage(IBitmapImpl bitmap, double opacity, Rect sourceRect, Rect destRect)
|
||||
{
|
||||
var pixbuf = bitmap as Gdk.Pixbuf;
|
||||
var rtb = bitmap as RenderTargetBitmapImpl;
|
||||
var size = new Size(pixbuf?.Width ?? rtb.PixelWidth, pixbuf?.Height ?? rtb.PixelHeight);
|
||||
var scale = new Vector(destRect.Width / sourceRect.Width, destRect.Height / sourceRect.Height);
|
||||
|
||||
_context.Save();
|
||||
_context.Scale(scale.X, scale.Y);
|
||||
destRect /= scale;
|
||||
|
||||
_context.PushGroup();
|
||||
|
||||
if (pixbuf != null)
|
||||
{
|
||||
Gdk.CairoHelper.SetSourcePixbuf(
|
||||
_context,
|
||||
pixbuf,
|
||||
-sourceRect.X + destRect.X,
|
||||
-sourceRect.Y + destRect.Y);
|
||||
}
|
||||
else
|
||||
{
|
||||
_context.SetSourceSurface(
|
||||
rtb.Surface,
|
||||
(int)(-sourceRect.X + destRect.X),
|
||||
(int)(-sourceRect.Y + destRect.Y));
|
||||
}
|
||||
|
||||
_context.Rectangle(destRect.ToCairo());
|
||||
_context.Fill();
|
||||
_context.PopGroupToSource();
|
||||
_context.PaintWithAlpha(opacityOverride);
|
||||
_context.Restore();
|
||||
}
|
||||
|
||||
public void DrawImage(IBitmapImpl source, IBrush opacityMask, Rect opacityMaskRect, Rect destRect)
|
||||
{
|
||||
PushOpacityMask(opacityMask, opacityMaskRect);
|
||||
DrawImage(source, 1, new Rect(0, 0, source.PixelWidth, source.PixelHeight), destRect);
|
||||
PopOpacityMask();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Draws a line.
|
||||
/// </summary>
|
||||
/// <param name="pen">The stroke pen.</param>
|
||||
/// <param name="p1">The first point of the line.</param>
|
||||
/// <param name="p1">The second point of the line.</param>
|
||||
public void DrawLine(Pen pen, Point p1, Point p2)
|
||||
{
|
||||
var size = new Rect(p1, p2).Size;
|
||||
|
||||
using (var p = SetPen(pen, size))
|
||||
{
|
||||
_context.MoveTo(p1.ToCairo());
|
||||
_context.LineTo(p2.ToCairo());
|
||||
_context.Stroke();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Draws a geometry.
|
||||
/// </summary>
|
||||
/// <param name="brush">The fill brush.</param>
|
||||
/// <param name="pen">The stroke pen.</param>
|
||||
/// <param name="geometry">The geometry.</param>
|
||||
public void DrawGeometry(IBrush brush, Pen pen, IGeometryImpl geometry)
|
||||
{
|
||||
var impl = geometry as StreamGeometryImpl;
|
||||
|
||||
var oldMatrix = Transform;
|
||||
Transform = impl.Transform * Transform;
|
||||
|
||||
|
||||
if (brush != null)
|
||||
{
|
||||
_context.AppendPath(impl.Path);
|
||||
using (var b = SetBrush(brush, geometry.Bounds.Size))
|
||||
{
|
||||
_context.FillRule = impl.FillRule == FillRule.EvenOdd
|
||||
? Cairo.FillRule.EvenOdd
|
||||
: Cairo.FillRule.Winding;
|
||||
|
||||
if (pen != null)
|
||||
_context.FillPreserve();
|
||||
else
|
||||
_context.Fill();
|
||||
}
|
||||
}
|
||||
Transform = oldMatrix;
|
||||
|
||||
if (pen != null)
|
||||
{
|
||||
_context.AppendPath(impl.Path);
|
||||
using (var p = SetPen(pen, geometry.Bounds.Size))
|
||||
{
|
||||
_context.Stroke();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Draws the outline of a rectangle.
|
||||
/// </summary>
|
||||
/// <param name="pen">The pen.</param>
|
||||
/// <param name="rect">The rectangle bounds.</param>
|
||||
public void DrawRectangle(Pen pen, Rect rect, float cornerRadius)
|
||||
{
|
||||
using (var p = SetPen(pen, rect.Size))
|
||||
{
|
||||
_context.Rectangle(rect.ToCairo());
|
||||
_context.Stroke();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Draws text.
|
||||
/// </summary>
|
||||
/// <param name="foreground">The foreground brush.</param>
|
||||
/// <param name="origin">The upper-left corner of the text.</param>
|
||||
/// <param name="text">The text.</param>
|
||||
public void DrawText(IBrush foreground, Point origin, IFormattedTextImpl text)
|
||||
{
|
||||
var layout = ((FormattedTextImpl)text).Layout;
|
||||
_context.MoveTo(origin.X, origin.Y);
|
||||
|
||||
using (var b = SetBrush(foreground, new Size(0, 0)))
|
||||
{
|
||||
Pango.CairoHelper.ShowLayout(_context, layout);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Draws a filled rectangle.
|
||||
/// </summary>
|
||||
/// <param name="brush">The brush.</param>
|
||||
/// <param name="rect">The rectangle bounds.</param>
|
||||
public void FillRectangle(IBrush brush, Rect rect, float cornerRadius)
|
||||
{
|
||||
using (var b = SetBrush(brush, rect.Size))
|
||||
{
|
||||
_context.Rectangle(rect.ToCairo());
|
||||
_context.Fill();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Pushes a clip rectange.
|
||||
/// </summary>
|
||||
/// <param name="clip">The clip rectangle.</param>
|
||||
/// <returns>A disposable used to undo the clip rectangle.</returns>
|
||||
public void PushClip(Rect clip)
|
||||
{
|
||||
_context.Save();
|
||||
_context.Rectangle(clip.ToCairo());
|
||||
_context.Clip();
|
||||
}
|
||||
|
||||
public void PopClip()
|
||||
{
|
||||
_context.Restore();
|
||||
}
|
||||
|
||||
readonly Stack<double> _opacityStack = new Stack<double>();
|
||||
|
||||
/// <summary>
|
||||
/// Pushes an opacity value.
|
||||
/// </summary>
|
||||
/// <param name="opacity">The opacity.</param>
|
||||
/// <returns>A disposable used to undo the opacity.</returns>
|
||||
public void PushOpacity(double opacity)
|
||||
{
|
||||
_opacityStack.Push(opacityOverride);
|
||||
|
||||
if (opacity < 1.0f)
|
||||
opacityOverride *= opacity;
|
||||
|
||||
}
|
||||
|
||||
public void PopOpacity()
|
||||
{
|
||||
opacityOverride = _opacityStack.Pop();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Pushes a matrix transformation.
|
||||
/// </summary>
|
||||
/// <param name="matrix">The matrix</param>
|
||||
/// <returns>A disposable used to undo the transformation.</returns>
|
||||
public IDisposable PushTransform(Matrix matrix)
|
||||
{
|
||||
_context.Save();
|
||||
_context.Transform(matrix.ToCairo());
|
||||
|
||||
return Disposable.Create(() =>
|
||||
{
|
||||
_context.Restore();
|
||||
});
|
||||
}
|
||||
|
||||
private double opacityOverride = 1.0f;
|
||||
|
||||
private IDisposable SetBrush(IBrush brush, Size destinationSize)
|
||||
{
|
||||
_context.Save();
|
||||
|
||||
BrushImpl impl = CreateBrushImpl(brush, destinationSize);
|
||||
|
||||
_context.SetSource(impl.PlatformBrush);
|
||||
return Disposable.Create(() =>
|
||||
{
|
||||
impl.Dispose();
|
||||
_context.Restore();
|
||||
});
|
||||
}
|
||||
|
||||
private BrushImpl CreateBrushImpl(IBrush brush, Size destinationSize)
|
||||
{
|
||||
var solid = brush as ISolidColorBrush;
|
||||
var linearGradientBrush = brush as ILinearGradientBrush;
|
||||
var radialGradientBrush = brush as IRadialGradientBrush;
|
||||
var imageBrush = brush as IImageBrush;
|
||||
var visualBrush = brush as IVisualBrush;
|
||||
BrushImpl impl = null;
|
||||
|
||||
if (solid != null)
|
||||
{
|
||||
impl = new SolidColorBrushImpl(solid, opacityOverride);
|
||||
}
|
||||
else if (linearGradientBrush != null)
|
||||
{
|
||||
impl = new LinearGradientBrushImpl(linearGradientBrush, destinationSize);
|
||||
}
|
||||
else if (radialGradientBrush != null)
|
||||
{
|
||||
impl = new RadialGradientBrushImpl(radialGradientBrush, destinationSize);
|
||||
}
|
||||
else if (imageBrush != null)
|
||||
{
|
||||
impl = new ImageBrushImpl(imageBrush, (BitmapImpl)imageBrush.Source.PlatformImpl, destinationSize);
|
||||
}
|
||||
else if (visualBrush != null)
|
||||
{
|
||||
if (_visualBrushRenderer != null)
|
||||
{
|
||||
var intermediateSize = _visualBrushRenderer.GetRenderTargetSize(visualBrush);
|
||||
|
||||
if (intermediateSize.Width >= 1 && intermediateSize.Height >= 1)
|
||||
{
|
||||
using (var intermediate = new Cairo.ImageSurface(Cairo.Format.ARGB32, (int)intermediateSize.Width, (int)intermediateSize.Height))
|
||||
{
|
||||
using (var ctx = new RenderTarget(intermediate).CreateDrawingContext(_visualBrushRenderer))
|
||||
{
|
||||
ctx.Clear(Colors.Transparent);
|
||||
_visualBrushRenderer.RenderVisualBrush(ctx, visualBrush);
|
||||
}
|
||||
|
||||
return new ImageBrushImpl(
|
||||
visualBrush,
|
||||
new RenderTargetBitmapImpl(intermediate),
|
||||
destinationSize);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new NotSupportedException("No IVisualBrushRenderer was supplied to DrawingContextImpl.");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
impl = new SolidColorBrushImpl(null, opacityOverride);
|
||||
}
|
||||
|
||||
return impl;
|
||||
}
|
||||
|
||||
private IDisposable SetPen(Pen pen, Size destinationSize)
|
||||
{
|
||||
if (pen.DashStyle != null)
|
||||
{
|
||||
if (pen.DashStyle.Dashes != null && pen.DashStyle.Dashes.Count > 0)
|
||||
{
|
||||
var cray = pen.DashStyle.Dashes.ToArray();
|
||||
_context.SetDash(cray, pen.DashStyle.Offset);
|
||||
}
|
||||
}
|
||||
|
||||
_context.LineWidth = pen.Thickness;
|
||||
_context.MiterLimit = pen.MiterLimit;
|
||||
|
||||
// Line caps and joins are currently broken on Cairo. I've defaulted them to sensible defaults for now.
|
||||
// Cairo does not have StartLineCap, EndLineCap, and DashCap properties, whereas Direct2D does.
|
||||
// TODO: Figure out a solution for this.
|
||||
_context.LineJoin = Cairo.LineJoin.Miter;
|
||||
_context.LineCap = Cairo.LineCap.Butt;
|
||||
|
||||
if (pen.Brush == null)
|
||||
return Disposable.Empty;
|
||||
|
||||
return SetBrush(pen.Brush, destinationSize);
|
||||
}
|
||||
|
||||
public void PushGeometryClip(IGeometryImpl clip)
|
||||
{
|
||||
_context.Save();
|
||||
_context.AppendPath(((StreamGeometryImpl)clip).Path);
|
||||
_context.Clip();
|
||||
}
|
||||
|
||||
public void PopGeometryClip()
|
||||
{
|
||||
_context.Restore();
|
||||
}
|
||||
|
||||
public void PushOpacityMask(IBrush mask, Rect bounds)
|
||||
{
|
||||
_context.PushGroup();
|
||||
var impl = CreateBrushImpl(mask, bounds.Size);
|
||||
_maskStack.Push(impl);
|
||||
}
|
||||
|
||||
public void PopOpacityMask()
|
||||
{
|
||||
_context.PopGroupToSource();
|
||||
var brushImpl = _maskStack.Pop();
|
||||
|
||||
_context.Mask(brushImpl.PlatformBrush);
|
||||
brushImpl.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,146 +0,0 @@
|
|||
// Copyright (c) The Avalonia Project. All rights reserved.
|
||||
// Licensed under the MIT license. See licence.md file in the project root for full license information.
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Avalonia.Media;
|
||||
using Avalonia.Platform;
|
||||
|
||||
namespace Avalonia.Cairo.Media
|
||||
{
|
||||
public class FormattedTextImpl : IFormattedTextImpl
|
||||
{
|
||||
private Size _constraint;
|
||||
|
||||
static double CorrectScale(double input)
|
||||
{
|
||||
return input * 0.75;
|
||||
}
|
||||
|
||||
public FormattedTextImpl(
|
||||
Pango.Context context,
|
||||
string text,
|
||||
Typeface typeface,
|
||||
TextAlignment textAlignment,
|
||||
TextWrapping wrapping,
|
||||
Size constraint,
|
||||
IReadOnlyList<FormattedTextStyleSpan> spans)
|
||||
{
|
||||
Contract.Requires<ArgumentNullException>(context != null);
|
||||
Contract.Requires<ArgumentNullException>(text != null);
|
||||
|
||||
Layout = new Pango.Layout(context);
|
||||
Layout.SetText(text);
|
||||
|
||||
Layout.FontDescription = new Pango.FontDescription
|
||||
{
|
||||
Family = typeface?.FontFamilyName ?? "monospace",
|
||||
Size = Pango.Units.FromDouble(CorrectScale(typeface?.FontSize ?? 12)),
|
||||
Style = (Pango.Style)(typeface?.Style ?? FontStyle.Normal),
|
||||
Weight = (typeface?.Weight ?? FontWeight.Normal).ToCairo(),
|
||||
};
|
||||
|
||||
Layout.Alignment = textAlignment.ToCairo();
|
||||
Layout.Attributes = new Pango.AttrList();
|
||||
Layout.Width = double.IsPositiveInfinity(constraint.Width) ? -1 : Pango.Units.FromDouble(constraint.Width);
|
||||
|
||||
if (spans != null)
|
||||
{
|
||||
foreach (var span in spans)
|
||||
{
|
||||
if (span.ForegroundBrush is SolidColorBrush scb)
|
||||
{
|
||||
var color = new Pango.Color();
|
||||
color.Parse(string.Format("#{0}", scb.Color.ToString().Substring(3)));
|
||||
|
||||
var brushAttr = new Pango.AttrForeground(color);
|
||||
brushAttr.StartIndex = (uint)TextIndexToPangoIndex(span.StartIndex);
|
||||
brushAttr.EndIndex = (uint)TextIndexToPangoIndex(span.StartIndex + span.Length);
|
||||
|
||||
this.Layout.Attributes.Insert(brushAttr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Size = Measure();
|
||||
}
|
||||
|
||||
public FormattedTextImpl(Pango.Layout layout)
|
||||
{
|
||||
Layout = layout;
|
||||
Size = Measure();
|
||||
}
|
||||
|
||||
public string Text => Layout.Text;
|
||||
|
||||
public Size Constraint => _constraint;
|
||||
|
||||
public Size Size { get; }
|
||||
|
||||
public Pango.Layout Layout { get; }
|
||||
|
||||
public IEnumerable<FormattedTextLine> GetLines()
|
||||
{
|
||||
return new FormattedTextLine[0];
|
||||
}
|
||||
|
||||
public TextHitTestResult HitTestPoint(Point point)
|
||||
{
|
||||
int textPosition;
|
||||
int trailing;
|
||||
|
||||
var isInside = Layout.XyToIndex(
|
||||
Pango.Units.FromDouble(point.X),
|
||||
Pango.Units.FromDouble(point.Y),
|
||||
out textPosition,
|
||||
out trailing);
|
||||
|
||||
textPosition = PangoIndexToTextIndex(textPosition);
|
||||
|
||||
return new TextHitTestResult
|
||||
{
|
||||
IsInside = isInside,
|
||||
TextPosition = textPosition,
|
||||
IsTrailing = trailing == 0,
|
||||
};
|
||||
}
|
||||
|
||||
int PangoIndexToTextIndex(int pangoIndex)
|
||||
{
|
||||
return Encoding.UTF8.GetString(Encoding.UTF8.GetBytes(Text), 0, Math.Min(pangoIndex, Text.Length)).Length;
|
||||
}
|
||||
|
||||
public Rect HitTestTextPosition(int index)
|
||||
{
|
||||
return Layout.IndexToPos(TextIndexToPangoIndex(index)).ToAvalonia();
|
||||
}
|
||||
|
||||
int TextIndexToPangoIndex(int textIndex)
|
||||
{
|
||||
return Encoding.UTF8.GetByteCount(textIndex < Text.Length ? Text.Remove(textIndex) : Text);
|
||||
}
|
||||
|
||||
public IEnumerable<Rect> HitTestTextRange(int index, int length)
|
||||
{
|
||||
var ranges = new List<Rect>();
|
||||
|
||||
for (var i = 0; i < length; i++)
|
||||
{
|
||||
ranges.Add(HitTestTextPosition(index + i));
|
||||
}
|
||||
|
||||
return ranges;
|
||||
}
|
||||
|
||||
private Size Measure()
|
||||
{
|
||||
int width;
|
||||
int height;
|
||||
Layout.GetPixelSize(out width, out height);
|
||||
|
||||
return new Size(width, height);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,56 +0,0 @@
|
|||
using Avalonia.Media;
|
||||
using Avalonia.Platform;
|
||||
using Avalonia.Rendering.Utilities;
|
||||
using global::Cairo;
|
||||
|
||||
namespace Avalonia.Cairo.Media
|
||||
{
|
||||
public class ImageBrushImpl : BrushImpl
|
||||
{
|
||||
public ImageBrushImpl(
|
||||
ITileBrush brush,
|
||||
IBitmapImpl bitmap,
|
||||
Size targetSize)
|
||||
{
|
||||
var calc = new TileBrushCalculator(brush, new Size(bitmap.PixelWidth, bitmap.PixelHeight), targetSize);
|
||||
|
||||
using (var intermediate = new ImageSurface(Format.ARGB32, (int)calc.IntermediateSize.Width, (int)calc.IntermediateSize.Height))
|
||||
{
|
||||
using (var context = new RenderTarget(intermediate).CreateDrawingContext(null))
|
||||
{
|
||||
var rect = new Rect(0, 0, bitmap.PixelWidth, bitmap.PixelHeight);
|
||||
|
||||
context.Clear(Colors.Transparent);
|
||||
context.PushClip(calc.IntermediateClip);
|
||||
context.Transform = calc.IntermediateTransform;
|
||||
context.DrawImage(bitmap, 1, rect, rect);
|
||||
context.PopClip();
|
||||
}
|
||||
|
||||
var result = new SurfacePattern(intermediate);
|
||||
|
||||
if ((brush.TileMode & TileMode.FlipXY) != 0)
|
||||
{
|
||||
// TODO: Currently always FlipXY as that's all cairo supports natively.
|
||||
// Support separate FlipX and FlipY by drawing flipped images to intermediate
|
||||
// surface.
|
||||
result.Extend = Extend.Reflect;
|
||||
}
|
||||
else
|
||||
{
|
||||
result.Extend = Extend.Repeat;
|
||||
}
|
||||
|
||||
if (brush.TileMode != TileMode.None)
|
||||
{
|
||||
var matrix = result.Matrix;
|
||||
matrix.InitTranslate(-calc.DestinationRect.X, -calc.DestinationRect.Y);
|
||||
result.Matrix = matrix;
|
||||
}
|
||||
|
||||
PlatformBrush = result;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,35 +0,0 @@
|
|||
// Copyright (c) The Avalonia Project. All rights reserved.
|
||||
// Licensed under the MIT license. See licence.md file in the project root for full license information.
|
||||
|
||||
using System;
|
||||
using Avalonia.Platform;
|
||||
|
||||
namespace Avalonia.Cairo.Media.Imaging
|
||||
{
|
||||
using System.IO;
|
||||
using Cairo = global::Cairo;
|
||||
|
||||
public class BitmapImpl : Gdk.Pixbuf, IBitmapImpl
|
||||
{
|
||||
public BitmapImpl(Gdk.Pixbuf pixbuf)
|
||||
:base(pixbuf.SaveToBuffer("png"))
|
||||
{
|
||||
}
|
||||
|
||||
public int PixelWidth => Width;
|
||||
|
||||
public int PixelHeight => Height;
|
||||
|
||||
public void Save(string fileName)
|
||||
{
|
||||
// TODO: Test
|
||||
Save(fileName, "png");
|
||||
}
|
||||
|
||||
public void Save(Stream stream)
|
||||
{
|
||||
var buffer = SaveToBuffer("png");
|
||||
stream.Write(buffer, 0, buffer.Length);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,58 +0,0 @@
|
|||
// Copyright (c) The Avalonia Project. All rights reserved.
|
||||
// Licensed under the MIT license. See licence.md file in the project root for full license information.
|
||||
|
||||
using System;
|
||||
using Avalonia.Media;
|
||||
using Avalonia.Platform;
|
||||
using Avalonia.Rendering;
|
||||
|
||||
namespace Avalonia.Cairo.Media.Imaging
|
||||
{
|
||||
using System.IO;
|
||||
using Cairo = global::Cairo;
|
||||
|
||||
public class RenderTargetBitmapImpl : IRenderTargetBitmapImpl
|
||||
{
|
||||
|
||||
private readonly RenderTarget _renderTarget;
|
||||
public RenderTargetBitmapImpl(Cairo.ImageSurface surface)
|
||||
{
|
||||
Surface = surface;
|
||||
_renderTarget = new RenderTarget(Surface);
|
||||
}
|
||||
|
||||
public int PixelWidth => Surface.Width;
|
||||
|
||||
public int PixelHeight => Surface.Height;
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
_renderTarget.Dispose();
|
||||
}
|
||||
|
||||
public Cairo.ImageSurface Surface
|
||||
{
|
||||
get;
|
||||
}
|
||||
|
||||
public void Save(string fileName)
|
||||
{
|
||||
Surface.WriteToPng(fileName);
|
||||
}
|
||||
|
||||
public IDrawingContextImpl CreateDrawingContext(IVisualBrushRenderer visualBrushRenderer)
|
||||
{
|
||||
return _renderTarget.CreateDrawingContext(visualBrushRenderer);
|
||||
}
|
||||
|
||||
public void Save(Stream stream)
|
||||
{
|
||||
var tempFileName = Path.GetTempFileName();
|
||||
Surface.WriteToPng(tempFileName);
|
||||
using (var tempFile = new FileStream(tempFileName, FileMode.Create))
|
||||
{
|
||||
tempFile.CopyTo(stream);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,23 +0,0 @@
|
|||
using System;
|
||||
using Avalonia.Media;
|
||||
using global::Cairo;
|
||||
|
||||
namespace Avalonia.Cairo
|
||||
{
|
||||
public class LinearGradientBrushImpl : BrushImpl
|
||||
{
|
||||
public LinearGradientBrushImpl(ILinearGradientBrush brush, Size destinationSize)
|
||||
{
|
||||
var start = brush.StartPoint.ToPixels(destinationSize);
|
||||
var end = brush.EndPoint.ToPixels(destinationSize);
|
||||
|
||||
this.PlatformBrush = new LinearGradient(start.X, start.Y, end.X, end.Y);
|
||||
|
||||
foreach (var stop in brush.GradientStops)
|
||||
((LinearGradient)this.PlatformBrush).AddColorStop(stop.Offset, stop.Color.ToCairo());
|
||||
|
||||
((LinearGradient)this.PlatformBrush).Extend = Extend.Pad;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,27 +0,0 @@
|
|||
using System;
|
||||
using Avalonia.Media;
|
||||
using global::Cairo;
|
||||
|
||||
namespace Avalonia.Cairo
|
||||
{
|
||||
public class RadialGradientBrushImpl : BrushImpl
|
||||
{
|
||||
public RadialGradientBrushImpl(IRadialGradientBrush brush, Size destinationSize)
|
||||
{
|
||||
var center = brush.Center.ToPixels(destinationSize);
|
||||
var gradientOrigin = brush.GradientOrigin.ToPixels(destinationSize);
|
||||
var radius = brush.Radius * Math.Min(destinationSize.Width, destinationSize.Height);
|
||||
|
||||
this.PlatformBrush = new RadialGradient(center.X, center.Y, 1, gradientOrigin.X, gradientOrigin.Y, radius);
|
||||
this.PlatformBrush.Matrix = Matrix.Identity.ToCairo();
|
||||
|
||||
foreach (var stop in brush.GradientStops)
|
||||
{
|
||||
((RadialGradient)this.PlatformBrush).AddColorStop(stop.Offset, stop.Color.ToCairo());
|
||||
}
|
||||
|
||||
((RadialGradient)this.PlatformBrush).Extend = Extend.Pad;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,22 +0,0 @@
|
|||
using System;
|
||||
using global::Cairo;
|
||||
|
||||
namespace Avalonia.Cairo
|
||||
{
|
||||
public class SolidColorBrushImpl : BrushImpl
|
||||
{
|
||||
public SolidColorBrushImpl(Avalonia.Media.ISolidColorBrush brush, double opacityOverride = 1.0f)
|
||||
{
|
||||
var color = brush?.Color.ToCairo() ?? new Color();
|
||||
|
||||
if (brush != null)
|
||||
color.A = Math.Min(brush.Opacity, color.A);
|
||||
|
||||
if (opacityOverride < 1.0f)
|
||||
color.A = Math.Min(opacityOverride, color.A);
|
||||
|
||||
this.PlatformBrush = new SolidPattern(color);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,124 +0,0 @@
|
|||
// Copyright (c) The Avalonia Project. All rights reserved.
|
||||
// Licensed under the MIT license. See licence.md file in the project root for full license information.
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Avalonia.Media;
|
||||
using Avalonia.Platform;
|
||||
using Avalonia.RenderHelpers;
|
||||
|
||||
namespace Avalonia.Cairo.Media
|
||||
{
|
||||
using Cairo = global::Cairo;
|
||||
|
||||
public class StreamGeometryContextImpl : IStreamGeometryContextImpl
|
||||
{
|
||||
private readonly StreamGeometryImpl _target;
|
||||
private Point _currentPoint;
|
||||
public StreamGeometryContextImpl(StreamGeometryImpl target, Cairo.Path path)
|
||||
{
|
||||
_target = target;
|
||||
|
||||
_surf = new Cairo.ImageSurface (Cairo.Format.Argb32, 0, 0);
|
||||
_context = new Cairo.Context (_surf);
|
||||
this.Path = path;
|
||||
|
||||
if (this.Path != null)
|
||||
{
|
||||
_context.AppendPath(this.Path);
|
||||
}
|
||||
}
|
||||
|
||||
public void ArcTo(Point point, Size size, double rotationAngle, bool isLargeArc, SweepDirection sweepDirection)
|
||||
{
|
||||
ArcToHelper.ArcTo(this, _currentPoint, point, size, rotationAngle, isLargeArc, sweepDirection);
|
||||
_currentPoint = point;
|
||||
}
|
||||
|
||||
public void BeginFigure(Point startPoint, bool isFilled)
|
||||
{
|
||||
if (this.Path == null)
|
||||
{
|
||||
_context.MoveTo(startPoint.ToCairo());
|
||||
_currentPoint = startPoint;
|
||||
}
|
||||
}
|
||||
|
||||
public void CubicBezierTo(Point point1, Point point2, Point point3)
|
||||
{
|
||||
if (this.Path == null)
|
||||
{
|
||||
_context.CurveTo(point1.ToCairo(), point2.ToCairo(), point3.ToCairo());
|
||||
_currentPoint = point3;
|
||||
}
|
||||
}
|
||||
|
||||
public void QuadraticBezierTo(Point control, Point endPoint)
|
||||
{
|
||||
if (this.Path == null)
|
||||
{
|
||||
QuadBezierHelper.QuadraticBezierTo(this, _currentPoint, control, endPoint);
|
||||
_currentPoint = endPoint;
|
||||
}
|
||||
}
|
||||
|
||||
internal bool FillContains(Point point)
|
||||
{
|
||||
using (var context = new Cairo.Context(new Cairo.ImageSurface(Cairo.Format.Argb32, 0, 0)))
|
||||
{
|
||||
context.AppendPath(Path);
|
||||
return context.InFill(point.X, point.Y);
|
||||
}
|
||||
}
|
||||
|
||||
internal bool StrokeContains(Pen pen, Point point)
|
||||
{
|
||||
using (var context = new Cairo.Context(new Cairo.ImageSurface(Cairo.Format.Argb32, 0, 0)))
|
||||
{
|
||||
context.AppendPath(Path);
|
||||
return context.InStroke(point.X, point.Y);
|
||||
}
|
||||
}
|
||||
|
||||
public void LineTo(Point point)
|
||||
{
|
||||
if (this.Path == null)
|
||||
{
|
||||
_context.LineTo(point.ToCairo());
|
||||
_currentPoint = point;
|
||||
}
|
||||
}
|
||||
|
||||
private readonly Cairo.Context _context;
|
||||
private readonly Cairo.ImageSurface _surf;
|
||||
public Cairo.Path Path { get; private set; }
|
||||
public Rect Bounds { get; private set; }
|
||||
|
||||
public void EndFigure(bool isClosed)
|
||||
{
|
||||
if (this.Path == null)
|
||||
{
|
||||
if (isClosed)
|
||||
_context.ClosePath ();
|
||||
}
|
||||
}
|
||||
|
||||
public void SetFillRule(FillRule fillRule)
|
||||
{
|
||||
_target.FillRule = fillRule;
|
||||
}
|
||||
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
if (this.Path == null)
|
||||
{
|
||||
Path = _context.CopyPath();
|
||||
Bounds = _context.FillExtents().ToAvalonia();
|
||||
}
|
||||
|
||||
_context.Dispose ();
|
||||
_surf.Dispose ();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,86 +0,0 @@
|
|||
// Copyright (c) The Avalonia Project. All rights reserved.
|
||||
// Licensed under the MIT license. See licence.md file in the project root for full license information.
|
||||
|
||||
using System;
|
||||
using Avalonia.Media;
|
||||
using Avalonia.Platform;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Avalonia.Cairo.Media
|
||||
{
|
||||
using Cairo = global::Cairo;
|
||||
|
||||
public class StreamGeometryImpl : IStreamGeometryImpl
|
||||
{
|
||||
public StreamGeometryImpl()
|
||||
{
|
||||
_impl = new StreamGeometryContextImpl(this, null);
|
||||
}
|
||||
|
||||
public StreamGeometryImpl(StreamGeometryContextImpl impl)
|
||||
{
|
||||
_impl = impl;
|
||||
}
|
||||
|
||||
public Rect Bounds
|
||||
{
|
||||
get { return _impl.Bounds; }
|
||||
}
|
||||
|
||||
public Cairo.Path Path
|
||||
{
|
||||
get { return _impl.Path; }
|
||||
}
|
||||
|
||||
private readonly StreamGeometryContextImpl _impl;
|
||||
|
||||
private Matrix _transform = Matrix.Identity;
|
||||
|
||||
public Matrix Transform
|
||||
{
|
||||
get { return _transform; }
|
||||
private set { _transform = value; }
|
||||
}
|
||||
|
||||
public FillRule FillRule { get; set; }
|
||||
|
||||
public IStreamGeometryImpl Clone()
|
||||
{
|
||||
return new StreamGeometryImpl(_impl);
|
||||
}
|
||||
|
||||
public Rect GetRenderBounds(double strokeThickness)
|
||||
{
|
||||
// TODO: Calculate properly.
|
||||
return Bounds.TransformToAABB(Transform).Inflate(strokeThickness);
|
||||
}
|
||||
|
||||
public IStreamGeometryContextImpl Open()
|
||||
{
|
||||
return _impl;
|
||||
}
|
||||
|
||||
public bool FillContains(Point point)
|
||||
{
|
||||
return _impl.FillContains(point);
|
||||
}
|
||||
|
||||
public IGeometryImpl Intersect(IGeometryImpl geometry)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public bool StrokeContains(Pen pen, Point point)
|
||||
{
|
||||
return _impl.StrokeContains(pen, point);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public IGeometryImpl WithTransform(Matrix transform)
|
||||
{
|
||||
var result = (StreamGeometryImpl)Clone();
|
||||
result.Transform = transform;
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,25 +0,0 @@
|
|||
// Copyright (c) The Avalonia Project. All rights reserved.
|
||||
// Licensed under the MIT license. See licence.md file in the project root for full license information.
|
||||
|
||||
using Avalonia.Cairo;
|
||||
using Avalonia.Platform;
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("Avalonia.Cairo")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("f999ba8b-64e7-40cc-98a4-003f1852d2a3")]
|
||||
|
||||
[assembly: ExportRenderingSubsystem(OperatingSystemType.WinNT, 3, "Cairo", typeof(CairoPlatform), nameof(CairoPlatform.Initialize), RequiresWindowingSubsystem = "GTK")]
|
||||
[assembly: ExportRenderingSubsystem(OperatingSystemType.Linux, 2, "Cairo", typeof(CairoPlatform), nameof(CairoPlatform.Initialize), RequiresWindowingSubsystem = "GTK")]
|
||||
[assembly: ExportRenderingSubsystem(OperatingSystemType.OSX, 3, "Cairo", typeof(CairoPlatform), nameof(CairoPlatform.Initialize), RequiresWindowingSubsystem = "GTK")]
|
|
@ -1,58 +0,0 @@
|
|||
// Copyright (c) The Avalonia Project. All rights reserved.
|
||||
// Licensed under the MIT license. See licence.md file in the project root for full license information.
|
||||
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using Avalonia.Cairo.Media;
|
||||
using Avalonia.Media;
|
||||
using Avalonia.Platform;
|
||||
using Avalonia.Rendering;
|
||||
using Gtk;
|
||||
using DrawingContext = Avalonia.Media.DrawingContext;
|
||||
|
||||
namespace Avalonia.Cairo
|
||||
{
|
||||
using global::Cairo;
|
||||
|
||||
/// <summary>
|
||||
/// A cairo render target.
|
||||
/// </summary>
|
||||
public class RenderTarget : IRenderTarget
|
||||
{
|
||||
private readonly Surface _surface;
|
||||
private readonly Func<Gdk.Drawable> _drawableAccessor;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="RenderTarget"/> class.
|
||||
/// </summary>
|
||||
/// <param name="window">The window.</param>
|
||||
/// <param name="width">The width of the window.</param>
|
||||
/// <param name="height">The height of the window.</param>
|
||||
public RenderTarget(Func<Gdk.Drawable> drawable)
|
||||
{
|
||||
_drawableAccessor = drawable;
|
||||
}
|
||||
|
||||
public RenderTarget(ImageSurface surface)
|
||||
{
|
||||
_surface = surface;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a cairo surface that targets a platform-specific resource.
|
||||
/// </summary>
|
||||
/// <param name="visualBrushRenderer">The visual brush renderer to use.</param>
|
||||
/// <returns>A surface wrapped in an <see cref="Avalonia.Media.DrawingContext"/>.</returns>
|
||||
public IDrawingContextImpl CreateDrawingContext(IVisualBrushRenderer visualBrushRenderer)
|
||||
{
|
||||
if (_drawableAccessor != null)
|
||||
return new Media.DrawingContext(_drawableAccessor(), visualBrushRenderer);
|
||||
if (_surface != null)
|
||||
return new Media.DrawingContext(_surface, visualBrushRenderer);
|
||||
throw new InvalidOperationException("Unspecified render target");
|
||||
}
|
||||
|
||||
public void Dispose() => _surface?.Dispose();
|
||||
}
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<runtime>
|
||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Mono.Cairo" publicKeyToken="0738eb9f132ed756" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" />
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
</configuration>
|
|
@ -1,105 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{54F237D5-A70A-4752-9656-0C70B1A7B047}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<RootNamespace>Avalonia.Gtk</RootNamespace>
|
||||
<AssemblyName>Avalonia.Gtk</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
|
||||
<NuGetPackageImportStamp>
|
||||
</NuGetPackageImportStamp>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug</OutputPath>
|
||||
<DefineConstants>DEBUG;</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<ConsolePause>false</ConsolePause>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release</OutputPath>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<ConsolePause>false</ConsolePause>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Mono.Cairo, Version=4.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756, processorArchitecture=MSIL">
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="gtk-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" />
|
||||
<Reference Include="atk-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" />
|
||||
<Reference Include="gdk-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" />
|
||||
<Reference Include="glib-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="..\..\Shared\SharedAssemblyInfo.cs">
|
||||
<Link>Properties\SharedAssemblyInfo.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="ClipboardImpl.cs" />
|
||||
<Compile Include="EmbeddableImpl.cs" />
|
||||
<Compile Include="Embedding\GtkAvaloniaControlHost.cs" />
|
||||
<Compile Include="FramebufferManager.cs" />
|
||||
<Compile Include="IconImpl.cs" />
|
||||
<Compile Include="KeyTransform.cs" />
|
||||
<Compile Include="ScreenImpl.cs" />
|
||||
<Compile Include="SurfaceFramebuffer.cs" />
|
||||
<Compile Include="SystemDialogImpl.cs" />
|
||||
<Compile Include="CursorFactory.cs" />
|
||||
<Compile Include="GtkExtensions.cs" />
|
||||
<Compile Include="PopupImpl.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="GtkPlatform.cs" />
|
||||
<Compile Include="WindowImpl.cs" />
|
||||
<Compile Include="TopLevelImpl.cs" />
|
||||
<Compile Include="Input\GtkKeyboardDevice.cs" />
|
||||
<Compile Include="Input\GtkMouseDevice.cs" />
|
||||
<Compile Include="Windows.cs" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\Avalonia.Animation\Avalonia.Animation.csproj">
|
||||
<Project>{D211E587-D8BC-45B9-95A4-F297C8FA5200}</Project>
|
||||
<Name>Avalonia.Animation</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\Avalonia.Base\Avalonia.Base.csproj">
|
||||
<Project>{B09B78D8-9B26-48B0-9149-D64A2F120F3F}</Project>
|
||||
<Name>Avalonia.Base</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\Avalonia.Diagnostics\Avalonia.Diagnostics.csproj">
|
||||
<Project>{7062ae20-5dcc-4442-9645-8195bdece63e}</Project>
|
||||
<Name>Avalonia.Diagnostics</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\Avalonia.Input\Avalonia.Input.csproj">
|
||||
<Project>{62024B2D-53EB-4638-B26B-85EEAA54866E}</Project>
|
||||
<Name>Avalonia.Input</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\Avalonia.Visuals\Avalonia.Visuals.csproj">
|
||||
<Project>{EB582467-6ABB-43A1-B052-E981BA910E3A}</Project>
|
||||
<Name>Avalonia.Visuals</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\Avalonia.Layout\Avalonia.Layout.csproj">
|
||||
<Project>{42472427-4774-4C81-8AFF-9F27B8E31721}</Project>
|
||||
<Name>Avalonia.Layout</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\Avalonia.Controls\Avalonia.Controls.csproj">
|
||||
<Project>{D2221C82-4A25-4583-9B43-D791E3F6820C}</Project>
|
||||
<Name>Avalonia.Controls</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\Avalonia.Styling\Avalonia.Styling.csproj">
|
||||
<Project>{F1BAA01A-F176-4C6A-B39D-5B40BB1B148F}</Project>
|
||||
<Name>Avalonia.Styling</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\Avalonia.Interactivity\Avalonia.Interactivity.csproj">
|
||||
<Project>{6B0ED19D-A08B-461C-A9D9-A9EE40B0C06B}</Project>
|
||||
<Name>Avalonia.Interactivity</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="..\..\..\build\Rx.props" />
|
||||
</Project>
|
|
@ -1,42 +0,0 @@
|
|||
// Copyright (c) The Avalonia Project. All rights reserved.
|
||||
// Licensed under the MIT license. See licence.md file in the project root for full license information.
|
||||
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using Gdk;
|
||||
using Avalonia.Input.Platform;
|
||||
|
||||
namespace Avalonia.Gtk
|
||||
{
|
||||
using Gtk = global::Gtk;
|
||||
|
||||
internal class ClipboardImpl : IClipboard
|
||||
{
|
||||
private static Gtk.Clipboard GetClipboard() => Gtk.Clipboard.GetForDisplay(Display.Default, new Atom(IntPtr.Zero));
|
||||
|
||||
public Task<string> GetTextAsync()
|
||||
{
|
||||
var clip = GetClipboard();
|
||||
var tcs = new TaskCompletionSource<string>();
|
||||
clip.RequestText((_, text) =>
|
||||
{
|
||||
tcs.TrySetResult(text);
|
||||
});
|
||||
return tcs.Task;
|
||||
}
|
||||
|
||||
public Task SetTextAsync(string text)
|
||||
{
|
||||
using (var cl = GetClipboard())
|
||||
cl.Text = text;
|
||||
return Task.FromResult(0);
|
||||
}
|
||||
|
||||
public Task ClearAsync()
|
||||
{
|
||||
using (var cl = GetClipboard())
|
||||
cl.Clear();
|
||||
return Task.FromResult(0);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,85 +0,0 @@
|
|||
// Copyright (c) The Avalonia Project. All rights reserved.
|
||||
// Licensed under the MIT license. See licence.md file in the project root for full license information.
|
||||
|
||||
using System.Collections.Generic;
|
||||
using Gdk;
|
||||
using Avalonia.Input;
|
||||
using Avalonia.Platform;
|
||||
|
||||
namespace Avalonia.Gtk
|
||||
{
|
||||
using Gtk = global::Gtk;
|
||||
|
||||
internal class CursorFactory : IStandardCursorFactory
|
||||
{
|
||||
public static CursorFactory Instance { get; } = new CursorFactory();
|
||||
|
||||
private CursorFactory()
|
||||
{
|
||||
}
|
||||
|
||||
private static readonly Dictionary<StandardCursorType, object> CursorTypeMapping = new Dictionary
|
||||
<StandardCursorType, object>
|
||||
{
|
||||
{StandardCursorType.AppStarting, CursorType.Watch},
|
||||
{StandardCursorType.Arrow, CursorType.LeftPtr},
|
||||
{StandardCursorType.Cross, CursorType.Cross},
|
||||
{StandardCursorType.Hand, CursorType.Hand1},
|
||||
{StandardCursorType.Ibeam, CursorType.Xterm},
|
||||
{StandardCursorType.No, Gtk.Stock.Cancel},
|
||||
{StandardCursorType.SizeAll, CursorType.Sizing},
|
||||
//{ StandardCursorType.SizeNorthEastSouthWest, 32643 },
|
||||
{StandardCursorType.SizeNorthSouth, CursorType.SbVDoubleArrow},
|
||||
//{ StandardCursorType.SizeNorthWestSouthEast, 32642 },
|
||||
{StandardCursorType.SizeWestEast, CursorType.SbHDoubleArrow},
|
||||
{StandardCursorType.UpArrow, CursorType.BasedArrowUp},
|
||||
{StandardCursorType.Wait, CursorType.Watch},
|
||||
{StandardCursorType.Help, Gtk.Stock.Help},
|
||||
{StandardCursorType.TopSide, CursorType.TopSide},
|
||||
{StandardCursorType.BottomSize, CursorType.BottomSide},
|
||||
{StandardCursorType.LeftSide, CursorType.LeftSide},
|
||||
{StandardCursorType.RightSide, CursorType.RightSide},
|
||||
{StandardCursorType.TopLeftCorner, CursorType.TopLeftCorner},
|
||||
{StandardCursorType.TopRightCorner, CursorType.TopRightCorner},
|
||||
{StandardCursorType.BottomLeftCorner, CursorType.BottomLeftCorner},
|
||||
{StandardCursorType.BottomRightCorner, CursorType.BottomRightCorner}
|
||||
};
|
||||
|
||||
private static readonly Dictionary<StandardCursorType, IPlatformHandle> Cache =
|
||||
new Dictionary<StandardCursorType, IPlatformHandle>();
|
||||
|
||||
private Gdk.Cursor GetCursor(object desc)
|
||||
{
|
||||
Gdk.Cursor rv;
|
||||
var name = desc as string;
|
||||
if (name != null)
|
||||
{
|
||||
var theme = Gtk.IconTheme.Default;
|
||||
var icon = theme.LoadIcon(name, 32, default(Gtk.IconLookupFlags));
|
||||
rv = icon == null ? new Gdk.Cursor(CursorType.XCursor) : new Gdk.Cursor(Display.Default, icon, 0, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
rv = new Gdk.Cursor((CursorType)desc);
|
||||
}
|
||||
|
||||
rv.Owned = false;
|
||||
return rv;
|
||||
}
|
||||
|
||||
public IPlatformHandle GetCursor(StandardCursorType cursorType)
|
||||
{
|
||||
IPlatformHandle rv;
|
||||
if (!Cache.TryGetValue(cursorType, out rv))
|
||||
{
|
||||
Cache[cursorType] =
|
||||
rv =
|
||||
new PlatformHandle(
|
||||
GetCursor(CursorTypeMapping[cursorType]).Handle,
|
||||
"GTKCURSOR");
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,42 +0,0 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reactive.Disposables;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Avalonia.Platform;
|
||||
using Gdk;
|
||||
using Gtk;
|
||||
using Action = System.Action;
|
||||
using WindowEdge = Avalonia.Controls.WindowEdge;
|
||||
|
||||
namespace Avalonia.Gtk
|
||||
{
|
||||
class EmbeddableImpl : TopLevelImpl, IEmbeddableWindowImpl
|
||||
{
|
||||
#pragma warning disable CS0067 // Method not used
|
||||
public event Action LostFocus;
|
||||
#pragma warning restore CS0067
|
||||
|
||||
public EmbeddableImpl(DrawingArea area) : base(area)
|
||||
{
|
||||
area.Events = EventMask.AllEventsMask;
|
||||
area.SizeAllocated += Plug_SizeAllocated;
|
||||
}
|
||||
|
||||
public EmbeddableImpl() : this(new PlatformHandleAwareDrawingArea())
|
||||
{
|
||||
}
|
||||
|
||||
private void Plug_SizeAllocated(object o, SizeAllocatedArgs args)
|
||||
{
|
||||
Resized?.Invoke(new Size(args.Allocation.Width, args.Allocation.Height));
|
||||
}
|
||||
|
||||
public override Size ClientSize
|
||||
{
|
||||
get { return new Size(Widget.Allocation.Width, Widget.Allocation.Height); }
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -1,77 +0,0 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Controls.Embedding;
|
||||
using Avalonia.Diagnostics;
|
||||
using Avalonia.Input;
|
||||
using Avalonia.Interactivity;
|
||||
using Avalonia.Layout;
|
||||
using Avalonia.Platform;
|
||||
using Avalonia.VisualTree;
|
||||
using Gdk;
|
||||
using Gtk;
|
||||
|
||||
namespace Avalonia.Gtk.Embedding
|
||||
{
|
||||
public class GtkAvaloniaControlHost : DrawingArea, IPlatformHandle
|
||||
{
|
||||
private EmbeddableControlRoot _root;
|
||||
|
||||
public GtkAvaloniaControlHost()
|
||||
{
|
||||
_root = new EmbeddableControlRoot(new EmbeddableImpl(this));
|
||||
_root.Prepare();
|
||||
if (_root.IsFocused)
|
||||
Unfocus();
|
||||
_root.GotFocus += RootGotFocus;
|
||||
CanFocus = true;
|
||||
}
|
||||
|
||||
void Unfocus()
|
||||
{
|
||||
var focused = (IVisual)FocusManager.Instance.Current;
|
||||
if (focused == null)
|
||||
return;
|
||||
while (focused.VisualParent != null)
|
||||
focused = focused.VisualParent;
|
||||
|
||||
if (focused == _root)
|
||||
KeyboardDevice.Instance.SetFocusedElement(null, NavigationMethod.Unspecified, InputModifiers.None);
|
||||
}
|
||||
|
||||
protected override bool OnFocusOutEvent(EventFocus evnt)
|
||||
{
|
||||
Unfocus();
|
||||
return false;
|
||||
}
|
||||
|
||||
private void RootGotFocus(object sender, RoutedEventArgs e)
|
||||
{
|
||||
this.HasFocus = true;
|
||||
GdkWindow.Focus(0);
|
||||
}
|
||||
|
||||
private Control _content;
|
||||
|
||||
public Control Content
|
||||
{
|
||||
get { return _content; }
|
||||
set
|
||||
{
|
||||
_content = value;
|
||||
if (_root != null)
|
||||
{
|
||||
_root.Content = value;
|
||||
_root.Prepare();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
IntPtr IPlatformHandle.Handle => PlatformHandleAwareWindow.GetNativeWindow(GdkWindow);
|
||||
|
||||
string IPlatformHandle.HandleDescriptor => "HWND";
|
||||
}
|
||||
}
|
|
@ -1,40 +0,0 @@
|
|||
using System;
|
||||
using Avalonia.Controls.Platform.Surfaces;
|
||||
using Avalonia.Platform;
|
||||
|
||||
namespace Avalonia.Gtk
|
||||
{
|
||||
class FramebufferManager : IFramebufferPlatformSurface, IDisposable
|
||||
{
|
||||
private readonly TopLevelImpl _window;
|
||||
private SurfaceFramebuffer _fb;
|
||||
|
||||
public FramebufferManager(TopLevelImpl window)
|
||||
{
|
||||
_window = window;
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
_fb?.Deallocate();
|
||||
}
|
||||
|
||||
public ILockedFramebuffer Lock()
|
||||
{
|
||||
if(_window.CurrentDrawable == null)
|
||||
throw new InvalidOperationException("Window is not in drawing state");
|
||||
|
||||
var drawable = _window.CurrentDrawable;
|
||||
var width = (int) _window.ClientSize.Width;
|
||||
var height = (int) _window.ClientSize.Height;
|
||||
if (_fb == null || _fb.Width != width ||
|
||||
_fb.Height != height)
|
||||
{
|
||||
_fb?.Deallocate();
|
||||
_fb = new SurfaceFramebuffer(width, height);
|
||||
}
|
||||
_fb.SetDrawable(drawable);
|
||||
return _fb;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,15 +0,0 @@
|
|||
// Copyright (c) The Avalonia Project. All rights reserved.
|
||||
// Licensed under the MIT license. See licence.md file in the project root for full license information.
|
||||
|
||||
namespace Avalonia.Gtk
|
||||
{
|
||||
using Gtk = global::Gtk;
|
||||
|
||||
public static class GtkExtensions
|
||||
{
|
||||
public static Rect ToAvalonia(this Gdk.Rectangle rect)
|
||||
{
|
||||
return new Rect(rect.Left, rect.Top, rect.Right, rect.Bottom);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,141 +0,0 @@
|
|||
// Copyright (c) The Avalonia Project. All rights reserved.
|
||||
// Licensed under the MIT license. See licence.md file in the project root for full license information.
|
||||
|
||||
using System;
|
||||
using System.Reactive.Disposables;
|
||||
using System.Threading;
|
||||
using Avalonia.Controls.Platform;
|
||||
using Avalonia.Input.Platform;
|
||||
using Avalonia.Input;
|
||||
using Avalonia.Platform;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Threading;
|
||||
|
||||
namespace Avalonia
|
||||
{
|
||||
public static class GtkApplicationExtensions
|
||||
{
|
||||
public static T UseGtk<T>(this T builder) where T : AppBuilderBase<T>, new()
|
||||
{
|
||||
builder.UseWindowingSubsystem(Gtk.GtkPlatform.Initialize, "Gtk");
|
||||
return builder;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
namespace Avalonia.Gtk
|
||||
{
|
||||
using System.IO;
|
||||
using Rendering;
|
||||
using Gtk = global::Gtk;
|
||||
|
||||
public class GtkPlatform : IPlatformThreadingInterface, IPlatformSettings, IWindowingPlatform, IPlatformIconLoader
|
||||
{
|
||||
private static readonly GtkPlatform s_instance = new GtkPlatform();
|
||||
private static Thread _uiThread;
|
||||
|
||||
public GtkPlatform()
|
||||
{
|
||||
Gtk.Application.Init();
|
||||
}
|
||||
|
||||
public Size DoubleClickSize => new Size(4, 4);
|
||||
|
||||
public TimeSpan DoubleClickTime => TimeSpan.FromMilliseconds(Gtk.Settings.Default.DoubleClickTime);
|
||||
public double RenderScalingFactor { get; } = 1;
|
||||
public double LayoutScalingFactor { get; } = 1;
|
||||
|
||||
public static void Initialize()
|
||||
{
|
||||
AvaloniaLocator.CurrentMutable
|
||||
.Bind<IWindowingPlatform>().ToConstant(s_instance)
|
||||
.Bind<IClipboard>().ToSingleton<ClipboardImpl>()
|
||||
.Bind<IStandardCursorFactory>().ToConstant(CursorFactory.Instance)
|
||||
.Bind<IKeyboardDevice>().ToConstant(GtkKeyboardDevice.Instance)
|
||||
.Bind<IPlatformSettings>().ToConstant(s_instance)
|
||||
.Bind<IPlatformThreadingInterface>().ToConstant(s_instance)
|
||||
.Bind<IRenderLoop>().ToConstant(new DefaultRenderLoop(60))
|
||||
.Bind<ISystemDialogImpl>().ToSingleton<SystemDialogImpl>()
|
||||
.Bind<IPlatformIconLoader>().ToConstant(s_instance);
|
||||
_uiThread = Thread.CurrentThread;
|
||||
}
|
||||
|
||||
public bool HasMessages()
|
||||
{
|
||||
return Gtk.Application.EventsPending();
|
||||
}
|
||||
|
||||
public void ProcessMessage()
|
||||
{
|
||||
Gtk.Application.RunIteration();
|
||||
}
|
||||
|
||||
public void RunLoop(CancellationToken cancellationToken)
|
||||
{
|
||||
while (!cancellationToken.IsCancellationRequested)
|
||||
Gtk.Application.RunIteration();
|
||||
}
|
||||
|
||||
public IDisposable StartTimer(TimeSpan interval, Action tick)
|
||||
{
|
||||
var result = true;
|
||||
var handle = GLib.Timeout.Add(
|
||||
(uint)interval.TotalMilliseconds,
|
||||
() =>
|
||||
{
|
||||
tick();
|
||||
return result;
|
||||
});
|
||||
|
||||
return Disposable.Create(() => result = false);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void Signal(DispatcherPriority prio)
|
||||
{
|
||||
Gtk.Application.Invoke(delegate { Signaled?.Invoke(null); });
|
||||
}
|
||||
|
||||
public bool CurrentThreadIsLoopThread => Thread.CurrentThread == _uiThread;
|
||||
|
||||
public event Action<DispatcherPriority?> Signaled;
|
||||
public IWindowImpl CreateWindow()
|
||||
{
|
||||
return new WindowImpl();
|
||||
}
|
||||
|
||||
public IEmbeddableWindowImpl CreateEmbeddableWindow() => new EmbeddableImpl();
|
||||
|
||||
public IPopupImpl CreatePopup()
|
||||
{
|
||||
return new PopupImpl();
|
||||
}
|
||||
|
||||
public IWindowIconImpl LoadIcon(string fileName)
|
||||
{
|
||||
return new IconImpl(new Gdk.Pixbuf(fileName));
|
||||
}
|
||||
|
||||
public IWindowIconImpl LoadIcon(Stream stream)
|
||||
{
|
||||
return new IconImpl(new Gdk.Pixbuf(stream));
|
||||
}
|
||||
|
||||
public IWindowIconImpl LoadIcon(IBitmapImpl bitmap)
|
||||
{
|
||||
if (bitmap is Gdk.Pixbuf)
|
||||
{
|
||||
return new IconImpl((Gdk.Pixbuf)bitmap);
|
||||
}
|
||||
else
|
||||
{
|
||||
using (var memoryStream = new MemoryStream())
|
||||
{
|
||||
bitmap.Save(memoryStream);
|
||||
return new IconImpl(new Gdk.Pixbuf(memoryStream));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,27 +0,0 @@
|
|||
using Avalonia.Platform;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Gdk;
|
||||
using System.IO;
|
||||
|
||||
namespace Avalonia.Gtk
|
||||
{
|
||||
class IconImpl : IWindowIconImpl
|
||||
{
|
||||
public IconImpl(Pixbuf pixbuf)
|
||||
{
|
||||
Pixbuf = pixbuf;
|
||||
}
|
||||
|
||||
public Pixbuf Pixbuf { get; }
|
||||
|
||||
public void Save(Stream stream)
|
||||
{
|
||||
var buffer = Pixbuf.SaveToBuffer("png");
|
||||
stream.Write(buffer, 0, buffer.Length);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,18 +0,0 @@
|
|||
// Copyright (c) The Avalonia Project. All rights reserved.
|
||||
// Licensed under the MIT license. See licence.md file in the project root for full license information.
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using Avalonia.Input;
|
||||
|
||||
|
||||
namespace Avalonia.Gtk
|
||||
{
|
||||
public class GtkKeyboardDevice : KeyboardDevice
|
||||
{
|
||||
public new static GtkKeyboardDevice Instance { get; } = new GtkKeyboardDevice();
|
||||
}
|
||||
}
|
|
@ -1,29 +0,0 @@
|
|||
// Copyright (c) The Avalonia Project. All rights reserved.
|
||||
// Licensed under the MIT license. See licence.md file in the project root for full license information.
|
||||
|
||||
using Avalonia.Input;
|
||||
namespace Avalonia.Gtk
|
||||
{
|
||||
public class GtkMouseDevice : MouseDevice
|
||||
{
|
||||
private static readonly GtkMouseDevice s_instance;
|
||||
|
||||
private Point _clientPosition;
|
||||
|
||||
static GtkMouseDevice()
|
||||
{
|
||||
s_instance = new GtkMouseDevice();
|
||||
}
|
||||
|
||||
private GtkMouseDevice()
|
||||
{
|
||||
}
|
||||
|
||||
public static new GtkMouseDevice Instance => s_instance;
|
||||
|
||||
internal void SetClientPosition(Point p)
|
||||
{
|
||||
_clientPosition = p;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,12 +0,0 @@
|
|||
using System;
|
||||
|
||||
namespace Avalonia.Gtk
|
||||
{
|
||||
public class MyClass
|
||||
{
|
||||
public MyClass ()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,16 +0,0 @@
|
|||
// Copyright (c) The Avalonia Project. All rights reserved.
|
||||
// Licensed under the MIT license. See licence.md file in the project root for full license information.
|
||||
|
||||
using Gtk;
|
||||
using Avalonia.Platform;
|
||||
|
||||
namespace Avalonia.Gtk
|
||||
{
|
||||
public class PopupImpl : WindowImpl, IPopupImpl
|
||||
{
|
||||
public PopupImpl()
|
||||
: base(WindowType.Popup)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,15 +0,0 @@
|
|||
// Copyright (c) The Avalonia Project. All rights reserved.
|
||||
// Licensed under the MIT license. See licence.md file in the project root for full license information.
|
||||
|
||||
using Avalonia.Gtk;
|
||||
using Avalonia.Platform;
|
||||
using System.Reflection;
|
||||
|
||||
// Information about this assembly is defined by the following attributes.
|
||||
// Change them to the values specific to your project.
|
||||
[assembly: AssemblyTitle("Avalonia.Gtk")]
|
||||
|
||||
[assembly: ExportWindowingSubsystem(OperatingSystemType.WinNT, 3, "GTK", typeof(GtkPlatform), nameof(GtkPlatform.Initialize))]
|
||||
[assembly: ExportWindowingSubsystem(OperatingSystemType.Linux, 2, "GTK", typeof(GtkPlatform), nameof(GtkPlatform.Initialize))]
|
||||
[assembly: ExportWindowingSubsystem(OperatingSystemType.OSX, 3, "GTK", typeof(GtkPlatform), nameof(GtkPlatform.Initialize))]
|
||||
|
|
@ -1,42 +0,0 @@
|
|||
using System;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Platform;
|
||||
using Avalonia.Utilities;
|
||||
using Gdk;
|
||||
using Screen = Avalonia.Platform.Screen;
|
||||
using Window = Gtk.Window;
|
||||
|
||||
namespace Avalonia.Gtk
|
||||
{
|
||||
internal class ScreenImpl : IScreenImpl
|
||||
{
|
||||
private Window window;
|
||||
|
||||
public int ScreenCount
|
||||
{
|
||||
get => window.Display.DefaultScreen.NMonitors;
|
||||
}
|
||||
public Screen[] AllScreens {
|
||||
get
|
||||
{
|
||||
Screen[] screens = new Screen[ScreenCount];
|
||||
var screen = window.Display.DefaultScreen;
|
||||
|
||||
for (short i = 0; i < screens.Length; i++)
|
||||
{
|
||||
Rectangle geometry = screen.GetMonitorGeometry(i);
|
||||
Rect geometryRect = new Rect(geometry.X, geometry.Y, geometry.Width, geometry.Height);
|
||||
Screen s = new Screen(geometryRect, geometryRect, false);
|
||||
screens[i] = s;
|
||||
}
|
||||
|
||||
return screens;
|
||||
}
|
||||
}
|
||||
|
||||
public ScreenImpl(Window window)
|
||||
{
|
||||
this.window = window;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,55 +0,0 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Avalonia.Controls.Platform.Surfaces;
|
||||
using Avalonia.Platform;
|
||||
using Cairo;
|
||||
using Gdk;
|
||||
|
||||
namespace Avalonia.Gtk
|
||||
{
|
||||
class SurfaceFramebuffer : ILockedFramebuffer
|
||||
{
|
||||
private Drawable _drawable;
|
||||
private ImageSurface _surface;
|
||||
|
||||
public SurfaceFramebuffer(int width, int height)
|
||||
{
|
||||
_surface = new ImageSurface(Cairo.Format.RGB24, width, height);
|
||||
}
|
||||
|
||||
public void SetDrawable(Drawable drawable)
|
||||
{
|
||||
_drawable = drawable;
|
||||
_surface.Flush();
|
||||
}
|
||||
|
||||
public void Deallocate()
|
||||
{
|
||||
_surface.Dispose();
|
||||
_surface = null;
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
using (var ctx = CairoHelper.Create(_drawable))
|
||||
{
|
||||
_surface.MarkDirty();
|
||||
ctx.SetSourceSurface(_surface, 0, 0);
|
||||
ctx.Paint();
|
||||
}
|
||||
_drawable = null;
|
||||
}
|
||||
|
||||
public IntPtr Address => _surface.DataPtr;
|
||||
public int Width => _surface.Width;
|
||||
public int Height => _surface.Height;
|
||||
public int RowBytes => _surface.Stride;
|
||||
//TODO: Proper DPI detect
|
||||
public Vector Dpi => new Vector(96, 96);
|
||||
public PixelFormat Format => PixelFormat.Bgra8888;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,88 +0,0 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Controls.Platform;
|
||||
using Avalonia.Platform;
|
||||
|
||||
namespace Avalonia.Gtk
|
||||
{
|
||||
using global::Gtk;
|
||||
class SystemDialogImpl : ISystemDialogImpl
|
||||
{
|
||||
public Task<string[]> ShowFileDialogAsync(FileDialog dialog, IWindowImpl parent)
|
||||
{
|
||||
var tcs = new TaskCompletionSource<string[]>();
|
||||
var dlg = new global::Gtk.FileChooserDialog(dialog.Title, ((TopLevelImpl)parent)?.Widget.Toplevel as Window,
|
||||
dialog is OpenFileDialog
|
||||
? FileChooserAction.Open
|
||||
: FileChooserAction.Save,
|
||||
"Cancel", ResponseType.Cancel,
|
||||
"Open", ResponseType.Accept)
|
||||
{
|
||||
SelectMultiple = (dialog as OpenFileDialog)?.AllowMultiple ?? false,
|
||||
};
|
||||
foreach (var filter in dialog.Filters)
|
||||
{
|
||||
var ffilter = new FileFilter()
|
||||
{
|
||||
Name = filter.Name + " (" + string.Join(";", filter.Extensions.Select(e => "*." + e)) + ")"
|
||||
};
|
||||
foreach (var ext in filter.Extensions)
|
||||
ffilter.AddPattern("*." + ext);
|
||||
dlg.AddFilter(ffilter);
|
||||
}
|
||||
dlg.SetFilename(dialog.InitialFileName);
|
||||
dlg.Modal = true;
|
||||
|
||||
dlg.Response += (_, args) =>
|
||||
{
|
||||
if (args.ResponseId == ResponseType.Accept)
|
||||
tcs.TrySetResult(dlg.Filenames);
|
||||
dlg.Hide();
|
||||
dlg.Dispose();
|
||||
};
|
||||
|
||||
dlg.Close += delegate
|
||||
{
|
||||
tcs.TrySetResult(null);
|
||||
dlg.Dispose();
|
||||
};
|
||||
dlg.Show();
|
||||
return tcs.Task;
|
||||
}
|
||||
|
||||
public Task<string> ShowFolderDialogAsync(OpenFolderDialog dialog, IWindowImpl parent)
|
||||
{
|
||||
var tcs = new TaskCompletionSource<string>();
|
||||
var dlg = new global::Gtk.FileChooserDialog(dialog.Title, ((TopLevelImpl)parent)?.Widget.Toplevel as Window,
|
||||
FileChooserAction.SelectFolder,
|
||||
"Cancel", ResponseType.Cancel,
|
||||
"Select Folder", ResponseType.Accept)
|
||||
{
|
||||
|
||||
};
|
||||
|
||||
dlg.Modal = true;
|
||||
|
||||
dlg.Response += (_, args) =>
|
||||
{
|
||||
if (args.ResponseId == ResponseType.Accept)
|
||||
tcs.TrySetResult(dlg.Filename);
|
||||
|
||||
dlg.Hide();
|
||||
dlg.Dispose();
|
||||
};
|
||||
|
||||
dlg.Close += delegate
|
||||
{
|
||||
tcs.TrySetResult(null);
|
||||
dlg.Dispose();
|
||||
};
|
||||
dlg.Show();
|
||||
return tcs.Task;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,320 +0,0 @@
|
|||
// Copyright (c) The Avalonia Project. All rights reserved.
|
||||
// Licensed under the MIT license. See licence.md file in the project root for full license information.
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Avalonia.Input;
|
||||
using Avalonia.Input.Raw;
|
||||
using Avalonia.Platform;
|
||||
using Gdk;
|
||||
using Action = System.Action;
|
||||
using WindowEdge = Avalonia.Controls.WindowEdge;
|
||||
using GLib;
|
||||
using Avalonia.Rendering;
|
||||
|
||||
namespace Avalonia.Gtk
|
||||
{
|
||||
using Gtk = global::Gtk;
|
||||
|
||||
public abstract class TopLevelImpl : ITopLevelImpl
|
||||
{
|
||||
private IInputRoot _inputRoot;
|
||||
private Gtk.Widget _widget;
|
||||
private FramebufferManager _framebuffer;
|
||||
|
||||
private Gtk.IMContext _imContext;
|
||||
|
||||
private uint _lastKeyEventTimestamp;
|
||||
|
||||
private static readonly Gdk.Cursor DefaultCursor = new Gdk.Cursor(CursorType.LeftPtr);
|
||||
|
||||
protected TopLevelImpl(Gtk.Widget window)
|
||||
{
|
||||
_widget = window;
|
||||
_framebuffer = new FramebufferManager(this);
|
||||
Init();
|
||||
}
|
||||
|
||||
void Init()
|
||||
{
|
||||
Handle = _widget as IPlatformHandle;
|
||||
_widget.Events = EventMask.AllEventsMask;
|
||||
_imContext = new Gtk.IMMulticontext();
|
||||
_imContext.Commit += ImContext_Commit;
|
||||
_widget.Realized += OnRealized;
|
||||
_widget.Realize();
|
||||
_widget.ButtonPressEvent += OnButtonPressEvent;
|
||||
_widget.ButtonReleaseEvent += OnButtonReleaseEvent;
|
||||
_widget.ScrollEvent += OnScrollEvent;
|
||||
_widget.Destroyed += OnDestroyed;
|
||||
_widget.KeyPressEvent += OnKeyPressEvent;
|
||||
_widget.KeyReleaseEvent += OnKeyReleaseEvent;
|
||||
_widget.ExposeEvent += OnExposeEvent;
|
||||
_widget.MotionNotifyEvent += OnMotionNotifyEvent;
|
||||
|
||||
|
||||
}
|
||||
|
||||
public IPlatformHandle Handle { get; private set; }
|
||||
public Gtk.Widget Widget => _widget;
|
||||
public Gdk.Drawable CurrentDrawable { get; private set; }
|
||||
|
||||
void OnRealized (object sender, EventArgs eventArgs)
|
||||
{
|
||||
_imContext.ClientWindow = _widget.GdkWindow;
|
||||
}
|
||||
|
||||
public abstract Size ClientSize { get; }
|
||||
|
||||
public Size MaxClientSize
|
||||
{
|
||||
get
|
||||
{
|
||||
// TODO: This should take into account things such as taskbar and window border
|
||||
// thickness etc.
|
||||
return new Size(_widget.Screen.Width, _widget.Screen.Height);
|
||||
}
|
||||
}
|
||||
|
||||
public IMouseDevice MouseDevice => GtkMouseDevice.Instance;
|
||||
|
||||
public Avalonia.Controls.WindowState WindowState
|
||||
{
|
||||
get
|
||||
{
|
||||
switch (_widget.GdkWindow.State)
|
||||
{
|
||||
case Gdk.WindowState.Iconified:
|
||||
return Controls.WindowState.Minimized;
|
||||
case Gdk.WindowState.Maximized:
|
||||
return Controls.WindowState.Maximized;
|
||||
default:
|
||||
return Controls.WindowState.Normal;
|
||||
}
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
switch (value)
|
||||
{
|
||||
case Controls.WindowState.Minimized:
|
||||
_widget.GdkWindow.Iconify();
|
||||
break;
|
||||
case Controls.WindowState.Maximized:
|
||||
_widget.GdkWindow.Maximize();
|
||||
break;
|
||||
case Controls.WindowState.Normal:
|
||||
_widget.GdkWindow.Deiconify();
|
||||
_widget.GdkWindow.Unmaximize();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public double Scaling => 1;
|
||||
|
||||
public Action Activated { get; set; }
|
||||
|
||||
public Action Closed { get; set; }
|
||||
|
||||
|
||||
public Action Deactivated { get; set; }
|
||||
|
||||
public Action<RawInputEventArgs> Input { get; set; }
|
||||
|
||||
public Action<Rect> Paint { get; set; }
|
||||
|
||||
public Action<Size> Resized { get; set; }
|
||||
|
||||
public Action<Point> PositionChanged { get; set; }
|
||||
|
||||
public Action<double> ScalingChanged { get; set; }
|
||||
|
||||
public IEnumerable<object> Surfaces => new object[]
|
||||
{
|
||||
Handle,
|
||||
new Func<Gdk.Drawable>(() => CurrentDrawable),
|
||||
_framebuffer
|
||||
};
|
||||
|
||||
public IPopupImpl CreatePopup()
|
||||
{
|
||||
return new PopupImpl();
|
||||
}
|
||||
|
||||
public IRenderer CreateRenderer(IRenderRoot root)
|
||||
{
|
||||
return new ImmediateRenderer(root);
|
||||
}
|
||||
|
||||
public void Invalidate(Rect rect)
|
||||
{
|
||||
if (_widget?.GdkWindow != null)
|
||||
_widget.GdkWindow.InvalidateRect(
|
||||
new Rectangle((int) rect.X, (int) rect.Y, (int) rect.Width, (int) rect.Height), true);
|
||||
}
|
||||
|
||||
public Point PointToClient(Point point)
|
||||
{
|
||||
int x, y;
|
||||
_widget.GdkWindow.GetDeskrelativeOrigin(out x, out y);
|
||||
|
||||
return new Point(point.X - x, point.Y - y);
|
||||
}
|
||||
|
||||
public Point PointToScreen(Point point)
|
||||
{
|
||||
int x, y;
|
||||
_widget.GdkWindow.GetDeskrelativeOrigin(out x, out y);
|
||||
return new Point(point.X + x, point.Y + y);
|
||||
}
|
||||
|
||||
public void SetInputRoot(IInputRoot inputRoot)
|
||||
{
|
||||
_inputRoot = inputRoot;
|
||||
}
|
||||
|
||||
|
||||
public void SetCursor(IPlatformHandle cursor)
|
||||
{
|
||||
_widget.GdkWindow.Cursor = cursor != null ? new Gdk.Cursor(cursor.Handle) : DefaultCursor;
|
||||
}
|
||||
|
||||
public void Show() => _widget.Show();
|
||||
|
||||
public void Hide() => _widget.Hide();
|
||||
|
||||
private static InputModifiers GetModifierKeys(ModifierType state)
|
||||
{
|
||||
var rv = InputModifiers.None;
|
||||
if (state.HasFlag(ModifierType.ControlMask))
|
||||
rv |= InputModifiers.Control;
|
||||
if (state.HasFlag(ModifierType.ShiftMask))
|
||||
rv |= InputModifiers.Shift;
|
||||
if (state.HasFlag(ModifierType.Mod1Mask))
|
||||
rv |= InputModifiers.Control;
|
||||
if(state.HasFlag(ModifierType.Button1Mask))
|
||||
rv |= InputModifiers.LeftMouseButton;
|
||||
if (state.HasFlag(ModifierType.Button2Mask))
|
||||
rv |= InputModifiers.RightMouseButton;
|
||||
if (state.HasFlag(ModifierType.Button3Mask))
|
||||
rv |= InputModifiers.MiddleMouseButton;
|
||||
return rv;
|
||||
}
|
||||
|
||||
void OnButtonPressEvent(object o, Gtk.ButtonPressEventArgs args)
|
||||
{
|
||||
var evnt = args.Event;
|
||||
var e = new RawMouseEventArgs(
|
||||
GtkMouseDevice.Instance,
|
||||
evnt.Time,
|
||||
_inputRoot,
|
||||
evnt.Button == 1
|
||||
? RawMouseEventType.LeftButtonDown
|
||||
: evnt.Button == 3 ? RawMouseEventType.RightButtonDown : RawMouseEventType.MiddleButtonDown,
|
||||
new Point(evnt.X, evnt.Y), GetModifierKeys(evnt.State));
|
||||
Input(e);
|
||||
}
|
||||
|
||||
void OnScrollEvent(object o, Gtk.ScrollEventArgs args)
|
||||
{
|
||||
var evnt = args.Event;
|
||||
double step = 1;
|
||||
var delta = new Vector();
|
||||
if (evnt.Direction == ScrollDirection.Down)
|
||||
delta = new Vector(0, -step);
|
||||
else if (evnt.Direction == ScrollDirection.Up)
|
||||
delta = new Vector(0, step);
|
||||
else if (evnt.Direction == ScrollDirection.Right)
|
||||
delta = new Vector(-step, 0);
|
||||
if (evnt.Direction == ScrollDirection.Left)
|
||||
delta = new Vector(step, 0);
|
||||
var e = new RawMouseWheelEventArgs(GtkMouseDevice.Instance, evnt.Time, _inputRoot, new Point(evnt.X, evnt.Y), delta, GetModifierKeys(evnt.State));
|
||||
Input(e);
|
||||
}
|
||||
|
||||
protected void OnButtonReleaseEvent(object o, Gtk.ButtonReleaseEventArgs args)
|
||||
{
|
||||
var evnt = args.Event;
|
||||
var e = new RawMouseEventArgs(
|
||||
GtkMouseDevice.Instance,
|
||||
evnt.Time,
|
||||
_inputRoot,
|
||||
evnt.Button == 1
|
||||
? RawMouseEventType.LeftButtonUp
|
||||
: evnt.Button == 3 ? RawMouseEventType.RightButtonUp : RawMouseEventType.MiddleButtonUp,
|
||||
new Point(evnt.X, evnt.Y), GetModifierKeys(evnt.State));
|
||||
Input(e);
|
||||
}
|
||||
|
||||
void OnDestroyed(object sender, EventArgs eventArgs)
|
||||
{
|
||||
Closed();
|
||||
}
|
||||
|
||||
private void ProcessKeyEvent(EventKey evnt)
|
||||
{
|
||||
|
||||
_lastKeyEventTimestamp = evnt.Time;
|
||||
if (_imContext.FilterKeypress(evnt))
|
||||
return;
|
||||
var e = new RawKeyEventArgs(
|
||||
GtkKeyboardDevice.Instance,
|
||||
evnt.Time,
|
||||
evnt.Type == EventType.KeyPress ? RawKeyEventType.KeyDown : RawKeyEventType.KeyUp,
|
||||
Common.KeyTransform.ConvertKey(evnt.Key), GetModifierKeys(evnt.State));
|
||||
Input(e);
|
||||
}
|
||||
|
||||
[ConnectBefore]
|
||||
void OnKeyPressEvent(object o, Gtk.KeyPressEventArgs args)
|
||||
{
|
||||
args.RetVal = true;
|
||||
ProcessKeyEvent(args.Event);
|
||||
}
|
||||
|
||||
void OnKeyReleaseEvent(object o, Gtk.KeyReleaseEventArgs args)
|
||||
{
|
||||
args.RetVal = true;
|
||||
ProcessKeyEvent(args.Event);
|
||||
}
|
||||
|
||||
private void ImContext_Commit(object o, Gtk.CommitArgs args)
|
||||
{
|
||||
Input(new RawTextInputEventArgs(GtkKeyboardDevice.Instance, _lastKeyEventTimestamp, args.Str));
|
||||
}
|
||||
|
||||
void OnExposeEvent(object o, Gtk.ExposeEventArgs args)
|
||||
{
|
||||
CurrentDrawable = args.Event.Window;
|
||||
Paint(args.Event.Area.ToAvalonia());
|
||||
CurrentDrawable = null;
|
||||
args.RetVal = true;
|
||||
}
|
||||
|
||||
void OnMotionNotifyEvent(object o, Gtk.MotionNotifyEventArgs args)
|
||||
{
|
||||
var evnt = args.Event;
|
||||
var position = new Point(evnt.X, evnt.Y);
|
||||
|
||||
GtkMouseDevice.Instance.SetClientPosition(position);
|
||||
|
||||
var e = new RawMouseEventArgs(
|
||||
GtkMouseDevice.Instance,
|
||||
evnt.Time,
|
||||
_inputRoot,
|
||||
RawMouseEventType.Move,
|
||||
position, GetModifierKeys(evnt.State));
|
||||
Input(e);
|
||||
args.RetVal = true;
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
_framebuffer.Dispose();
|
||||
_widget.Hide();
|
||||
_widget.Dispose();
|
||||
_widget = null;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,136 +0,0 @@
|
|||
using System;
|
||||
using System.Reactive.Disposables;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Platform;
|
||||
using Gdk;
|
||||
|
||||
namespace Avalonia.Gtk
|
||||
{
|
||||
using Gtk = global::Gtk;
|
||||
|
||||
public class WindowImpl : TopLevelImpl, IWindowImpl
|
||||
{
|
||||
private Gtk.Window _window;
|
||||
private Gtk.Window Window => _window ?? (_window = (Gtk.Window)Widget);
|
||||
|
||||
public WindowImpl(Gtk.WindowType type) : base(new PlatformHandleAwareWindow(type))
|
||||
{
|
||||
Init();
|
||||
}
|
||||
|
||||
public WindowImpl()
|
||||
: base(new PlatformHandleAwareWindow(Gtk.WindowType.Toplevel) {DefaultSize = new Gdk.Size(900, 480)})
|
||||
{
|
||||
Init();
|
||||
}
|
||||
|
||||
void Init()
|
||||
{
|
||||
Window.FocusActivated += OnFocusActivated;
|
||||
Window.ConfigureEvent += OnConfigureEvent;
|
||||
_lastClientSize = ClientSize;
|
||||
_lastPosition = Position;
|
||||
}
|
||||
|
||||
private Size _lastClientSize;
|
||||
private Point _lastPosition;
|
||||
|
||||
void OnConfigureEvent(object o, Gtk.ConfigureEventArgs args)
|
||||
{
|
||||
var evnt = args.Event;
|
||||
args.RetVal = true;
|
||||
var newSize = new Size(evnt.Width, evnt.Height);
|
||||
|
||||
if (newSize != _lastClientSize)
|
||||
{
|
||||
Resized(newSize);
|
||||
_lastClientSize = newSize;
|
||||
}
|
||||
|
||||
var newPosition = new Point(evnt.X, evnt.Y);
|
||||
|
||||
if (newPosition != _lastPosition)
|
||||
{
|
||||
PositionChanged(newPosition);
|
||||
_lastPosition = newPosition;
|
||||
}
|
||||
}
|
||||
|
||||
public override Size ClientSize
|
||||
{
|
||||
get
|
||||
{
|
||||
int width;
|
||||
int height;
|
||||
Window.GetSize(out width, out height);
|
||||
return new Size(width, height);
|
||||
}
|
||||
}
|
||||
|
||||
public IScreenImpl Screen => new ScreenImpl(Window);
|
||||
|
||||
public void Resize(Size value)
|
||||
{
|
||||
Window.Resize((int)value.Width, (int)value.Height);
|
||||
}
|
||||
|
||||
public void SetTitle(string title)
|
||||
{
|
||||
Window.Title = title;
|
||||
}
|
||||
|
||||
void IWindowBaseImpl.Activate()
|
||||
{
|
||||
_window.Activate();
|
||||
}
|
||||
|
||||
void OnFocusActivated(object sender, EventArgs eventArgs)
|
||||
{
|
||||
Activated();
|
||||
}
|
||||
|
||||
public void BeginMoveDrag()
|
||||
{
|
||||
int x, y;
|
||||
ModifierType mod;
|
||||
Window.Screen.RootWindow.GetPointer(out x, out y, out mod);
|
||||
Window.BeginMoveDrag(1, x, y, 0);
|
||||
}
|
||||
|
||||
public void BeginResizeDrag(Controls.WindowEdge edge)
|
||||
{
|
||||
int x, y;
|
||||
ModifierType mod;
|
||||
Window.Screen.RootWindow.GetPointer(out x, out y, out mod);
|
||||
Window.BeginResizeDrag((Gdk.WindowEdge)(int)edge, 1, x, y, 0);
|
||||
}
|
||||
|
||||
public Point Position
|
||||
{
|
||||
get
|
||||
{
|
||||
int x, y;
|
||||
Window.GetPosition(out x, out y);
|
||||
return new Point(x, y);
|
||||
}
|
||||
set { Window.Move((int)value.X, (int)value.Y); }
|
||||
}
|
||||
|
||||
public IDisposable ShowDialog()
|
||||
{
|
||||
Window.Modal = true;
|
||||
Window.Show();
|
||||
|
||||
return Disposable.Empty;
|
||||
}
|
||||
|
||||
public void SetSystemDecorations(bool enabled) => Window.Decorated = enabled;
|
||||
|
||||
public void SetIcon(IWindowIconImpl icon)
|
||||
{
|
||||
Window.Icon = ((IconImpl)icon).Pixbuf;
|
||||
}
|
||||
|
||||
public void ShowTaskbarIcon(bool value) => Window.SkipTaskbarHint = !value;
|
||||
}
|
||||
}
|
|
@ -1,91 +0,0 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Avalonia.Platform;
|
||||
using Gdk;
|
||||
using Gtk;
|
||||
using Window = Gtk.Window;
|
||||
using WindowType = Gtk.WindowType;
|
||||
|
||||
namespace Avalonia.Gtk
|
||||
{
|
||||
class PlatformHandleAwareWindow : Window, IPlatformHandle
|
||||
{
|
||||
public PlatformHandleAwareWindow(WindowType type) : base(type)
|
||||
{
|
||||
Events = EventMask.AllEventsMask;
|
||||
}
|
||||
|
||||
IntPtr IPlatformHandle.Handle => GetNativeWindow();
|
||||
public string HandleDescriptor => "HWND";
|
||||
|
||||
|
||||
[DllImport("libgdk-win32-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
|
||||
static extern IntPtr gdk_win32_drawable_get_handle(IntPtr gdkWindow);
|
||||
|
||||
[DllImport("libgtk-x11-2.0.so.0", CallingConvention = CallingConvention.Cdecl)]
|
||||
static extern IntPtr gdk_x11_drawable_get_xid(IntPtr gdkWindow);
|
||||
|
||||
[DllImport("libgdk-quartz-2.0-0.dylib", CallingConvention = CallingConvention.Cdecl)]
|
||||
static extern IntPtr gdk_quartz_window_get_nswindow(IntPtr gdkWindow);
|
||||
|
||||
IntPtr _nativeWindow;
|
||||
|
||||
IntPtr GetNativeWindow()
|
||||
{
|
||||
if (_nativeWindow != IntPtr.Zero)
|
||||
return _nativeWindow;
|
||||
return _nativeWindow = GetNativeWindow(GdkWindow);
|
||||
}
|
||||
|
||||
public static IntPtr GetNativeWindow(Gdk.Window window)
|
||||
{
|
||||
IntPtr h = window.Handle;
|
||||
|
||||
//Try whatever backend that works
|
||||
try
|
||||
{
|
||||
return gdk_quartz_window_get_nswindow(h);
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
try
|
||||
{
|
||||
return gdk_x11_drawable_get_xid(h);
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
return gdk_win32_drawable_get_handle(h);
|
||||
}
|
||||
|
||||
protected override bool OnConfigureEvent(EventConfigure evnt)
|
||||
{
|
||||
base.OnConfigureEvent(evnt);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
class PlatformHandleAwareDrawingArea : DrawingArea, IPlatformHandle
|
||||
{
|
||||
|
||||
|
||||
|
||||
IntPtr IPlatformHandle.Handle => GetNativeWindow();
|
||||
public string HandleDescriptor => "HWND";
|
||||
IntPtr _nativeWindow;
|
||||
|
||||
IntPtr GetNativeWindow()
|
||||
{
|
||||
|
||||
if (_nativeWindow != IntPtr.Zero)
|
||||
return _nativeWindow;
|
||||
Realize();
|
||||
return _nativeWindow = PlatformHandleAwareWindow.GetNativeWindow(GdkWindow);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -27,6 +27,34 @@
|
|||
<Compile Include="..\Avalonia.Gtk\KeyTransform.cs">
|
||||
<Link>KeyTransform.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="KeyTransform.cs" />
|
||||
<Compile Include="Interop\CairoSurface.cs" />
|
||||
<Compile Include="ClipboardImpl.cs" />
|
||||
<Compile Include="CursorFactory.cs" />
|
||||
<Compile Include="FramebufferManager.cs" />
|
||||
<Compile Include="GdkCursor.cs" />
|
||||
<Compile Include="GdkKey.cs" />
|
||||
<Compile Include="Gtk3Platform.cs" />
|
||||
<Compile Include="Interop\GException.cs" />
|
||||
<Compile Include="Interop\GObject.cs" />
|
||||
<Compile Include="Interop\ICustomGtk3NativeLibraryResolver.cs" />
|
||||
<Compile Include="Interop\DynLoader.cs" />
|
||||
<Compile Include="Interop\GlibTimeout.cs" />
|
||||
<Compile Include="Interop\Native.cs" />
|
||||
<Compile Include="Interop\NativeException.cs" />
|
||||
<Compile Include="Interop\Pixbuf.cs" />
|
||||
<Compile Include="Interop\Resolver.cs" />
|
||||
<Compile Include="Interop\Signal.cs" />
|
||||
<Compile Include="ImageSurfaceFramebuffer.cs" />
|
||||
<Compile Include="PlatformIconLoader.cs" />
|
||||
<Compile Include="PopupImpl.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="SystemDialogs.cs" />
|
||||
<Compile Include="WindowBaseImpl.cs" />
|
||||
<Compile Include="Interop\Utf8Buffer.cs" />
|
||||
<Compile Include="WindowImpl.cs" />
|
||||
<Compile Include="ScreenImpl.cs" />
|
||||
<Compile Include="GtkScreen.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\Avalonia.Base\Avalonia.Base.csproj" />
|
||||
|
|
|
@ -4,11 +4,8 @@ using System.Linq;
|
|||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Avalonia.Input;
|
||||
#if GTK3_PINVOKE
|
||||
using Avalonia.Gtk3;
|
||||
#else
|
||||
using GdkKey = Gdk.Key;
|
||||
#endif
|
||||
|
||||
namespace Avalonia.Gtk.Common
|
||||
{
|
||||
static class KeyTransform
|
|
@ -395,7 +395,10 @@ namespace Avalonia.Gtk3
|
|||
Native.GtkWindowResize(GtkWidget, (int)value.Width, (int)value.Height);
|
||||
}
|
||||
|
||||
public IScreenImpl Screen { get; } = new ScreenImpl();
|
||||
public IScreenImpl Screen
|
||||
{
|
||||
get;
|
||||
} = new ScreenImpl();
|
||||
|
||||
public Point Position
|
||||
{
|
||||
|
|
|
@ -14,6 +14,9 @@ namespace Avalonia.MonoMac
|
|||
internal readonly MouseDevice MouseDevice = new MouseDevice();
|
||||
readonly KeyboardDevice _keyboardDevice = new KeyboardDevice();
|
||||
internal static NSApplication App;
|
||||
private static bool s_monoMacInitialized;
|
||||
private static bool s_showInDock = true;
|
||||
|
||||
void DoInitialize()
|
||||
{
|
||||
AvaloniaLocator.CurrentMutable
|
||||
|
@ -26,7 +29,7 @@ namespace Avalonia.MonoMac
|
|||
.Bind<ISystemDialogImpl>().ToSingleton<SystemDialogsImpl>()
|
||||
.Bind<IPlatformThreadingInterface>().ToConstant(PlatformThreadingInterface.Instance);
|
||||
|
||||
InitializeCocoaApp();
|
||||
InitializeMonoMac();
|
||||
}
|
||||
|
||||
public static void Initialize()
|
||||
|
@ -36,12 +39,29 @@ namespace Avalonia.MonoMac
|
|||
|
||||
}
|
||||
|
||||
void InitializeCocoaApp()
|
||||
void InitializeMonoMac()
|
||||
{
|
||||
if(s_monoMacInitialized)
|
||||
return;
|
||||
NSApplication.Init();
|
||||
App = NSApplication.SharedApplication;
|
||||
App.ActivationPolicy = NSApplicationActivationPolicy.Regular;
|
||||
UpdateActivationPolicy();
|
||||
s_monoMacInitialized = true;
|
||||
}
|
||||
|
||||
static void UpdateActivationPolicy() => App.ActivationPolicy = ShowInDock
|
||||
? NSApplicationActivationPolicy.Regular
|
||||
: NSApplicationActivationPolicy.Accessory;
|
||||
|
||||
public static bool ShowInDock
|
||||
{
|
||||
get => s_showInDock;
|
||||
set
|
||||
{
|
||||
s_showInDock = value;
|
||||
if (s_monoMacInitialized)
|
||||
UpdateActivationPolicy();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -153,7 +153,10 @@ namespace Avalonia.MonoMac
|
|||
Position = pos;
|
||||
}
|
||||
|
||||
public IScreenImpl Screen { get; } = new ScreenImpl();
|
||||
public IScreenImpl Screen
|
||||
{
|
||||
get;
|
||||
} = new ScreenImpl();
|
||||
|
||||
public override Point PointToClient(Point point)
|
||||
{
|
||||
|
|
|
@ -94,10 +94,6 @@
|
|||
<Project>{eb582467-6abb-43a1-b052-e981ba910e3a}</Project>
|
||||
<Name>Avalonia.Visuals</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\Gtk\Avalonia.Cairo\Avalonia.Cairo.csproj">
|
||||
<Project>{fb05ac90-89ba-4f2f-a924-f37875fb547c}</Project>
|
||||
<Name>Avalonia.Cairo</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\Markup\Avalonia.Markup.Xaml\Avalonia.Markup.Xaml.csproj">
|
||||
<Project>{3e53a01a-b331-47f3-b828-4a5717e77a24}</Project>
|
||||
<Name>Avalonia.Markup.Xaml</Name>
|
||||
|
|
|
@ -104,7 +104,11 @@ namespace Avalonia.Win32
|
|||
}
|
||||
}
|
||||
|
||||
public IScreenImpl Screen => new ScreenImpl();
|
||||
public IScreenImpl Screen
|
||||
{
|
||||
get;
|
||||
} = new ScreenImpl();
|
||||
|
||||
|
||||
public IRenderer CreateRenderer(IRenderRoot root)
|
||||
{
|
||||
|
|
|
@ -99,7 +99,7 @@ namespace Avalonia.Controls.UnitTests
|
|||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Fact (Skip = "We don't have rendering modules with dependencies right now")]
|
||||
public void LoadsRenderingModuleWithoutDependenciesWhenNoModuleMatches()
|
||||
{
|
||||
using (AvaloniaLocator.EnterScope())
|
||||
|
@ -107,7 +107,7 @@ namespace Avalonia.Controls.UnitTests
|
|||
ResetModuleLoadStates();
|
||||
var builder = AppBuilder.Configure<App>()
|
||||
.UseWindowingSubsystem(() => { })
|
||||
.UseRenderingSubsystem(() => { }, "Cairo");
|
||||
.UseRenderingSubsystem(() => { }, "TBD");
|
||||
builder.UseAvaloniaModules().SetupWithoutStarting();
|
||||
Assert.True(DefaultRenderingModule.IsLoaded);
|
||||
Assert.False(Direct2DModule.IsLoaded);
|
||||
|
|
|
@ -1,105 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{E106CF37-4066-4615-B684-172A6D30B058}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>Avalonia.Cairo.RenderTests</RootNamespace>
|
||||
<AssemblyName>Avalonia.Cairo.RenderTests</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<TargetFrameworkProfile />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>..\..\artifacts\tests\</OutputPath>
|
||||
<DefineConstants>TRACE;DEBUG;AVALONIA_CAIRO</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>..\..\artifacts\tests\</OutputPath>
|
||||
<DefineConstants>TRACE;AVALONIA_CAIRO</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="WindowsBase" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\src\Gtk\Avalonia.Cairo\Avalonia.Cairo.csproj">
|
||||
<Project>{FB05AC90-89BA-4F2F-A924-F37875FB547C}</Project>
|
||||
<Name>Avalonia.Cairo</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\src\Avalonia.Animation\Avalonia.Animation.csproj">
|
||||
<Project>{D211E587-D8BC-45B9-95A4-F297C8FA5200}</Project>
|
||||
<Name>Avalonia.Animation</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\src\Avalonia.Base\Avalonia.Base.csproj">
|
||||
<Project>{B09B78D8-9B26-48B0-9149-D64A2F120F3F}</Project>
|
||||
<Name>Avalonia.Base</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\src\Avalonia.Controls\Avalonia.Controls.csproj">
|
||||
<Project>{D2221C82-4A25-4583-9B43-D791E3F6820C}</Project>
|
||||
<Name>Avalonia.Controls</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\src\Avalonia.Input\Avalonia.Input.csproj">
|
||||
<Project>{62024B2D-53EB-4638-B26B-85EEAA54866E}</Project>
|
||||
<Name>Avalonia.Input</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\src\Avalonia.Interactivity\Avalonia.Interactivity.csproj">
|
||||
<Project>{6B0ED19D-A08B-461C-A9D9-A9EE40B0C06B}</Project>
|
||||
<Name>Avalonia.Interactivity</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\src\Avalonia.Layout\Avalonia.Layout.csproj">
|
||||
<Project>{42472427-4774-4C81-8AFF-9F27B8E31721}</Project>
|
||||
<Name>Avalonia.Layout</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\src\Avalonia.Visuals\Avalonia.Visuals.csproj">
|
||||
<Project>{EB582467-6ABB-43A1-B052-E981BA910E3A}</Project>
|
||||
<Name>Avalonia.Visuals</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\src\Avalonia.Styling\Avalonia.Styling.csproj">
|
||||
<Project>{F1BAA01A-F176-4C6A-B39D-5B40BB1B148F}</Project>
|
||||
<Name>Avalonia.Styling</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="app.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
|
||||
</ItemGroup>
|
||||
<Import Project="Avalonia.RenderTests.projitems" Label="Shared" />
|
||||
<Choose>
|
||||
<When Condition="'$(VisualStudioVersion)' == '10.0' And '$(IsCodedUITest)' == 'True'">
|
||||
<ItemGroup>
|
||||
<Reference Include="Microsoft.VisualStudio.QualityTools.CodedUITestFramework, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.VisualStudio.TestTools.UITest.Common, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.VisualStudio.TestTools.UITest.Extension, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.VisualStudio.TestTools.UITesting, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
</When>
|
||||
</Choose>
|
||||
<Import Project="$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets" Condition="Exists('$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets')" />
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<Import Project="..\..\build\Magick.NET-Q16-AnyCPU.props" />
|
||||
<Import Project="..\..\build\Rx.props" />
|
||||
<Import Project="..\..\build\XUnit.props" />
|
||||
</Project>
|
|
@ -72,9 +72,6 @@
|
|||
<Name>Avalonia.Styling</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="app.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
|
||||
</ItemGroup>
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
<Compile Include="$(MSBuildThisFileDirectory)Media\RadialGradientBrushTests.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Media\BitmapTests.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)OpacityMaskTests.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)SVGPathTests.cs" />
|
||||
<Compile Include="Media\FormattedTextImplTests.cs" />
|
||||
<Compile Include="Controls\ImageTests.cs" />
|
||||
<Compile Include="Controls\BorderTests.cs" />
|
||||
|
|
|
@ -7,9 +7,7 @@ using Avalonia.Layout;
|
|||
using Avalonia.Media;
|
||||
using Xunit;
|
||||
|
||||
#if AVALONIA_CAIRO
|
||||
namespace Avalonia.Cairo.RenderTests.Controls
|
||||
#elif AVALONIA_SKIA
|
||||
#if AVALONIA_SKIA
|
||||
namespace Avalonia.Skia.RenderTests
|
||||
#else
|
||||
namespace Avalonia.Direct2D1.RenderTests.Controls
|
||||
|
@ -149,11 +147,8 @@ namespace Avalonia.Direct2D1.RenderTests.Controls
|
|||
CompareImages();
|
||||
}
|
||||
|
||||
#if AVALONIA_CAIRO
|
||||
[Fact(Skip = "Font scaling currently broken on cairo")]
|
||||
#else
|
||||
|
||||
[Fact]
|
||||
#endif
|
||||
public async Task Border_Centers_Content_Horizontally()
|
||||
{
|
||||
Decorator target = new Decorator
|
||||
|
@ -180,11 +175,7 @@ namespace Avalonia.Direct2D1.RenderTests.Controls
|
|||
CompareImages();
|
||||
}
|
||||
|
||||
#if AVALONIA_CAIRO
|
||||
[Fact(Skip = "Font scaling currently broken on cairo")]
|
||||
#else
|
||||
[Fact]
|
||||
#endif
|
||||
public async Task Border_Centers_Content_Vertically()
|
||||
{
|
||||
Decorator target = new Decorator
|
||||
|
@ -211,11 +202,7 @@ namespace Avalonia.Direct2D1.RenderTests.Controls
|
|||
CompareImages();
|
||||
}
|
||||
|
||||
#if AVALONIA_CAIRO
|
||||
[Fact(Skip = "Font scaling currently broken on cairo")]
|
||||
#else
|
||||
[Fact]
|
||||
#endif
|
||||
public async Task Border_Stretches_Content_Horizontally()
|
||||
{
|
||||
Decorator target = new Decorator
|
||||
|
@ -242,11 +229,7 @@ namespace Avalonia.Direct2D1.RenderTests.Controls
|
|||
CompareImages();
|
||||
}
|
||||
|
||||
#if AVALONIA_CAIRO
|
||||
[Fact(Skip = "Font scaling currently broken on cairo")]
|
||||
#else
|
||||
[Fact]
|
||||
#endif
|
||||
public async Task Border_Stretches_Content_Vertically()
|
||||
{
|
||||
Decorator target = new Decorator
|
||||
|
@ -273,11 +256,7 @@ namespace Avalonia.Direct2D1.RenderTests.Controls
|
|||
CompareImages();
|
||||
}
|
||||
|
||||
#if AVALONIA_CAIRO
|
||||
[Fact(Skip = "Font scaling currently broken on cairo")]
|
||||
#else
|
||||
[Fact]
|
||||
#endif
|
||||
public async Task Border_Left_Aligns_Content()
|
||||
{
|
||||
Decorator target = new Decorator
|
||||
|
@ -304,11 +283,7 @@ namespace Avalonia.Direct2D1.RenderTests.Controls
|
|||
CompareImages();
|
||||
}
|
||||
|
||||
#if AVALONIA_CAIRO
|
||||
[Fact(Skip = "Font scaling currently broken on cairo")]
|
||||
#else
|
||||
[Fact]
|
||||
#endif
|
||||
public async Task Border_Right_Aligns_Content()
|
||||
{
|
||||
Decorator target = new Decorator
|
||||
|
@ -335,11 +310,7 @@ namespace Avalonia.Direct2D1.RenderTests.Controls
|
|||
CompareImages();
|
||||
}
|
||||
|
||||
#if AVALONIA_CAIRO
|
||||
[Fact(Skip = "Font scaling currently broken on cairo")]
|
||||
#else
|
||||
[Fact]
|
||||
#endif
|
||||
public async Task Border_Top_Aligns_Content()
|
||||
{
|
||||
Decorator target = new Decorator
|
||||
|
@ -366,11 +337,7 @@ namespace Avalonia.Direct2D1.RenderTests.Controls
|
|||
CompareImages();
|
||||
}
|
||||
|
||||
#if AVALONIA_CAIRO
|
||||
[Fact(Skip = "Font scaling currently broken on cairo")]
|
||||
#else
|
||||
[Fact]
|
||||
#endif
|
||||
public async Task Border_Bottom_Aligns_Content()
|
||||
{
|
||||
Decorator target = new Decorator
|
||||
|
|
|
@ -8,9 +8,7 @@ using Avalonia.Layout;
|
|||
using Avalonia.Media;
|
||||
using Xunit;
|
||||
|
||||
#if AVALONIA_CAIRO
|
||||
namespace Avalonia.Cairo.RenderTests.Controls
|
||||
#elif AVALONIA_SKIA
|
||||
#if AVALONIA_SKIA
|
||||
namespace Avalonia.Skia.RenderTests
|
||||
#else
|
||||
namespace Avalonia.Direct2D1.RenderTests.Controls
|
||||
|
|
|
@ -8,9 +8,7 @@ using Avalonia.Media;
|
|||
using Avalonia.Media.Imaging;
|
||||
using Xunit;
|
||||
|
||||
#if AVALONIA_CAIRO
|
||||
namespace Avalonia.Cairo.RenderTests.Controls
|
||||
#elif AVALONIA_SKIA
|
||||
#if AVALONIA_SKIA
|
||||
namespace Avalonia.Skia.RenderTests
|
||||
#else
|
||||
namespace Avalonia.Direct2D1.RenderTests.Controls
|
||||
|
|
|
@ -6,9 +6,7 @@ using Avalonia.Layout;
|
|||
using Avalonia.Media;
|
||||
using Xunit;
|
||||
|
||||
#if AVALONIA_CAIRO
|
||||
namespace Avalonia.Cairo.RenderTests.Controls
|
||||
#elif AVALONIA_SKIA
|
||||
#if AVALONIA_SKIA
|
||||
namespace Avalonia.Skia.RenderTests
|
||||
#else
|
||||
namespace Avalonia.Direct2D1.RenderTests.Controls
|
||||
|
|
|
@ -7,9 +7,7 @@ using System.Text;
|
|||
using Xunit;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
#if AVALONIA_CAIRO
|
||||
namespace Avalonia.Cairo.RenderTests
|
||||
#elif AVALONIA_SKIA
|
||||
#if AVALONIA_SKIA
|
||||
namespace Avalonia.Skia.RenderTests
|
||||
#else
|
||||
namespace Avalonia.Direct2D1.RenderTests
|
||||
|
|
|
@ -13,9 +13,7 @@ using Avalonia.Media.Imaging;
|
|||
using Avalonia.Platform;
|
||||
using Xunit;
|
||||
|
||||
#if AVALONIA_CAIRO
|
||||
namespace Avalonia.Cairo.RenderTests.Media
|
||||
#elif AVALONIA_SKIA
|
||||
#if AVALONIA_SKIA
|
||||
namespace Avalonia.Skia.RenderTests
|
||||
#else
|
||||
namespace Avalonia.Direct2D1.RenderTests.Media
|
||||
|
@ -105,11 +103,7 @@ namespace Avalonia.Direct2D1.RenderTests.Media
|
|||
CompareImagesNoRenderer(testName);
|
||||
}
|
||||
|
||||
#if AVALONIA_CAIRO
|
||||
//wontfix
|
||||
#else
|
||||
[Theory]
|
||||
#endif
|
||||
[InlineData(PixelFormat.Bgra8888), InlineData(PixelFormat.Rgba8888)]
|
||||
public void WritableBitmapShouldBeUsable(PixelFormat fmt)
|
||||
{
|
||||
|
|
|
@ -9,9 +9,7 @@ using System.Linq;
|
|||
using System.Text;
|
||||
using Xunit;
|
||||
|
||||
#if AVALONIA_CAIRO
|
||||
namespace Avalonia.Cairo.RenderTests.Media
|
||||
#elif AVALONIA_SKIA
|
||||
#if AVALONIA_SKIA
|
||||
namespace Avalonia.Skia.RenderTests
|
||||
#else
|
||||
|
||||
|
@ -86,11 +84,8 @@ namespace Avalonia.Direct2D1.RenderTests.Media
|
|||
widthConstraint);
|
||||
}
|
||||
|
||||
#if AVALONIA_CAIRO
|
||||
[Theory(Skip = "TODO: Font scaling currently broken on cairo")]
|
||||
#else
|
||||
|
||||
[Theory]
|
||||
#endif
|
||||
[InlineData("", FontSize, 0, FontSizeHeight)]
|
||||
[InlineData("x", FontSize, 7.20, FontSizeHeight)]
|
||||
[InlineData(stringword, FontSize, 28.80, FontSizeHeight)]
|
||||
|
@ -114,12 +109,8 @@ namespace Avalonia.Direct2D1.RenderTests.Media
|
|||
|
||||
Assert.Equal(expHeight, linesHeight, 2);
|
||||
}
|
||||
|
||||
#if AVALONIA_CAIRO
|
||||
[Theory(Skip = "TODO: Font scaling currently broken on cairo")]
|
||||
#else
|
||||
|
||||
[Theory]
|
||||
#endif
|
||||
[InlineData("", 1, -1, TextWrapping.NoWrap)]
|
||||
[InlineData("x", 1, -1, TextWrapping.NoWrap)]
|
||||
[InlineData(stringword, 1, -1, TextWrapping.NoWrap)]
|
||||
|
@ -142,12 +133,8 @@ namespace Avalonia.Direct2D1.RenderTests.Media
|
|||
var lines = constrained.GetLines().ToArray();
|
||||
Assert.Equal(linesCount, lines.Count());
|
||||
}
|
||||
|
||||
#if AVALONIA_CAIRO
|
||||
[Theory(Skip = "TODO: Font scaling currently broken on cairo")]
|
||||
#else
|
||||
|
||||
[Theory]
|
||||
#endif
|
||||
[InlineData("x", 0, 0, true, false, 0)]
|
||||
[InlineData(stringword, -1, -1, false, false, 0)]
|
||||
[InlineData(stringword, 25, 13, true, false, 3)]
|
||||
|
@ -181,12 +168,8 @@ namespace Avalonia.Direct2D1.RenderTests.Media
|
|||
Assert.Equal(isInside, htRes.IsInside);
|
||||
Assert.Equal(isTrailing, htRes.IsTrailing);
|
||||
}
|
||||
|
||||
#if AVALONIA_CAIRO
|
||||
[Theory(Skip = "TODO: Font scaling currently broken on cairo")]
|
||||
#else
|
||||
|
||||
[Theory]
|
||||
#endif
|
||||
[InlineData("", 0, 0, 0, 0, FontSizeHeight)]
|
||||
[InlineData("x", 0, 0, 0, 7.20, FontSizeHeight)]
|
||||
[InlineData("x", -1, 7.20, 0, 0, FontSizeHeight)]
|
||||
|
@ -207,12 +190,8 @@ namespace Avalonia.Direct2D1.RenderTests.Media
|
|||
Assert.Equal(width, r.Width, 2);
|
||||
Assert.Equal(height, r.Height, 2);
|
||||
}
|
||||
|
||||
#if AVALONIA_CAIRO
|
||||
[Theory(Skip = "TODO: Font scaling currently broken on cairo")]
|
||||
#else
|
||||
|
||||
[Theory]
|
||||
#endif
|
||||
[InlineData("x", 0, 200, 200 - 7.20, 0, 7.20, FontSizeHeight)]
|
||||
[InlineData(stringword, 0, 200, 171.20, 0, 7.20, FontSizeHeight)]
|
||||
[InlineData(stringword, 3, 200, 200 - 7.20, 0, 7.20, FontSizeHeight)]
|
||||
|
@ -230,12 +209,8 @@ namespace Avalonia.Direct2D1.RenderTests.Media
|
|||
Assert.Equal(width, r.Width, 2);
|
||||
Assert.Equal(height, r.Height, 2);
|
||||
}
|
||||
|
||||
#if AVALONIA_CAIRO
|
||||
[Theory(Skip = "TODO: Font scaling currently broken on cairo")]
|
||||
#else
|
||||
|
||||
[Theory]
|
||||
#endif
|
||||
[InlineData("x", 0, 200, 100 - 7.20 / 2, 0, 7.20, FontSizeHeight)]
|
||||
[InlineData(stringword, 0, 200, 85.6, 0, 7.20, FontSizeHeight)]
|
||||
[InlineData(stringword, 3, 200, 100 + 7.20, 0, 7.20, FontSizeHeight)]
|
||||
|
@ -253,12 +228,8 @@ namespace Avalonia.Direct2D1.RenderTests.Media
|
|||
Assert.Equal(width, r.Width, 2);
|
||||
Assert.Equal(height, r.Height, 2);
|
||||
}
|
||||
|
||||
#if AVALONIA_CAIRO
|
||||
[Theory(Skip = "TODO: Font scaling currently broken on cairo")]
|
||||
#else
|
||||
|
||||
[Theory]
|
||||
#endif
|
||||
[InlineData("x", 0, 1, "0,0,7.20,13.59")]
|
||||
[InlineData(stringword, 0, 4, "0,0,28.80,13.59")]
|
||||
[InlineData(stringmiddlenewlines, 10, 10, "0,13.59,57.61,13.59")]
|
||||
|
|
|
@ -9,9 +9,7 @@ using Avalonia.Media;
|
|||
using Avalonia.Media.Imaging;
|
||||
using Xunit;
|
||||
|
||||
#if AVALONIA_CAIRO
|
||||
namespace Avalonia.Cairo.RenderTests.Media
|
||||
#elif AVALONIA_SKIA
|
||||
#if AVALONIA_SKIA
|
||||
namespace Avalonia.Skia.RenderTests
|
||||
#else
|
||||
namespace Avalonia.Direct2D1.RenderTests.Media
|
||||
|
@ -366,11 +364,8 @@ namespace Avalonia.Direct2D1.RenderTests.Media
|
|||
CompareImages();
|
||||
}
|
||||
|
||||
#if AVALONIA_CAIRO
|
||||
[Fact(Skip = "TileMode.FlipX not yet supported on cairo")]
|
||||
#else
|
||||
|
||||
[Fact]
|
||||
#endif
|
||||
public async Task ImageBrush_NoStretch_FlipX_TopLeftDest()
|
||||
{
|
||||
Decorator target = new Decorator
|
||||
|
@ -393,12 +388,8 @@ namespace Avalonia.Direct2D1.RenderTests.Media
|
|||
await RenderToFile(target);
|
||||
CompareImages();
|
||||
}
|
||||
|
||||
#if AVALONIA_CAIRO
|
||||
[Fact(Skip = "TileMode.FlipY not yet supported on cairo")]
|
||||
#else
|
||||
|
||||
[Fact]
|
||||
#endif
|
||||
public async Task ImageBrush_NoStretch_FlipY_TopLeftDest()
|
||||
{
|
||||
Decorator target = new Decorator
|
||||
|
|
|
@ -10,9 +10,7 @@ using System.Text;
|
|||
using System.Threading.Tasks;
|
||||
using Xunit;
|
||||
|
||||
#if AVALONIA_CAIRO
|
||||
namespace Avalonia.Cairo.RenderTests.Media
|
||||
#elif AVALONIA_SKIA
|
||||
#if AVALONIA_SKIA
|
||||
namespace Avalonia.Skia.RenderTests
|
||||
#else
|
||||
namespace Avalonia.Direct2D1.RenderTests.Media
|
||||
|
|
|
@ -10,9 +10,7 @@ using System.Text;
|
|||
using System.Threading.Tasks;
|
||||
using Xunit;
|
||||
|
||||
#if AVALONIA_CAIRO
|
||||
namespace Avalonia.Cairo.RenderTests.Media
|
||||
#elif AVALONIA_SKIA
|
||||
#if AVALONIA_SKIA
|
||||
namespace Avalonia.Skia.RenderTests
|
||||
#else
|
||||
namespace Avalonia.Direct2D1.RenderTests.Media
|
||||
|
|
|
@ -9,9 +9,7 @@ using Avalonia.Media;
|
|||
using Avalonia.Media.Imaging;
|
||||
using Xunit;
|
||||
|
||||
#if AVALONIA_CAIRO
|
||||
namespace Avalonia.Cairo.RenderTests.Media
|
||||
#elif AVALONIA_SKIA
|
||||
#if AVALONIA_SKIA
|
||||
namespace Avalonia.Skia.RenderTests
|
||||
#else
|
||||
namespace Avalonia.Direct2D1.RenderTests.Media
|
||||
|
@ -85,10 +83,8 @@ namespace Avalonia.Direct2D1.RenderTests.Media
|
|||
await RenderToFile(target);
|
||||
CompareImages();
|
||||
}
|
||||
|
||||
#if AVALONIA_CAIRO
|
||||
[Fact(Skip = "Font scaling currently broken on cairo")]
|
||||
#elif AVALONIA_SKIA_SKIP_FAIL
|
||||
|
||||
#if AVALONIA_SKIA_SKIP_FAIL
|
||||
[Fact(Skip = "FIXME")]
|
||||
#else
|
||||
[Fact]
|
||||
|
@ -142,9 +138,7 @@ namespace Avalonia.Direct2D1.RenderTests.Media
|
|||
CompareImages();
|
||||
}
|
||||
|
||||
#if AVALONIA_CAIRO
|
||||
[Fact(Skip = "Font scaling currently broken on cairo")]
|
||||
#elif AVALONIA_SKIA_SKIP_FAIL
|
||||
#if AVALONIA_SKIA_SKIP_FAIL
|
||||
[Fact(Skip = "FIXME")]
|
||||
#else
|
||||
[Fact]
|
||||
|
@ -171,9 +165,7 @@ namespace Avalonia.Direct2D1.RenderTests.Media
|
|||
CompareImages();
|
||||
}
|
||||
|
||||
#if AVALONIA_CAIRO
|
||||
[Fact(Skip = "Font scaling currently broken on cairo")]
|
||||
#elif AVALONIA_SKIA_SKIP_FAIL
|
||||
#if AVALONIA_SKIA_SKIP_FAIL
|
||||
[Fact(Skip = "FIXME")]
|
||||
#else
|
||||
[Fact]
|
||||
|
@ -200,9 +192,7 @@ namespace Avalonia.Direct2D1.RenderTests.Media
|
|||
CompareImages();
|
||||
}
|
||||
|
||||
#if AVALONIA_CAIRO
|
||||
[Fact(Skip = "Font scaling currently broken on cairo")]
|
||||
#elif AVALONIA_SKIA_SKIP_FAIL
|
||||
#if AVALONIA_SKIA_SKIP_FAIL
|
||||
[Fact(Skip = "FIXME")]
|
||||
#else
|
||||
[Fact]
|
||||
|
@ -253,9 +243,7 @@ namespace Avalonia.Direct2D1.RenderTests.Media
|
|||
CompareImages();
|
||||
}
|
||||
|
||||
#if AVALONIA_CAIRO
|
||||
[Fact(Skip = "Font scaling currently broken on cairo")]
|
||||
#elif AVALONIA_SKIA_SKIP_FAIL
|
||||
#if AVALONIA_SKIA_SKIP_FAIL
|
||||
[Fact(Skip = "FIXME")]
|
||||
#else
|
||||
[Fact]
|
||||
|
@ -337,9 +325,7 @@ namespace Avalonia.Direct2D1.RenderTests.Media
|
|||
CompareImages();
|
||||
}
|
||||
|
||||
#if AVALONIA_CAIRO
|
||||
[Fact(Skip = "TileMode.FlipX not yet supported on cairo")]
|
||||
#elif AVALONIA_SKIA_SKIP_FAIL
|
||||
#if AVALONIA_SKIA_SKIP_FAIL
|
||||
[Fact(Skip = "FIXME")]
|
||||
#else
|
||||
[Fact]
|
||||
|
@ -367,9 +353,7 @@ namespace Avalonia.Direct2D1.RenderTests.Media
|
|||
CompareImages();
|
||||
}
|
||||
|
||||
#if AVALONIA_CAIRO
|
||||
[Fact(Skip = "TileMode.FlipY not yet supported on cairo")]
|
||||
#elif AVALONIA_SKIA_SKIP_FAIL
|
||||
#if AVALONIA_SKIA_SKIP_FAIL
|
||||
[Fact(Skip = "FIXME")]
|
||||
#else
|
||||
[Fact]
|
||||
|
@ -397,9 +381,7 @@ namespace Avalonia.Direct2D1.RenderTests.Media
|
|||
CompareImages();
|
||||
}
|
||||
|
||||
#if AVALONIA_CAIRO
|
||||
[Fact(Skip = "Font scaling currently broken on cairo")]
|
||||
#elif AVALONIA_SKIA_SKIP_FAIL
|
||||
#if AVALONIA_SKIA_SKIP_FAIL
|
||||
[Fact(Skip = "FIXME")]
|
||||
#else
|
||||
[Fact]
|
||||
|
@ -427,9 +409,7 @@ namespace Avalonia.Direct2D1.RenderTests.Media
|
|||
CompareImages();
|
||||
}
|
||||
|
||||
#if AVALONIA_CAIRO
|
||||
[Fact(Skip = "Font scaling currently broken on cairo")]
|
||||
#elif AVALONIA_SKIA_SKIP_FAIL
|
||||
#if AVALONIA_SKIA_SKIP_FAIL
|
||||
[Fact(Skip = "FIXME")]
|
||||
#else
|
||||
[Fact]
|
||||
|
|
|
@ -7,9 +7,7 @@ using System.Text;
|
|||
using Xunit;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
#if AVALONIA_CAIRO
|
||||
namespace Avalonia.Cairo.RenderTests
|
||||
#elif AVALONIA_SKIA
|
||||
#if AVALONIA_SKIA
|
||||
namespace Avalonia.Skia.RenderTests
|
||||
#else
|
||||
namespace Avalonia.Direct2D1.RenderTests
|
||||
|
|
|
@ -0,0 +1,53 @@
|
|||
using Avalonia.Controls;
|
||||
using Avalonia.Controls.Shapes;
|
||||
using Avalonia.Media;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using Xunit;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
#if AVALONIA_CAIRO
|
||||
namespace Avalonia.Cairo.RenderTests
|
||||
#elif AVALONIA_SKIA
|
||||
namespace Avalonia.Skia.RenderTests
|
||||
#else
|
||||
namespace Avalonia.Direct2D1.RenderTests
|
||||
#endif
|
||||
{
|
||||
public class SVGPathTests : TestBase
|
||||
{
|
||||
public SVGPathTests()
|
||||
:base("SVGPath")
|
||||
{
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task SVGPath()
|
||||
{
|
||||
var target = new Canvas
|
||||
{
|
||||
Background = Brushes.Yellow,
|
||||
Width = 76,
|
||||
Height = 76,
|
||||
Children = new Avalonia.Controls.Controls
|
||||
{
|
||||
new Path
|
||||
{
|
||||
Width = 32,
|
||||
Height = 40,
|
||||
[Canvas.LeftProperty] = 23,
|
||||
[Canvas.TopProperty] = 18,
|
||||
Stretch = Stretch.Fill,
|
||||
Fill = Brushes.Black,
|
||||
//Coffee Maker by Becris from the Noun Project
|
||||
Data = StreamGeometry.Parse("M5,51v4c0,1.654,1.346,3,3,3h7v3c0,0.552,0.447,1,1,1h8c0.553,0,1-0.448,1-1v-3h18v3c0,0.552,0.447,1,1,1h8 c0.553,0,1-0.448,1-1v-3c2.757,0,5-2.243,5-5V13V7c0-2.757-2.243-5-5-5H11C8.243,2,6,4.243,6,7v2c0,2.757,2.243,5,5,5h1.743 l-2.717,11.775c-0.068,0.297,0.002,0.609,0.192,0.848C10.407,26.861,10.695,27,11,27h4c0.431,0,0.812-0.275,0.948-0.684L18.721,18 h1.499l1.811,7.243C22.142,25.688,22.541,26,23,26h12c0.459,0,0.858-0.312,0.97-0.757L37.78,18h6.658l-3.235,29.11 C41.147,47.618,40.72,48,40.21,48h-4.167c0.873-1.159,1.203-2.622,0.897-4.047L35,34.895v-2.481l2.707-2.707 c0.286-0.286,0.372-0.716,0.217-1.09C37.77,28.244,37.404,28,37,28H22c-0.553,0-1,0.448-1,1v0.719l-2.758-0.689 c-0.443-0.111-0.906,0.094-1.123,0.496l-7,13l1.762,0.948l6.631-12.315L21,31.781v3.115l-1.94,9.057 c-0.306,1.426,0.025,2.889,0.897,4.048H8C6.346,48,5,49.346,5,51z M23,60h-6v-2h6V60z M51,60h-6v-2h6V60z M8,9V7 c0-1.654,1.346-3,3-3h42c1.654,0,3,1.346,3,3v5H46H14h-3C9.346,12,8,10.654,8,9z M34.219,24H23.781l-1.5-6h13.438L34.219,24z M44.66,16H37H21h-3c-0.431,0-0.812,0.275-0.948,0.684L14.279,25h-2.022l2.539-11h30.087l-0.185,1.662L44.66,16z M43.191,47.331 L46.896,14H56v39c0,1.654-1.346,3-3,3h-1h-8H24h-8H8c-0.552,0-1-0.449-1-1v-4c0-0.551,0.448-1,1-1h15.948h8.104h8.158 C41.741,50,43.022,48.853,43.191,47.331z M23,30h11.586l-1.293,1.293C33.105,31.48,33,31.735,33,32v2H23V30z M21.614,46.886 c-0.571-0.708-0.79-1.624-0.6-2.514L22.809,36h10.383l1.794,8.372c0.19,0.89-0.028,1.806-0.6,2.514 C33.813,47.594,32.963,48,32.052,48h-8.104C23.037,48,22.187,47.594,21.614,46.886z")
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
await RenderToFile(target);
|
||||
CompareImages();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -7,9 +7,7 @@ using Avalonia.Controls.Shapes;
|
|||
using Avalonia.Media;
|
||||
using Xunit;
|
||||
|
||||
#if AVALONIA_CAIRO
|
||||
namespace Avalonia.Cairo.RenderTests.Shapes
|
||||
#elif AVALONIA_SKIA
|
||||
#if AVALONIA_SKIA
|
||||
namespace Avalonia.Skia.RenderTests
|
||||
#else
|
||||
namespace Avalonia.Direct2D1.RenderTests.Shapes
|
||||
|
|
|
@ -7,9 +7,7 @@ using Avalonia.Controls.Shapes;
|
|||
using Avalonia.Media;
|
||||
using Xunit;
|
||||
|
||||
#if AVALONIA_CAIRO
|
||||
namespace Avalonia.Cairo.RenderTests.Shapes
|
||||
#elif AVALONIA_SKIA
|
||||
#if AVALONIA_SKIA
|
||||
namespace Avalonia.Skia.RenderTests
|
||||
#else
|
||||
namespace Avalonia.Direct2D1.RenderTests.Shapes
|
||||
|
@ -21,12 +19,8 @@ namespace Avalonia.Direct2D1.RenderTests.Shapes
|
|||
: base(@"Shapes\Line")
|
||||
{
|
||||
}
|
||||
|
||||
#if !AVALONIA_CAIRO
|
||||
|
||||
[Fact]
|
||||
#else
|
||||
[Fact(Skip = "Fails on Cairo")]
|
||||
#endif
|
||||
public async Task Line_1px_Stroke()
|
||||
{
|
||||
Decorator target = new Decorator
|
||||
|
@ -45,12 +39,8 @@ namespace Avalonia.Direct2D1.RenderTests.Shapes
|
|||
await RenderToFile(target);
|
||||
CompareImages();
|
||||
}
|
||||
|
||||
#if !AVALONIA_CAIRO
|
||||
|
||||
[Fact]
|
||||
#else
|
||||
[Fact(Skip = "Fails on Cairo")]
|
||||
#endif
|
||||
public async Task Line_1px_Stroke_Reversed()
|
||||
{
|
||||
Decorator target = new Decorator
|
||||
|
|
|
@ -7,9 +7,7 @@ using Avalonia.Layout;
|
|||
using Avalonia.Media;
|
||||
using Xunit;
|
||||
|
||||
#if AVALONIA_CAIRO
|
||||
namespace Avalonia.Cairo.RenderTests.Shapes
|
||||
#elif AVALONIA_SKIA
|
||||
#if AVALONIA_SKIA
|
||||
namespace Avalonia.Skia.RenderTests
|
||||
#else
|
||||
namespace Avalonia.Direct2D1.RenderTests.Shapes
|
||||
|
@ -25,11 +23,8 @@ namespace Avalonia.Direct2D1.RenderTests.Shapes
|
|||
{
|
||||
}
|
||||
|
||||
#if AVALONIA_CAIRO
|
||||
[Fact(Skip = "Broken in Cairo: waiting for Skia")]
|
||||
#else
|
||||
|
||||
[Fact]
|
||||
#endif
|
||||
public async Task Line_Absolute()
|
||||
{
|
||||
Decorator target = new Decorator
|
||||
|
@ -49,12 +44,8 @@ namespace Avalonia.Direct2D1.RenderTests.Shapes
|
|||
await RenderToFile(target);
|
||||
CompareImages();
|
||||
}
|
||||
|
||||
#if AVALONIA_CAIRO
|
||||
[Fact(Skip = "Broken in Cairo: waiting for Skia")]
|
||||
#else
|
||||
|
||||
[Fact]
|
||||
#endif
|
||||
public async Task Line_Relative()
|
||||
{
|
||||
Decorator target = new Decorator
|
||||
|
@ -74,12 +65,8 @@ namespace Avalonia.Direct2D1.RenderTests.Shapes
|
|||
await RenderToFile(target);
|
||||
CompareImages();
|
||||
}
|
||||
|
||||
#if AVALONIA_CAIRO
|
||||
[Fact(Skip = "Broken in Cairo: waiting for Skia")]
|
||||
#else
|
||||
|
||||
[Fact]
|
||||
#endif
|
||||
public async Task HorizontalLine_Absolute()
|
||||
{
|
||||
Decorator target = new Decorator
|
||||
|
@ -99,12 +86,8 @@ namespace Avalonia.Direct2D1.RenderTests.Shapes
|
|||
await RenderToFile(target);
|
||||
CompareImages();
|
||||
}
|
||||
|
||||
#if AVALONIA_CAIRO
|
||||
[Fact(Skip = "Broken in Cairo: waiting for Skia")]
|
||||
#else
|
||||
|
||||
[Fact]
|
||||
#endif
|
||||
public async Task HorizontalLine_Relative()
|
||||
{
|
||||
Decorator target = new Decorator
|
||||
|
@ -124,12 +107,8 @@ namespace Avalonia.Direct2D1.RenderTests.Shapes
|
|||
await RenderToFile(target);
|
||||
CompareImages();
|
||||
}
|
||||
|
||||
#if AVALONIA_CAIRO
|
||||
[Fact(Skip = "Broken in Cairo: waiting for Skia")]
|
||||
#else
|
||||
|
||||
[Fact]
|
||||
#endif
|
||||
public async Task VerticalLine_Absolute()
|
||||
{
|
||||
Decorator target = new Decorator
|
||||
|
@ -149,12 +128,8 @@ namespace Avalonia.Direct2D1.RenderTests.Shapes
|
|||
await RenderToFile(target);
|
||||
CompareImages();
|
||||
}
|
||||
|
||||
#if AVALONIA_CAIRO
|
||||
[Fact(Skip = "Broken in Cairo: waiting for Skia")]
|
||||
#else
|
||||
|
||||
[Fact]
|
||||
#endif
|
||||
public async Task VerticalLine_Relative()
|
||||
{
|
||||
Decorator target = new Decorator
|
||||
|
@ -174,12 +149,8 @@ namespace Avalonia.Direct2D1.RenderTests.Shapes
|
|||
await RenderToFile(target);
|
||||
CompareImages();
|
||||
}
|
||||
|
||||
#if AVALONIA_CAIRO
|
||||
[Fact(Skip = "Broken in Cairo: waiting for Skia")]
|
||||
#else
|
||||
|
||||
[Fact]
|
||||
#endif
|
||||
public async Task CubicBezier_Absolute()
|
||||
{
|
||||
Decorator target = new Decorator
|
||||
|
@ -200,12 +171,8 @@ namespace Avalonia.Direct2D1.RenderTests.Shapes
|
|||
await RenderToFile(target);
|
||||
CompareImages();
|
||||
}
|
||||
|
||||
#if AVALONIA_CAIRO
|
||||
[Fact(Skip = "Broken in Cairo: waiting for Skia")]
|
||||
#else
|
||||
|
||||
[Fact]
|
||||
#endif
|
||||
public async Task CubicBezier_Relative()
|
||||
{
|
||||
Decorator target = new Decorator
|
||||
|
@ -226,12 +193,8 @@ namespace Avalonia.Direct2D1.RenderTests.Shapes
|
|||
await RenderToFile(target);
|
||||
CompareImages();
|
||||
}
|
||||
|
||||
#if AVALONIA_CAIRO
|
||||
[Fact(Skip = "Broken in Cairo: waiting for Skia")]
|
||||
#else
|
||||
|
||||
[Fact]
|
||||
#endif
|
||||
public async Task Arc_Absolute()
|
||||
{
|
||||
Decorator target = new Decorator
|
||||
|
@ -252,12 +215,8 @@ namespace Avalonia.Direct2D1.RenderTests.Shapes
|
|||
await RenderToFile(target);
|
||||
CompareImages();
|
||||
}
|
||||
|
||||
#if AVALONIA_CAIRO
|
||||
[Fact(Skip = "Broken in Cairo: waiting for Skia")]
|
||||
#else
|
||||
|
||||
[Fact]
|
||||
#endif
|
||||
public async Task Arc_Relative()
|
||||
{
|
||||
Decorator target = new Decorator
|
||||
|
@ -375,9 +334,7 @@ namespace Avalonia.Direct2D1.RenderTests.Shapes
|
|||
CompareImages();
|
||||
}
|
||||
|
||||
#if AVALONIA_CAIRO
|
||||
[Fact(Skip = "Path with StrokeDashCap, StrokeStartLineCap, StrokeEndLineCap rendering is not implemented in Cairo yet")]
|
||||
#elif AVALONIA_SKIA_SKIP_FAIL
|
||||
#if AVALONIA_SKIA_SKIP_FAIL
|
||||
[Fact(Skip = "FIXME")]
|
||||
#else
|
||||
[Fact]
|
||||
|
|
|
@ -7,9 +7,7 @@ using Avalonia.Controls.Shapes;
|
|||
using Avalonia.Media;
|
||||
using Xunit;
|
||||
|
||||
#if AVALONIA_CAIRO
|
||||
namespace Avalonia.Cairo.RenderTests.Shapes
|
||||
#elif AVALONIA_SKIA
|
||||
#if AVALONIA_SKIA
|
||||
namespace Avalonia.Skia.RenderTests
|
||||
#else
|
||||
namespace Avalonia.Direct2D1.RenderTests.Shapes
|
||||
|
@ -21,12 +19,8 @@ namespace Avalonia.Direct2D1.RenderTests.Shapes
|
|||
: base(@"Shapes\Polygon")
|
||||
{
|
||||
}
|
||||
|
||||
#if AVALONIA_CAIRO
|
||||
[Fact(Skip = "Caused by cairo bug")]
|
||||
#else
|
||||
|
||||
[Fact]
|
||||
#endif
|
||||
public async Task Polygon_1px_Stroke()
|
||||
{
|
||||
Decorator target = new Decorator
|
||||
|
@ -48,11 +42,7 @@ namespace Avalonia.Direct2D1.RenderTests.Shapes
|
|||
CompareImages();
|
||||
}
|
||||
|
||||
#if AVALONIA_CAIRO
|
||||
[Fact(Skip = "Caused by cairo bug")]
|
||||
#else
|
||||
[Fact]
|
||||
#endif
|
||||
public async Task Polygon_NonUniformFill()
|
||||
{
|
||||
Decorator target = new Decorator
|
||||
|
|
|
@ -7,9 +7,7 @@ using Avalonia.Controls.Shapes;
|
|||
using Avalonia.Media;
|
||||
using Xunit;
|
||||
|
||||
#if AVALONIA_CAIRO
|
||||
namespace Avalonia.Cairo.RenderTests.Shapes
|
||||
#elif AVALONIA_SKIA
|
||||
#if AVALONIA_SKIA
|
||||
namespace Avalonia.Skia.RenderTests
|
||||
#else
|
||||
namespace Avalonia.Direct2D1.RenderTests.Shapes
|
||||
|
@ -22,11 +20,7 @@ namespace Avalonia.Direct2D1.RenderTests.Shapes
|
|||
{
|
||||
}
|
||||
|
||||
#if AVALONIA_CAIRO
|
||||
[Fact(Skip = "Caused by cairo bug")]
|
||||
#else
|
||||
[Fact]
|
||||
#endif
|
||||
public async Task Polyline_1px_Stroke()
|
||||
{
|
||||
var polylinePoints = new Point[] { new Point(0, 0), new Point(5, 0), new Point(6, -2), new Point(7, 3), new Point(8, -3),
|
||||
|
@ -49,12 +43,8 @@ namespace Avalonia.Direct2D1.RenderTests.Shapes
|
|||
await RenderToFile(target);
|
||||
CompareImages();
|
||||
}
|
||||
|
||||
#if AVALONIA_CAIRO
|
||||
[Fact(Skip = "Caused by cairo bug")]
|
||||
#else
|
||||
|
||||
[Fact]
|
||||
#endif
|
||||
public async Task Polyline_10px_Stroke_PenLineJoin()
|
||||
{
|
||||
var polylinePoints = new Point[] { new Point(0, 0), new Point(5, 0), new Point(6, -2), new Point(7, 3), new Point(8, -3),
|
||||
|
|
|
@ -7,9 +7,7 @@ using Avalonia.Controls.Shapes;
|
|||
using Avalonia.Media;
|
||||
using Xunit;
|
||||
|
||||
#if AVALONIA_CAIRO
|
||||
namespace Avalonia.Cairo.RenderTests.Shapes
|
||||
#elif AVALONIA_SKIA
|
||||
#if AVALONIA_SKIA
|
||||
namespace Avalonia.Skia.RenderTests
|
||||
#else
|
||||
namespace Avalonia.Direct2D1.RenderTests.Shapes
|
||||
|
|
|
@ -14,17 +14,13 @@ using System.Threading.Tasks;
|
|||
using System;
|
||||
using System.Threading;
|
||||
using Avalonia.Threading;
|
||||
#if AVALONIA_CAIRO
|
||||
using Avalonia.Cairo;
|
||||
#elif AVALONIA_SKIA
|
||||
#if AVALONIA_SKIA
|
||||
using Avalonia.Skia;
|
||||
#else
|
||||
using Avalonia.Direct2D1;
|
||||
#endif
|
||||
|
||||
#if AVALONIA_CAIRO
|
||||
namespace Avalonia.Cairo.RenderTests
|
||||
#elif AVALONIA_SKIA
|
||||
#if AVALONIA_SKIA
|
||||
namespace Avalonia.Skia.RenderTests
|
||||
#else
|
||||
namespace Avalonia.Direct2D1.RenderTests
|
||||
|
@ -37,9 +33,7 @@ namespace Avalonia.Direct2D1.RenderTests
|
|||
|
||||
static TestBase()
|
||||
{
|
||||
#if AVALONIA_CAIRO
|
||||
CairoPlatform.Initialize();
|
||||
#elif AVALONIA_SKIA
|
||||
#if AVALONIA_SKIA
|
||||
SkiaPlatform.Initialize();
|
||||
#else
|
||||
Direct2D1Platform.Initialize();
|
||||
|
|
|
@ -1,23 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<runtime>
|
||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="SharpDX.Direct2D1" publicKeyToken="b4dcf0f35e5521f1" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-3.1.1.0" newVersion="3.1.1.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="SharpDX" publicKeyToken="b4dcf0f35e5521f1" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-3.1.1.0" newVersion="3.1.1.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="SharpDX.DXGI" publicKeyToken="b4dcf0f35e5521f1" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-3.1.1.0" newVersion="3.1.1.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Mono.Cairo" publicKeyToken="0738eb9f132ed756" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" />
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
</configuration>
|
До Ширина: | Высота: | Размер: 609 B |
До Ширина: | Высота: | Размер: 611 B |
До Ширина: | Высота: | Размер: 761 B |
До Ширина: | Высота: | Размер: 615 B |
До Ширина: | Высота: | Размер: 760 B |
До Ширина: | Высота: | Размер: 771 B |
Двоичные данные
tests/TestFiles/Cairo/Controls/Border/Border_Fill.expected.png
До Ширина: | Высота: | Размер: 601 B |
До Ширина: | Высота: | Размер: 743 B |