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);
        }
示例#2
0
            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);
            }
示例#3
0
        protected override void OnPaint(GUI.PaintEventArgs e)
        {
            Graphics graphics = e.Graphics;

            graphics.SmoothingMode   = SmoothingMode.AntiAlias;
            graphics.PixelOffsetMode = PixelOffsetMode.None;


            //  Polygon1
            PolygonElement polygon1 = m_PolygonElement1;

            PolylineGeometry path1 = new PolylineGeometry(polygon1.Polygon, true, false);

            BSplineGeometry bspline1 = new BSplineGeometry(path1);

            bspline1.InterpolationStep = 1.0 / m_PointsNumberSlider.Value;


            //  Polygon2
            PolygonElement polygon2 = m_PolygonElement2;

            PolylineGeometry path2 = new PolylineGeometry(polygon2.Polygon, true, false);

            BSplineGeometry bspline2 = new BSplineGeometry(path2);

            bspline1.InterpolationStep = 1.0 / m_PointsNumberSlider.Value;


            DoublePathTransform tcurve = new DoublePathTransform();

            tcurve.PreserveXScale = m_PreserveXScaleCheckBox.IsChecked;
            if (m_FixedLenCheckBox.IsChecked)
            {
                tcurve.BaseLength = 1140.0;
            }
            tcurve.AddPaths(bspline1, bspline2);

            Tuple <Geometry, double> geometry = GetCurveTransformedTextGeometry(tcurve.TotalLength1);

            tcurve.BaseHeight = FontAscentInPixels + geometry.Item2 + 3;

            GeometryTransformer ftrans = new GeometryTransformer(geometry.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.LawnGreen);
                    }

                    brush = m_TextBrush_Irrlicht;
                }

                graphics.FillGeometry(brush, ftrans);
            }
            if (m_OutlineCheckBox.IsChecked)
            {
                graphics.DrawGeometry(Color.White, ftrans, m_OutlineThicknessSlider.Value);
            }


            graphics.DrawGeometry(m_BSplinePen, bspline1);
            graphics.DrawGeometry(m_BSplinePen, bspline2);


            base.OnPaint(e);
        }