protected virtual void OnPaintSurface(SKPaintSurfaceEventArgs e) { // invoke the event PaintSurface?.Invoke(this, e); p8SkiaLayout.OnCanvasViewPaintSurface(this, e); }
//Switch between Rectangle Snapping and Painting private void SwitchMode() { Grid.IsEnabled = !Grid.IsEnabled; PaintSurface.IsEnabled = !PaintSurface.IsEnabled; _currentPath = null; //"Hide" Selection Rectangle SelectionRectangle.Margin = new Thickness(99999); //Stop animations by setting AnimationTimeline to null SelectedMode.BeginAnimation(OpacityProperty, null); //Set correct Selected Mode Indicator if (Grid.IsEnabled) { //Prevent Painting in Capture Rectangle mode Grid.CaptureMouse(); Cursor = Cursors.Cross; CropIcon.Background = Brushes.Gray; DrawIcon.Background = Brushes.Transparent; } else { //Prevent Capturing Rectangle in Paint Mode PaintSurface.CaptureMouse(); Cursor = Cursors.Pen; DrawIcon.Background = Brushes.Gray; CropIcon.Background = Brushes.Transparent; } //Fade Selected Mode View in FadeSelectedModeIn(); }
protected override void OnRenderFrame(FrameEventArgs e) { base.OnRenderFrame(e); Title = $"(Vsync: {VSync}) FPS: {1f / e.Time:0}"; this.renderTarget.Width = this.Width; this.renderTarget.Height = this.Height; var props = new SKSurfaceProps { Flags = SKSurfacePropsFlags.None, PixelGeometry = SKPixelGeometry.RgbHorizontal }; using (var surface = SKSurface.Create(this.context, this.renderTarget)) { Debug.Assert(surface != null); Debug.Assert(surface.Handle != IntPtr.Zero); var canvas = surface.Canvas; canvas.Flush(); var info = this.renderTarget; PaintSurface?.Invoke(this, new SKPaintGLSurfaceEventArgs(surface, renderTarget)); canvas.Flush(); } this.context.Flush(); SwapBuffers(); }
protected override void OnRenderFrame(FrameEventArgs e) { base.OnRenderFrame(e); Title = $"(Vsync: {VSync}) FPS: {1f / e.Time:0}"; var props = new SKSurfaceProperties(SKSurfacePropsFlags.None, SKPixelGeometry.BgrHorizontal); using (var surface = SKSurface.Create(_context, _renderTarget, SKColorType.Bgra8888, props)) { if (surface != null) { Debug.Assert(surface != null); Debug.Assert(surface.Handle != IntPtr.Zero); var canvas = surface.Canvas; canvas.Flush(); var info = this._renderTarget; PaintSurface?.Invoke(this, new SKPaintGLSurfaceEventArgs(surface, _renderTarget)); canvas.Flush(); } else { } } this._context.Flush(); SwapBuffers(); }
public virtual void DrawInSurface(SKSurface surface, GRBackendRenderTargetDesc renderTarget) { if (PaintSurface != null) { PaintSurface.Invoke(this, new SKPaintGLSurfaceEventArgs(surface, renderTarget)); } }
protected virtual void OnPaintSurface(SKPaintGLSurfaceEventArgs e) { if (PaintSurface != null) { PaintSurface.Invoke(this, e); } }
public virtual void Init(string _Name, BrushData _Brush, Color _Color) { m_SizeSecondaryBrush = Constants.c_SizeSecondaryMultipler; // Cache m_GameManager = GameManager.Instance; m_Transform = transform; m_Direction = Vector3.zero; m_TerrainManager = TerrainManager.Instance; m_DrawLines = new List <DrawLine>(1) { GetComponent <DrawLine>() }; m_BrushData = _Brush; // Buffers m_SearchBuffer = new List <GameObject> (); // Runtime GameObject brushObject = Instantiate(_Brush.m_Prefab, m_Transform) as GameObject; m_Brush = brushObject.GetComponent <Brush> (); m_DrawLines[0].Init(this, m_Brush); m_Color = _Color; m_ColorHash = PaintSurface.GetColorHash(_Color); m_Brush.Init(this, Brush.EBrushType.MAIN); m_PlayerName = _Name; m_WorldPercent = 0.0f; m_Level = 0; RegisterMap(); m_GameManager.onEndGame += OnEndGame; }
//Close Window with fade out animation private async void CloseSnap(bool result, int delay = 0) { int duration = 70; this.Animate(OpacityProperty, Opacity, 1, duration, delay); SelectionRectangle.Animate(OpacityProperty, 0.3, 0, duration, delay); await PaintSurface.AnimateAsync(OpacityProperty, 1, 0, duration, delay); WindowState = WindowState.Minimized; try { if (result) { //Send frozen window to back NativeMethods.SetWindowPos(new WindowInteropHelper(this).Handle, NativeMethods.HwndBottom, 0, 0, 0, 0, NativeMethods.SwpNomove | NativeMethods.SwpNosize | NativeMethods.SwpNoactivate); Focusable = false; //Finish await ScreenshotHelper.FinishScreenshot(SelectionStream, HwndName); DialogResult = true; return; } if (Error) { await Statics.ShowNotificationAsync(strings.uploadingError, NotificationWindow.NotificationType.Error); } } catch { // could not finish screenshot } await Task.Delay(duration * 3); DialogResult = false; }
protected virtual void OnPaintSurface(SKPaintGLSurfaceEventArgs e) { PaintSurface?.Invoke(this, e); }
protected virtual void OnPaintSurface(SKPaintSurfaceEventArgs e) { // invoke the event PaintSurface?.Invoke(this, e); }
public virtual void DrawInSurface(SKSurface surface, SKImageInfo info) { PaintSurface?.Invoke(this, new SKPaintSurfaceEventArgs(surface, info)); }
protected virtual void OnDraw(SKSurface surface, SKImageInfo info) { PaintSurface?.Invoke(this, new SKPaintSurfaceEventArgs(surface, info)); }
protected virtual void OnDrawFrame(SKPaintSurfaceEventArgs e) { PaintSurface?.Invoke(this, e); }
protected virtual void OnDrawFrame(SKSurface surface, GRBackendRenderTargetDesc renderTarget) { PaintSurface?.Invoke(this, new SKPaintGLSurfaceEventArgs(surface, renderTarget)); }
protected void SendPaintSurface(SKPaintSurfaceEventArgs e) { PaintSurface?.Invoke(this, e); }
public void OnDrawFrame(SKSurface surface, GRBackendRenderTargetDesc renderTarget) { PaintSurface?.Invoke(surface, renderTarget); }
public override void Draw(Canvas canvas) { base.Draw(canvas); PaintSurface?.Invoke(this, canvas); }