-
Notifications
You must be signed in to change notification settings - Fork 760
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
perf: Add DisplayInformation bindings
- Loading branch information
Showing
3 changed files
with
141 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
src/Uno.UWP/Graphics/Display/DisplayInformation.Interop.wasm.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
#if NET7_0_OR_GREATER | ||
using System.Runtime.InteropServices.JavaScript; | ||
|
||
namespace __Windows.Graphics.Display | ||
{ | ||
internal partial class DisplayInformation | ||
{ | ||
internal static partial class NativeMethods | ||
{ | ||
private const string JsType = "globalThis.Windows.Graphics.Display.DisplayInformation"; | ||
|
||
[JSImport($"{JsType}.getDevicePixelRatio")] | ||
internal static partial float GetDevicePixelRatio(); | ||
|
||
[JSImport($"{JsType}.getScreenHeight")] | ||
internal static partial float GetScreenHeight(); | ||
|
||
[JSImport($"{JsType}.getScreenOrientationAngle")] | ||
internal static partial int? GetScreenOrientationAngle(); | ||
|
||
[JSImport($"{JsType}.getScreenOrientationType")] | ||
internal static partial string GetScreenOrientationType(); | ||
|
||
[JSImport($"{JsType}.getScreenWidth")] | ||
internal static partial float GetScreenWidth(); | ||
|
||
[JSImport($"{JsType}.startDpiChanged")] | ||
internal static partial void StartDpiChanged(); | ||
|
||
[JSImport($"{JsType}.startOrientationChanged")] | ||
internal static partial void StartOrientationChanged(); | ||
|
||
[JSImport($"{JsType}.stopDpiChanged")] | ||
internal static partial void StopDpiChanged(); | ||
|
||
[JSImport($"{JsType}.stopOrientationChanged")] | ||
internal static partial void StopOrientationChanged(); | ||
} | ||
} | ||
} | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters