Beispiel #1
0
 public void FillRectangle(double left, double bottom, double right, double top, ColorRGBA fillColor)
 {
     if (right < left || top < bottom)
     {
         throw new ArgumentException();
     }
     simpleRect.SetRect(left, bottom, right, top);
     gx.Render(simpleRect.MakeVertexSnap(), fillColor);
 }
Beispiel #2
0
        public override void FillRectangle(double left, double bottom, double right, double top)
        {
            if (right < left || top < bottom)
            {
                throw new ArgumentException();
            }
            simpleRect.SetRect(left, bottom, right, top);
            var v1 = GetFreeVxs();

            gx.Render(simpleRect.MakeVertexSnap(v1), this.fillColor);
            ReleaseVxs(ref v1);
        }
Beispiel #3
0
        public override void FillRect(double left, double top, double width, double height)
        {
            //----------------------------------------------------------
            //BitmapExt
            if (this._renderQuality == RenderQualtity.Fast)
            {
                this._bxt.FillRectangle(
                    (int)Math.Round(left),
                    (int)Math.Round(top),
                    (int)Math.Round(left + width),
                    (int)Math.Round(top + height),

                    ColorInt.FromArgb(this.fillColor.ToARGB()));
                return;
            }

            //Agg
            //----------------------------------------------------------
            if (this._orientation == DrawBoardOrientation.LeftBottom)
            {
                double right  = left + width;
                double bottom = top - height;
                if (right < left || top < bottom)
                {
#if DEBUG
                    throw new ArgumentException();
#else
                    return;
#endif
                }

                _simpleRectVxsGen.SetRect(left + 0.5, (bottom + 0.5) + height, right - 0.5, (top - 0.5) + height);
            }
            else
            {
                double right  = left + width;
                double bottom = top - height;
                if (right < left || top < bottom)
                {
#if DEBUG
                    throw new ArgumentException();
#else
                    return;
#endif
                }

                int canvasH = this.Height;
                _simpleRectVxsGen.SetRect(left + 0.5, canvasH - (bottom + 0.5 + height), right - 0.5, canvasH - (top - 0.5 + height));
            }

            var v1 = GetFreeVxs();
            _aggsx.Render(_simpleRectVxsGen.MakeVertexSnap(v1), this.fillColor);
            ReleaseVxs(ref v1);
        }
Beispiel #4
0
        public static void FillRectangle(this AggRenderSurface gx, double left,
                                         double bottom, double right, double top, Color fillColor)
        {
            if (right < left || top < bottom)
            {
                throw new ArgumentException();
            }

            simpleRect.SetRect(left, bottom, right, top);

            VectorToolBox.GetFreeVxs(out var v1);
            gx.Render(simpleRect.MakeVertexSnap(v1), fillColor);
            VectorToolBox.ReleaseVxs(ref v1);
        }
        public static void FillRectangle(this Graphics2D gx, double left,
                                         double bottom, double right, double top, Color fillColor)
        {
            if (right < left || top < bottom)
            {
                throw new ArgumentException();
            }

            simpleRect.SetRect(left, bottom, right, top);
            var v1 = GetFreeVxs();

            gx.Render(simpleRect.MakeVertexSnap(v1), fillColor);
            RelaseVxs(ref v1);
        }
        public override void FillRect(double left, double top, double width, double height)
        {
            //----------------------------------------------------------
            //BitmapExt
            if (_useDefaultBrush && this._renderQuality == RenderQualtity.Fast)
            {
                this._bxt.FillRectangle(
                    (int)Math.Round(left),
                    (int)Math.Round(top),
                    (int)Math.Round(left + width),
                    (int)Math.Round(top + height),
                    ColorInt.FromArgb(this.fillColor.ToARGB()));
                return;
            }

            //Agg
            //----------------------------------------------------------
            if (this._orientation == DrawBoardOrientation.LeftBottom)
            {
                double right  = left + width;
                double bottom = top - height;
                if (right < left || top < bottom)
                {
#if DEBUG
                    throw new ArgumentException();
#else
                    return;
#endif
                }

                _simpleRectVxsGen.SetRect(left + 0.5, (bottom + 0.5) + height, right - 0.5, (top - 0.5) + height);
            }
            else
            {
                double right  = left + width;
                double bottom = top - height;
                if (right < left || top < bottom)
                {
#if DEBUG
                    throw new ArgumentException();
#else
                    return;
#endif
                }

                int canvasH = this.Height;
                _simpleRectVxsGen.SetRect(left + 0.5, canvasH - (bottom + 0.5 + height), right - 0.5, canvasH - (top - 0.5 + height));
            }

            var v1 = GetFreeVxs();
            //----------------------------------------------------------
            if (!_useDefaultBrush)
            {
                Brush br = _curBrush;
                switch (br.BrushKind)
                {
                case BrushKind.LinearGradient:
                {
                    //fill linear gradient brush
                    //....

                    //check resolved object for br
                    //if not then create a new one
                    //-------------------------------------------
                    //original agg's gradient fill

                    _aggGradientBrush.ResolveBrush((LinearGradientBrush)br);
                    _aggGradientBrush.SetOffset((float)-left, (float)-top);
                    Fill(_simpleRectVxsGen.MakeVxs(v1), _aggGradientBrush);
                }
                break;

                case BrushKind.CircularGraident:
                {
                    _circularGradBrush.ResolveBrush((CircularGradientBrush)br);
                    _circularGradBrush.SetOffset((float)-left, (float)-top);
                    Fill(_simpleRectVxsGen.MakeVxs(v1), _circularGradBrush);
                }
                break;

                default:
                {
                    _aggsx.Render(_simpleRectVxsGen.MakeVertexSnap(v1), this.fillColor);
                }
                break;
                }
            }
            else
            {
                _aggsx.Render(_simpleRectVxsGen.MakeVertexSnap(v1), this.fillColor);
            }
            ReleaseVxs(ref v1);
        }