protected override void OnPaint(GUI.PaintEventArgs e) { Graphics graphics = e.Graphics; graphics.SmoothingMode = SmoothingMode.AntiAlias; graphics.PixelOffsetMode = PixelOffsetMode.None; PolygonElement polygon = m_PolygonElement; if (!polygon.IsModified) { //TEST return; } polygon.close(m_CloseCheckBox.IsChecked); PolylineGeometry poly = new PolylineGeometry(polygon.Polygon, true, m_CloseCheckBox.IsChecked); BSplineGeometry bspline = new BSplineGeometry(poly); bspline.InterpolationStep = 1.0 / m_PointsNumberSlider.Value; SinglePathTransform tcurve = new SinglePathTransform(); tcurve.PreserveXScale = m_PreserveXScaleCheckBox.IsChecked; if (m_FixedLenCheckBox.IsChecked) { tcurve.BaseLength = 1120; } tcurve.AddPath(bspline); GeometryTransformer ftrans = new GeometryTransformer(GetCurveTransformedTextGeometry(tcurve.TotalLength).Item1, tcurve); if (m_FillCheckBox.IsChecked) { Brush brush = m_TextBrush; // Irrlicht Renderer can't render smoothed gradients now if (graphics.RenderSystemName.Contains(Graphics.RSN_Irrlicht)) { if (m_TextBrush_Irrlicht == null) { m_TextBrush_Irrlicht = new SolidColorBrush(Color.Yellow); } brush = m_TextBrush_Irrlicht; } graphics.FillGeometry(brush, ftrans); } if (m_OutlineCheckBox.IsChecked) { graphics.DrawGeometry(m_FillCheckBox.IsChecked ? Color.Red : Color.White, ftrans, m_OutlineThicknessSlider.Value); } graphics.DrawGeometry(m_BSplinePen, bspline); base.OnPaint(e); }
protected override void OnPaint(GUI.PaintEventArgs e) { e.Graphics.SmoothingMode = SmoothingMode.AntiAlias; PolygonElement polygon = m_PolygonElement; polygon.close(m_CloseCheckBox.IsChecked); PolylineGeometry poly = new PolylineGeometry(polygon.Polygon, true, m_CloseCheckBox.IsChecked); BSplineGeometry bspline = new BSplineGeometry(poly); bspline.InterpolationStep = 1.0 / m_PointsNumberSlider.Value; e.Graphics.DrawGeometry(m_BSplinePen, bspline); base.OnPaint(e); }
protected override void OnLoad(EventArgs e) { base.OnLoad(e); // Graphics m_BSplinePen = new Pen(Color.Maroon, 2); m_TextBrush = //Brushes.White; new LinearGradientBrush(Point.Zero, new Point(Width, Height), Color.Red, Color.LawnGreen); // Geometry m_PolygonElement1 = new PolygonElement(6, 5.0); m_PolygonElement1.close(false); AddElement(m_PolygonElement1); m_PolygonElement2 = new PolygonElement(6, 5.0); m_PolygonElement2.close(false); AddElement(m_PolygonElement2); InitPoly(); }