- #include <graphics.h>
- #include <conio.h>
- void main()
- { initgraph(640, 480);
- // 定义 IMAGE 对象
- IMAGE img;
- // 绘制内容
- circle(100, 100, 20);
- line(70, 100, 130, 100);
- line(100, 70, 100, 130);
- // 保存区域至 img 对象
- getimage(&img, 70, 70, 60, 60);
- /*注意,前两参数应该是拷图的原点坐标,后两个参数应该分别对应的是原点起始的拷贝区域的宽和高,而不是对应切图区域的终点坐标。*/
- // 将 img 对对象显示在屏幕的某个位置
- putimage(200, 200, &img);
- getch();
- closegraph();
- }
- //该片段来自于http://www.codesnippet.cn/detail/2309201410484.html
来源: http://www.codesnippet.cn/detail/2309201410484.html