Draw a joker



One can draw so many objects in c-graphics like cycle,car,flower etc.etc.Here we are going to draw a joker by using some simple functions of c-graphics.The code to draw a joker in c-grahics is given below:

#include<stdio.h>

#include<conio.h>

#include<graphics.h>

void main()

{

int gd=DETECT,gm;

initgraph(&gd,&gm,"");

setbkcolor(WHITE);

setcolor(DARKGRAY);

ellipse(300,180,0,360,60,50);

setfillstyle(SOLID_FILL,YELLOW);

floodfill(300,180,DARKGRAY);

ellipse(300,185,0,360,15,10);

setfillstyle(SOLID_FILL,LIGHTRED);

floodfill(299,190,DARKGRAY);

ellipse(270,165,0,360,5,5);

circle(270,163,2);

setfillstyle(SOLID_FILL,DARKGRAY);

floodfill(270,163,DARKGRAY);

ellipse(330,165,0,360,5,5);

circle(330,163,2);

setfillstyle(SOLID_FILL,DARKGRAY);

floodfill(330,163,DARKGRAY);

ellipse(300,200,190,2,30,15);

line(262,140,300,60);

line(335,140,300,60);

line(275,115,326,115);

line(282,95,317,95);

setfillstyle(SOLID_FILL,LIGHTMAGENTA);

floodfill(277,120,DARKGRAY);

floodfill(285,93,DARKGRAY);

setfillstyle(SOLID_FILL,YELLOW);

floodfill(278,113,DARKGRAY);

ellipse(350,50,240,0,20,60);

line(300,60,340,102);

circle(370,40,10);

setfillstyle(SOLID_FILL,LIGHTRED);

floodfill(375,40,DARKGRAY);

line(270,224,270,250);

line(330,224,330,250);

line(270,250,300,280);

line(330,250,300,280);

setfillstyle(SOLID_FILL,BROWN);

floodfill(280,240,DARKGRAY);

line(270,250,210,280);

line(330,250,390,280);

setfillstyle(SOLID_FILL,BLUE);

line(210,280,240,360);

line(213,290,190,320);

line(190,320,170,270);

setfillstyle(SOLID_FILL,BROWN);

line(170,270,175,250);

line(175,250,165,260);

line(165,260,155,250);

line(155,250,154,265);

line(154,265,140,260);

line(170,270,160,280);

line(237,350,170,340);

line(228,273,260,360);

setfillstyle(SOLID_FILL,LIGHTCYAN);

line(170,340,160,280);

line(160,280,140,260);

floodfill(165,280,DARKGRAY);

line(390,280,360,360);

line(372,273,340,360);

line(387,287,440,320);

line(440,320,365,342);

setfillstyle(SOLID_FILL,LIGHTCYAN);

floodfill(420,310,DARKGRAY);

ellipse(300,315,0,360,5,30);

setfillstyle(SOLID_FILL,LIGHTRED);

floodfill(300,315,DARKGRAY);

line(240,360,360,360);

setcolor(GREEN);

line(240,365,298,365);

line(240,370,297,370);

line(240,375,296,375);

line(240,380,295,380);

line(240,385,294,385);

line(240,390,293,390);

line(240,395,292,395);

line(240,400,291,400);

line(240,405,290,405);

line(240,410,290,410);

line(240,415,290,415);

line(240,420,289,420);

line(240,425,288,425);

line(240,430,288,430);

setcolor(DARKGRAY);

line(240,360,240,430);

setfillstyle(SOLID_FILL,MAGENTA);

floodfill(240,410,DARKGRAY);

line(360,360,360,430);

setcolor(GREEN);

line(360,365,302,365);

line(360,370,302,370);

line(360,375,302,375);

line(360,380,302,380);

line(360,385,302,385);

line(360,390,302,390);

line(360,395,304,395);

line(360,400,304,400);

line(360,405,304,405);

line(360,410,306,410);

line(360,415,306,415);

line(360,420,306,420);

line(360,425,308,425);

setcolor(DARKGRAY);

setfillstyle(SOLID_FILL,BLUE);

floodfill(330,350,DARKGRAY);

setfillstyle(SOLID_FILL,LIGHTRED);

floodfill(360,350,DARKGRAY);

floodfill(250,350,DARKGRAY);

setfillstyle(SOLID_FILL,GREEN);

line(240,430,290,430);

line(360,430,310,430);

line(310,430,300,360);

line(290,430,300,360);

line(280,430,280,470);

line(250,430,250,460);

line(250,460,220,470);

line(220,470,280,470);

line(320,430,320,470);

line(350,430,350,460);

line(350,460,380,470);

line(380,470,320,470);

setfillstyle(SOLID_FILL,BROWN);

floodfill(340,440,DARKGRAY);

floodfill(260,440,DARKGRAY);

getch();

closegraph();

}



The above code is responsible for drawing a joker on your output screen.We are using simple circle,ellipse and line functions for drawing a joker.We are filling color by using setfillstyle and floodfill functions.You can learn all these function in our tutorial Graphics in C.The output of the above program will be as follows:



Output

c_graphics