protected override void OnPaint(Alt.GUI.PaintEventArgs e) { Debug.Log("onpaint"); Alt.Sketch.Graphics graphics = e.Graphics; if (!DoubleBuffered) { graphics.FillRectangle(Alt.Sketch.Color.FromArgb((graphics is SoftwareGraphics) ? 128 : 192, Alt.Sketch.Color.DodgerBlue), ClientRectangle); } else { graphics.Clear(Alt.Sketch.Color.FromArgb((graphics is SoftwareGraphics) ? 128 : 192, Alt.Sketch.Color.DodgerBlue)); } int w = ClientWidth; int h = ClientHeight; m_Scale = viewZoom * System.Math.Min(w, h) / 23; m_CenterX = w / 2 + m_OffsetX; m_CenterY = h * 0.83 + m_OffsetY; m_DebugDraw.SetViewTransform(m_CenterX, m_CenterY, m_Scale); //Paint base.OnPaint(e); }
protected virtual void OnPaint(Alt.GUI.PaintEventArgs e) { if (Child != null) { Child.InjectRender(e); } }
protected void Box2D_onPaint(Alt.GUI.PaintEventArgs e) { if (m_Test == null) { return; } Alt.Sketch.Graphics graphics = e.Graphics; graphics.SmoothingMode = SmoothingMode.AntiAlias; m_Test.SetTextLine(30); settings.hz = TPS; // settingsHz; m_Test.Step(settings); m_Test.DrawTitle(50, 15, "Dominos"); }
protected void FarseerPhysics_onPaint(Alt.GUI.PaintEventArgs e) { if (m_Test == null) { return; } Alt.Sketch.Graphics graphics = e.Graphics; graphics.SmoothingMode = SmoothingMode.AntiAlias; m_Test.DebugView.m_Graphics = graphics; m_Test.DebugView.m_Font = m_InfoFont; Alt.Sketch.Size clientSize = ClientSize; double ClientWidth = clientSize.Width; double ClientHeight = clientSize.Height; m_Test.m_Scale = viewZoom * System.Math.Min(ClientWidth, ClientHeight) / 39; m_Test.m_CenterX = ClientWidth / 2 + m_Test.m_OffsetX * m_Test.m_Scale; m_Test.m_CenterY = ClientHeight / 2 + m_Test.m_OffsetY * m_Test.m_Scale; m_TPSCounter.Tick(); settings.Hz = m_TPSCounter.TPS; m_Test.TextLine = 30; m_Test.Update(settings); m_Test.m_CenterX = ClientWidth / 2 + m_Test.m_OffsetX * m_Test.m_Scale; m_Test.m_CenterY = ClientHeight * 3 / 5 + m_Test.m_OffsetY * m_Test.m_Scale; m_Test.DebugView.SetViewTransform(m_Test.m_CenterX, m_Test.m_CenterY, m_Test.m_Scale); m_Test.DrawTitle(30, 15, "Car"); m_Test.DebugView.RenderDebugData(); }
void DoPaint() { if (m_Renderer == null) { return; } m_Renderer.BeginRender(GetComponent <Camera>(), GetComponent <Renderer>(), m_Width, m_Height); { Alt.GUI.PaintEventArgs e = new Alt.GUI.PaintEventArgs(Alt.Sketch.Graphics.FromRenderer(m_Renderer), new Alt.Sketch.RectI(Alt.Sketch.PointI.Zero, m_Width, m_Height)); OnPaint(e); if (!e.Handled && Paint != null) { Paint(this, e); } } m_Renderer.EndRender(); }
protected override void OnPaint(Alt.GUI.PaintEventArgs e) { base.OnPaint(e); if (m_svgDoc == null) { return; } e.Graphics.SmoothingMode = SmoothingMode.AntiAlias; Matrix4 mtx = Matrix4.CreateTranslation(-m_SVGPathBounds.Center.X, -m_SVGPathBounds.Center.Y); double scale = m_Scale; mtx.Scale(scale, scale, MatrixOrder.Append); mtx.Rotate(m_Rotation, MatrixOrder.Append); mtx.Translate(m_x, m_y, MatrixOrder.Append); e.Graphics.Transform = mtx.ToMatrix(); e.Graphics.Opacity = m_Opacity; m_svgDoc.Draw(e.Graphics); }
protected virtual void OnPaintBackground(Alt.GUI.PaintEventArgs e) { }
protected void Paint_onPaint(Alt.GUI.PaintEventArgs e) { #if UNITY_5 && USE_ExtBrush if (e.Graphics is SoftwareGraphics) { return; } Alt.Sketch.Color colorMultiplier; #endif int opacity = 128; if (m_MaterialBrush1 == null) { #if UNITY_5 && USE_ExtBrush Bitmap image = Bitmap.FromFile("AltData/About.gif"); ExtBrush brush; brush = new ExtBrush(); brush.MaterialName = "Material1"; brush.SetExtParameter("Image", image); m_MaterialBrush1 = brush; brush = new ExtBrush(); brush.MaterialName = "Material2"; brush.SetExtParameter("Image", image); m_MaterialBrush2 = brush; brush = new ExtBrush(); brush.MaterialName = "Material3"; brush.SetExtParameter("Image", image); m_MaterialBrush3 = brush; brush = new ExtBrush(); brush.MaterialName = "Material4"; brush.SetExtParameter("Image", image); m_MaterialBrush4 = brush; #else SolidColorBrush brush; brush = new SolidColorBrush(Alt.Sketch.Color.FromArgb(opacity, Alt.Sketch.Color.Red)); m_MaterialBrush1 = brush; brush = new SolidColorBrush(Alt.Sketch.Color.FromArgb(opacity, Alt.Sketch.Color.Green)); m_MaterialBrush2 = brush; brush = new SolidColorBrush(Alt.Sketch.Color.FromArgb(opacity, Alt.Sketch.Color.DodgerBlue)); m_MaterialBrush3 = brush; brush = new SolidColorBrush(Alt.Sketch.Color.FromArgb(opacity, Alt.Sketch.Color.Yellow)); m_MaterialBrush4 = brush; #endif } Brush currentBrush; switch (m_CurrentBrush) { case 0: currentBrush = m_MaterialBrush1; #if UNITY_5 && USE_ExtBrush colorMultiplier = Alt.Sketch.Color.LightCoral; #endif break; case 1: currentBrush = m_MaterialBrush2; #if UNITY_5 && USE_ExtBrush colorMultiplier = Alt.Sketch.Color.Green; #endif break; case 2: currentBrush = m_MaterialBrush3; #if UNITY_5 && USE_ExtBrush colorMultiplier = Alt.Sketch.Color.Red; #endif break; case 3: currentBrush = m_MaterialBrush4; #if UNITY_5 && USE_ExtBrush colorMultiplier = Alt.Sketch.Color.Cyan; #endif break; default: return; } Alt.Sketch.Graphics graphics = e.Graphics; graphics.SmoothingMode = SmoothingMode.None; Alt.Sketch.Rect rect = e.ClipRectangle; rect.Deflate(50 + offset, 50 + offset); graphics.FillRoundedRectangle(currentBrush, rect, 20 #if UNITY_5 && USE_ExtBrush , colorMultiplier #else , UseHardwareRender ? Alt.Sketch.Color.FromArgb(opacity, Alt.Sketch.Color.White) : Alt.Sketch.Color.White #endif ); graphics.SmoothingMode = SmoothingMode.AntiAlias; graphics.DrawRoundedRectangle(m_ContourPen, rect, 20); }
protected void QuickFont_onPaint(Alt.GUI.PaintEventArgs e) { Alt.Sketch.Graphics graphics = e.Graphics; GraphicsState state; switch (currentDemoPage) { case 1: { double yOffset = 0; QFont.Begin(); state = graphics.Save(); graphics.TranslateTransform(ClientWidth * 0.5f, yOffset + 10); heading1.Print("AltGUI QuickFont", QFontAlignment.Centre); yOffset += heading1.Measure("QuickFont").Height; graphics.Restore(state); state = graphics.Save(); graphics.TranslateTransform(20f, yOffset); heading2.Print("Introduction", QFontAlignment.Left); yOffset += heading2.Measure("Introduction").Height; graphics.Restore(state); state = graphics.Save(); graphics.TranslateTransform(30f, yOffset + 20); mainText.Print(introduction, ClientWidth - 60, QFontAlignment.Justify); graphics.Restore(state); QFont.End(); } break; case 2: { double yOffset = 20; QFont.Begin(); state = graphics.Save(); graphics.TranslateTransform(20f, yOffset); heading2.Print("Easy as ABC!", QFontAlignment.Left); yOffset += heading2.Measure("Easy as ABC!").Height; graphics.Restore(state); PrintComment(graphics, usingQuickFontIsSuperEasy, ref yOffset); PrintCode(graphics, loadingAFont1, ref yOffset); PrintComment(graphics, andPrintWithIt, ref yOffset); PrintCode(graphics, printWithFont1, ref yOffset); PrintComment(graphics, itIsAlsoEasyToMeasure, ref yOffset); PrintCode(graphics, measureText1, ref yOffset); PrintComment(graphics, oneOfTheFirstGotchas, ref yOffset); PrintCode(graphics, loadingAFont2, ref yOffset); QFont.End(); } break; case 3: { double yOffset = 20; QFont.Begin(); state = graphics.Save(); graphics.TranslateTransform(20f, yOffset); heading2.Print("Alignment", QFontAlignment.Left); yOffset += heading2.Measure("Easy as ABC!").Height; graphics.Restore(state); PrintCommentWithLine(graphics, whenPrintingText, QFontAlignment.Left, ClientWidth * 0.5f, ref yOffset); PrintCode(graphics, printWithFont2, ref yOffset); PrintCommentWithLine(graphics, righAlignedText, QFontAlignment.Right, ClientWidth * 0.5f, ref yOffset); yOffset += 10f; PrintCommentWithLine(graphics, centredTextAsYou, QFontAlignment.Centre, ClientWidth * 0.5f, ref yOffset); QFont.End(); } break; case 4: { double yOffset = 20; QFont.Begin(); state = graphics.Save(); graphics.TranslateTransform(20f, yOffset); heading2.Print("Bounds and Justify", QFontAlignment.Left); yOffset += heading2.Measure("Easy as ABC!").Height; graphics.Restore(state); state = graphics.Save(); yOffset += 20; graphics.TranslateTransform((int)(ClientWidth * 0.5), yOffset); controlsText.Options.Colour = Alt.Sketch.Color.Yellow; controlsText.Print("Press [Up], [Down] or [Enter]!", QFontAlignment.Centre); yOffset += controlsText.Measure("[]").Height; graphics.Restore(state); double boundShrink = (int)(350 * (1 - Math.Cos(boundsAnimationCnt * Math.PI * 2))); yOffset += 15; PrintWithBounds(graphics, mainText, ofCourseItsNot, new Alt.Sketch.Rect(30f + boundShrink * 0.5f, yOffset, ClientWidth - 60 - boundShrink, 350f), cycleAlignment, ref yOffset); string printWithBounds = "myFont.Print(text, 400f, QFontAlignment." + cycleAlignment + ");"; yOffset += 15f; PrintCode(graphics, printWithBounds, ref yOffset); QFont.End(); } break; case 5: { double yOffset = 20; QFont.Begin(); state = graphics.Save(); graphics.TranslateTransform(20f, yOffset); heading2.Print("Your own Texture Fonts", QFontAlignment.Left); yOffset += heading2.Measure("T").Height; graphics.Restore(state); PrintComment(graphics, anotherCoolFeature, ref yOffset); PrintCode(graphics, textureFontCode1, ref yOffset); PrintComment(graphics, thisWillHaveCreated, ref yOffset); QFont.End(); } break; case 6: { double yOffset = 20; QFont.Begin(); state = graphics.Save(); graphics.TranslateTransform(20f, yOffset); heading2.Print("Your own Texture Fonts", QFontAlignment.Left); yOffset += heading2.Measure("T").Height; graphics.Restore(state); PrintComment(graphics, ifYouDoIntend, ref yOffset); PrintCode(graphics, textureFontCode2, ref yOffset); PrintComment(graphics, actuallyTexturing, ref yOffset); PrintCode(graphics, textureFontCode3, ref yOffset); QFont.End(); } break; case 7: { double yOffset = 20; QFont.Begin(); heading2.Options.DropShadowOffset = new Alt.Sketch.Vector2(0.1f + 0.2f * (float)Math.Sin(cnt), 0.1f + 0.2f * (float)Math.Cos(cnt)); state = graphics.Save(); graphics.TranslateTransform(20f, yOffset); heading2.Print("Drop Shadows", QFontAlignment.Left); yOffset += heading2.Measure("T").Height; graphics.Restore(state); heading2.Options.DropShadowOffset = new Alt.Sketch.Vector2(0.16f, 0.16f); //back to default mainText.Options.DropShadowActive = true; mainText.Options.DropShadowOpacity = 0.7f; mainText.Options.DropShadowOffset = new Alt.Sketch.Vector2(0.1f + 0.2f * (float)Math.Sin(cnt), 0.1f + 0.2f * (float)Math.Cos(cnt)); PrintComment(graphics, asIhaveleant, ref yOffset); PrintCode(graphics, dropShadowCode1, ref yOffset); PrintComment(graphics, thisWorksFine, ref yOffset); PrintCode(graphics, dropShadowCode2, ref yOffset); PrintComment(graphics, onceAFont, ref yOffset); mainText.Options.DropShadowActive = false; QFont.End(); } break; case 8: { double yOffset = 20; QFont.Begin(); monoSpaced.Options.CharacterSpacing = 0.05f; state = graphics.Save(); graphics.TranslateTransform(20f, yOffset); heading2.Print("Monospaced Fonts", QFontAlignment.Left); yOffset += heading2.Measure("T").Height; graphics.Restore(state); PrintComment(graphics, monoSpaced, hereIsSomeMono, QFontAlignment.Left, ref yOffset); PrintCode(graphics, monoCode1, ref yOffset); PrintComment(graphics, monoSpaced, theDefaultMono, QFontAlignment.Left, ref yOffset); PrintCommentWithLine(graphics, monoSpaced, mono, QFontAlignment.Left, ClientWidth * 0.5f, ref yOffset); yOffset += 2f; PrintCommentWithLine(graphics, monoSpaced, mono, QFontAlignment.Right, ClientWidth * 0.5f, ref yOffset); yOffset += 2f; PrintCommentWithLine(graphics, monoSpaced, mono, QFontAlignment.Centre, ClientWidth * 0.5f, ref yOffset); yOffset += 2f; monoSpaced.Options.CharacterSpacing = 0.5f; PrintComment(graphics, monoSpaced, "As usual, you can adjust character spacing with myFont.Options.CharacterSpacing.", QFontAlignment.Left, ref yOffset); QFont.End(); } break; case 9: { double yOffset = 20; QFont.Begin(); state = graphics.Save(); graphics.TranslateTransform(20f, yOffset); heading2.Print("In Conclusion", QFontAlignment.Left); yOffset += heading2.Measure("T").Height; graphics.Restore(state); PrintComment(graphics, thereAreActually, ref yOffset); QFont.End(); } break; } QFont.Begin(); Alt.Sketch.Color pressColor = new ColorR(0.8, 0.2, 0.2); // new ColorR(0.8, 0.1, 0.1); if (currentDemoPage != lastPage) { state = graphics.Save(); graphics.TranslateTransform(ClientWidth - 15 - 16 * (float)(1 + Math.Sin(cnt * 4)), ClientHeight - controlsText.Measure("P").Height - 17); controlsText.Options.Colour = pressColor; controlsText.Print("Press [Right] ->", QFontAlignment.Right); graphics.Restore(state); } if (currentDemoPage != 1) { state = graphics.Save(); graphics.TranslateTransform(15 + 16 * (float)(1 + Math.Sin(cnt * 4)), ClientHeight - controlsText.Measure("P").Height - 17); controlsText.Options.Colour = pressColor; controlsText.Print("<- Press [Left]", QFontAlignment.Left); graphics.Restore(state); } QFont.End(); }