arkimg.bmp

BMP拡張
ビットマップ画像の基礎的な利用のためのAPIとArkBmpクラスを定義します。
  • Bitmap: ビットマップを取り扱うためのデータクラス。
  • createBitmap: Bitmap を適切に初期化します。
  • ArkBmp: ArkImgのBMP用クラス。
struct BmpSize;
int width;
int height;
struct BitmapFileHeader;
ビットマップフォーマットのファイルヘッダ
ubyte typeH;
ubyte typeL;
ushort type;
"BM"
uint size;
ファイルサイズ
要変更
ushort reserved1;
予約
常に0
ushort reserved2;
予約
常に0
uint offset;
データの開始位置のオフセット
BitmapInformationHeader以外であれば要変更 BitmapFileHeader.sizeof + BitmapInformationHeader.sizeof
template BitmapCoreHeaderImpl()
ビットマップフォーマットの情報ヘッダの中身
short width;
画像の横幅
要変更
short height;
画像の縦幅
要変更
short planes;
プレーン数
常に1
short bitCount;
1ピクセル当たりのビット数
24bit以外であれば要変更
template BitmapInformationHeaderImpl()
ビットマップフォーマットの情報ヘッダの中身
int width;
画像の横幅
要変更
int height;
画像の縦幅
要変更
ushort planes;
プレーン数
常に1
ushort bitCount;
1ピクセル当たりのビット数
32bit以外であれば要変更
uint compression;
圧縮
0であれば無圧縮 それ以外であれば要変更
uint sizeImage;
画像のバイトサイズ
要変更
int xPixPerMeter;
横方向解像度[pixel/m]
96dpiで3780
int yPixPerMeter;
縦方向解像度[pixel/m]
96dpiで3780
uint clrUsed;
色パレット数
パレットを使用する場合は要変更
uint cirImportant;
重要色数
template BitmapInformationHeaderV5Impl()
ビットマップフォーマットの情報ヘッダ
uint redMask;
赤マスク
uint greenMask;
緑マスク
uint blueMask;
青マスク
uint alphaMask;
アルファマスク
uint csType;
カラースペースタイプ
struct CieXyzTriple;
CieXyzTriple endpoints;
XYZ
CieXyz red;
CieXyz green;
CieXyz blue;
uint gammaRed;
赤ガンマ値
uint gammaGreen;
緑ガンマ値
uint gammaBlue;
青ガンマ値
uint intent;
展開意図
uint profileData;
プロファイルデータ
uint profileSize;
プロファイルサイズ
uint reserved;
予約
pure nothrow @nogc @safe void initAlpha();
アルファチャンネルの設定
struct BitmapCoreHeader;
ビットマップフォーマットの情報ヘッダ(V1)
uint size;
この構造体のサイズ
常に40
struct BitmapInformationHeader;
ビットマップフォーマットの情報ヘッダ(V1)
uint size;
この構造体のサイズ
常に40
struct BitmapInformationHeaderV5;
ビットマップフォーマットの情報ヘッダ(V5)
uint size;
この構造体のサイズ
常に124
struct BmpImage;
ビットマップファイルの構造
必ずメモリ上にビット列を含めた十分なサイズを設けること。
Example:
auto bmp = cast(BmpImage*)new ubyte[bmpsz];
等とすること。
pure nothrow @nogc @property ref @system inout(BitmapFileHeader) fileHeader() inout;
ファイルヘッダ
pure nothrow @nogc @property @system inout(ubyte)[] fileBuffer() inout;
ファイル全体のバッファ
pure nothrow @nogc @property @system size_t infoSize() inout;
情報ヘッダーサイズ
pure nothrow @nogc @property ref @system inout(BitmapInformationHeader) info() inout;
情報ヘッダー
pure nothrow @nogc @property ref @system inout(BitmapCoreHeader) coreInfo() inout;
Coreヘッダー
pure nothrow @nogc @property ref @system inout(BitmapInformationHeaderV5) infoV5() inout;
V5情報ヘッダー
pure nothrow @nogc @property size_t imageBufferSize() const;
画像のバッファサイズ
pure nothrow @nogc @property BmpSize size() const;
画像のサイズ
pure nothrow @nogc @property uint channels() const;
画像のチャンネル数
pure nothrow @nogc @property uint stride() const;
画像のストライド(一行のバイト数)
pure nothrow @nogc @property @system inout(uint)[] palette() inout;
パレットのバッファ
pure nothrow @nogc @property @system inout(ubyte)[] dib() inout;
画像のバッファ
pure nothrow @nogc @property @system inout(ubyte)[] row(size_t y) inout;
画像の行バッファ
yは画像の下端(0)から上端へ向かって正方向に進む。
pure nothrow @nogc @system void vflip();
画像の上下逆転
@nogc @system Bitmap alphaBrend(uint color = 16777215) const;
pure @nogc @trusted void initialize(size_t fileHeaderSize, size_t infoHeaderSize, ushort colorPalleteCnt, BmpSize size, uint dep = 8, uint channels = 4);
pure @nogc @safe void initialize(BmpSize size, uint dep = 8, uint channels = 4);
pure @nogc @trusted void initialize(ubyte[] fileBuffer);
初期化
int addRef()();
@nogc @trusted int release()();
pure @nogc Bitmap createBitmap(BmpSize size, uint dep = 8, uint channels = 4);
pure @nogc inout(Bitmap) createBitmap(inout(ubyte)[] fileBuffer = null);
class ArkBmp: arkimg._internal.base.ArkImgBase;
ArkImg for Bitmap
this(in ubyte[] binary = null, in ubyte[] commonKey = null, in ubyte[] iv = null);
コンストラクタ
void load(in ubyte[] binary);
immutable(ubyte)[] save() const;
void baseImage(in ubyte[] binary, string mimeType = null);
immutable(ubyte)[] baseImage(string mimeType = null);
PRIMITIVES