Computer Graphics in C for CARROM Design

//Developed by Ashish Prajapati
#include<graphics.h>
#include<stdlib.h>
#include<stdio.h>
#include<conio.h>
int main(void)
{
/* request auto detection */
int gdriver = DETECT, gmode, errorcode;
int i,midx,midy,left, top, right, bottom;
/* initialize graphics and local variables */
initgraph(&gdriver, &gmode, “..//bgi”);
/* read result of initialization */
errorcode = graphresult();
if (errorcode != grOk)  /* an error occurred */
{
printf(“Graphics error: %sn”, grapherrormsg(errorcode));
printf(“Press any key to halt:”);
getch();
exit(1); /* terminate with an error code */
}
setbkcolor(WHITE);
{
setcolor(RED);
for(i=0;i<24;i++)
{
left = getmaxx() / 2 – 200;
top = getmaxy() / 2 – 200;//Developed by Ashish Prajapati
right = getmaxx() / 2 + 200;
bottom = getmaxy() / 2 + 200;
/* draw a rectangle */
rectangle(left-i,top-i,right+i,bottom+i);
}
}
setcolor(YELLOW);
for(i=0;i<200;i++)
{
left = getmaxx() / 2 – 200;
top = getmaxy() / 2 – 200;
right = getmaxx() / 2 + 200;
bottom = getmaxy() / 2 + 200;
/* draw a rectangle */
rectangle(left+i,top+i,right-i,bottom-i);
}
setcolor(BROWN);
line(left-20,top-20,left-5,bottom+5);
line(right+5,top-5,right+20,bottom+20);
line(right+5,bottom+5,left-20,bottom+20);
line(left-5,top-5,right+20,top-20);
setcolor(GREEN);
midx = getmaxx() / 2;
midy = getmaxy() / 2;
for(i=0;i<5;i++)
{
circle(midx,midy,39-i);
}
setcolor(RED);
circle(midx,midy,42);
setcolor(MAGENTA);
for(i=0;i<3;i++)
circle(midx,midy,45+i);
setcolor(CYAN);
for(i=0;i<12;i++)
{
circle(midx-188,midy-188,12-i);
circle(midx-188,midy+188,12-i);
circle(midx+188,midy-188,12-i);
circle(midx+188,midy+188,12-i);
}
/*circle hole*/
setcolor(RED);
circle(midx-188,midy-188,12);
circle(midx-188,midy+188,12);//Developed by Ashish Prajapati
circle(midx+188,midy-188,12);
circle(midx+188,midy+188,12);
setcolor(BLUE);
for(i=0;i<7;i++)
{
circle(midx-188,midy-188,7-i);
circle(midx-188,midy+188,7-i);
circle(midx+188,midy-188,7-i);
circle(midx+188,midy+188,7-i);
}
setcolor(BLUE);
line(midx-60,midy-60,midx-160,midy-160)   ;
line(midx-160,midy-60+220,midx-60,midy-160+220) ;
line(midx-160+220,midy-60,midx-60+220,midy-160) ;
line(midx-60+220,midy-60+220,midx-160+220,midy-160+220);
for(i=0;i<21;i++)
{
setcolor(39);
line(midx+20,midy+20,midx-i,midy+i);
setcolor(6);
line(midx+20,midy+20,midx+i,midy-i);
setcolor(5);
line(midx-20,midy-20,midx-i,midy+i);
setcolor(3);
line(midx-20,midy-20,midx+i,midy-i);
}
setcolor(BLUE);
for(i=0;i<4;i++)
{
circle(midx,midy,4-i);
}
setcolor(BLUE);
for(i=0;i<2;i++)
{
circle(midx,midy,20-i)  ;//Developed by Ashish Prajapati
}
setcolor(RED)  ;
line(midx+24,midy+24,midx-24,midy-24);
line(midx+24,midy+24,midx-24,midy+24);
line(midx-24,midy-24,midx-24,midy+24);
line(midx-24,midy+24,midx+24,midy-24);
line(midx-24,midy-24,midx+24,midy-24);
line(midx+24,midy+24,midx+24,midy-24);
/*Fall Circle*/
setcolor(BLUE);
{
circle(midx-140,midy-140,4);
circle(midx-140,midy+140,4);
circle(midx+140,midy-140,4);
circle(midx+140,midy+140,4);
}
/* circle of fall side*/
setcolor(BLUE);
{
circle(midx-148,midy-132,8);
circle(midx-148,midy+132,8);
circle(midx+148,midy-132,8);
circle(midx+148,midy+132,8);
circle(midx-132,midy-148,8);
circle(midx-132,midy+148,8);
circle(midx+132,midy-148,8);
circle(midx+132,midy+148,8);
}
/*Circle inside circle*/
setcolor(RED);
for(i=0;i<5;i++)
{
circle(midx-148,midy-132,5-i);
circle(midx-148,midy+132,5-i);
circle(midx+148,midy-132,5-i);
circle(midx+148,midy+132,5-i);
circle(midx-132,midy-148,5-i);
circle(midx-132,midy+148,5-i);
circle(midx+132,midy-148,5-i);
circle(midx+132,midy+148,5-i);
}
setcolor(BLUE);
/*Circle attachment line*/
for(int j=0;j<6;j++)
{
line(midx-134+2*j,midy-156+j,midx+134-2*j,midy-156+j);
line(midx-136,midy-140,midx+136,midy-140);
line(midx-134+2*j,midy+156-j,midx+134-2*j,midy+156-j);
line(midx+136,midy+140,midx-136,midy+140);
line(midx+156-j,midy+134-2*j,midx+156-j,midy-134+2*j);
line(midx+140,midy+136,midx+140,midy-136);
line(midx-156+j,midy-134+2*j,midx-156+j,midy+134-2*j);
line(midx-140,midy-136,midx-140,midy+136);
}//Developed by Ashish Prajapati
//line arc
{
arc(midx+60+10, midy-60-10,90,0, 14);
arc(midx+60+10, midy+60+10,0,270, 14);
arc(midx-60-10, midy-60-10,180,90, 14);
arc(midx-60-10, midy+60+10,270,180, 14);
}
getch();
closegraph();
return 0;
}//Developed by Ashish Prajapati

About the author

Being the CEO and Founder of ClecoTech International, Mr. Ashish Prajapati is dedicated towards his aim of mentoring young startups into a full-fledged businesses. He is helping startups from America, Europe, India, and various other countries through proper guidance and the use of latest technologies to develop their innovation and ideas into definite realities.

Comments

  1. Amazing Personality of Mumbai Escorts Girls when you will look them you can’t stop your feelings. Feelings of every humen being, is very important to fulfill them because of our is life too short no one can say when it will be stop. You should to enjoy each and every moments of your life. If you want to enjoy your whole life with someone special so don’t worry about it. Because we brought new and fresh Mumbai Escorts who can give you deeply satisfaction. Now days every Mumbai Female Escorts are very professional in their work and they know how to keep client happy. They are very naughty and open minded Escorts in Mumbai. Foreigners and peoples who come outside of Mumbai in city are very crazy to meet our Independent Mumbai Escorts because they know here they find quality and trusty Escorts Service in Mumbai. When they enter in our agency they tells us their entire requirements and we finds the exact match for them because we don’t want to disappointed our customers at any cost. We have good collection of Independent Escorts in Mumbai and celebrities, models, Collage Girls Mumbai and premium escorts are on Demand. If you are looking something spicy and taste like red chilly then make us call or drop an e-mail for booking. We provides both incall and outcall Mumbai Escorts Service at reputed hotels. If you want to book our Mumbai Call Girls or Call Girls in Mumbai then don’t hesitate feel free contact us now. we are also providing service in these area also:- Rajkot Escorts | Juhu Escorts | Andheri Escorts | Raipur Escorts

  2. My site has some tips on how to perform search engine optimization (also know as SEO) on your website. check it out Using keyword analysis, you can identify the market size, number of search for that exact keyword, competitive arena and even identify the intent behind keyword searches.

  3. In Indian and Thai culture, the elephant is a great symbol for strength, power, luck, fortune, stability and wisdom. The animal itself is considered holy and elephant charms can be found all over Asia but mostly in India and Thailand. The belief is that if an elephant is facing your door good fortune will come to your home. Many businesses in Asia have these animals at the entrances for good luck. https://www.pmp900.com/first

  4. Some key issues in the potential success in the adoption of e-learning can include (but is not limited to) the school or college's present computer network capacity, the willingness of the school's leaders to support change, current or probable resources, the potential accessibility of the e-learning services by the students. blog empreendedor

Leave a Reply

Your email address will not be published. Required fields are marked *