int main(int argc, char** argv) { int fbfd, status, offset; /* 프레임버퍼 정보 처리를 위한 구조체 */ unsigned short pixel; fbfd = open(FBDEVICE, O_RDWR); /* 사용할 프레임버퍼 장치를 오픈한다. */ if(fbfd < 0) { perror("Error: cannot open framebuffer device"); return -1; } DrawPoint(fbfd, 50, 50, makepixel(255, 0, 0)); /* Red 점을 출력 */ DrawPoint(fbfd, 100, 100, makepixel(0, 255, 0)); /* Green 점을 출력 */ DrawPoint(fbfd, 150, 150, makepixel(0, 0, 255)); /* Blue 점을 출력 */ DrawLine(fbfd, 0, 100, 200, makepixel(0, 255, 255)) ; /* Cyan 색상을 생성 */ DrawCircle(fbfd, 200, 200, 100, makepixel(255, 0, 255)) ; /* Magenta색상을 생성 */ close(fbfd); /* 사용이 끝난 프레임버 퍼 장치를 닫는다. */ return 0; }
int main(int argc, char** argv){ int fbfd, status, offset; unsigned short pixel; fbfd = open(FBDEVICE, O_RDWR); if(fbfd<0){ perror("error"); return -1; } DrawFace(fbfd, 0,0,0,0, makepixel(255,255,0)); close(fbfd); return 0; }
void draw_icon(struct icon *icon) { int i, j; bmphandle_t bh; if (icon->mode) { bh = bmp_open(icon->name); if (bh == NULL) { perror("bmp_open"); return; } for (i=icon->y; i<icon->y+bmp_height(bh); i++) for (j=icon->x; j<icon->x+bmp_width(bh); j++) *(myfb->fb + i*myfb->fbvar.xres +j) = makepixel(bmp_getpixel(bh, j-icon->x, i-icon->y)); bmp_close(bh); } else { drow_rect(icon->x, icon->y, icon->x + icon->w, icon->y + icon->h, icon->color); put_string_center(icon->x + icon->w/2, icon->y + icon->h/2, icon->name, icon->color); } }
void set_bgcolor(void) { memset(myfb->fb, makepixel(bgcolor), myfb->fbvar.xres*20); }