さらに描画のおはなし - 1 / 2 -
static void Graphix_ClipCircleUseIGraphics(GraphixApplet* app)
{
IGraphics* graphics = app->g;
AEEClip clip;
AEERect rect;
AEECircle circle;
// 画面を緑色でクリア
IGRAPHICS_SetBackground(graphics,0xCC,0xFF,0xCC);
IGRAPHICS_ClearViewport(graphics);
// クリッピング領域を円に設定
clip.type = CLIPPING_CIRCLE;
clip.shape.circle.cx = 60;
clip.shape.circle.cy = 60;
clip.shape.circle.r = 40;
IGRAPHICS_SetClip(graphics,&clip,0);
// 塗り潰しモードを設定
IGRAPHICS_SetFillMode(graphics,TRUE);
// 描画色を赤色に設定
IGRAPHICS_SetColor(graphics,0xFF,0x88,0x88,0x00);
IGRAPHICS_SetFillColor(graphics,0xFF,0xCC,0xCC,0x00);
// 四角形を描画
rect.x = 10;
rect.y = 10;
rect.dx = 60;
rect.dy = 50;
IGRAPHICS_DrawRect(graphics,&rect);
// 描画色を青色に設定
IGRAPHICS_SetColor(graphics,0x88,0x88,0xFF,0x00);
IGRAPHICS_SetFillColor(graphics,0xCC,0xCC,0xFF,0x00);
// 円を描画
circle.cx = 80;
circle.cy = 70;
circle.r = 40;
IGRAPHICS_DrawCircle(graphics,&circle);
// クリッピング領域をリセット
IGRAPHICS_SetClip(graphics,NULL,0);
// 画面更新
IGRAPHICS_Update(graphics);
return;
}