さらに描画のおはなし - 1 / 2 -
static void Graphix_ClipRectUseIGraphics(GraphixApplet* app)
{
IGraphics* graphics = app->g;
AEEClip clip;
AEERect rect;
AEECircle circle;
// 画面を緑色でクリア
IGRAPHICS_SetBackground(graphics,0xCC,0xFF,0xCC);
IGRAPHICS_ClearViewport(graphics);
// クリッピング領域を四角形に設定
clip.type = CLIPPING_RECT;
clip.shape.rect.x = 20;
clip.shape.rect.y = 20;
clip.shape.rect.dx = 80;
clip.shape.rect.dy = 80;
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;
}