快讯

在BMP文件中隐藏信息

2004-02-14 09:34  出处:PConline  作者:网上收集  责任编辑:zwg 

void flattenBitmap(BITMAP* src, LOOKUP* store) { /* passes over data as if reading it - but just flattens all data to '0' bits and compiles a hotspots list */ unsigned long offset,tmp; unsigned char thisR; unsigned char thisG; unsigned char thisB; unsigned char lookaheadR; unsigned char lookaheadG; unsigned char lookaheadB; int dom,lookaheaddom; int keepflag,keepflag2; unsigned long int hits; PIXEL getdata; PIXEL controlPixel, thisPixel; unsigned long int longtmp; unsigned long int longtmp2; unsigned long int *longptrtmp; offset=0; while (offset< (src- >x_size*src- >y_size)) { getdata=getIndexedPixel(offset, src); thisR=getdata.red; thisG=getdata.green; thisB=getdata.blue; dom=biggest_of_3(thisR,thisG,thisB); keepflag=FALSE; /* If 1 col varies from others by at least 3 = > candidate */ if (dom==thisG && abs(thisG-thisR) >2 && abs(thisG-thisB) >2) keepflag=TRUE; if (dom==thisB && abs(thisB-thisR) >2 && abs(thisB-thisG) >2) keepflag=TRUE; if (dom==thisR && abs(thisR-thisB) >2 && abs(thisR-thisG) >2) keepflag=TRUE; if (keepflag==FALSE) { offset++; continue; } /* only one of the 3 cols=dom here, and that col is at least 3 points greater than the others */ /* see if dominant col continues on more pixels(+ or - 1) and that other cols dont challenge its dominance */ tmp=offset+1; hits=1; while (tmp< (src- >x_size*src- >y_size)) { getdata=getIndexedPixel(tmp, src); lookaheadR=getdata.red; lookaheadG=getdata.green; lookaheadB=getdata.blue; keepflag=FALSE; if (dom==thisG && abs(lookaheadG-thisG)< 2) keepflag=TRUE; if (dom==thisR && abs(lookaheadR-thisR)< 2) keepflag=TRUE; if (dom==thisB && abs(lookaheadB-thisB)< 2) keepflag=TRUE; /* check dom is still dominant col by at least 3 */ lookaheaddom=biggest_of_3(lookaheadR,lookaheadG,lookaheadB); keepflag2=FALSE; if (thisR==dom && lookaheadR==lookaheaddom && abs(lookaheadR-lookaheadG) >2 && abs(lookaheadR-lookaheadB) >2) keepflag2=TRUE; if (thisG==dom && lookaheadG==lookaheaddom && abs(lookaheadG-lookaheadR) >2 && abs(lookaheadG-lookaheadB) >2) keepflag2=TRUE; if (thisB==dom && lookaheadB==lookaheaddom && abs(lookaheadB-lookaheadR) >2 && abs(lookaheadB-lookaheadG) >2) keepflag2=TRUE; if (keepflag==FALSE || keepflag2==FALSE) break; hits++; tmp++; } if (hits >2) { for (longtmp=offset+2; longtmp< offset+hits; longtmp++) { controlPixel=getIndexedPixel(offset,src); thisPixel=getIndexedPixel(longtmp,src); dom=biggest_of_3(controlPixel.red, controlPixel.green, controlPixel.blue); if (dom==controlPixel.red) { thisPixel.red=controlPixel.red; } if (dom==controlPixel.green) { thisPixel.green=controlPixel.green; } if (dom==controlPixel.blue) { thisPixel.blue=controlPixel.blue; } setIndexedPixel(longtmp,src,thisPixel); /* store in lookup table */ if (store- >curitem >=store- >currentlen) { longptrtmp=store- >dataspace; store- >dataspace=(unsigned long int*)calloc(2*store- >currentlen,sizeof(unsigned long int)); for (longtmp2=0; longtmp2< store- >currentlen; longtmp2++) { *(store- >dataspace+longtmp2)=*(longptrtmp+longtmp2); } free (longptrtmp); longptrtmp=NULL; store- >currentlen*=2; } *(store- >dataspace+(store- >curitem++))=longtmp; } offset+=hits; } else { offset++; } } } 正文完 附件: 在BMP中隐藏信息-Win32下的可执行文件 bs_win32.zip
键盘也能翻页,试试“← →”键
IT热词搜索 来源:360新闻
软件论坛帖子排行
相关文章

相关软件:

腾讯QQ2012
大小:52.93 MB 授权:免费
腾讯QQ2012
立即下载
腾讯QQ2013
大小:49.32 MB 授权:免费
腾讯QQ2013
立即下载