📄 circles.cpp
字号:
#include "canvas.h"
// show simple Canvas functions, change style and color of drawing
void circles(Canvas& c, const Point& p, double size)
// post: series of circles drawn on c, centered at p
// initial size = size (decreased by 20% for each one
{
color spectrum[] = {CanvasColor::RED, CanvasColor::ORANGE, CanvasColor::YELLOW,
CanvasColor::GREEN, CanvasColor::BLUE, CanvasColor::INDIGO,
CanvasColor::VIOLET};
int k;
for(k=0; k < 7; k++)
{ c.SetColor(spectrum[k]);
c.DrawCircle(p,size);
size *= 0.80;
}
}
int main()
{
const int WIDTH = 250, HEIGHT = 150;
Canvas c(WIDTH, HEIGHT, 20,20);
circles(c, Point(WIDTH/4, HEIGHT/2), WIDTH/4);
c.SetFrame();
circles(c, Point(3*WIDTH/4, HEIGHT/2), WIDTH/4);
c.runUntilEscape();
return 0;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -