getimage

函数名: getimage     功 能: 将指定区域的一个位图存到主存中     用 法: void far getimage(int left, int top, int right, int bottom,      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;     }     } 发表于 @ 2008年06月28日 10:55:54|评论(0AddFeedbackCountStack("2593801") )|编辑|收藏旧一篇: getimagedocument.write("");//window.onload = function(){dp.SyntaxHighlighter.ClipboardSwf = 'http://hi.images.youkuaiyun.com/flash/syntaxhighlighter/clipboard.swf';dp.SyntaxHighlighter.HighlightAll('code');//}
类似网络爬虫,从一个网页“爬”到另一个网页,然后选择图片下载。多线程。 可以用来按照一定规则下载网页中的元素,如图片、网页、flash等,举例如下: 1. 下载sohu主页的所有图片 在地址栏中输入www.sohu.com,在“选项”中将最大下载图片数目设为0,最大访问网页数设为1,点开始即可。 2. 下载sohu主页及其子链接中的所有图片,共下载100张 在“选项”中将最大下载图片数目设为100,最大访问网页数设为0 3. 下载人人网中的相册 打开相册中的一张相片,如http://photo.renren.com/getphoto.do?id=975410152&owner=230410031&curpage=0&t=#975410152,将地址复制到软件的地址栏(注意要将窗口拉长,使得地址栏足够容下这个地址,否则地址会被切断,这个bug我一直没找到解决办法)。 接下来需要一点观察。先看要下载的图片链接(http://fmn017.xnimg.cn/fmn017/pic001/20080926/17/21/large_wJZc_3213f200058.jpg),再看下一张,是http://fmn014.xnimg.cn/fmn014/pic001/20080926/17/21/large_Ao10_3208l200058.jpg,找到其中的公共部分,不妨取为xnimg.cn/fmn,将其输入“选项”中的“图片路径含有”,并勾选复选框。 再观察“上一张”、“下一张”的链接(http://photo.renren.com/getphoto.do?id=975410152&owner=230410031&curpage=0&t=#975409483)(http://photo.renren.com/getphoto.do?id=975410152&owner=230410031&curpage=0&t=#975410114),取其公共部分photo.renren.com/getphoto.do,填入“网页路径含有”并勾选复选框。 最后将最大下载图片数目和最大访问网页数都设为0,点开始即可。上面限制了图片和网页路径,只是为了防止下载不需要的图片。 4. 一次性在你的100个好友的页面上留下脚印 观察所有个人主页链接url,取出公共部分http://renren.com/profile.do,剩下的我就不用说了吧……对了,要是一张图片都不想下载,只要在“图片路径含有”中输入一个空格就可以了,因为任何图片url都不包含空格…… 5. 下载一部小说目录中的所有链接 提示:“选项”中有一个小小的“高级”按钮,有兴趣的同志可以研究一下…… ps. 大家可能看出来了,这个软件很类似网络爬虫,从一个网页“爬”到另一个网页,然后选择图片下载。如果有人需要根据关键词从大的图片搜索引擎下载图片,我推荐crazyPic这个软件。我这个软件的用途我暂时就想出这么多,欢迎发掘更多用途,也欢迎挑bug!
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值