91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 10KB
    文件類型: .zip
    金幣: 2
    下載: 2 次
    發布日期: 2021-06-07
  • 語言: C/C++
  • 標簽: C語言??

資源簡介

c語言 jpg轉換bmp格式 不用任何庫 無錯誤 正確運行 c語言 jpg轉換bmp格式 不用任何庫 無錯誤 正確運行 c語言 jpg轉換bmp格式 不用任何庫 無錯誤 正確運行

資源截圖

代碼片段和文件信息



#include?
#include?
#include?“xixi.h“
//#include?“stdafx.h“
char?*FileName?=?“image.jpg“;
extern?char?error_string[90];





typedef?struct?s_BM_header?{
WORD?BMP_id;?//?‘B‘‘M‘
DWORD?size;?//?size?in?bytes?of?the?BMP?file
DWORD?zero_res;?//?0
DWORD?offbits;?//?54
DWORD?biSize;?//?0x28
DWORD?Width;??//?X
DWORD?Height;??//?Y
WORD??biPlanes;?//?1
WORD??biBitCount;?//?24
DWORD?biCompression;?//?0?=?BI_RGB
DWORD?biSizeImage;?//?0
DWORD?biXPelsPerMeter;?//?0xB40
DWORD?biYPelsPerMeter;?//?0xB40
DWORD?biClrUsed;?//0
DWORD?biClrImportant;?//0
}?BM_header;
typedef?struct?s_RGB?{
BYTE?B;
BYTE?G;
BYTE?R;
}?RGB;

void?exitmessage(char?*message)
{
printf(“%s\n“?message);?exit(0);
}

void?write_buf_to_BMP(BYTE?*im_buffer?WORD?X_bitmap?WORD?Y_bitmap?char?*BMPname)
{
SWORD?x?y;
RGB?*pixel;
BM_header?BH;
FILE?*fp_bitmap;
DWORD?im_loc_bytes;
BYTE?nr_fillingbytes?i;
BYTE?zero_byte?=?0;

fopen_s(&fp_bitmap?BMPname?“wb“);
if?(fp_bitmap?==?NULL)?exitmessage(“File?cannot?be?created“);

if?(X_bitmap?%?4?!=?0)?nr_fillingbytes?=?4?-?((X_bitmap?*?3L)?%?4);
else?nr_fillingbytes?=?0;

BH.BMP_id?=?‘M‘?*?256?+?‘B‘;?????fwrite(&BH.BMP_id?2?1?fp_bitmap);
BH.size?=?54?+?Y_bitmap*(X_bitmap?*?3?+?nr_fillingbytes);?fwrite(&BH.size?4?1?fp_bitmap);
BH.zero_res?=?0;?????????????fwrite(&BH.zero_res?4?1?fp_bitmap);
BH.offbits?=?54;?????????????fwrite(&BH.offbits?4?1?fp_bitmap);
BH.biSize?=?0x28;????????????fwrite(&BH.biSize?4?1?fp_bitmap);
BH.Width?=?X_bitmap; ??????fwrite(&BH.Width?4?1?fp_bitmap);
BH.Height?=?Y_bitmap; ??????fwrite(&BH.Height?4?1?fp_bitmap);
BH.biPlanes?=?1;?????????????fwrite(&BH.biPlanes?2?1?fp_bitmap);
BH.biBitCount?=?24;??????????fwrite(&BH.biBitCount?2?1?fp_bitmap);
BH.biCompression?=?0;????????fwrite(&BH.biCompression?4?1?fp_bitmap);
BH.biSizeImage?=?0;??????????fwrite(&BH.biSizeImage?4?1?fp_bitmap);
BH.biXPelsPerMeter?=?0xB40;??fwrite(&BH.biXPelsPerMeter?4?1?fp_bitmap);
BH.biYPelsPerMeter?=?0xB40;??fwrite(&BH.biYPelsPerMeter?4?1?fp_bitmap);
BH.biClrUsed?=?0; ??????????fwrite(&BH.biClrUsed?4?1?fp_bitmap);
BH.biClrImportant?=?0; ??????fwrite(&BH.biClrImportant?4?1?fp_bitmap);

printf(“Writing?bitmap?...\n“);
im_loc_bytes?=?(DWORD)im_buffer?+?((DWORD)Y_bitmap?-?1)*X_bitmap?*?4;

for?(y?=?0;?y {
for?(x?=?0;?x {
pixel?=?(RGB?*)im_loc_bytes;
fwrite(pixel?3?1?fp_bitmap);
im_loc_bytes?+=?4;
}
for?(i?=?0;?i fwrite(&zero_byte?1?1?fp_bitmap);
im_loc_bytes?-=?2L?*?X_bitmap?*?4;
}
printf(“Done.\n“);
fclose(fp_bitmap);
}



//?Used?markers:
#define?SOI?0xD8
#define?EOI?0xD9
#define?APP0?0xE0
#define?SOF?0xC0
#define?DQT?0xDB
#define?DHT?0xC4
#define?SOS?0xDA
#define?DRI?0xDD
#define?COM?0xFE

char?error_string[90];
//char?err[90];
void?exit_func(char?*err)?{
strcpy(error

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2018-04-03?16:49??C語言JPG轉BMP\
?????文件???????33036??2018-04-03?16:40??C語言JPG轉BMP\xixi.c
?????文件?????????490??2018-04-03?16:03??C語言JPG轉BMP\xixi.h

評論

共有 條評論