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: %s\n", 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

Post a Comment

25 comments:

  1. If running proves to be a problem then it may be wise to find alternative exercises such as circuit training, weight training, swimming or cycling. great post to read

    ReplyDelete
  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.

    ReplyDelete
  3. i would alway prefer hotel rooms with flannel sheets and cotton beddings, i love the feel of those fabric’ Ada Compliance Website Design

    ReplyDelete
  4. There are many kinds of social graph sites that you can enjoy online. You can play pure games, and there are graph games only for betting sites. 바둑이사이트

    ReplyDelete
  5. I want you to thank for your time of this wonderful read!!! I definately enjoy every little bit of it and I have you bookmarked to check out new stuff of your blog a must read blog! Carrom Board Game

    ReplyDelete
  6. 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

    ReplyDelete
  7. Your contents are too straightforward to browse and easy to understand.
    web design company San Francisco

    ReplyDelete
  8. I really like your writing style, great information, thankyou for posting. logo design in Bangalore

    ReplyDelete
  9. Leader in developing embedded system projects, providing Engineering and SCADA solutions using Raspberry pi, Arduino and more.... android development

    ReplyDelete
  10. It’s amazing in support of me to truly have a blog site, which will be valuable meant for my knowledge. Thanks admin.
    San Francisco website design

    ReplyDelete
  11. Online casino games are offered contrastingly by various casinos since there are download-based and program based online casino. Chumba slots

    ReplyDelete
  12. One should consistently peruse and follow these manuals so as introduce and use accessories in a right way. razer viper mini

    ReplyDelete
  13. Games can be characterized as a "framework in which players participate in counterfeit clash, characterized by rules, which bring about a quantifiable result". VMake Video Editor Mod APK

    ReplyDelete
  14. SEO takes all their time, however no outcomes are as yet observed after an extensive time of this distress. Sounds natural, isn't that right?Lead generation

    ReplyDelete
  15. Nice post. I was checking constantly this blog and I am impressed! Extremely helpful information specially the last part I care for such info a lot. I was seeking this particular information for a very long time. Thank you and good luck. création de site internet

    ReplyDelete
  16. The new site is modern, up-to-date, UI company and offers an excellent who fits as the best graphic design firm in the US.

    ReplyDelete
  17. 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

    ReplyDelete
  18. Nice post! This is a very nice blog that I will definitively come back to more times this year! Thanks for informative post. Leslie Jean Designs

    ReplyDelete
  19. The main advance in valuing is to ensure the potential design organization layout the entirety of the costs related with the work and carefully records it all. Webdesign

    ReplyDelete
  20. There is a development in progress to have web based gaming enslavement/computer game dependence recorded in future releases of the DSM, yet until further notice it's anything but an authority analysis. pc games download

    ReplyDelete
  21. They comprehend that the specialists and circuit repairmen clearly more on comfortable standing with their individual field of work than them. Webdesigner

    ReplyDelete