在纯C / C ++编写BMP图像++没有其他图书馆 [英] Writing BMP image in pure c/c++ without other libraries

查看:103
本文介绍了在纯C / C ++编写BMP图像++没有其他图书馆的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的算法,我需要创建信息输出。我必须写在bmp文件布尔矩阵。
它必须是monocromic图像,其中像素是白色,如果这样的元素矩阵是真实的。
主要问题是BMP头和该怎么写。

In my algorithm i need create information output. I must to write boolean matrix in bmp file. It must be monocromic image, where pixel is white if matrix on such element is true. Main problem is bmp header and how to write this.

推荐答案

在不使用任何其他图书馆,你可以看一下<一个href=\"https://web.archive.org/web/20080912171714/http://www.fortunecity.com/skyscraper/windows/364/bmpffrmt.html\"相对=nofollow> BMP格式的文件。我已经实现了它在过去,它可以在不太多的工作要做。

Without the use of any other library you can look at the BMP file format. I've implemented it in the past and it can be done without too much work.

位图文件结构

每个位图文件包含一个
  位图文件头,一个
  位图信息头,一个色
  表,并且字节的数组
  定义位图位。该文件有
  格式如下:

Each bitmap file contains a bitmap-file header, a bitmap-information header, a color table, and an array of bytes that defines the bitmap bits. The file has the following form:

BITMAPFILEHEADER bmfh;结果
  BITMAPINFOHEADER bmih;结果
  RGBQUAD aColors [];结果
  BYTE aBitmapBits [];

BITMAPFILEHEADER bmfh;
BITMAPINFOHEADER bmih;
RGBQUAD aColors[];
BYTE aBitmapBits[];

...详情请参阅文件格式

... see the file format for more details

这篇关于在纯C / C ++编写BMP图像++没有其他图书馆的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆