コード例 #1
0
 public void DrawButton(
     int x, int y,
     int width, int height,
     ushort fontID,
     int fontHeight,
     ushort borderColor,
     ushort fillColor,
     ushort fontColor,
     string text,
     RoundedCornerStyle cornerStyle = RoundedCornerStyle.All)
 {
     BasicTypeSerializer.Put(SendContext, (byte)Command.DrawButton);
     BasicTypeSerializer.Put(SendContext, (ushort)x);
     BasicTypeSerializer.Put(SendContext, (ushort)y);
     BasicTypeSerializer.Put(SendContext, (ushort)width);
     BasicTypeSerializer.Put(SendContext, (ushort)height);
     BasicTypeSerializer.Put(SendContext, (ushort)fontID);
     BasicTypeSerializer.Put(SendContext, (ushort)fontHeight);
     BasicTypeSerializer.Put(SendContext, (ushort)borderColor);
     BasicTypeSerializer.Put(SendContext, (ushort)fillColor);
     BasicTypeSerializer.Put(SendContext, (ushort)fontColor);
     BasicTypeSerializer.Put(SendContext, text, true);
     BasicTypeSerializer.Put(SendContext, (ushort)cornerStyle);
     SendContext.CheckHighWatermark();
 }
コード例 #2
0
 protected virtual void InitializeLookAndFeel() {
     BorderColor = (ushort)BasicColor.Black;
     FillColor = (ushort)BasicColor.White;
     FillColorClicked = (ushort)BasicColor.Black;
     FontColor = (ushort)BasicColor.Black;
     FontColorClicked = (ushort)BasicColor.White;
     CornerStyle = RoundedCornerStyle.All;
     if (Text == null) {
         Text = "?";
     }
     if (FontInfo == null) {
         FontInfo = new DejaVuSans9().GetFontInfo();
     }
 }
コード例 #3
0
ファイル: ButtonWidget.cs プロジェクト: adammendoza/herdrider
 protected virtual void InitializeLookAndFeel()
 {
     BorderColor      = (ushort)BasicColor.Black;
     FillColor        = (ushort)BasicColor.White;
     FillColorClicked = (ushort)BasicColor.Black;
     FontColor        = (ushort)BasicColor.Black;
     FontColorClicked = (ushort)BasicColor.White;
     CornerStyle      = RoundedCornerStyle.All;
     if (Text == null)
     {
         Text = "?";
     }
     if (FontInfo == null)
     {
         FontInfo = new DejaVuSans9().GetFontInfo();
     }
 }
コード例 #4
0
ファイル: VirtualCanvas.cs プロジェクト: josemotta/Netduino
 override public void DrawProgressBar(
     int x, int y,
     int width, int height,
     RoundedCornerStyle borderCorners,
     RoundedCornerStyle progressCorners,
     BasicColor borderColor, BasicColor borderFillColor,
     BasicColor progressBorderColor, BasicColor progressFillColor,
     int progress)
 {
     BasicTypeSerializer.Put(Context, (byte)Command.DrawProgressBar);
     BasicTypeSerializer.Put(Context, (ushort)x);
     BasicTypeSerializer.Put(Context, (ushort)y);
     BasicTypeSerializer.Put(Context, (ushort)width);
     BasicTypeSerializer.Put(Context, (ushort)height);
     BasicTypeSerializer.Put(Context, (ushort)borderCorners);
     BasicTypeSerializer.Put(Context, (ushort)progressCorners);
     BasicTypeSerializer.Put(Context, (ushort)borderColor);
     BasicTypeSerializer.Put(Context, (ushort)borderFillColor);
     BasicTypeSerializer.Put(Context, (ushort)progressBorderColor);
     BasicTypeSerializer.Put(Context, (ushort)progressFillColor);
     BasicTypeSerializer.Put(Context, (ushort)progress);
 }
コード例 #5
0
ファイル: VirtualCanvas.cs プロジェクト: josemotta/Netduino
 public void DrawProgressBar(
     int x, int y,
     int width, int height,
     RoundedCornerStyle borderCorners,
     RoundedCornerStyle progressCorners,
     ushort borderColor, ushort borderFillColor,
     ushort progressBorderColor, ushort progressFillColor,
     int progress) {
     BasicTypeSerializer.Put(SendContext,(byte)Command.DrawProgressBar);
     BasicTypeSerializer.Put(SendContext,(ushort)x);
     BasicTypeSerializer.Put(SendContext,(ushort)y);
     BasicTypeSerializer.Put(SendContext,(ushort)width);
     BasicTypeSerializer.Put(SendContext,(ushort)height);
     BasicTypeSerializer.Put(SendContext,(ushort)borderCorners);
     BasicTypeSerializer.Put(SendContext,(ushort)progressCorners);
     BasicTypeSerializer.Put(SendContext,(ushort)borderColor);
     BasicTypeSerializer.Put(SendContext,(ushort)borderFillColor);
     BasicTypeSerializer.Put(SendContext,(ushort)progressBorderColor);
     BasicTypeSerializer.Put(SendContext,(ushort)progressFillColor);
     BasicTypeSerializer.Put(SendContext,(ushort)progress);
     SendContext.CheckHighWatermark();
 }
コード例 #6
0
 override public void DrawRectangleRounded(int x0, int y0, int x1, int y1, BasicColor color, int radius, RoundedCornerStyle corners) {
     BasicTypeSerializer.Put(Context,(byte)Command.DrawRectangleRounded);
     BasicTypeSerializer.Put(Context,(ushort)x0);
     BasicTypeSerializer.Put(Context,(ushort)y0);
     BasicTypeSerializer.Put(Context,(ushort)x1);
     BasicTypeSerializer.Put(Context,(ushort)y1);
     BasicTypeSerializer.Put(Context,(ushort)color);
     BasicTypeSerializer.Put(Context,(ushort)radius);
     BasicTypeSerializer.Put(Context,(ushort)corners);
 }
コード例 #7
0
 override public void DrawProgressBar(
     int x, int y,
     int width, int height,
     RoundedCornerStyle borderCorners,
     RoundedCornerStyle progressCorners,
     BasicColor borderColor, BasicColor borderFillColor,
     BasicColor progressBorderColor, BasicColor progressFillColor,
     int progress) {
     BasicTypeSerializer.Put(Context,(byte)Command.DrawProgressBar);
     BasicTypeSerializer.Put(Context,(ushort)x);
     BasicTypeSerializer.Put(Context,(ushort)y);
     BasicTypeSerializer.Put(Context,(ushort)width);
     BasicTypeSerializer.Put(Context,(ushort)height);
     BasicTypeSerializer.Put(Context,(ushort)borderCorners);
     BasicTypeSerializer.Put(Context,(ushort)progressCorners);
     BasicTypeSerializer.Put(Context,(ushort)borderColor);
     BasicTypeSerializer.Put(Context,(ushort)borderFillColor);
     BasicTypeSerializer.Put(Context,(ushort)progressBorderColor);
     BasicTypeSerializer.Put(Context,(ushort)progressFillColor);
     BasicTypeSerializer.Put(Context,(ushort)progress);
 }
コード例 #8
0
ファイル: VirtualCanvas.cs プロジェクト: josemotta/Netduino
 override public void DrawRectangleRounded(int x0, int y0, int x1, int y1, BasicColor color, int radius, RoundedCornerStyle corners)
 {
     BasicTypeSerializer.Put(Context, (byte)Command.DrawRectangleRounded);
     BasicTypeSerializer.Put(Context, (ushort)x0);
     BasicTypeSerializer.Put(Context, (ushort)y0);
     BasicTypeSerializer.Put(Context, (ushort)x1);
     BasicTypeSerializer.Put(Context, (ushort)y1);
     BasicTypeSerializer.Put(Context, (ushort)color);
     BasicTypeSerializer.Put(Context, (ushort)radius);
     BasicTypeSerializer.Put(Context, (ushort)corners);
 }
コード例 #9
0
 public void DrawRectangleRounded(int x0, int y0, int x1, int y1, ushort color, int radius, RoundedCornerStyle corners)
 {
     BasicTypeSerializer.Put(SendContext, (byte)Command.DrawRectangleRounded);
     BasicTypeSerializer.Put(SendContext, (ushort)x0);
     BasicTypeSerializer.Put(SendContext, (ushort)y0);
     BasicTypeSerializer.Put(SendContext, (ushort)x1);
     BasicTypeSerializer.Put(SendContext, (ushort)y1);
     BasicTypeSerializer.Put(SendContext, (ushort)color);
     BasicTypeSerializer.Put(SendContext, (ushort)radius);
     BasicTypeSerializer.Put(SendContext, (ushort)corners);
     SendContext.CheckHighWatermark();
 }
コード例 #10
0
ファイル: Canvas.cs プロジェクト: Larouex/herdrider
        // Draws a filled rectangle with rounded corners
        // x0: Starting x co-ordinate
        // y0: Starting y co-ordinate
        // x1: Ending x co-ordinate
        // y1: Ending y co-ordinate
        // color: Color used when drawing
        // radius: Corner radius in pixels
        // corners: Which corners to round
        public virtual void DrawRectangleRounded(int x0, int y0, int x1, int y1, BasicColor color, int radius, RoundedCornerStyle corners)
        {
            var height = 0;
            var y = 0;
            if (corners == RoundedCornerStyle.None) {
                DrawRectangleFilled(x0, y0, x1, y1, color);
                return;
            }
            // Calculate height
            if (y1 < y0) {
                y = y1;
                y1 = y0;
                y0 = y;
            }
            height = y1 - y0;
            // Check radius
            if (radius > height / 2) {
                radius = height / 2;
            }
            radius -= 1;

            // Draw body
            DrawRectangleFilled(x0 + radius, y0, x1 - radius, y1, color);
            switch (corners) {
                case RoundedCornerStyle.All:
                    DrawCircleFilled(x0 + radius, y0 + radius, radius, color);
                    DrawCircleFilled(x1 - radius, y0 + radius, radius, color);
                    DrawCircleFilled(x0 + radius, y1 - radius, radius, color);
                    DrawCircleFilled(x1 - radius, y1 - radius, radius, color);
                    if (radius * 2 + 1 < height) {
                        DrawRectangleFilled(x0, y0 + radius, x0 + radius, y1 - radius, color);
                        DrawRectangleFilled(x1 - radius, y0 + radius, x1, y1 - radius, color);
                    }
                    break;
                case RoundedCornerStyle.Top:
                    DrawCircleFilled(x0 + radius, y0 + radius, radius, color);
                    DrawCircleFilled(x1 - radius, y0 + radius, radius, color);
                    DrawRectangleFilled(x0, y0 + radius, x0 + radius, y1, color);
                    DrawRectangleFilled(x1 - radius, y0 + radius, x1, y1, color);
                    break;
                case RoundedCornerStyle.Bottom:
                    DrawCircleFilled(x0 + radius, y1 - radius, radius, color);
                    DrawCircleFilled(x1 - radius, y1 - radius, radius, color);
                    DrawRectangleFilled(x0, y0, x0 + radius, y1 - radius, color);
                    DrawRectangleFilled(x1 - radius, y0, x1, y1 - radius, color);
                    break;
                case RoundedCornerStyle.Left:
                    DrawCircleFilled(x0 + radius, y0 + radius, radius, color);
                    DrawCircleFilled(x0 + radius, y1 - radius, radius, color);
                    if (radius * 2 + 1 < height) {
                        DrawRectangleFilled(x0, y0 + radius, x0 + radius, y1 - radius, color);
                    }
                    DrawRectangleFilled(x1 - radius, y0, x1, y1, color);
                    break;
                case RoundedCornerStyle.Right:
                    DrawCircleFilled(x1 - radius, y0 + radius, radius, color);
                    DrawCircleFilled(x1 - radius, y1 - radius, radius, color);
                    if (radius * 2 + 1 < height) {
                        DrawRectangleFilled(x1 - radius, y0 + radius, x1, y1 - radius, color);
                    }
                    DrawRectangleFilled(x0, y0, x0 + radius, y1, color);
                    break;
                default:
                    break;
            }
        }
コード例 #11
0
ファイル: Canvas.cs プロジェクト: Larouex/herdrider
 // Draws a progress bar with rounded corners
 // x: Starting x location
 // y: Starting y location
 // width: Total width of the progress bar in pixels
 // height: Total height of the progress bar in pixels
 // borderCorners: The type of rounded corners to render with the progress bar border
 // progressCorners: The type of rounded corners to render with the inner progress bar
 // borderColor: 16-bit color for the outer border
 // borderFillColor: 16-bit color for the interior of the outer border
 // progressBorderColor: 16-bit color for the progress bar's border
 // progressFillColor: 16-bit color for the inner bar's fill
 // progress: Progress percentage (between 0 and 100)
 // Draw a the progress bar (150x15 pixels large, starting at X:10, Y:195 with rounded corners on the top and showing 72% progress)
 //      DrawProgressBar(10, 195, 150, 15, RoundedCornerStyle.TOP, RoundedCornerStyle.TOP, GrayScaleValues.GRAY_128, GrayScaleValues.GRAY_225, ColorTheme.LIMEGREEN_LIGHTER, ColorTheme.LIMEGREEN_BASE, 72 );
 public virtual void DrawProgressBar(int x, int y, int width, int height, RoundedCornerStyle borderCorners, RoundedCornerStyle progressCorners, BasicColor borderColor, BasicColor borderFillColor, BasicColor progressBorderColor, BasicColor progressFillColor, int progress)
 {
     // Draw border with rounded corners
     DrawRectangleRounded(x, y, x + width, y + height, borderColor, 5, borderCorners);
     DrawRectangleRounded(x + 1, y + 1, x + width - 1, y + height - 1, borderFillColor, 5, borderCorners);
     // Progress bar
     if (progress > 0 && progress <= 100) {
         // Calculate bar size
         var bw = (width - 6);   // bar at 100%
         if (progress != 100) {
             bw = (bw * progress) / 100;
         }
         DrawRectangleRounded(x + 3, y + 3, bw + x + 3, y + height - 3, progressBorderColor, 5, progressCorners);
         DrawRectangleRounded(x + 4, y + 4, bw + x + 3 - 1, y + height - 4, progressFillColor, 5, progressCorners);
     }
 }
コード例 #12
0
ファイル: VirtualCanvas.cs プロジェクト: Larouex/herdrider
 public void DrawRectangleRounded(int x0, int y0, int x1, int y1, ushort color, int radius, RoundedCornerStyle corners)
 {
     BasicTypeSerializer.Put(SendContext,(byte)Command.DrawRectangleRounded);
     BasicTypeSerializer.Put(SendContext,(ushort)x0);
     BasicTypeSerializer.Put(SendContext,(ushort)y0);
     BasicTypeSerializer.Put(SendContext,(ushort)x1);
     BasicTypeSerializer.Put(SendContext,(ushort)y1);
     BasicTypeSerializer.Put(SendContext,(ushort)color);
     BasicTypeSerializer.Put(SendContext,(ushort)radius);
     BasicTypeSerializer.Put(SendContext,(ushort)corners);
     SendContext.CheckHighWatermark();
 }
コード例 #13
0
ファイル: VirtualCanvas.cs プロジェクト: Larouex/herdrider
 public void DrawProgressBar(
     int x, int y,
     int width, int height,
     RoundedCornerStyle borderCorners,
     RoundedCornerStyle progressCorners,
     ushort borderColor, ushort borderFillColor,
     ushort progressBorderColor, ushort progressFillColor,
     int progress)
 {
     BasicTypeSerializer.Put(SendContext,(byte)Command.DrawProgressBar);
     BasicTypeSerializer.Put(SendContext,(ushort)x);
     BasicTypeSerializer.Put(SendContext,(ushort)y);
     BasicTypeSerializer.Put(SendContext,(ushort)width);
     BasicTypeSerializer.Put(SendContext,(ushort)height);
     BasicTypeSerializer.Put(SendContext,(ushort)borderCorners);
     BasicTypeSerializer.Put(SendContext,(ushort)progressCorners);
     BasicTypeSerializer.Put(SendContext,(ushort)borderColor);
     BasicTypeSerializer.Put(SendContext,(ushort)borderFillColor);
     BasicTypeSerializer.Put(SendContext,(ushort)progressBorderColor);
     BasicTypeSerializer.Put(SendContext,(ushort)progressFillColor);
     BasicTypeSerializer.Put(SendContext,(ushort)progress);
     SendContext.CheckHighWatermark();
 }
コード例 #14
0
ファイル: VirtualCanvas.cs プロジェクト: Larouex/herdrider
 public void DrawButton(
     int x, int y,
     int width, int height,
     ushort fontID,
     int fontHeight,
     ushort borderColor,
     ushort fillColor,
     ushort fontColor,
     string text,
     RoundedCornerStyle cornerStyle = RoundedCornerStyle.All)
 {
     BasicTypeSerializer.Put(SendContext,(byte)Command.DrawButton);
     BasicTypeSerializer.Put(SendContext,(ushort)x);
     BasicTypeSerializer.Put(SendContext,(ushort)y);
     BasicTypeSerializer.Put(SendContext,(ushort)width);
     BasicTypeSerializer.Put(SendContext,(ushort)height);
     BasicTypeSerializer.Put(SendContext,(ushort)fontID);
     BasicTypeSerializer.Put(SendContext,(ushort)fontHeight);
     BasicTypeSerializer.Put(SendContext,(ushort)borderColor);
     BasicTypeSerializer.Put(SendContext,(ushort)fillColor);
     BasicTypeSerializer.Put(SendContext,(ushort)fontColor);
     BasicTypeSerializer.Put(SendContext,text, true);
     BasicTypeSerializer.Put(SendContext,(ushort)cornerStyle);
     SendContext.CheckHighWatermark();
 }