Extensions.cs 615 B

1234567891011121314151617181920212223
  1. using System;
  2. using Avalonia.Media;
  3. using CoreGraphics;
  4. using UIKit;
  5. namespace Avalonia.iOS
  6. {
  7. static class Extensions
  8. {
  9. public static Size ToAvalonia(this CGSize size) => new Size(size.Width, size.Height);
  10. public static Point ToAvalonia(this CGPoint point) => new Point(point.X, point.Y);
  11. static nfloat ColorComponent(byte c) => ((float) c) / 255;
  12. public static UIColor ToUiColor(this Color color) => new UIColor(
  13. ColorComponent(color.R),
  14. ColorComponent(color.G),
  15. ColorComponent(color.B),
  16. ColorComponent(color.A));
  17. }
  18. }