MakeVxs() public method

public MakeVxs ( VertexStore sourceVxs, VertexStore vxs ) : VertexStore
sourceVxs VertexStore
vxs VertexStore
return VertexStore
示例#1
0
 /// <summary>
 /// draw line
 /// </summary>
 /// <param name="x1"></param>
 /// <param name="y1"></param>
 /// <param name="x2"></param>
 /// <param name="y2"></param>
 /// <param name="color"></param>
 public void Line(double x1, double y1, double x2, double y2, ColorRGBA color)
 {
     lines.Clear();
     lines.MoveTo(x1, y1);
     lines.LineTo(x2, y2);
     gx.Render(stroke.MakeVxs(lines.Vxs), color);
 }
示例#2
0
        public override void DrawEllipse(double left, double bottom, double right, double top)
        {
            ellipse.Reset((left + right) * 0.5,
                          (bottom + top) * 0.5,
                          (right - left) * 0.5,
                          (top - bottom) * 0.5,
                          ellipseGenNSteps);
            var v1 = GetFreeVxs();
            var v2 = GetFreeVxs();

            gx.Render(stroke.MakeVxs(ellipse.MakeVxs(v1), v2), this.fillColor);
            ReleaseVxs(ref v1);
            ReleaseVxs(ref v2);
        }
示例#3
0
        public void dbugLine(double x1, double y1, double x2, double y2, Drawing.Color color)
        {
            dbug_v1.AddMoveTo(x1, y1);
            dbug_v1.AddLineTo(x2, y2);
            //dbug_v1.AddStop();

            dbugStroke.MakeVxs(dbug_v1, dbug_v2);
            Render(dbug_v2, color);
            dbug_v1.Clear();
            dbug_v2.Clear();
        }
示例#4
0
        //static SvgFontStore svgFontStore = new SvgFontStore();
        //public static void DrawString(this ImageGraphics2D gx,
        //    string text,
        //    double x,
        //    double y,
        //    double pointSize = 12,
        //    Justification justification = Justification.Left,
        //    Baseline baseline = Baseline.Text,
        //    Color color = new Color(),
        //    bool drawFromHintedCache = false,
        //    Color backgroundColor = new Color())
        //{
        //    ////use svg font
        //    var svgFont = svgFontStore.LoadFont(SvgFontStore.DEFAULT_SVG_FONTNAME, (int)pointSize);
        //    //TODO: review here
        //    //stringPrinter on each platform may not interchangeable ***
        //    if (stringPrinter == null)
        //    {
        //        stringPrinter = new MyTypeFacePrinter(gx.GfxPlatform);

        //    }

        //    stringPrinter.CurrentActualFont = svgFont;
        //    stringPrinter.DrawFromHintedCache = false;
        //    stringPrinter.LoadText(text);
        //    VertexStore vxs = stringPrinter.MakeVxs();
        //    vxs = Affine.NewTranslation(x, y).TransformToVxs(vxs);
        //    gx.Render(vxs, Color.Black);
        //}

        public static void Rectangle(this AggRenderSurface gx, double left, double bottom, double right, double top, Color color, double strokeWidth = 1)
        {
            stroke.Width = strokeWidth;
            simpleRect.SetRect(left + .5, bottom + .5, right - .5, top - .5);


            VectorToolBox.GetFreeVxs(out VertexStore v1, out VertexStore v2);

            gx.Render(stroke.MakeVxs(simpleRect.MakeVxs(v1), v2), color);

            VectorToolBox.ReleaseVxs(ref v1, ref v2);
        }
        //static SvgFontStore svgFontStore = new SvgFontStore();
        //public static void DrawString(this ImageGraphics2D gx,
        //    string text,
        //    double x,
        //    double y,
        //    double pointSize = 12,
        //    Justification justification = Justification.Left,
        //    Baseline baseline = Baseline.Text,
        //    Color color = new Color(),
        //    bool drawFromHintedCache = false,
        //    Color backgroundColor = new Color())
        //{
        //    ////use svg font
        //    var svgFont = svgFontStore.LoadFont(SvgFontStore.DEFAULT_SVG_FONTNAME, (int)pointSize);
        //    //TODO: review here
        //    //stringPrinter on each platform may not interchangeable ***
        //    if (stringPrinter == null)
        //    {
        //        stringPrinter = new MyTypeFacePrinter(gx.GfxPlatform);

        //    }

        //    stringPrinter.CurrentActualFont = svgFont;
        //    stringPrinter.DrawFromHintedCache = false;
        //    stringPrinter.LoadText(text);
        //    VertexStore vxs = stringPrinter.MakeVxs();
        //    vxs = Affine.NewTranslation(x, y).TransformToVxs(vxs);
        //    gx.Render(vxs, Color.Black);
        //}

        public static void Rectangle(this Graphics2D gx, double left, double bottom, double right, double top, Color color, double strokeWidth = 1)
        {
            stroke.Width = strokeWidth;
            simpleRect.SetRect(left + .5, bottom + .5, right - .5, top - .5);

            var v1 = GetFreeVxs();
            var v2 = GetFreeVxs();

            gx.Render(stroke.MakeVxs(simpleRect.MakeVxs(v1), v2), color);

            RelaseVxs(ref v1);
            RelaseVxs(ref v2);
        }
示例#6
0
        /// <summary>
        /// draw line
        /// </summary>
        /// <param name="x1"></param>
        /// <param name="y1"></param>
        /// <param name="x2"></param>
        /// <param name="y2"></param>
        /// <param name="color"></param>
        public override void DrawLine(double x1, double y1, double x2, double y2)
        {
            //BitmapExt
            if (this.RenderQuality == RenderQualtity.Fast)
            {
                this._bxt.DrawLine(
                    (int)Math.Round(x1),
                    (int)Math.Round(y1),
                    (int)Math.Round(x2),
                    (int)Math.Round(y2),
                    this.strokeColor.ToARGB()
                    );

                return;
            }

            //----------------------------------------------------------
            //Agg
            if (_orientation == DrawBoardOrientation.LeftBottom)
            {
                //as original
                _lineGen.Clear();
                _lineGen.MoveTo(x1, y1);
                _lineGen.LineTo(x2, y2);
                var v1 = GetFreeVxs();
                _aggsx.Render(stroke.MakeVxs(_lineGen.Vxs, v1), this.strokeColor);
                ReleaseVxs(ref v1);
            }
            else
            {
                //left-top
                int h = this.Height;

                _lineGen.Clear();
                _lineGen.MoveTo(x1, h - y1);
                _lineGen.LineTo(x2, h - y2);


                var v1 = GetFreeVxs();
                _aggsx.Render(stroke.MakeVxs(_lineGen.Vxs, v1), this.strokeColor);
                ReleaseVxs(ref v1);
            }
        }
示例#7
0
        public static VertexStore MakeVxs(VertexStore vxs, double w)
        {
            Stroke stroke = new Stroke(w);

            return(stroke.MakeVxs(vxs));
        }
示例#8
0
 public override void CreateStroke(VertexStore orgVxs, float strokeW, VertexStore output)
 {
     _stroke.Width = strokeW;
     _stroke.MakeVxs(orgVxs, output);
 }