基本信息
源码名称:c++ 直线裁剪、画矩形等示例源码(graphics)
源码大小:23.36M
文件格式:.rar
开发语言:C/C++
更新时间:2020-01-29
   友情提示:(无需注册或充值,赞助后即可获取资源下载链接)

     嘿,亲!知识可是无价之宝呢,但咱这精心整理的资料也耗费了不少心血呀。小小地破费一下,绝对物超所值哦!如有下载和支付问题,请联系我们QQ(微信同号):813200300

本次赞助数额为: 2 元 
   源码介绍





#include <stdio.h>

#include <graphics.h>

 

typedef struct{

int x;

int y;

}pt2;

 

/*declare your drawing functions.*/

void drawline(pt2 startpt, pt2 endpt, int color);

void drawcircle(pt2 centerpt, int radius, int color);

 

int main()

{

int color, radius;

pt2 startpt, endpt, centerpt;

 

/*initialize graphics driver.*/

int gdriver=VGA;

int gmode=VGAHI;

initgraph(&gdriver, &gmode, "C:\\TC20\\BGI");

 

/*start drawing.*/

printf("Press enter to start drawing.");

getchar();

 

/*invoke your drawing functions one by one.*/

startpt.x=10;

startpt.y=10;

endpt.x=300;

endpt.y=250;

color=4;

drawline(startpt, endpt, color);

 

centerpt.x=200;

centerpt.y=180;

radius=145;

color=8;

drawcircle(centerpt, radius, color);

 

/*end drawing.*/

printf("Drawing is done, press enter to exit.");

getchar();

 

/*close graphics driver.*/

closegraph();

}

 

/*

* draw line

* startpt: the start point of the line

* endpt: the end point of the line

* color: the color of the line

*/

void drawline(pt2 startpt, pt2 endpt, int color)

{

 

}

 

/*

* draw circle

* centerpt: the center of the circle

* radius: the radius of the circle

* color: the color of the circle

*/

void drawcircle(pt2 centerpt, int radius, int color)

{

 

}