├── .gitattributes
├── .gitignore
├── LICENSE
├── README.md
├── Resources
├── NewApi.png
├── sharex-20220319134253.png
├── sharex-20220319134414.png
├── sharex-20220319134520.png
├── sharex-20220319134617.png
└── 报告20220330-1905.diagsession
├── SharpConstraintLayout.Core.Benchmark
├── App.xaml
├── App.xaml.cs
├── CSharpAbsoluteLayoutControlTest.cs
├── CSharpConstraintLayoutControlTest.cs
├── CSharpConstraintLayoutTest.cs
├── CSharpRelativeLayoutControlTest.cs
├── FlexLayoutControlTest.cs
├── FlowTest.cs
├── JavaConstraintLayoutControlTest.Android.cs
├── JavaConstraintLayoutTest.Android.cs
├── JavaFlowTest.Android.cs
├── JavaRelativeLayoutControlTest.Android.cs
├── MauiProgram.cs
├── Platforms
│ ├── Android
│ │ ├── AndroidManifest.xml
│ │ ├── MainActivity.cs
│ │ ├── MainApplication.cs
│ │ └── Resources
│ │ │ └── values
│ │ │ └── colors.xml
│ ├── MacCatalyst
│ │ ├── AppDelegate.cs
│ │ ├── Info.plist
│ │ └── Program.cs
│ ├── Windows
│ │ ├── App.xaml
│ │ ├── App.xaml.cs
│ │ ├── Package.appxmanifest
│ │ └── app.manifest
│ └── iOS
│ │ ├── AppDelegate.cs
│ │ ├── Info.plist
│ │ └── Program.cs
├── Properties
│ └── launchSettings.json
├── Resources
│ ├── Fonts
│ │ └── OpenSans-Regular.ttf
│ ├── Images
│ │ └── dotnet_bot.svg
│ ├── Raw
│ │ ├── AboutAssets.txt
│ │ └── favorite_black_24dp.svg
│ ├── appicon.svg
│ └── appiconfg.svg
├── SharpConstraintLayout.Core.Benchmark.csproj
└── SimpleClock.cs
├── SharpConstraintLayout.Core.Console
├── FlowTest.cs
├── Program.cs
├── SharpConstraintLayout.Core.Console.csproj
└── SimpleTest.cs
├── SharpConstraintLayout.Core
├── ArrayHelperClass.cs
├── DateTimeHelperClass.cs
├── DecimalFormat.cs
├── ExceptionHelperClass.cs
├── GlobalUsing.cs
├── HashMapHelperClass.cs
├── LinkedHashMap.cs
├── ListHelperClass.cs
├── MathHelperClass.cs
├── NumberHelperClass.cs
├── RectangularArrays.cs
├── SharpConstraintLayout.Core.csproj
├── StringHelperClass.cs
└── androidx
│ └── constraintlayout
│ └── core
│ ├── ArrayLinkedVariables.cs
│ ├── ArrayRow.cs
│ ├── Cache.cs
│ ├── GoalRow.cs
│ ├── LinearSystem.cs
│ ├── Metrics.cs
│ ├── Pools.cs
│ ├── PriorityGoalRow.cs
│ ├── SolverVariable.cs
│ ├── SolverVariableValues.cs
│ ├── motion
│ ├── CustomAttribute.cs
│ ├── CustomVariable.cs
│ ├── Motion.cs
│ ├── MotionConstrainedPoint.cs
│ ├── MotionPaths.cs
│ ├── MotionWidget.cs
│ ├── key
│ │ ├── MotionConstraintSet.cs
│ │ ├── MotionKey.cs
│ │ ├── MotionKeyAttributes.cs
│ │ ├── MotionKeyCycle.cs
│ │ ├── MotionKeyPosition.cs
│ │ ├── MotionKeyTimeCycle.cs
│ │ └── MotionKeyTrigger.cs
│ ├── parse
│ │ └── KeyParser.cs
│ └── utils
│ │ ├── ArcCurveFit.cs
│ │ ├── CurveFit.cs
│ │ ├── DifferentialInterpolator.cs
│ │ ├── Easing.cs
│ │ ├── FloatRect.cs
│ │ ├── HyperSpline.cs
│ │ ├── KeyCache.cs
│ │ ├── KeyCycleOscillator.cs
│ │ ├── KeyFrameArray.cs
│ │ ├── LinearCurveFit.cs
│ │ ├── MonotonicCurveFit.cs
│ │ ├── Oscillator.cs
│ │ ├── Rect.cs
│ │ ├── Schlick.cs
│ │ ├── SplineSet.cs
│ │ ├── SpringStopEngine.cs
│ │ ├── StepCurve.cs
│ │ ├── StopEngine.cs
│ │ ├── StopLogicEngine.cs
│ │ ├── TimeCycleSplineSet.cs
│ │ ├── TypedBundle.cs
│ │ ├── TypedValues.cs
│ │ ├── Utils.cs
│ │ ├── VelocityMatrix.cs
│ │ └── ViewState.cs
│ ├── parser
│ ├── CLArray.cs
│ ├── CLContainer.cs
│ ├── CLElement.cs
│ ├── CLKey.cs
│ ├── CLNumber.cs
│ ├── CLObject.cs
│ ├── CLParser.cs
│ ├── CLParsingException.cs
│ ├── CLString.cs
│ └── CLToken.cs
│ ├── state
│ ├── ConstraintReference.cs
│ ├── Dimension.cs
│ ├── HelperReference.cs
│ ├── Interpolator.cs
│ ├── Reference.cs
│ ├── Registry.cs
│ ├── RegistryCallback.cs
│ ├── State.cs
│ ├── Transition.cs
│ ├── WidgetFrame.cs
│ └── helpers
│ │ ├── AlignHorizontallyReference.cs
│ │ ├── AlignVerticallyReference.cs
│ │ ├── BarrierReference.cs
│ │ ├── ChainReference.cs
│ │ ├── Facade.cs
│ │ ├── GuidelineReference.cs
│ │ ├── HorizontalChainReference.cs
│ │ └── VerticalChainReference.cs
│ └── widgets
│ ├── Barrier.cs
│ ├── Chain.cs
│ ├── ChainHead.cs
│ ├── ConstraintAnchor.cs
│ ├── ConstraintWidget.cs
│ ├── ConstraintWidgetContainer.cs
│ ├── Flow.cs
│ ├── Guideline.cs
│ ├── Helper.cs
│ ├── HelperWidget.cs
│ ├── Optimizer.cs
│ ├── Placeholder.cs
│ ├── Rectangle.cs
│ ├── VirtualLayout.cs
│ ├── WidgetContainer.cs
│ └── analyzer
│ ├── BaselineDimensionDependency.cs
│ ├── BasicMeasure.cs
│ ├── ChainRun.cs
│ ├── Dependency.cs
│ ├── DependencyGraph.cs
│ ├── DependencyNode.cs
│ ├── DimensionDependency.cs
│ ├── Direct.cs
│ ├── Grouping.cs
│ ├── GuidelineReference.cs
│ ├── HelperReferences.cs
│ ├── HorizontalWidgetRun.cs
│ ├── RunGroup.cs
│ ├── VerticalWidgetRun.cs
│ ├── WidgetGroup.cs
│ └── WidgetRun.cs
├── SharpConstraintLayout.Maui.Example
├── App.xaml
├── App.xaml.cs
├── AppShell.xaml
├── AppShell.xaml.cs
├── MauiProgram.cs
├── Models
│ └── MicrosoftNews.cs
├── Pages
│ ├── HStack.cs
│ ├── LayoutPerformanceTestPage.xaml
│ ├── LayoutPerformanceTestPage.xaml.cs
│ ├── MainPage.cs
│ ├── MainPage.xaml
│ ├── MainPage.xaml.cs
│ ├── ShowAnimationView.xaml
│ ├── ShowAnimationView.xaml.cs
│ ├── ShowZIndexView.xaml
│ ├── ShowZIndexView.xaml.cs
│ ├── TestContentView.xaml
│ ├── TestContentView.xaml.cs
│ ├── XamlSupport.xaml
│ └── XamlSupport.xaml.cs
├── Platforms
│ ├── Android
│ │ ├── AndroidManifest.xml
│ │ ├── MainActivity.cs
│ │ ├── MainApplication.cs
│ │ └── Resources
│ │ │ └── values
│ │ │ └── colors.xml
│ ├── MacCatalyst
│ │ ├── AppDelegate.cs
│ │ ├── Info.plist
│ │ └── Program.cs
│ ├── Tizen
│ │ ├── Main.cs
│ │ └── tizen-manifest.xml
│ ├── Windows
│ │ ├── App.xaml
│ │ ├── App.xaml.cs
│ │ ├── Package.appxmanifest
│ │ └── app.manifest
│ └── iOS
│ │ ├── AppDelegate.cs
│ │ ├── Info.plist
│ │ └── Program.cs
├── Properties
│ └── launchSettings.json
├── Resources
│ ├── Fonts
│ │ ├── OpenSans-Regular.ttf
│ │ └── OpenSans-Semibold.ttf
│ ├── Images
│ │ └── dotnet_bot.svg
│ ├── Raw
│ │ └── AboutAssets.txt
│ ├── Styles.xaml
│ ├── appicon.svg
│ └── appiconfg.svg
├── SharpConstraintLayout.Maui.Example.csproj
├── SharpConstraintLayout.Maui.Example.sln
├── Tool
│ ├── FrameRateCalculator.Android.cs
│ ├── FrameRateCalculator.Windows.cs
│ ├── FrameRateCalculator.iOS.cs
│ ├── Log.cs
│ ├── SimpleTest.cs
│ ├── UIThread.cs
│ └── ViewExtension.Maui.cs
└── ViewModels
│ └── ListViewViewModel.cs
├── SharpConstraintLayout.Maui.Native.Benchmark
├── CSharpConstraintLayoutControlTest.Native.Android.cs
├── MauiProgram.cs
├── Platforms
│ ├── Android
│ │ ├── AndroidManifest.xml
│ │ ├── MainActivity.cs
│ │ ├── MainApplication.cs
│ │ └── Resources
│ │ │ └── values
│ │ │ └── colors.xml
│ ├── MacCatalyst
│ │ ├── AppDelegate.cs
│ │ ├── Info.plist
│ │ └── Program.cs
│ ├── Windows
│ │ ├── App.xaml
│ │ ├── App.xaml.cs
│ │ ├── Package.appxmanifest
│ │ └── app.manifest
│ └── iOS
│ │ ├── AppDelegate.cs
│ │ ├── Info.plist
│ │ └── Program.cs
├── Properties
│ └── launchSettings.json
├── Resources
│ ├── Fonts
│ │ └── OpenSans-Regular.ttf
│ ├── Images
│ │ └── dotnet_bot.svg
│ ├── Raw
│ │ ├── AboutAssets.txt
│ │ └── favorite_black_24dp.svg
│ ├── appicon.svg
│ └── appiconfg.svg
└── SharpConstraintLayout.Maui.Native.Benchmark.csproj
├── SharpConstraintLayout.Maui.Native.Example
├── MainController.Android.cs
├── MainController.MaciOS.cs
├── MainController.Windows.cs
├── MainPage.Android.cs
├── MainPage.MaciOS.cs
├── MainPage.Windows.cs
├── MainPage.cs
├── Platforms
│ ├── Android
│ │ ├── AndroidManifest.xml
│ │ ├── MainApplication.cs
│ │ └── Resources
│ │ │ └── values
│ │ │ └── colors.xml
│ ├── MacCatalyst
│ │ ├── AppDelegate.cs
│ │ ├── Info.plist
│ │ └── Program.cs
│ ├── Windows
│ │ ├── App.xaml
│ │ ├── App.xaml.cs
│ │ ├── MainWindow.xaml
│ │ ├── MainWindow.xaml.cs
│ │ ├── Package.appxmanifest
│ │ └── app.manifest
│ └── iOS
│ │ ├── AppDelegate.cs
│ │ ├── Info.plist
│ │ └── Program.cs
├── Properties
│ └── launchSettings.json
├── Resources
│ ├── Fonts
│ │ └── OpenSans-Regular.ttf
│ ├── Images
│ │ └── dotnet_bot.svg
│ ├── Raw
│ │ ├── AboutAssets.txt
│ │ └── favorite_black_24dp.svg
│ ├── appicon.svg
│ └── appiconfg.svg
├── SharpConstraintLayout.Maui.Native.Example.csproj
└── Tool
│ ├── SimpleTest.cs
│ ├── UIThread.cs
│ ├── ViewExtension.Android.cs
│ ├── ViewExtension.Windows.cs
│ └── ViewExtension.iOS.cs
├── SharpConstraintLayout.Maui.Native
├── DebugTool
│ ├── MessageClient.cs
│ └── SimpleDebug.cs
├── GloableUsing.cs
├── SharpConstraintLayout.Maui.Native.csproj
└── Widget
│ ├── ConstraintHelper.Android.cs
│ ├── ConstraintHelper.Windows.cs
│ ├── ConstraintHelper.iOS.cs
│ ├── ConstraintLayout.Android.cs
│ ├── ConstraintLayout.Windows.cs
│ └── ConstraintLayout.iOS.cs
├── SharpConstraintLayout.Maui.sln
├── SharpConstraintLayout.Maui
├── GloableUsing.cs
├── Helper
│ └── Widget
│ │ ├── Flow.cs
│ │ ├── Interface
│ │ ├── IFlow.cs
│ │ └── ILayer.cs
│ │ └── Layer.cs
├── SharpConstraintLayout.Maui.csproj
├── SizeI.cs
└── Widget
│ ├── Barrier.cs
│ ├── ConstraintHelper.Maui.cs
│ ├── ConstraintHelper.cs
│ ├── ConstraintLayout.Maui.cs
│ ├── ConstraintLayout.cs
│ ├── ConstraintLayoutAnimationExtension.Maui.cs
│ ├── ConstraintSet.Constraint.cs
│ ├── ConstraintSet.Core.cs
│ ├── ConstraintSet.Data.cs
│ ├── ConstraintSet.Layout.cs
│ ├── ConstraintSet.PropertySet.cs
│ ├── ConstraintSet.Transform.cs
│ ├── Enums.cs
│ ├── FluentConstraintSet.cs
│ ├── Group..cs
│ ├── Guideline.cs
│ ├── IBaseline.cs
│ ├── Interface
│ ├── IBarrier.cs
│ ├── IConstraintHelper.cs
│ ├── IConstraintLayout.cs
│ ├── IConstraintSet.cs
│ ├── IElement.cs
│ ├── IGroup.cs
│ ├── IGuideline.cs
│ ├── IPlaceholder.cs
│ └── IVirtualLayout.cs
│ ├── MeasureSpec.cs
│ ├── Placeholder.cs
│ ├── UIElementExtension.cs
│ ├── UIThread.cs
│ ├── ViewInfo.cs
│ └── VirtualLayout.cs
├── SharpConstraintLayout.Native.sln
└── SharpConstraintLayoutTests
├── AdvancedChainTest.cs
├── Amount.cs
├── AmountTest.cs
├── ArrayBackedVariables.cs
├── ArrayLinkedVariablesTest.cs
├── BarrierTest.cs
├── BasicTests.cs
├── CenterWrapTest.cs
├── ChainTest.cs
├── ChainWrapContentTest.cs
├── CircleTest.cs
├── ComposeLayoutsTest.cs
├── EquationVariable.cs
├── EquationVariableTest.cs
├── FlowTest.cs
├── GlobalUsing.cs
├── GuidelineTest.cs
├── HistogramCounter.cs
├── LayoutTest.cs
├── LinearEquation.cs
├── LinearEquationTest.cs
├── LinearSystemTest.cs
├── MatchConstraintTest.cs
├── NestedLayout.cs
├── ObjectExtension.cs
├── OptimizationsTest.cs
├── PerformanceTest.cs
├── PriorityTest.cs
├── RandomLayoutTest.cs
├── RatioTest.cs
├── SharpConstraintLayoutTests.csproj
├── SolverVariableValuesTest.cs
├── VisibilityTest.cs
├── WidgetsPositioningTest.cs
├── WrapTest.cs
├── my
├── MyBaselineTest.cs
└── MyWarpTest.cs
├── parser
├── CLParserBenchmarkTest.cs
└── CLParserTest.cs
├── scout
├── Direction.cs
├── Scout.cs
├── ScoutProbabilities.cs
├── ScoutWidget.cs
└── Utils.cs
└── widgets
├── BasicSolverVariableValues.cs
└── ChainHeadTest.cs
/.gitattributes:
--------------------------------------------------------------------------------
1 | ###############################################################################
2 | # Set default behavior to automatically normalize line endings.
3 | ###############################################################################
4 | * text=auto
5 |
6 | ###############################################################################
7 | # Set default behavior for command prompt diff.
8 | #
9 | # This is need for earlier builds of msysgit that does not have it on by
10 | # default for csharp files.
11 | # Note: This is only used by command line
12 | ###############################################################################
13 | #*.cs diff=csharp
14 |
15 | ###############################################################################
16 | # Set the merge driver for project and solution files
17 | #
18 | # Merging from the command prompt will add diff markers to the files if there
19 | # are conflicts (Merging from VS is not affected by the settings below, in VS
20 | # the diff markers are never inserted). Diff markers may cause the following
21 | # file extensions to fail to load in VS. An alternative would be to treat
22 | # these files as binary and thus will always conflict and require user
23 | # intervention with every merge. To do so, just uncomment the entries below
24 | ###############################################################################
25 | #*.sln merge=binary
26 | #*.csproj merge=binary
27 | #*.vbproj merge=binary
28 | #*.vcxproj merge=binary
29 | #*.vcproj merge=binary
30 | #*.dbproj merge=binary
31 | #*.fsproj merge=binary
32 | #*.lsproj merge=binary
33 | #*.wixproj merge=binary
34 | #*.modelproj merge=binary
35 | #*.sqlproj merge=binary
36 | #*.wwaproj merge=binary
37 |
38 | ###############################################################################
39 | # behavior for image files
40 | #
41 | # image files are treated as binary by default.
42 | ###############################################################################
43 | #*.jpg binary
44 | #*.png binary
45 | #*.gif binary
46 |
47 | ###############################################################################
48 | # diff behavior for common document formats
49 | #
50 | # Convert binary document formats to text before diffing them. This feature
51 | # is only available from the command line. Turn it on by uncommenting the
52 | # entries below.
53 | ###############################################################################
54 | #*.doc diff=astextplain
55 | #*.DOC diff=astextplain
56 | #*.docx diff=astextplain
57 | #*.DOCX diff=astextplain
58 | #*.dot diff=astextplain
59 | #*.DOT diff=astextplain
60 | #*.pdf diff=astextplain
61 | #*.PDF diff=astextplain
62 | #*.rtf diff=astextplain
63 | #*.RTF diff=astextplain
64 |
--------------------------------------------------------------------------------
/Resources/NewApi.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xtuzy/SharpConstraintLayout/83057e11cc524be7c74d04bbe75c85bef787b684/Resources/NewApi.png
--------------------------------------------------------------------------------
/Resources/sharex-20220319134253.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xtuzy/SharpConstraintLayout/83057e11cc524be7c74d04bbe75c85bef787b684/Resources/sharex-20220319134253.png
--------------------------------------------------------------------------------
/Resources/sharex-20220319134414.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xtuzy/SharpConstraintLayout/83057e11cc524be7c74d04bbe75c85bef787b684/Resources/sharex-20220319134414.png
--------------------------------------------------------------------------------
/Resources/sharex-20220319134520.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xtuzy/SharpConstraintLayout/83057e11cc524be7c74d04bbe75c85bef787b684/Resources/sharex-20220319134520.png
--------------------------------------------------------------------------------
/Resources/sharex-20220319134617.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xtuzy/SharpConstraintLayout/83057e11cc524be7c74d04bbe75c85bef787b684/Resources/sharex-20220319134617.png
--------------------------------------------------------------------------------
/Resources/报告20220330-1905.diagsession:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xtuzy/SharpConstraintLayout/83057e11cc524be7c74d04bbe75c85bef787b684/Resources/报告20220330-1905.diagsession
--------------------------------------------------------------------------------
/SharpConstraintLayout.Core.Benchmark/App.xaml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
9 |
10 | #512bdf
11 | White
12 |
13 |
17 |
18 |
24 |
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/SharpConstraintLayout.Core.Benchmark/App.xaml.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.Maui.Controls;
2 |
3 | namespace SharpConstraintLayout.Core.Benchmark
4 | {
5 | public partial class App : Application
6 | {
7 | public App()
8 | {
9 | InitializeComponent();
10 |
11 | MainPage = new MainPage();
12 | }
13 | }
14 | }
--------------------------------------------------------------------------------
/SharpConstraintLayout.Core.Benchmark/CSharpAbsoluteLayoutControlTest.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.Maui.Controls;
2 | using Microsoft.Maui.Graphics;
3 | using Microsoft.Maui.Layouts;
4 | using System.Collections.Generic;
5 | using Xunit;
6 | using Xunit.Abstractions;
7 | namespace SharpConstraintLayout.Core.Benchmark
8 | {
9 | public class CSharpAbsoluteLayoutControlTest
10 | {
11 | readonly ITestOutputHelper _output;
12 |
13 | public CSharpAbsoluteLayoutControlTest(ITestOutputHelper output)
14 | {
15 | _output = output;
16 | }
17 |
18 | [Theory]
19 | [InlineData(5)]
20 | [InlineData(25)]
21 | [InlineData(50)]
22 | [InlineData(75)]
23 | [InlineData(100)]
24 | [InlineData(500)]
25 | [InlineData(1000)]
26 | public void PerformanceTest(int childCount)
27 | {
28 | //don't measure time of create control.
29 | var absoluteLayout = new AbsoluteLayout()
30 | {
31 | WidthRequest = 1000,
32 | HeightRequest = 1000,
33 | };
34 | View preview = new ContentView();
35 | var views = new List();
36 | for (var i = 1; i <= childCount - 1; i++)
37 | {
38 | var view = new ContentView() { };
39 | views.Add(view);
40 | }
41 |
42 | absoluteLayout.Add(preview);
43 | foreach (var view in views)
44 | {
45 | absoluteLayout.Add(view);
46 | }
47 | int space = 2;
48 | var time = SimpleClock.BenchmarkTime(() =>
49 | {
50 | var pre = preview;
51 | AbsoluteLayout.SetLayoutBounds(pre, new Rect(0, 0, 100, 100));
52 | //AbsoluteLayout.SetLayoutFlags(pre, AbsoluteLayoutFlags.PositionProportional);
53 |
54 | for (var index = 0; index < views.Count; index++)
55 | {
56 | var view = views[index];
57 | AbsoluteLayout.SetLayoutBounds(view, new Rect((index+1)*space, (index + 1) * space, 100, 100));
58 | //AbsoluteLayout.SetLayoutFlags(view, AbsoluteLayoutFlags.PositionProportional);
59 | pre = view;
60 | }
61 |
62 | var manager = new AbsoluteLayoutManager(absoluteLayout);
63 | var measure = manager.Measure(absoluteLayout.WidthRequest, absoluteLayout.HeightRequest);
64 | var arrange = manager.ArrangeChildren(new Rect(Point.Zero, measure));
65 | }, 10);
66 | _output.WriteLine(time);
67 |
68 | var children = absoluteLayout.Children;
69 | for (var index = 0; index < children.Count; index++)
70 | {
71 | var child = children[index];
72 | Assert.Equal(0 + (index * space), child.Frame.Left);
73 | Assert.Equal(0 + (index * space), child.Frame.Top);
74 | Assert.Equal(100, child.Frame.Width);
75 | Assert.Equal(100, child.Frame.Height);
76 | }
77 | }
78 | }
79 | }
80 |
--------------------------------------------------------------------------------
/SharpConstraintLayout.Core.Benchmark/MauiProgram.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.Maui.Controls.Compatibility.Hosting;
2 | using Microsoft.Maui.Controls.Hosting;
3 | using Microsoft.Maui.Hosting;
4 | using Xunit.Runners.Maui;
5 |
6 | namespace SharpConstraintLayout.Core.Benchmark
7 | {
8 | public static class MauiProgram
9 | {
10 | public static MauiApp CreateMauiApp()
11 | {
12 | var builder = MauiApp.CreateBuilder();
13 | builder
14 | //.UseMauiApp()
15 | .ConfigureFonts(fonts =>
16 | {
17 | fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular");
18 | });
19 | builder.ConfigureTests(new TestOptions
20 | {
21 | Assemblies =
22 | {
23 | typeof(MauiProgram).Assembly
24 | }
25 | })
26 | .UseVisualRunner();
27 | builder.UseMauiCompatibility();
28 | return builder.Build();
29 | }
30 | }
31 | }
--------------------------------------------------------------------------------
/SharpConstraintLayout.Core.Benchmark/Platforms/Android/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/SharpConstraintLayout.Core.Benchmark/Platforms/Android/MainActivity.cs:
--------------------------------------------------------------------------------
1 | using Android.App;
2 | using Android.Content.PM;
3 | using Android.OS;
4 | using Microsoft.Maui;
5 |
6 | namespace SharpConstraintLayout.Core.Benchmark
7 | {
8 | [Activity(Theme = "@style/Maui.SplashTheme", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation | ConfigChanges.UiMode | ConfigChanges.ScreenLayout | ConfigChanges.SmallestScreenSize)]
9 | public class MainActivity : MauiAppCompatActivity
10 | {
11 | }
12 | }
--------------------------------------------------------------------------------
/SharpConstraintLayout.Core.Benchmark/Platforms/Android/MainApplication.cs:
--------------------------------------------------------------------------------
1 | using Android.App;
2 | using Android.Runtime;
3 | using Microsoft.Maui;
4 | using Microsoft.Maui.Hosting;
5 | using System;
6 |
7 | namespace SharpConstraintLayout.Core.Benchmark
8 | {
9 | [Application]
10 | public class MainApplication : MauiApplication
11 | {
12 | protected MainApplication(IntPtr javaReference, JniHandleOwnership transfer) : base(javaReference, transfer)
13 | {
14 | }
15 |
16 | protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp();
17 | }
18 | }
--------------------------------------------------------------------------------
/SharpConstraintLayout.Core.Benchmark/Platforms/Android/Resources/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #512BD4
4 | #2B0B98
5 | #2B0B98
6 |
--------------------------------------------------------------------------------
/SharpConstraintLayout.Core.Benchmark/Platforms/MacCatalyst/AppDelegate.cs:
--------------------------------------------------------------------------------
1 | using Foundation;
2 | using Microsoft.Maui;
3 | using Microsoft.Maui.Hosting;
4 | using UIKit;
5 |
6 | namespace SharpConstraintLayout.Core.Benchmark
7 | {
8 | [Register("AppDelegate")]
9 | public class AppDelegate : MauiUIApplicationDelegate
10 | {
11 | protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp();
12 | }
13 | }
--------------------------------------------------------------------------------
/SharpConstraintLayout.Core.Benchmark/Platforms/MacCatalyst/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | UIDeviceFamily
6 |
7 | 1
8 | 2
9 |
10 | UIRequiredDeviceCapabilities
11 |
12 | arm64
13 |
14 | UISupportedInterfaceOrientations
15 |
16 | UIInterfaceOrientationPortrait
17 | UIInterfaceOrientationLandscapeLeft
18 | UIInterfaceOrientationLandscapeRight
19 |
20 | UISupportedInterfaceOrientations~ipad
21 |
22 | UIInterfaceOrientationPortrait
23 | UIInterfaceOrientationPortraitUpsideDown
24 | UIInterfaceOrientationLandscapeLeft
25 | UIInterfaceOrientationLandscapeRight
26 |
27 | XSAppIconAssets
28 | Assets.xcassets/appicon.appiconset
29 |
30 |
31 |
--------------------------------------------------------------------------------
/SharpConstraintLayout.Core.Benchmark/Platforms/MacCatalyst/Program.cs:
--------------------------------------------------------------------------------
1 | using ObjCRuntime;
2 | using UIKit;
3 |
4 | namespace SharpConstraintLayout.Core.Benchmark
5 | {
6 | public class Program
7 | {
8 | // This is the main entry point of the application.
9 | static void Main(string[] args)
10 | {
11 | // if you want to use a different Application Delegate class from "AppDelegate"
12 | // you can specify it here.
13 | UIApplication.Main(args, null, typeof(AppDelegate));
14 | }
15 | }
16 | }
--------------------------------------------------------------------------------
/SharpConstraintLayout.Core.Benchmark/Platforms/Windows/App.xaml:
--------------------------------------------------------------------------------
1 |
7 |
--------------------------------------------------------------------------------
/SharpConstraintLayout.Core.Benchmark/Platforms/Windows/App.xaml.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.Maui;
2 | using Microsoft.Maui.Hosting;
3 | using Microsoft.UI.Xaml;
4 |
5 | // To learn more about WinUI, the WinUI project structure,
6 | // and more about our project templates, see: http://aka.ms/winui-project-info.
7 |
8 | namespace SharpConstraintLayout.Core.Benchmark.WinUI
9 | {
10 | ///
11 | /// Provides application-specific behavior to supplement the default Application class.
12 | ///
13 | ///
14 | /// Provides application-specific behavior to supplement the default Application class.
15 | ///
16 | public partial class App : MauiWinUIApplication
17 | {
18 | ///
19 | /// Initializes the singleton application object. This is the first line of authored code
20 | /// executed, and as such is the logical equivalent of main() or WinMain().
21 | ///
22 | public App()
23 | {
24 | this.InitializeComponent();
25 | }
26 |
27 | protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp();
28 | }
29 | }
--------------------------------------------------------------------------------
/SharpConstraintLayout.Core.Benchmark/Platforms/Windows/Package.appxmanifest:
--------------------------------------------------------------------------------
1 | SharpConstraintLayoutBenchmark Microsoft appiconStoreLogo.png
2 |
--------------------------------------------------------------------------------
/SharpConstraintLayout.Core.Benchmark/Platforms/Windows/app.manifest:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
11 | true/PM
12 | PerMonitorV2, PerMonitor
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/SharpConstraintLayout.Core.Benchmark/Platforms/iOS/AppDelegate.cs:
--------------------------------------------------------------------------------
1 | using Foundation;
2 | using Microsoft.Maui;
3 | using Microsoft.Maui.Hosting;
4 | using UIKit;
5 |
6 | namespace SharpConstraintLayout.Core.Benchmark
7 | {
8 | [Register("AppDelegate")]
9 | public class AppDelegate : MauiUIApplicationDelegate
10 | {
11 | protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp();
12 | }
13 | }
--------------------------------------------------------------------------------
/SharpConstraintLayout.Core.Benchmark/Platforms/iOS/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | LSRequiresIPhoneOS
6 |
7 | UIDeviceFamily
8 |
9 | 1
10 | 2
11 |
12 | UIRequiredDeviceCapabilities
13 |
14 | arm64
15 |
16 | UISupportedInterfaceOrientations
17 |
18 | UIInterfaceOrientationPortrait
19 | UIInterfaceOrientationLandscapeLeft
20 | UIInterfaceOrientationLandscapeRight
21 |
22 | UISupportedInterfaceOrientations~ipad
23 |
24 | UIInterfaceOrientationPortrait
25 | UIInterfaceOrientationPortraitUpsideDown
26 | UIInterfaceOrientationLandscapeLeft
27 | UIInterfaceOrientationLandscapeRight
28 |
29 | XSAppIconAssets
30 | Assets.xcassets/appicon.appiconset
31 |
32 |
33 |
--------------------------------------------------------------------------------
/SharpConstraintLayout.Core.Benchmark/Platforms/iOS/Program.cs:
--------------------------------------------------------------------------------
1 | using ObjCRuntime;
2 | using UIKit;
3 |
4 | namespace SharpConstraintLayout.Core.Benchmark
5 | {
6 | public class Program
7 | {
8 | // This is the main entry point of the application.
9 | static void Main(string[] args)
10 | {
11 | // if you want to use a different Application Delegate class from "AppDelegate"
12 | // you can specify it here.
13 | UIApplication.Main(args, null, typeof(AppDelegate));
14 | }
15 | }
16 | }
--------------------------------------------------------------------------------
/SharpConstraintLayout.Core.Benchmark/Properties/launchSettings.json:
--------------------------------------------------------------------------------
1 | {
2 | "profiles": {
3 | "Windows Machine": {
4 | "commandName": "MsixPackage",
5 | "nativeDebugging": false
6 | }
7 | }
8 | }
--------------------------------------------------------------------------------
/SharpConstraintLayout.Core.Benchmark/Resources/Fonts/OpenSans-Regular.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xtuzy/SharpConstraintLayout/83057e11cc524be7c74d04bbe75c85bef787b684/SharpConstraintLayout.Core.Benchmark/Resources/Fonts/OpenSans-Regular.ttf
--------------------------------------------------------------------------------
/SharpConstraintLayout.Core.Benchmark/Resources/Raw/AboutAssets.txt:
--------------------------------------------------------------------------------
1 | Any raw assets you want to be deployed with your application can be placed in
2 | this directory (and child directories) and given a Build Action of "MauiAsset":
3 |
4 |
5 |
6 | These files will be deployed with you package and will be accessible using Essentials:
7 |
8 | async Task LoadMauiAsset()
9 | {
10 | using var stream = await FileSystem.OpenAppPackageFileAsync("AboutAssets.txt");
11 | using var reader = new StreamReader(stream);
12 |
13 | var contents = reader.ReadToEnd();
14 | }
15 |
--------------------------------------------------------------------------------
/SharpConstraintLayout.Core.Benchmark/Resources/Raw/favorite_black_24dp.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/SharpConstraintLayout.Core.Benchmark/Resources/appicon.svg:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/SharpConstraintLayout.Core.Benchmark/Resources/appiconfg.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/SharpConstraintLayout.Core.Console/Program.cs:
--------------------------------------------------------------------------------
1 | // See https://aka.ms/new-console-template for more information
2 | using BenchmarkDotNet.Running;
3 | using SharpConstraintLayout.Core.Benchmark;
4 |
5 | /*Console.WriteLine("Hello, World!");
6 | var test = new FlowTest();
7 | for (int i = 0; i < 100; i++)
8 | {
9 | var data = Console.ReadLine();
10 | var strs = data.Split(',');
11 | test.measureFlowWrapNoneMemoryAnalysis(int.Parse(strs[0]), int.Parse(strs[1]));
12 | }*/
13 |
14 | //var summary = BenchmarkRunner.Run();
15 | Console.ReadLine();
16 | //new FlowTest().measureFlowWrapNoneMemoryAnalysis1000Widget(1000, 1000);
17 | new FlowTest().measureFlowWrapChainMemoryAnalysis(1,100);
18 | //new FlowTest().Measure_Views_Benchmark();
19 | Console.ReadLine();
20 | GC.Collect();
21 | Console.ReadLine();
--------------------------------------------------------------------------------
/SharpConstraintLayout.Core.Console/SharpConstraintLayout.Core.Console.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Exe
5 | net6.0
6 | enable
7 | enable
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/SharpConstraintLayout.Core.Console/SimpleTest.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Diagnostics;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading;
7 | using System.Threading.Tasks;
8 |
9 | namespace SharpConstraintLayout.Core.Benchmark
10 | {
11 | internal class SimpleTest
12 | {
13 | internal static void AreEqual(double hope, double real, string method, string messages = "")
14 | {
15 | Console.WriteLine($"{method} {((int)hope == (int)real ? "Passed" : "Failed")}: {messages}, result: hope { hope} real { real} ");
16 | }
17 |
18 | internal static void AreEqual(double hope, double real, int detal, string method, string messages = "")
19 | {
20 | Console.WriteLine($"{method} {((Math.Abs((int)hope - (int)real)) <= detal ? "Passed" : "Failed")}: {messages}, result: hope { hope} real { real} ");
21 | }
22 | }
23 | }
--------------------------------------------------------------------------------
/SharpConstraintLayout.Core/ArrayHelperClass.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 |
5 |
6 | public static class ArrayHelperClass
7 | {
8 | public static T[] Copy(this T[] oldArray, int copyLength)
9 | {
10 | var newArray = new T[copyLength];
11 | Array.Copy(oldArray, newArray, Math.Min(oldArray.Length, copyLength));
12 | return newArray;
13 | }
14 |
15 | public static void Fill(this T[] oldArray, T value) where T : class
16 | {
17 | for (int i = 0; i < oldArray.Length; i++)
18 | oldArray[i] = value;
19 | }
20 |
21 | public static void Fill(this double[] oldArray, double value)
22 | {
23 | for (int i = 0; i < oldArray.Length; i++)
24 | oldArray[i] = value;
25 | }
26 |
27 | public static void Fill(this float[] oldArray, float value)
28 | {
29 | for (int i = 0; i < oldArray.Length; i++)
30 | oldArray[i] = value;
31 | }
32 |
33 | public static void Fill(this int[] oldArray, int value)
34 | {
35 | for (int i = 0; i < oldArray.Length; i++)
36 | oldArray[i] = value;
37 | }
38 | }
39 |
40 |
--------------------------------------------------------------------------------
/SharpConstraintLayout.Core/DateTimeHelperClass.cs:
--------------------------------------------------------------------------------
1 | //---------------------------------------------------------------------------------------------------------
2 | // Copyright © - 2017 Tangible Software Solutions Inc.
3 | // This class can be used by anyone provided that the copyright notice remains intact.
4 | //
5 | // This class is used to replace calls to Java's System.currentTimeMillis with the C# equivalent.
6 | // Unix time is defined as the number of seconds that have elapsed since midnight UTC, 1 January 1970.
7 | //---------------------------------------------------------------------------------------------------------
8 | using System;
9 | using System.Diagnostics;
10 |
11 | public static class DateTimeHelperClass
12 | {
13 | private static readonly System.DateTime Jan1st1970 = new System.DateTime(1970, 1, 1, 0, 0, 0, System.DateTimeKind.Utc);
14 | public static long CurrentUnixTimeMillis()
15 | {
16 | return (long)(System.DateTime.UtcNow - Jan1st1970).TotalMilliseconds;
17 | }
18 |
19 | ///
20 | /// https://stackoverflow.com/a/44136515/13254773
21 | ///
22 | ///
23 | public static long nanoTime()
24 | {
25 | /*long nano = 10000L * Stopwatch.GetTimestamp();
26 | nano /= TimeSpan.TicksPerMillisecond;
27 | nano *= 100L;
28 | return nano;*/
29 | return (long)(System.DateTime.UtcNow.Ticks - Jan1st1970.Ticks) * 100L;
30 | }
31 | }
--------------------------------------------------------------------------------
/SharpConstraintLayout.Core/DecimalFormat.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 |
5 |
6 | public class DecimalFormat
7 | {
8 | private string v;
9 |
10 | public DecimalFormat(string v)
11 | {
12 | this.v = v;
13 | }
14 |
15 | public string format(double mValue)
16 | {
17 | throw new NotImplementedException();
18 | }
19 |
20 | public string format(float[] vs)
21 | {
22 | throw new NotImplementedException();
23 | }
24 | }
25 |
26 |
--------------------------------------------------------------------------------
/SharpConstraintLayout.Core/ExceptionHelperClass.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 |
5 |
6 | public class AssertionError : Exception
7 | {
8 | public AssertionError() : base()
9 | {
10 | }
11 |
12 | public AssertionError(string message) : base(message)
13 | {
14 | }
15 |
16 | public AssertionError(string message, Exception innerException) : base(message, innerException)
17 | {
18 | }
19 | }
20 |
21 |
--------------------------------------------------------------------------------
/SharpConstraintLayout.Core/GlobalUsing.cs:
--------------------------------------------------------------------------------
1 | global using Console = System.Diagnostics.Debug;
2 |
--------------------------------------------------------------------------------
/SharpConstraintLayout.Core/HashMapHelperClass.cs:
--------------------------------------------------------------------------------
1 | //---------------------------------------------------------------------------------------------------------
2 | // Copyright © - 2017 Tangible Software Solutions Inc.
3 | // This class can be used by anyone provided that the copyright notice remains intact.
4 | //
5 | // This class is used to replace calls to some Java HashMap or Hashtable methods.
6 | //---------------------------------------------------------------------------------------------------------
7 | using System.Collections.Generic;
8 | internal static class HashMapHelperClass
9 | {
10 | internal static HashSet> SetOfKeyValuePairs(this IDictionary dictionary)
11 | {
12 | HashSet> entries = new HashSet>();
13 | foreach (KeyValuePair keyValuePair in dictionary)
14 | {
15 | entries.Add(keyValuePair);
16 | }
17 | return entries;
18 | }
19 |
20 | internal static TValue GetValueOrNull(this IDictionary dictionary, TKey key)
21 | {
22 | TValue ret;
23 | dictionary.TryGetValue(key, out ret);
24 | return ret;
25 | }
26 | }
--------------------------------------------------------------------------------
/SharpConstraintLayout.Core/LinkedHashMap.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Runtime.CompilerServices;
4 | using System.Text;
5 |
6 | ///
7 | /// 参考:
8 | /// 1. https://stackoverflow.com/questions/29205934/c-sharp-equivalent-of-linkedhashmap
9 | /// 2. https://stackoverflow.com/questions/754233/is-it-there-any-lru-implementation-of-idictionary/3719378#3719378
10 | ///
11 | ///
12 | ///
13 | internal class LinkedHashMap
14 | {
15 | private Dictionary>> D = new Dictionary>>();
16 | private LinkedList> LL = new LinkedList>();
17 |
18 | public LinkedHashMap()
19 | {
20 | }
21 |
22 | [MethodImpl(MethodImplOptions.Synchronized)]
23 | public V get(K key)
24 | {
25 | return D[key].Value.Item2;
26 | }
27 |
28 | [MethodImpl(MethodImplOptions.Synchronized)]
29 | public void put(K key, V val)
30 | {
31 | if (D.TryGetValue(key, out var existingNode))
32 | {
33 | LL.Remove(existingNode);
34 | }
35 |
36 | Tuple cacheItem = new Tuple(key, val);
37 | LinkedListNode> node = new LinkedListNode>(cacheItem);
38 | LL.AddLast(node);
39 | D[key] = node;
40 | }
41 |
42 | private void RemoveFirst()
43 | {
44 | // Remove from LRUPriority
45 | LinkedListNode> node = LL.First;
46 | LL.RemoveFirst();
47 |
48 | // Remove from cache
49 | D.Remove(node.Value.Item1);
50 | }
51 |
52 | public int Count
53 | {
54 | get
55 | {
56 | return D.Count;
57 | }
58 | }
59 |
60 | public bool containsKey(K key)
61 | {
62 | return D.ContainsKey(key);
63 | }
64 | }
65 |
--------------------------------------------------------------------------------
/SharpConstraintLayout.Core/ListHelperClass.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 |
5 |
6 | internal static class ListHelperClass
7 | {
8 | public static void addAll(this List list, IEnumerable value)
9 | {
10 | foreach (var item in value)
11 | list.Add(item);
12 | }
13 | }
14 |
15 |
--------------------------------------------------------------------------------
/SharpConstraintLayout.Core/MathHelperClass.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 |
5 | ///
6 | /// 一般参考Math.java
7 | ///
8 | public static class MathExtension
9 | {
10 | /**
11 | * Constant by which to multiply an angular value in degrees to obtain an
12 | * angular value in radians.
13 | */
14 | private const double DEGREES_TO_RADIANS = 0.017453292519943295;
15 |
16 | /**
17 | * Converts an angle measured in degrees to an approximately
18 | * equivalent angle measured in radians. The conversion from
19 | * degrees to radians is generally inexact.
20 | *
21 | * @param angdeg an angle, in degrees
22 | * @return the measurement of the angle {@code angdeg}
23 | * in radians.
24 | * @since 1.2
25 | */
26 | public static double toRadians(double angdeg)
27 | {
28 | return angdeg * DEGREES_TO_RADIANS;
29 | }
30 |
31 | ///
32 | /// https://www.dreamincode.net/forums/topic/273525-java-mathhypotab-equivalent-in-c%23/
33 | ///
34 | ///
35 | ///
36 | ///
37 | public static double hypot(double x, double y)
38 | {
39 | return System.Math.Sqrt(x * x + y * y);
40 | }
41 |
42 |
43 | /**
44 | * Constant by which to multiply an angular value in radians to obtain an
45 | * angular value in degrees.
46 | */
47 | private const double RADIANS_TO_DEGREES = 57.29577951308232;
48 |
49 | /**
50 | * Converts an angle measured in radians to an approximately
51 | * equivalent angle measured in degrees. The conversion from
52 | * radians to degrees is generally inexact; users should
53 | * not expect {@code cos(toRadians(90.0))} to exactly
54 | * equal {@code 0.0}.
55 | *
56 | * @param angrad an angle, in radians
57 | * @return the measurement of the angle {@code angrad}
58 | * in degrees.
59 | * @since 1.2
60 | */
61 | public static double toDegrees(double angrad)
62 | {
63 | return angrad * RADIANS_TO_DEGREES;
64 | }
65 | }
66 |
--------------------------------------------------------------------------------
/SharpConstraintLayout.Core/NumberHelperClass.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 |
5 |
6 | public static class NumberHelperClass
7 | {
8 | ///
9 | /// https://stackoverflow.com/a/26394670/13254773
10 | ///
11 | ///
12 | ///
13 | public static int floatToIntBits(this float value)
14 | {
15 | return BitConverter.ToInt32(BitConverter.GetBytes(value), 0);
16 | }
17 |
18 | public static float intBitsToFloat(this int value)
19 | {
20 | return (float)BitConverter.ToDouble(BitConverter.GetBytes(value),0);//TODO:验证正确性
21 | }
22 | }
23 |
24 |
--------------------------------------------------------------------------------
/SharpConstraintLayout.Core/RectangularArrays.cs:
--------------------------------------------------------------------------------
1 | //----------------------------------------------------------------------------------------
2 | // Copyright © - 2017 Tangible Software Solutions Inc.
3 | // This class can be used by anyone provided that the copyright notice remains intact.
4 | //
5 | // This class includes methods to convert Java rectangular arrays (jagged arrays
6 | // with inner arrays of the same length).
7 | //----------------------------------------------------------------------------------------
8 | public static class RectangularArrays
9 | {
10 | internal static double[][] ReturnRectangularDoubleArray(int size1, int size2)
11 | {
12 | double[][] newArray = new double[size1][];
13 | for (int array1 = 0; array1 < size1; array1++)
14 | {
15 | newArray[array1] = new double[size2];
16 | }
17 |
18 | return newArray;
19 | }
20 |
21 | public static float[][] ReturnRectangularFloatArray(int size1, int size2)
22 | {
23 | float[][] newArray = new float[size1][];
24 | for (int array1 = 0; array1 < size1; array1++)
25 | {
26 | newArray[array1] = new float[size2];
27 | }
28 |
29 | return newArray;
30 | }
31 |
32 | internal static object[][] ReturnRectangularObjectArray(int size1, int size2)
33 | {
34 | object[][] newArray = new object[size1][];
35 | for (int array1 = 0; array1 < size1; array1++)
36 | {
37 | newArray[array1] = new object[size2];
38 | }
39 |
40 | return newArray;
41 | }
42 |
43 | public static float[][][][] ReturnRectangularFloatArray(int size1, int size2, int size3, int size4)
44 | {
45 | float[][][][] newArray = new float[size1][][][];
46 | for (int array1 = 0; array1 < size1; array1++)
47 | {
48 | newArray[array1] = new float[size2][][];
49 | if (size3 > -1)
50 | {
51 | for (int array2 = 0; array2 < size2; array2++)
52 | {
53 | newArray[array1][array2] = new float[size3][];
54 | if (size4 > -1)
55 | {
56 | for (int array3 = 0; array3 < size3; array3++)
57 | {
58 | newArray[array1][array2][array3] = new float[size4];
59 | }
60 | }
61 | }
62 | }
63 | }
64 |
65 | return newArray;
66 | }
67 | }
--------------------------------------------------------------------------------
/SharpConstraintLayout.Core/SharpConstraintLayout.Core.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | net6.0;
5 | preview
6 | C# port of ConstraintLayout
7 | https://github.com/xtuzy/SharpConstraintLayout
8 | https://github.com/xtuzy/SharpConstraintLayout
9 | wpf;constraintlayout
10 | True
11 | True
12 | 1.1.1
13 | use span test performance
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/SharpConstraintLayout.Core/androidx/constraintlayout/core/Cache.cs:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2016 The Android Open Source Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | namespace androidx.constraintlayout.core
17 | {
18 | ///
19 | /// Cache for common objects
20 | ///
21 | public class Cache
22 | {
23 | internal Pools.Pool optimizedArrayRowPool = new Pools.SimplePool(256);
24 | internal Pools.Pool arrayRowPool = new Pools.SimplePool(256);
25 | internal Pools.Pool solverVariablePool = new Pools.SimplePool(256);
26 | internal SolverVariable[] mIndexedVariables = new SolverVariable[32];
27 | }
28 |
29 | }
--------------------------------------------------------------------------------
/SharpConstraintLayout.Core/androidx/constraintlayout/core/GoalRow.cs:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2017 The Android Open Source Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | namespace androidx.constraintlayout.core
18 | {
19 | public class GoalRow : ArrayRow
20 | {
21 |
22 | public GoalRow(Cache cache) : base(cache)
23 | {
24 | }
25 |
26 | public override void addError(SolverVariable error)
27 | {
28 | base.addError(error);
29 | // error variables in the goal shouldn't be tracked (we only care if they are
30 | // in the system rows)
31 | error.usageInRowCount--;
32 | }
33 | }
34 | }
--------------------------------------------------------------------------------
/SharpConstraintLayout.Core/androidx/constraintlayout/core/motion/key/MotionConstraintSet.cs:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2021 The Android Open Source Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | namespace androidx.constraintlayout.core.motion.key
17 | {
18 | public class MotionConstraintSet
19 | {
20 | private const string ERROR_MESSAGE = "XML parser error must be within a Constraint ";
21 |
22 | private const int INTERNAL_MATCH_PARENT = -1;
23 | private const int INTERNAL_WRAP_CONTENT = -2;
24 | private const int INTERNAL_MATCH_CONSTRAINT = -3;
25 | private const int INTERNAL_WRAP_CONTENT_CONSTRAINED = -4;
26 |
27 | private bool mValidate;
28 | public string mIdString;
29 | public const int ROTATE_NONE = 0;
30 | public const int ROTATE_PORTRATE_OF_RIGHT = 1;
31 | public const int ROTATE_PORTRATE_OF_LEFT = 2;
32 | public const int ROTATE_RIGHT_OF_PORTRATE = 3;
33 | public const int ROTATE_LEFT_OF_PORTRATE = 4;
34 | public int mRotate = 0;
35 | }
36 |
37 | }
--------------------------------------------------------------------------------
/SharpConstraintLayout.Core/androidx/constraintlayout/core/motion/utils/DifferentialInterpolator.cs:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2021 The Android Open Source Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | namespace androidx.constraintlayout.core.motion.utils
17 | {
18 | public interface DifferentialInterpolator
19 | {
20 | float getInterpolation(float v);
21 | float Velocity {get;}
22 | }
23 |
24 | }
--------------------------------------------------------------------------------
/SharpConstraintLayout.Core/androidx/constraintlayout/core/motion/utils/FloatRect.cs:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2021 The Android Open Source Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | namespace androidx.constraintlayout.core.motion.utils
17 | {
18 | public class FloatRect
19 | {
20 | public float bottom;
21 | public float left;
22 | public float right;
23 | public float top;
24 | public float centerX()
25 | {
26 | return (left + right) * 0.5f;
27 | }
28 | public float centerY()
29 | {
30 | return (top + bottom) * 0.5f;
31 | }
32 |
33 | }
34 |
35 | }
--------------------------------------------------------------------------------
/SharpConstraintLayout.Core/androidx/constraintlayout/core/motion/utils/KeyCache.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 |
3 | /*
4 | * Copyright (C) 2020 The Android Open Source Project
5 | *
6 | * Licensed under the Apache License, Version 2.0 (the "License");
7 | * you may not use this file except in compliance with the License.
8 | * You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing, software
13 | * distributed under the License is distributed on an "AS IS" BASIS,
14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | * See the License for the specific language governing permissions and
16 | * limitations under the License.
17 | */
18 |
19 | namespace androidx.constraintlayout.core.motion.utils
20 | {
21 |
22 | ///
23 | /// Used by KeyTimeCycles (and any future time dependent behaviour) to cache its current parameters
24 | /// to maintain consistency across requestLayout type rebuilds.
25 | ///
26 | public class KeyCache
27 | {
28 |
29 | internal Dictionary