HOT C PROGRAMS BLOGSPOT

HOT C PROGRAMS BLOGSPOT

Click On Related Results For More Information

Thursday 11 October 2012

Graphics Point Clipping C Program

/* .......Works on Win XP */

#include<stdio.h>
#include<conio.h>
#include<graphics.h>
int tlx,tly,brx,bry,px,py;
void point_clip()
{ int wxmin,wymin,wxmax,wymax;
wxmin=tlx;
wxmax=brx;
wymin=tly;
wymax=bry;
if(px>=wxmin&&px<=wxmax)
if(py>=wymin&&py<=wymax)
putpixel(px,py,RED);
getch();
closegraph();
}
void main(void)
{ int gd=DETECT,gm,xc,yc,r;
clrscr();
printf("Enter the top left coordinate");
scanf("%d%d",&tlx,&tly);
printf("Enter the bottom right coordinate");
scanf("%d%d",&brx,&bry);
printf("\n Enter the point");
scanf("%d%d",&px,&py);
 initgraph(&gd,&gm,"c:\\tc\\bgi");  /*Sometimes it may be "C:\\TC\\BGI" , It depends machine to mac..*/
setbkcolor(YELLOW);
setcolor(RED);
rectangle(tlx,tly,brx,bry);
point_clip();
}






1 comment:

  1. It is a pleasure to read your blog posts! Just wanted to let you know how much people like me appreciate what you are doing. Thanks a lot! The information you have shared is very useful, and we would love to visit this site for more information. Also, I'd like to share with you something about Clicking Fast in 2022. There are a few things to consider while choosing the Best Mouse for Clicking Fast, The first is Comfort. Clicking Fast should not come at the expense of fatigue. Therefore, an ergonomic grip that feels good and is fun to use is the key.

    ReplyDelete