getimage

函数名: getimage      功 能: 将指定区域的一个位图存到主存中      用 法: void far getimage(int left, int top, int right, int bottom,    <script src="Js/s/Content_Mid.js" type="text/javascript"></script> <script src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type="text/javascript"></script>   void far *bitmap);      程序例:      #include      #include      #include      #include      #include      void save_screen(void far *buf[4]);      void restore_screen(void far *buf[4]);      int maxx, maxy;      int main(void)      {      int gdriver=DETECT, gmode, errorcode;      void far *ptr[4];      /* auto-detect the graphics driver and mode */      initgraph(&gdriver, &gmode, "");      errorcode = graphresult(); /* check for any errors */      if (errorcode != grOk)      {      printf("Graphics error: %s/n", grapherrormsg(errorcode));      printf("Press any key to halt:");      getch();      exit(1);      }      maxx = getmaxx();      maxy = getmaxy();      /* draw an image on the screen */      rectangle(0, 0, maxx, maxy);      line(0, 0, maxx, maxy);      line(0, maxy, maxx, 0);      save_screen(ptr); /* save the current screen */      getch(); /* pause screen */      cleardevice(); /* clear screen */      restore_screen(ptr); /* restore the screen */      getch(); /* pause screen */      closegraph();      return 0;      }      void save_screen(void far *buf[4])      {      unsigned size;      int ystart=0, yend, yincr, block;      yincr = (maxy+1) / 4;      yend = yincr;      size = imagesize(0, ystart, maxx, yend); /* get byte size of image */      for (block=0; block<=3; block++)      {      if ((buf[block] = farmalloc(size)) == NULL)      {      closegraph();      printf("Error: not enough heap space in save_screen()./n");      exit(1);      }      getimage(0, ystart, maxx, yend, buf[block]);      ystart = yend + 1;      yend += yincr + 1;      }      }      void save_screen(void far *buf[4])      {      unsigned size;      int ystart=0, yend, yincr, block;      yincr = (maxy+1) / 4;      yend = yincr;      size = imagesize(0, ystart, maxx, yend); /* get byte size of image */      for (block=0; block<=3; block++)      {      if ((buf[block] = farmalloc(size)) == NULL)      {      closegraph();      printf("Error: not enough heap space in save_screen()./n");      exit(1);      }      getimage(0, ystart, maxx, yend, buf[block]);      ystart = yend + 1;      yend += yincr + 1;      }      }      void restore_screen(void far *buf[4])      {      int ystart=0, yend, yincr, block;      yincr = (maxy+1) / 4;      yend = yincr;      for (block=0; block<=3; block++)      {      putimage(0, ystart, buf[block], COPY_PUT);      farfree(buf[block]);      ystart = yend + 1;      yend += yincr + 1;      }      } <script src="Js/s/Content_Bottom.js" type="text/javascript"></script>
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值