그래픽 라이브러리 - gxLib
글 수 28
설명
gx_circle()는 원을 그립니다. Device Context의 pen_color를 이용하여 테두리를 그리며, brush_color을 이용하여 내부를 칠합니다. 만일 pen_color나 brush_color의 alpha 값이 0 이라면 출력되지 않습니다. 즉, pen_color의 alpha 값이 0 이면 테두리가 그려지지 않으며, 또한 brush_color의 alpha 값이 0이면 내부를 칠하지 않습니다.
| 헤더 | gx.h | |||||||||||||
| 형태 | void gx_circle( dc_t *dc, int center_x, int center_y, int radius) | |||||||||||||
| 인수 |
| |||||||||||||
| 반환 |
| |||||||||||||
예제
#include <stdio.h>
#include <gx.h>
#include <gxbdf.h>
int main( void)
{
dc_t *dc_screen; // 화면 Device Context
if ( gx_init( "/dev/fb")) // gxLib 초기화
gx_print_error( ""); // 실행 중 에러 내용을 출력
else
{
if ( !( dc_screen = gx_get_screen_dc())) // 화면 출력을 위한 스크린 DC 구함
gx_print_error( ""); // 실행 중 에러 내용을 출력
else
{
gx_clear( dc_screen, gx_color( 0, 0, 0, 255));
dc_screen->pen_color = gx_color( 255, 255, 255, 255);
dc_screen->brush_color = gx_color( 255, 0, 255, 255);
gx_circle( dc_screen, 150, 150, 100);
dc_screen->pen_color = gx_color( 255, 255, 255, 0);
dc_screen->brush_color = gx_color( 255, 0, 0, 255);
gx_circle( dc_screen, 150, 150, 90);
dc_screen->pen_color = gx_color( 255, 255, 255, 0);
dc_screen->brush_color = gx_color( 255, 0, 0, 0);
gx_circle( dc_screen, 150, 150, 80);
dc_screen->pen_color = gx_color( 255, 0, 255, 255);
dc_screen->brush_color = gx_color( 0, 255, 0, 255);
gx_circle( dc_screen, 150, 150, 70);
gx_release_dc( dc_screen);
}
gx_close();
}
return 0;
}
프로그래을 실행하면 화면에 지정된 색상으로 원이 출력됩니다.




결과면 타워이에요.
gx_circle()을 gx_ellipse() 로만 바꿔주면 되겠네요.