public SkiaView(Activity context) : base(context) { _context = context; SkiaPlatform.Initialize(); Holder.AddCallback(this); _handler = new Handler(context.MainLooper); }
protected void InitPerspex(Type appType) { if (_initialized) { return; } _initialized = true; var window = new UIWindow(UIScreen.MainScreen.Bounds); var controller = new PerspexViewController(window); window.RootViewController = controller; window.MakeKeyAndVisible(); Application.RegisterPlatformCallback(() => { MouseDevice = new MouseDevice(); KeyboardDevice = new KeyboardDevice(); SharedPlatform.Register(appType.Assembly); PerspexLocator.CurrentMutable .Bind <IClipboard>().ToTransient <Clipboard>() //.Bind<ISystemDialogImpl>().ToTransient<SystemDialogImpl>() .Bind <IStandardCursorFactory>().ToTransient <CursorFactory>() .Bind <IKeyboardDevice>().ToConstant(KeyboardDevice) .Bind <IMouseDevice>().ToConstant(MouseDevice) .Bind <IPlatformSettings>().ToSingleton <PlatformSettings>() .Bind <IPlatformThreadingInterface>().ToConstant(PlatformThreadingInterface.Instance) .Bind <IWindowImpl>().ToConstant(controller.PerspexView); SkiaPlatform.Initialize(); }); }
public void Hit_Test_Should_Respect_Stroke() { using (AvaloniaLocator.EnterScope()) { SkiaPlatform.Initialize(); var root = new TestRoot { Width = 100, Height = 100, Child = new Ellipse { Width = 100, Height = 100, Stroke = Brushes.Red, StrokeThickness = 5, HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Center } }; root.Renderer = new DeferredRenderer(root, null); root.Measure(Size.Infinity); root.Arrange(new Rect(root.DesiredSize)); var outsideResult = root.Renderer.HitTest(new Point(50, 50), root, null); var insideResult = root.Renderer.HitTest(new Point(1, 50), root, null); Assert.Empty(outsideResult); Assert.Equal(new[] { root.Child }, insideResult); } }
public static void Initialize(Type appType, AndroidPlatformOptions options) { AvaloniaLocator.CurrentMutable .Bind <IClipboard>().ToTransient <ClipboardImpl>() .Bind <IStandardCursorFactory>().ToTransient <CursorFactory>() .Bind <IKeyboardDevice>().ToSingleton <AndroidKeyboardDevice>() .Bind <IPlatformSettings>().ToConstant(Instance) .Bind <IPlatformThreadingInterface>().ToConstant(new AndroidThreadingInterface()) .Bind <ISystemDialogImpl>().ToTransient <SystemDialogImpl>() .Bind <IWindowingPlatform>().ToConstant(Instance) .Bind <IPlatformIconLoader>().ToSingleton <PlatformIconLoader>() .Bind <IRenderTimer>().ToConstant(new DefaultRenderTimer(60)) .Bind <IRenderLoop>().ToConstant(new RenderLoop()) .Bind <PlatformHotkeyConfiguration>().ToSingleton <PlatformHotkeyConfiguration>() .Bind <IAssetLoader>().ToConstant(new AssetLoader(appType.Assembly)); SkiaPlatform.Initialize(); ((global::Android.App.Application)global::Android.App.Application.Context.ApplicationContext) .RegisterActivityLifecycleCallbacks(new ActivityTracker()); if (options.UseGpu) { EglPlatformOpenGlInterface.TryInitialize(); } }
private static IDisposable Start() { var scope = AvaloniaLocator.EnterScope(); SkiaPlatform.Initialize(); return(scope); }
public static void Initialize(Type appType, AndroidPlatformOptions options) { Options = options; AvaloniaLocator.CurrentMutable .Bind <IClipboard>().ToTransient <ClipboardImpl>() .Bind <ICursorFactory>().ToTransient <CursorFactory>() .Bind <IWindowingPlatform>().ToConstant(new WindowingPlatformStub()) .Bind <IKeyboardDevice>().ToSingleton <AndroidKeyboardDevice>() .Bind <IPlatformSettings>().ToConstant(Instance) .Bind <IPlatformThreadingInterface>().ToConstant(new AndroidThreadingInterface()) .Bind <ISystemDialogImpl>().ToTransient <SystemDialogImpl>() .Bind <IPlatformIconLoader>().ToSingleton <PlatformIconLoaderStub>() .Bind <IRenderTimer>().ToConstant(new ChoreographerTimer()) .Bind <IRenderLoop>().ToConstant(new RenderLoop()) .Bind <PlatformHotkeyConfiguration>().ToSingleton <PlatformHotkeyConfiguration>() .Bind <IAssetLoader>().ToConstant(new AssetLoader(appType.Assembly)); SkiaPlatform.Initialize(); if (options.UseGpu) { EglPlatformOpenGlInterface.TryInitialize(); } }
public MainView() { AutoresizingMask = UIViewAutoresizing.All; SkiaPlatform.Initialize(); _target = AvaloniaLocator.Current.GetService <IPlatformRenderInterface>() .CreateRenderTarget(AvaloniaPlatformHandle); UpdateText(0); }
static TestBase() { #if AVALONIA_CAIRO CairoPlatform.Initialize(); #elif AVALONIA_SKIA SkiaPlatform.Initialize(); #else Direct2D1Platform.Initialize(); #endif }
static TestBase() { #if PERSPEX_CAIRO CairoPlatform.Initialize(); #elif PERSPEX_SKIA SkiaPlatform.Initialize(); #else Direct2D1Platform.Initialize(); #endif }
static TestBase() { #if AVALONIA_SKIA SkiaPlatform.Initialize(); #else Direct2D1Platform.Initialize(); #endif AvaloniaLocator.CurrentMutable .Bind <IPlatformThreadingInterface>() .ToConstant(threadingInterface); }
public static void Initialize() { AvaloniaLocator.CurrentMutable .Bind <IClipboard>().ToTransient <ClipboardImpl>() .Bind <IStandardCursorFactory>().ToTransient <CursorFactory>() .Bind <IKeyboardDevice>().ToSingleton <AndroidKeyboardDevice>() .Bind <IMouseDevice>().ToSingleton <AndroidMouseDevice>() .Bind <IPlatformSettings>().ToConstant(Instance) .Bind <IPlatformThreadingInterface>().ToConstant(new AndroidThreadingInterface()) .Bind <ISystemDialogImpl>().ToTransient <SystemDialogImpl>() .Bind <IWindowingPlatform>().ToConstant(Instance); SkiaPlatform.Initialize(); }
// TODO: Can we merge this with UseSkia somehow once HW/platform cleanup is done? public static AppBuilder UseSkiaViewHost(this AppBuilder builder) { var window = new UIWindow(UIScreen.MainScreen.Bounds); var controller = new AvaloniaViewController(window); window.RootViewController = controller; window.MakeKeyAndVisible(); AvaloniaLocator.CurrentMutable .Bind <IWindowingPlatform>().ToConstant(new WindowingPlatformImpl(controller.AvaloniaView)); SkiaPlatform.Initialize(); return(builder); }
// TODO: Can we merge this with UseSkia somehow once HW/platform cleanup is done? public static AppT UseSkiaViewHost <AppT>(this AppT app) where AppT : Application { var window = new UIWindow(UIScreen.MainScreen.Bounds); var controller = new PerspexViewController(window); window.RootViewController = controller; window.MakeKeyAndVisible(); PerspexLocator.CurrentMutable .Bind <IWindowingPlatform>().ToConstant(new WindowingPlatformImpl(controller.PerspexView)); SkiaPlatform.Initialize(); return(app); }
public static void Initialize(Avalonia.Application app) { AvaloniaLocator.CurrentMutable .Bind <IClipboard>().ToTransient <ClipboardImpl>() .Bind <IStandardCursorFactory>().ToTransient <CursorFactory>() .Bind <IKeyboardDevice>().ToSingleton <AndroidKeyboardDevice>() .Bind <IPlatformSettings>().ToConstant(Instance) .Bind <IPlatformThreadingInterface>().ToConstant(new AndroidThreadingInterface()) .Bind <ISystemDialogImpl>().ToTransient <SystemDialogImpl>() .Bind <IWindowingPlatform>().ToConstant(Instance) .Bind <IPlatformIconLoader>().ToSingleton <PlatformIconLoader>() .Bind <IRenderLoop>().ToConstant(new DefaultRenderLoop(60)) .Bind <IAssetLoader>().ToConstant(new AssetLoader(app.GetType().Assembly)); SkiaPlatform.Initialize(); ((global::Android.App.Application)global::Android.App.Application.Context.ApplicationContext) .RegisterActivityLifecycleCallbacks(new ActivityTracker()); }
AndroidPlatform() { AvaloniaLocator.CurrentMutable .Bind <IClipboard>().ToTransient <ClipboardImpl>() .Bind <IStandardCursorFactory>().ToTransient <CursorFactory>() .Bind <IKeyboardDevice>().ToSingleton <AndroidKeyboardDevice>() .Bind <IMouseDevice>().ToSingleton <AndroidMouseDevice>() .Bind <IPlatformSettings>().ToConstant(this) .Bind <IPlatformThreadingInterface>().ToConstant(new AndroidThreadingInterface()) .Bind <ISystemDialogImpl>().ToTransient <SystemDialogImpl>() .Bind <ITopLevelRenderer>().ToTransient <AndroidTopLevelRenderer>() .Bind <IWindowingPlatform>().ToConstant(this); SkiaPlatform.Initialize(); _scalingFactor = global::Android.App.Application.Context.Resources.DisplayMetrics.ScaledDensity; //we have custom Assetloader so no need to overwrite it }
/// <summary> /// Enable Skia renderer. /// </summary> /// <typeparam name="T">Builder type.</typeparam> /// <param name="builder">Builder.</param> /// <returns>Configure builder.</returns> public static T UseSkia <T>(this T builder) where T : AppBuilderBase <T>, new() { return(builder.UseRenderingSubsystem(() => SkiaPlatform.Initialize( AvaloniaLocator.Current.GetService <SkiaOptions>() ?? new SkiaOptions()), "Skia")); }
public SkiaView(Activity context) : base(context) { _context = context; SkiaPlatform.Initialize(); Holder.AddCallback(this); }
/// <summary> /// Enable Skia renderer. /// </summary> /// <typeparam name="T">Builder type.</typeparam> /// <param name="builder">Builder.</param> /// <returns>Configure builder.</returns> public static T UseSkia <T>(this T builder) where T : AppBuilderBase <T>, new() { builder.UseRenderingSubsystem(() => SkiaPlatform.Initialize(), "Skia"); return(builder); }