如何在C语言中实现复杂度极高的位图创建过程?
- 内容介绍
- 文章标签
- 相关推荐
本文共计222个文字,预计阅读时间需要1分钟。
我想知道如何从C语言中导入和导出位图。基本上,我不知道从哪里开始。内存中的位图看起来像是这样的:
cstruct Image { int width; int height; char *data; // 1 byte per channel, only 1 channel=grayscale}
我想知道我如何能够从C导入和导出位图.我基本上不知道从哪里开始. 内存中的位图看起来类似于:struct Image { int width; int height; char *data; // 1 byte per channel & only 1 channel == grayscale } struct Image theImage; theImage.width = 100; theImage.height = 100; theImage.data = malloc(sizeof(char) * theImage.width * theImage.height);
至于导入和导出,有一些非常简单的文件格式,请看一下BMP.对于更复杂的格式,最好使用已有的库.
大多数框架已经有最常见的文件格式的加载/保存方法.如果你正在寻找一个轻量级的库,你可以看看SDL.
本文共计222个文字,预计阅读时间需要1分钟。
我想知道如何从C语言中导入和导出位图。基本上,我不知道从哪里开始。内存中的位图看起来像是这样的:
cstruct Image { int width; int height; char *data; // 1 byte per channel, only 1 channel=grayscale}
我想知道我如何能够从C导入和导出位图.我基本上不知道从哪里开始. 内存中的位图看起来类似于:struct Image { int width; int height; char *data; // 1 byte per channel & only 1 channel == grayscale } struct Image theImage; theImage.width = 100; theImage.height = 100; theImage.data = malloc(sizeof(char) * theImage.width * theImage.height);
至于导入和导出,有一些非常简单的文件格式,请看一下BMP.对于更复杂的格式,最好使用已有的库.
大多数框架已经有最常见的文件格式的加载/保存方法.如果你正在寻找一个轻量级的库,你可以看看SDL.

