xxxx18一60岁hd中国/日韩女同互慰一区二区/西西人体扒开双腿无遮挡/日韩欧美黄色一级片 - 色护士精品影院www

  • 大小: 5KB
    文件類型: .rar
    金幣: 2
    下載: 0 次
    發布日期: 2021-05-29
  • 語言: 其他
  • 標簽: BMP??8位????24位??

資源簡介

網上找了半天沒找到,自己整理的 BMP 8位轉24位

資源截圖

代碼片段和文件信息

//?ConvertBMP.cpp?:?定義控制臺應用程序的入口點。
//

#include?“stdafx.h“
#include?

#define?WIDTHBYTES(bits)?((bits?+?31)/32*4)

BOOL?Convert8To24(RGBQUAD?*?pColorTable?BYTE*?srcImage?BYTE*?dstImage?LONG?imageWidthLONG?imageHeight)
{
LONG?lLineBytes24?=?((imageWidth*24+31)/32*4);
LONG?lLineBytes8?=?((imageWidth*8+31)/32*4);

int?i?j?n;
for(i?=?0;?i? {
for(j?=?0?n?=?0;?j? {
int?num?=?*(srcImage+lLineBytes8*i+j);?//?獲取8位中調色板信息的偏移量
*(dstImage+lLineBytes24*i+n)?=?pColorTable[num].rgbBlue;
n++;
*(dstImage+lLineBytes24*i+n)?=?pColorTable[num].rgbGreen;
n++;
*(dstImage+lLineBytes24*i+n)?=?pColorTable[num].rgbRed;
n++;
}
}
return?true;
}

void?ChangeBmpHeader(PBITMAPFILEHEADER?pbfheader?PBITMAPINFOHEADER?pbiheader?WORD?wType)
{

pbiheader->biBitCount?=?wType;?//?24?或者?8
pbiheader->biClrUsed?=?(wType?==?24)???0?:?256;
pbiheader->biClrImportant?=?(wType?==?24)???0?:?256;
pbfheader->bfOffBits?=?sizeof(BITMAPFILEHEADER)?+?sizeof(BITMAPINFOHEADER)?+?pbiheader->biClrUsed?*?sizeof(RGBQUAD);?
pbiheader->biSizeImage?=?WIDTHBYTES(pbiheader->biWidth?*?pbiheader->biBitCount)?*?pbiheader->biHeight;
pbfheader->bfSize?=?pbfheader->bfOffBits?+?pbiheader->biSizeImage;
}

int?_tmain(int?argc?_TCHAR*?argv[])
{
FILE*?fpSrc?=?fopen(“1.bmp““rb+“);
if(fpSrc?==?NULL)?return?false;

//?讀取BMP文件頭信息
BITMAPFILEHEADER?bf;
fread(&bf?sizeof(BITMAPFILEHEADER)?1?fpSrc);

//?讀取位圖信息頭
BITMAPINFOHEADER?bi;
fread(&bi?sizeof(BITMAPINFOHEADER)?1?fpSrc);

int?bmpWidth?=?bi.biWidth;
int?bmpHeight?=?bi.biHeight;
int?biBitCount?=?bi.biBitCount;

RGBQUAD?*pColorTable;
if(bi.biBitCount?==?8)?{
pColorTable=new?RGBQUAD[256];
fread(pColorTable?sizeof(RGBQUAD)?256?fpSrc);
}
else?if(bi.biBitCount?==?24){
fclose(fpSrc);
return;
}

int?lineByte=(bmpWidth?*?biBitCount/8+3)/4*4;

unsigned?char?*pBmpBuf;

pBmpBuf?=?new?unsigned?char[lineByte?*?bmpHeight];
fread(pBmpBuf?1?lineByte?*?bmpHeight?fpSrc);

//fclose(fpSrc);
//----------------------------------------------------------------
//FILE*?fpDes?=?fopen(“2.bmp““wb“);
//if(fpDes?==?NULL)
//{
// fclose(fpSrc);
// return?FALSE;
//}

rewind(fpSrc);
ChangeBmpHeader(&bf?&bi?24);
fwrite(&bf?sizeof(BITMAPFILEHEADER)?1?fpSrc);
fwrite(&bi?sizeof(BITMAPINFOHEADER)?1?fpSrc);

int?lineByte24?=?(bmpWidth?*?bi.biBitCount/8+3)/4*4;
unsigned?char?*dstImage;
dstImage?=?new?unsigned?char[lineByte24?*?bmpHeight];

Convert8To24(pColorTable?pBmpBuf?dstImage?bmpWidth?bmpHeight);
fwrite(dstImage?lineByte24?*?bmpHeight?1?fpSrc);

delete?[]?pBmpBuf;
delete?[]?dstImage;
fclose(fpSrc);
}

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----

?????文件???????2798??2017-07-20?18:20??ConvertBMP\ConvertBMP.cpp

?????文件???????4142??2017-07-12?18:42??ConvertBMP\ConvertBMP.vcxproj

?????文件???????1314??2017-07-12?18:42??ConvertBMP\ConvertBMP.vcxproj.filters

?????文件????????376??2017-07-12?19:00??ConvertBMP\ConvertBMP.vcxproj.user

?????文件???????1574??2017-07-12?18:42??ConvertBMP\ReadMe.txt

?????文件????????215??2017-07-12?18:42??ConvertBMP\stdafx.cpp

?????文件????????233??2017-07-12?18:42??ConvertBMP\stdafx.h

?????文件????????236??2017-07-12?18:42??ConvertBMP\targetver.h

?????目錄??????????0??2017-07-20?18:19??ConvertBMP

-----------?---------??----------?-----??----

????????????????10888????????????????????9


評論

共有 條評論