Exemple #1
0
        public void PushClip(Rectangle clip)
        {
            Rect oldClip = new Rect();

            this.canvas.GetClipBounds(oldClip);
            clipStack.Push(new RectF(oldClip));
            this.canvas.ClipRect((RectF)clip, Region.Op.Intersect);
        }
Exemple #2
0
        public void DrawAndFillRectangle(SolidColor lineColor, IColor fillColor, Rectangle rect)
        {
            if (fillColor is SolidColor)
            {
                this.FillRectangle(rect, (SolidColor)fillColor);
            }

            this.DrawRectangle(rect, lineColor);
        }
Exemple #3
0
        public void DrawAndFillRectangle(SolidColor lineColor, IColor fillColor, Rectangle rect, float weight, LineStyles lineStyle)
        {
            if (fillColor is SolidColor)
            {
                this.FillRectangle(rect, (SolidColor)fillColor);
            }

            this.DrawRectangle(rect, lineColor, weight, lineStyle);
        }
Exemple #4
0
        public void DrawRectangle(Rectangle rect, SolidColor color, float width, LineStyles lineStyle)
        {
            using (var p = new Paint())
            {
                p.Color       = color;
                p.StrokeWidth = width;

                this.DrawRectangle(p, rect);
            }
        }
Exemple #5
0
        internal void DrawText(string text, Paint p, Typeface font, float size, Rectangle rect, ReoGridHorAlign halign, ReoGridVerAlign valign)
        {
            p.SetTypeface(font);
            p.TextSize = size;

            var measuredRect = new Rect();

            p.GetTextBounds(text, 0, text.Length, measuredRect);

            float x = rect.Left, y = rect.Top;

            switch (halign)
            {
            case ReoGridHorAlign.General:
            case ReoGridHorAlign.Left:
                x = rect.Left;
                break;

            case ReoGridHorAlign.Center:
                x = rect.Left + (rect.Width - measuredRect.Width()) / 2;
                break;

            case ReoGridHorAlign.Right:
                x = rect.Right - measuredRect.Width();
                break;
            }

            switch (valign)
            {
            case ReoGridVerAlign.Top:
                y = rect.Top + measuredRect.Height();
                break;

            case ReoGridVerAlign.Middle:
                y = rect.Bottom - (rect.Height - measuredRect.Height()) / 2;
                break;

            case ReoGridVerAlign.General:
            case ReoGridVerAlign.Bottom:
                y = rect.Bottom;
                break;
            }

            this.canvas.DrawText(text, x, y, p);
        }
Exemple #6
0
 public void DrawEllipse(Paint pen, Rectangle rectangle)
 {
     // TODO
 }
Exemple #7
0
        public void FillRectangleLinear(SolidColor startColor, SolidColor endColor, float angle, Rectangle rect)
        {
            using (var p = new Paint())
            {
                p.SetShader(new LinearGradient(rect.Left, rect.Top, rect.Left, rect.Bottom,
                                               startColor, endColor, Shader.TileMode.Mirror));

                this.canvas.DrawRect((RectF)rect, p);
            }
        }
Exemple #8
0
 public void FillRectangle(HatchStyles style, SolidColor hatchColor, SolidColor bgColor, Rectangle rect)
 {
     // TODO
 }
Exemple #9
0
 public void FillRectangle(Rectangle rect, IColor color)
 {
     this.FillRectangle(rect.X, rect.Y, rect.Width, rect.Height, color);
 }
Exemple #10
0
 public void DrawRectangle(Paint p, Rectangle rect)
 {
     this.DrawRectangle(p, rect.X, rect.Y, rect.Width, rect.Height);
 }
Exemple #11
0
 public void DrawText(string text, string fontName, float size, SolidColor color, Rectangle rect, ReoGridHorAlign halign, ReoGridVerAlign valign)
 {
     using (var p = new Paint())
     {
         using (var font = Typeface.Create(fontName, Android.Graphics.TypefaceStyle.Normal))
         {
             this.DrawText(text, p, font, size, rect, halign, valign);
         }
     }
 }
Exemple #12
0
 public void DrawRectangle(Rectangle rect, SolidColor color)
 {
     this.DrawRectangle(rect.X, rect.Y, rect.Width, rect.Height, color);
 }
Exemple #13
0
 public void FillEllipse(IColor fillColor, Rectangle rectangle)
 {
     // TODO
 }
Exemple #14
0
 public void FillEllipse(Paint b, Rectangle rectangle)
 {
     // TODO
 }
Exemple #15
0
 public void DrawEllipse(SolidColor color, Rectangle rectangle)
 {
     // TODO
 }
Exemple #16
0
 public void DrawImage(Picture image, Rectangle rect)
 {
     this.canvas.DrawPicture(image, (Android.Graphics.RectF)rect);
 }
Exemple #17
0
 public void DrawText(string text, string fontName, float size, SolidColor color, Rectangle rect)
 {
     this.DrawText(text, fontName, size, color, rect, ReoGridHorAlign.General, ReoGridVerAlign.General);
 }