如何解决从头开始在 C 中读取和绘制 BMP 图像
我正在开发自己的操作系统,使用 gnu-efi,我编写了一个小的 BMP 图像加载程序。
当我在屏幕上绘制仅在像素上显示蓝色时,我可以成功读取其标题和数据(不确定)。
//蓝色像素是绘制BMP图像
如何用颜色加载它?
EXPLAIN PLAN SET STATEMENT_ID = 'test3' for select * from EVENT where timestamp between 1620741600000 and 1621900800000 and status = 'CANC';
SELECT * FROM PLAN_TABLE WHERE STATEMENT_ID = 'test3';
颜色取值为 0xFFFFFFFF;
以下是我的 bmp 加载器:
BMP.h
PlotPixel(x,y,color)
BMP.c
// bmp.h
#define WIN_BITMAP_SIGNATURE 0x4D42 // BM [ASCII]
#define BMP_HEADER_SIZE 54
#define DIB_HEADER_SIZE 40
#pragma pack(push,1)
typedef struct
{
uint16_t bfType; // The characters "BM" - 2 Bytes
uint32_t bfSize; // The size of the file in bytes - 4 Bytes
uint16_t bfReserved1; // Unused - must be zero - 2 Bytes
uint16_t bfReserved2; // Unused - must be zero - 2 Bytes
uint32_t bfOffBits; // Offset to start of Pixel Data - 4 Bytes
uint32_t biSize; // DIB Header Size - 4 Bytes
int32_t biWidth; // Width - 4 Bytes
int32_t biHeight;
uint16_t biPlanes;
uint16_t biBitCount;
uint32_t biCompression;
uint32_t biSizeImage;
int32_t biXPexelsPerMeter;
int32_t biYPexelsPerMeter;
uint32_t biClrUsed;
uint32_t biClrImportant;
} BITMAP_HEADER;
typedef struct
{
BITMAP_HEADER* header;
uint8_t* data;
} BITMAP_IMG;
typedef struct
{
uint32_t red_mask;
uint32_t green_mask;
uint32_t blue_mask;
uint32_t alpha_mask;
uint32_t color_space_type;
uint32_t unused[16];
} BMPColorHeader;
#pragma pack(pop)
unsigned long createRGBA(int r,int g,int b,int a);
unsigned long createRGB(int r,int b);
BITMAP_IMG* LoadBMPImage(EFI_FILE* Directory,CHAR16* Path,EFI_HANDLE ImageHandle,EFI_SYstem_TABLE* SystemTable);
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。