亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來(lái)到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? tififd.cpp

?? 《精通 vc++ 圖像編程》的源代碼
?? CPP
?? 第 1 頁(yè) / 共 3 頁(yè)
字號(hào):

				bCoding_scheme= 2 ;
				lnResync= 0 ;
				device.color= WHITE ;
	            lnDots_left= m_lImgWidth;//FAXWIDTH ;
		        tree= (NODE *)&gTwoTree ;
			    cpTmp_line= cpRef_line ;
				cpRef_line= device.cur_line ;
				device.cur_line= cpTmp_line ;
				memset (device.cur_line,0x00,(m_lImgWidth+7)/*FAXWIDTH*//8) ;
				lnHorz_runs= lnCode= 0 ;
				lnA0= (-1) ;
            }

			/* Next check is for an EOL code.  If we have one in T.6 it
            marks the end of the image (EOFB).  Otherwise, we ignore
            any 0 fill bits in the EOL code and carry on till the 1
            which marks its end. We then reset our resync flag (set at
            the start and on a decoding error and reset our key
            variables to the start of the line. If we are 2-D coding, we
            set a dummy OUREOL2 code to force reading of the next tag
            bit. If we are 1-D coding we start the next line pointing at
            the root of the white run decoding tree */

			if (lnCode== OUREOL)
            {
				if (m_image.wOptions&2) 
					break;
				if ((bOctet&0x80)== 0) 
					continue;

				lnResync= 0 ;
				device.color= WHITE ;
				lnDots_left= m_lImgWidth;//FAXWIDTH ;
				if (m_image.wOptions&1) 
					lnCode= OUREOL2 ;
				else
				{
					tree= (NODE *)&gWTree ;
					lnCode= 0 ;
				}
				continue;
            }

			/* Next check is for the tag bit when 2-D coding.  We set our
            bCoding_scheme flag appropriately and then start the next line
            pointing either to the root of the white decoding tree, or else
            to the two-dimensional code word coding tree, as
            appropriate */

			if (lnCode== OUREOL2)
            {
				bCoding_scheme= ((bOctet&0x80) >> 7);
				
				if (bCoding_scheme== 1)
				{
					tree= (NODE *)&gWTree;
				}
				else
				{
					tree= (NODE *)&gTwoTree ;
					lnHorz_runs= 0 ;
					lnA0= (-1) ;
				}
				cpTmp_line= cpRef_line ;
				cpRef_line= device.cur_line ;
				device.cur_line= cpTmp_line ;
				memset (device.cur_line,0x00,(m_lImgWidth+7)/*FAXWIDTH*//8) ;
				lnCode= 0 ;
				continue ;
            }

         /* Now for the main decoding algorithm.  The codes are
            arranged as a binary tree.  We take the left fork for
            a 0 bit and the right fork for a one bit, and make that
            our new code word.  If the code word is either zero or a
            minus number we have a run length, but all positive code
            words represent pointers to the next branch in the tree.
            There are two types of run lengths - those below 64 are
            terminating codes, which mean we flip the colour and start
            the next code with the root of the other decoding tree.  For
            make-up codes of 64 and above we start the next code with
            the root of the same tree.  If we happened to be doing
            1-D coding because we were in a 2-D horizontal run
            (horz-run is decremented to zero) we point the next code at
            the two-dimensional tree */

			if(lnCode > 91)
				lnCode = 0;
			else
				lnCode= (*tree)[lnCode][(bOctet&0x80)>>7]  ;

			if (lnCode<1)
            {
				lnCode= (-lnCode) ;
				if (!lnResync) 
				{
					if ((lnDots_left-= lnCode)<0) 
						lnResync= 1 ;
				}

				if ((!lnResync)&&(lnCode!= 0)) 
					if(! ProcessLine(&device, lnCode))
						return NULL;

				if (lnCode < 64)
				{
					device.color= (~device.color) ;
					tree= device.color ? (NODE *)&gBTree : (NODE *)&gWTree;
					if (m_image.wOptions&3)
					{
						if ((bCoding_scheme!= 1)&&(--lnHorz_runs== 0))
						{
							lnA0= 0 ;
							tree= (NODE *)&gTwoTree ;
						}
					}
				}
				lnCode= 0 ;
				continue ;
			}
			if (lnCode<BADRUN) 
				continue ;

			/* Codes of 3000 and above are NEVER valid run-lengths.  We use
            these codes internally for special actions.  See DECODE.H for
            actual values.  BADRUN means we've fallen out of the tree and
            have to lnResync.  OUREOL means we've hit an EOL code and so we
            can Output our line. HORZMODE is the 2-D horizontal mode, which
            forces us to drop into 1-D mode for two run-lengths. */

			if (lnCode== BADRUN)
            {
				lnResync= 1 ;
				continue ;
            }

			if (lnCode== OUREOL)
			{
				if(! ProcessLine(&device,OUREOL))	// Output our line
					return NULL;

				continue ;
            }

			if (lnCode== HORZMODE)
            {
				lnHorz_runs= 2;
				lnCode= 0;
				tree= device.color ? (NODE *)&gBTree : (NODE *)&gWTree;
				continue ;
            }

			/* The remaining codes above 3000 are all 2-D so we start by
            sorting out colours on current line and on reference line.
            Then we work out lnB1 allowing for the fact that it must be a
            change, and finally adjust the values of lnA0 and lnB1 if
            positioned at start/end line. */

			if (lnA0== (-1)) 
			{
				bRef_color= WHITE ;
			}
			else
            {
				lnA0= (m_lImgWidth/*FAXWIDTH*/-lnDots_left) ;
				j= (lnA0/8) ;
				bThis_bit= (0x80>>(lnA0%8)) ;
				if (cpRef_line[j]&bThis_bit) 
					bRef_color= BLACK ; 
				else 
					bRef_color= WHITE ;
            }

			for (lnB1= lnA0+1;lnB1<m_lImgWidth/*FAXWIDTH*/;lnB1++)
            {
				j= (lnB1/8) ;
				bThis_bit= (0x80>>(lnB1%8)) ;
				if ((cpRef_line[j]&bThis_bit)!= (bRef_color&bThis_bit)) 
					break ;
            }
			if (bRef_color!= device.color)
            {
				for (lnB1++;lnB1<m_lImgWidth/*FAXWIDTH*/;lnB1++)
				{
					j= (lnB1/8) ;
					bThis_bit= (0x80>>(lnB1%8)) ;
					if ((cpRef_line[j]&bThis_bit)==(bRef_color&bThis_bit)) 
						break ;
				}
            }
			if (lnB1>m_lImgWidth)//FAXWIDTH) 
				lnB1= m_lImgWidth;//FAXWIDTH ;
			lnA0= (m_lImgWidth/*FAXWIDTH*/-lnDots_left) ;

			/* If the code is below PASSMODE then it is one of the	
            vertical code words, which are pretty easy to decipher as
            we have all the data. Vertical mode flips the colour and
            then continues. */

			if (lnCode<PASSMODE)
            {
				lnCode= ((lnB1-lnA0)+(lnCode-VTMODE0)) ;
				if (!lnResync) 
				{
					if ((lnDots_left-= lnCode)<0) 
						lnResync= 1 ;
				}

				if ((!lnResync)&&(lnCode!= 0)) 
					if(! ProcessLine(&device, lnCode) )
						return NULL;

				device.color= (~device.color) ;
				lnCode= 0 ;
				continue ;
            }

			/* If the code is PASSMODE then we need to identify lnB2
            before proceeding - pass mode does not flip the colour. */

			for (lnB2= lnB1+1;lnB2<m_lImgWidth/*FAXWIDTH*/;lnB2++)
            {
				j= (lnB2/8) ;
				bThis_bit= (0x80>>(lnB2%8)) ;
				if ((cpRef_line[j]&bThis_bit)== (device.color&bThis_bit)) 
					break ;
            }
			if (lnB2>m_lImgWidth/*FAXWIDTH*/) lnB2= m_lImgWidth;//FAXWIDTH ;

			if (lnCode== PASSMODE)
            {
				lnCode= (lnB2-lnA0) ;
				if (!lnResync) 
				{
					if ((lnDots_left-= lnCode)<0) 
						lnResync= 1 ;
				}
				
				if ((!lnResync)&&(lnCode!= 0)) 
					if(! ProcessLine(&device, lnCode) )
						return NULL;

				lnCode= 0 ;
				continue ;
            }

			/* Finally, if we weren't pass mode, we lnResync if T4, else
            abandon if T6 */

			if (m_image.wOptions&2) 
				return NULL;

			lnResync= 1 ;
			continue ;
		}
	}
	
	if(! ProcessLine(&device, DEINIT) )
		return NULL; 

	// no image ????????, should never be true!!
	if(m_outImage.lpImage == NULL)
		return NULL;

	// --- make dib image 
	BITMAPINFOHEADER bih;
	RGBQUAD rgb[2];

	bih.biSize = sizeof(BITMAPINFOHEADER);
	bih.biWidth = m_outImage.wWidth;
	bih.biHeight = m_outImage.wLength;
	bih.biPlanes = 1;
	bih.biBitCount = 1;
	bih.biCompression = BI_RGB;  // uncompressed format
	WORD wWidthBytes = WIDTHBYTES(bih.biWidth*bih.biBitCount);
	bih.biSizeImage = wWidthBytes*bih.biHeight;
	bih.biXPelsPerMeter = 0;
	bih.biYPelsPerMeter = 0;
	bih.biClrUsed = 0;
	bih.biClrImportant = 0;

	rgb[0].rgbBlue=0x00;
	rgb[0].rgbGreen=0x00;
	rgb[0].rgbRed=0x00;
	rgb[0].rgbReserved=0;

	rgb[1].rgbBlue=0xff;
	rgb[1].rgbGreen=0xff;
	rgb[1].rgbRed=0xff;
	rgb[1].rgbReserved=0;	

	// flip 0, 1 in image bits
	DWORD dwPos = 0;
	BYTE  byDelta, byPixel = 0;
	for (int row=0; row<bih.biHeight; ++row)
	{
		for (int col=0; col<wWidthBytes; ++col)
		{
			dwPos = row*wWidthBytes+col;
			*(m_outImage.lpImage+dwPos) = ~(*(m_outImage.lpImage+dwPos));
		}

		byDelta = 8-bih.biWidth%8;
		if (byDelta == 8)
			continue;

		byPixel = *(m_outImage.lpImage+dwPos);
		byPixel >>= byDelta;
		byPixel <<= byDelta;
		*(m_outImage.lpImage+dwPos) = byPixel;
	}

	// vertically flip image buffer
	if (! VertFlipBuf(m_outImage.lpImage, wWidthBytes, bih.biHeight))
		return FALSE;

    // Allocate enough memory for the new CF_DIB, and copy bits 
	DWORD dwBitsSize = bih.biSizeImage;
	DWORD dwColorTableSize = (1<<bih.biBitCount) * sizeof(RGBQUAD);
	DWORD dwHeaderSize = sizeof(BITMAPINFOHEADER);
	DWORD dwSize = dwHeaderSize + dwBitsSize + dwColorTableSize;
    HANDLE hDIB = GlobalAlloc(GHND, dwSize); 
	if (hDIB == NULL)
		return NULL;

    LPBYTE lpDIB = (LPBYTE)GlobalLock(hDIB); 
    memcpy(lpDIB, (LPBYTE)&bih, dwHeaderSize); 
    memcpy(lpDIB+dwHeaderSize, (LPBYTE)rgb, dwColorTableSize); 
    memcpy(FindDIBBits((LPBYTE)lpDIB), (LPBYTE)m_outImage.lpImage, dwBitsSize); 

	return hDIB;	// OK
}

/**************************************************************************

Contents :           Single function module, part of DECODE

Function name :      ProcessLine

Purpose :            to compose and Output decoded scan lines

Parameters passed :  pointer to DEVPARMS structure (see decode.h)
                     integer value of run length

Value returned :     integer 0 for failure, 1 for success

Variables changed :  DEVPARMS structure members (flags, indices and buffers)
                     See DECODE.H

Functions called :   VerticalScale, HorizScale, newpage, Output

Exit points :        Return 0 if malloc fails to allow enough space for image
                     Otherwise returns 1 after any one of thirteen
                     successful routes to completion - sorry about the
                     unstructured programming, but the indentation levels
                     got illegible.  It could be argued that this
                     function is too big.

COMMENTS
________

ProcessLine has five types of entry -

1.   iRunlength of INIT initializes
2.   iRunlength of DEINIT uninitializes
3.   iRunlength of OUREOP throws pages
4.   iRunlength of OUREOL outputs lines
5.   all other runlengths placed scaled runs in lines


The DEVPARMS structure contains the device ID, details of the scaling
used, and the color of the current Output run.  Note that there is a
substatial amount of static storage which is needed to keep track of
the run line currently being decoded.


***************************************************************************/

int CTifIFD::ProcessLine(DEVPARMS * device, int iRunlength)
{
	int lnTemp;
	BYTE bBit;
	int lnCopyRun;

	/**************************************************************************

	We initialize here.  We malloc storage for our Output buffer needs
	(computed from the destination device width and the number of lines
	it can Output at a time) and initialize that to white space.  The
	index to this array is set to 0, our bit counter is set to  8.  In
	case 2-D coding is used we set the 2-D map index to 0 and the 2-D map
	bit counter to 8 also.  As we keep track of the last significant byte
	in each line to avoid having to Output trailing white space at the
	end of lines (or complete white space for blank lines) we set m_lnLastSaveByte to
	0 too.  We set our m_lnRow to zero, initialize our scaling, set our color
	to white and finally kick off our multibyte line counter.
	
	**************************************************************************/


	if (iRunlength==INIT)
	{
		m_lnFaxBytes = ((int)device->dest_width/8)*device->total_lines;
		m_lpFaxline = new BYTE[m_lnFaxBytes];
		if (m_lpFaxline==NULL) 
			return 0;

		m_lnSliceBytes = device->total_lines/8;

		memset(m_lpFaxline,0x00,m_lnFaxBytes) ;
		m_lnIndex=0 ;
		m_lnThisbit=8 ;
		m_ln2DIndex=0 ;
		m_ln2DBit=8 ;
		m_lnLastSaveByte=0 ;
		m_lnRow = 0;
		HorizScale(device,(long int)m_lnIndex) ;
		VerticalScale(device,(long int)-1) ;
		device->color=WHITE ;
		device->this_line=device->total_lines ;
		return (1) ;
	}	

	/**************************************************************************

	We deinitialize here - we just free memory and get out

	**************************************************************************/

	if (iRunlength==DEINIT)
	{
		delete m_lpFaxline;
		m_lpFaxline=NULL;
		return (1) ;
	}

	/**************************************************************************

	At the end of each page we make sure any partial lines get printed
	(by calling Output).  We reset our m_lnLastSaveByte marker, set our Output buffer
	to white space and reset vertical scaling.  We do the relevant
	newpage function for our device and get out.

	**************************************************************************/

	if (iRunlength==OUREOP)
	{
		if (device->total_lines>1)
		{
			//  while (device->this_line!=device->total_lines)
			//   Output(device,m_lpFaxline,m_lnRow,m_lnLastSaveByte) ;
		}
		//else if (m_lnLastSaveByte!=0) 
		//	   Output(device,m_lpFaxline,m_lnRow,m_lnLastSaveByte) ;
		m_lnLastSaveByte=0 ;
		memset(m_lpFaxline,0x00,m_lnFaxBytes) ;
		m_lnRow = 0 ;
		//VerticalScale(device,(long int)-1) ;
		//newpage(device) ;
		return 1;
	}

	/**************************************************************************

?? 快捷鍵說(shuō)明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
91一区一区三区| 久久久久久久久久久黄色| 67194成人在线观看| 久久免费的精品国产v∧| 亚洲视频中文字幕| 老司机免费视频一区二区三区| 成人福利在线看| 日韩精品自拍偷拍| 亚洲精品欧美在线| 国产老肥熟一区二区三区| 欧美日韩国产免费| 国产精品色噜噜| 久久99精品久久久| 欧美日韩免费观看一区三区| 国产欧美一区二区在线观看| 麻豆精品在线播放| 3atv一区二区三区| 一区二区三区不卡视频在线观看 | 亚洲色图清纯唯美| 久久99在线观看| 91精品国产91久久久久久一区二区 | 亚洲国产精品一区二区久久恐怖片 | 久久亚洲精精品中文字幕早川悠里 | 国产电影一区在线| 日韩一区二区三区观看| 亚洲综合精品久久| 色综合久久综合网欧美综合网| 久久精品人人做人人爽人人| 蓝色福利精品导航| 日韩欧美一区中文| 美国十次了思思久久精品导航| 欧美日韩国产bt| 亚洲成av人片在线观看| 欧美日精品一区视频| 亚洲精品videosex极品| 色久优优欧美色久优优| 一区二区三区国产精华| 在线精品亚洲一区二区不卡| 一区二区三区在线视频免费观看 | 91视视频在线观看入口直接观看www | 国产精品国产成人国产三级| 粉嫩欧美一区二区三区高清影视 | 国产精品资源在线观看| 精品国产三级电影在线观看| 日韩电影免费在线看| 制服丝袜中文字幕一区| 日韩电影在线一区二区| 欧美一区二区精品在线| 精品在线播放免费| 2023国产一二三区日本精品2022| 久久超碰97人人做人人爱| 精品精品国产高清a毛片牛牛| 久久精品国产**网站演员| 欧美成人艳星乳罩| 国产一区二区三区免费在线观看| 久久综合久久鬼色| 成人国产一区二区三区精品| 国产精品美女久久久久久久久| av在线综合网| 一级日本不卡的影视| 欧美久久免费观看| 麻豆精品一二三| 久久久精品日韩欧美| 成人免费黄色在线| 亚洲午夜三级在线| 日韩精品在线网站| 成人动漫视频在线| 性欧美大战久久久久久久久| 日韩精品中文字幕一区| proumb性欧美在线观看| 亚洲午夜影视影院在线观看| 精品播放一区二区| 色哟哟欧美精品| 日韩电影一二三区| 中文字幕一区二区视频| 欧美日韩一区二区在线观看| 极品少妇xxxx偷拍精品少妇| 国产精品福利一区二区三区| 欧美日韩高清一区二区| 韩国中文字幕2020精品| 亚洲人快播电影网| 日韩欧美不卡在线观看视频| 99re这里只有精品视频首页| 日本不卡123| 亚洲欧洲精品一区二区三区不卡| 777久久久精品| 成人久久18免费网站麻豆 | 久久99蜜桃精品| 亚洲另类春色校园小说| 精品久久99ma| 色域天天综合网| 国产成人免费网站| 日本成人在线网站| 一区二区三区美女| 欧美激情艳妇裸体舞| 91精品国产日韩91久久久久久| 国产成人99久久亚洲综合精品| 香蕉av福利精品导航| 国产精品视频一二| 欧美mv和日韩mv的网站| 欧美日韩免费电影| 99久久99精品久久久久久| 激情欧美一区二区三区在线观看| 亚洲国产精品自拍| 亚洲精品国产视频| 亚洲天堂福利av| 国产亚洲精品7777| 精品国产乱码久久久久久蜜臀| 欧美日韩在线观看一区二区| 99久久国产综合精品麻豆| 成人免费看片app下载| 国产成人在线免费观看| 狠狠色狠狠色综合| 美日韩黄色大片| 男人操女人的视频在线观看欧美| 亚洲一区在线观看视频| 自拍av一区二区三区| 中文字幕成人网| 国产精品视频你懂的| 国产精品午夜在线观看| 国产欧美日韩视频在线观看| 久久久青草青青国产亚洲免观| 精品美女一区二区| 日韩免费高清视频| 日韩视频在线永久播放| 欧美电视剧在线看免费| 欧美丰满一区二区免费视频| 欧美性大战久久| 欧美日韩免费不卡视频一区二区三区| 欧美性做爰猛烈叫床潮| 欧美日韩激情在线| 在线综合+亚洲+欧美中文字幕| 7777精品伊人久久久大香线蕉| 日韩视频在线永久播放| 久久综合色一综合色88| 国产日韩精品视频一区| 中文字幕精品一区| 一区二区三区四区不卡在线| 亚洲午夜在线视频| 蜜桃av一区二区三区| 极品瑜伽女神91| av成人动漫在线观看| 色婷婷综合视频在线观看| 欧美婷婷六月丁香综合色| 5月丁香婷婷综合| 久久综合九色综合欧美98| 日本一二三四高清不卡| 亚洲日本韩国一区| 亚洲r级在线视频| 九九国产精品视频| 成人sese在线| 欧美日韩黄色一区二区| 日韩欧美美女一区二区三区| 国产欧美精品区一区二区三区| 亚洲免费在线视频| 日韩av中文在线观看| 国产精品一区二区黑丝| 一本一本大道香蕉久在线精品 | 欧美国产精品劲爆| 亚洲精品视频免费看| 蜜臀av一区二区在线免费观看| 国产剧情一区在线| 在线免费不卡视频| 国产日产欧美一区二区视频| 一区二区三区加勒比av| 国产精品一二三区在线| 欧美伊人久久久久久久久影院| 精品裸体舞一区二区三区| 亚洲精品写真福利| 国产一区二区三区精品欧美日韩一区二区三区 | 一本久道久久综合中文字幕| 欧美日韩另类一区| 中文字幕在线免费不卡| 日韩成人av影视| 91久久线看在观草草青青| 精品久久久久久久久久久久久久久久久 | 亚洲资源中文字幕| 国产精品 欧美精品| 7777精品伊人久久久大香线蕉超级流畅 | 男人的天堂久久精品| 欧美中文一区二区三区| 亚洲国产精品成人综合| 麻豆精品蜜桃视频网站| 欧美天天综合网| 一区二区成人在线| 成人精品小蝌蚪| 久久蜜桃一区二区| 蜜臀va亚洲va欧美va天堂| 欧美主播一区二区三区美女| 亚洲欧洲成人自拍| 国产成人亚洲精品青草天美| 欧美一区二区视频在线观看2022| 亚洲精品日韩专区silk| 99久久免费精品| 久久久久国产精品麻豆| 麻豆高清免费国产一区| 91麻豆精品国产自产在线| 亚洲一区影音先锋| 欧美在线你懂的| 亚洲一区二区视频|