c语言加载位图函数 c语言加载配置文件( 二 )


output_b[height-1-j][i]=pix[i*3];
}
}
for(i =0; iheight; i++)
{
for(j = 0; jwidth-1; j++)
{
fprintf(fpb,"%4d",b[i][j]);
fprintf(fpg,"%4d",g[i][j]);
fprintf(fpr,"%4d",r[i][j]);
}
fprintf(fpb,"%4d\n",b[i][j]);
fprintf(fpg,"%4d\n",g[i][j]);
fprintf(fpr,"%4d\n",r[i][j]);
}
fclose(fpr);
fclose(fpg);
fclose(fpb);
}
void bmpFileTest(FILE* fpbmp)
{
unsigned short bfType = 0;
fseek(fpbmp, 0L, SEEK_SET);//seek_set 起始位置
fread(bfType, sizeof(char), 2, fpbmp);
if (BM != bfType)
{
printf("This file is not bmp file.!!!\n");
exit(1);
}
}
/* To get the OffSet of header to data part */
void bmpHeaderPartLength(FILE* fpbmp)
{
fseek(fpbmp, 10L, SEEK_SET);
fread(OffSet, sizeof(char), 4, fpbmp);
printf("The Header Part is of length %d.\n", OffSet);
}
/* To get the width and height of the bmp file */
void BmpWidthHeight(FILE* fpbmp)
{
fseek(fpbmp, 18L, SEEK_SET);
fread(width, sizeof(char), 4, fpbmp);
fseek(fpbmp, 22L, SEEK_SET);
fread(height, sizeof(char), 4, fpbmp);
printf("The Width of the bmp file is %ld.\n", width);
printf("The Height of the bmp file is %ld.\n", height);
}
c语言加载位图没用看懂的人,总是会说不实用的.
有句话说 拙匠总怪工具差
用c语言编个程序,我想用 BitBlt 加载掩码图和位图实现,让活动的人物背景透明 。可以试试TransparentBlt 函数 。
BOOL TransparentBlt(HDC hdcDest, int nXOriginDest, int nYOriginDest, int nWidthDest, int hHeightDest, HDC hdcSrc, int nXOriginSrc, int nYOriginSrc, int nWidthSrc, int nHeightSrc, UINT crTransparent);
crTransparent:源位图中的RGB值当作透明颜色 。
比如:人物图片底色是黑色 , 用TransparentBlt函数blt图片,参数crTransparent设为黑色RGB(0,0,0) , 就能完成透明拷贝 。
c语言加载位图函数的介绍就聊到这里吧,感谢你花时间阅读本站内容,更多关于c语言加载配置文件、c语言加载位图函数的信息别忘了在本站进行查找喔 。

推荐阅读