9 ディスプレイにグラフィック表示させてみよう

グラフィックの使い方

メソッド引数説明
DrawCircleint x, int y, int r, Color color円の頂点のx座標、y座標、半径r、色color
DrawRectangleint x0, int y0, int x1, int y1, Color color長方形を描く。width:幅、height:高さ
DrawFilledRectangleint x, int y, int width, int height, Color color内側がcolorで塗られた長方形を描く。width:幅、height:高さ
DrawLineint x0, int y0, int x1, int y1, Color color(x0,y0)座標から(x1,y1)座標までcolor色で線を引く。
DrawExtraLargeStringint x, int y, string data, Color color文字の左上の座標(x,y)から大きな文字データdataをcolor色で表示させる。


図形がディスプレイの表示領域範囲(160×128ドット)を超えると実行エラーになります。

グラフィックで絵を描く
        private void main()
        {
            BrainPad.Display.Clear();
            BrainPad.Display.DrawCircle(30, 30, 10, BrainPad.Color.Yellow);
            BrainPad.Display.DrawRectangle(50, 10, 30, 30, BrainPad.Color.Green);
            BrainPad.Display.DrawFilledRectangle(20, 50, 40, 25, BrainPad.Color.Magneta);
            BrainPad.Display.DrawLine(90, 15, 155, 70, BrainPad.Color.Red);
            BrainPad.Display.DrawLine(90, 15, 115, 75, BrainPad.Color.Blue);
            BrainPad.Display.DrawLine(115, 75, 155, 70, BrainPad.Color.Cyan);
            BrainPad.Display.DrawExtraLargeString(10, 90, "Brain", BrainPad.Color.White);
            for(int i=1; i<=15; i++)
                BrainPad.Display.DrawCircle(85,70, i, BrainPad.Color.Red);
        }
 1 
 2 
 3 ディスプレイ消去
 4 円を描く
 5 正方形を描く
 6 内側が塗られた長方形
 7 線を引く
 8 線を引く
 9 線を引く
10 大きな文字を書く
11 円を多数描く
12 
13