Skip to content

Latest commit

 

History

History

bmp2img

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

bmp2img command

Description

bmp2img コマンドは 256 色の Bitmap フォーマットの画像ファイルを VGS::GFX や VGS::VDP で扱えるイメージ形式(RGB565 の const unsigned short 型配列)を宣言するC言語のプログラムコードに変換します。

Usage

bmp2img [-t WxH] /path/to/file.bmp

-t WxH オプションを指定すると、画像を指定サイズ(WxH)のタイルパターンとして左上から順番にイメージ形式への変換をします。

例えば、画像サイズが 128x128 の image.bmp に -t 8x8 を指定すると、次のような順序で出力されます。

  1. rom_image[0~63] (1番目) = 左上の 8x8
  2. rom_image[64~127] (2番目) = 1番目の1つ右側の 8x8
  3. rom_image[128〜191] (3番目) = 2番目の1つ右側の 8x8
  4. rom_image[1024〜1087] (17番目) = 1番目の1つ下側の 8x8
  5. rom_image[16320〜16383] (256番目) = 右下の8x8

なお、上記の例は VGS::VDPのptnテーブル形式 としてそのまま使用できます。

Example

% bmp2img -t 8x8 example/assets/vram_ptn.bmp
const unsigned short rom_vram_ptn[16384] = {
    0x431B, 0x0000, 0x5729, 0x0000, 0x0000, 0x5729, 0x0000, 0x431B, 0x0000, 0x431B, 0x0000, 0x431B, 0x431B, 0x0000, 0x431B, 0x0000,
    0x5729, 0x0000, 0x431B, 0x0000, 0x0000, 0x431B, 0x0000, 0x7331, 0x0000, 0x431B, 0x0000, 0xC115, 0xC115, 0x0000, 0x431B, 0x0000,
(中略)
    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000
};