How danfekete/bmp2c works
bmp2c is a command-line bitmap-to-C-data converter. Its main workflow parses options and an input path, reads a bitmap, prepares grayscale pixels, converts them to a monochrome image with optional Floyd–Steinberg dithering, run-length encodes the result, and writes a C header. An optional test mode decodes the compressed bitmap through a drawing callback for display. The README is empty; relationships below are based on the shown main routine and source-index references, so unsampled behavior is not inferred.
Main entry points: buffer.c Color buffer · rle.c RLE encoder · bmp.c BMP reader · mono.c Monochrome processing
Components 10
Input and options
- Option parser
argparse/argparse.c - BMP reader
src/bmp.c
Image processing
- Color buffer
src/buffer.c - Color conversion
src/color.c - Monochrome processing
src/mono.c
Encoding and output
- RLE encoder
src/rle.c - Header writer
src/h_writer.c - Test renderer
src/draw.c
Other components
- CLI user
- Display callback
src/main.c
Connections 11
- CLI user → Option parser: provides options
- Option parser → BMP reader: selects input
- CLI user → BMP reader: provides bitmap
- BMP reader → Color buffer: returns pixels
src/bmp.c - Color buffer → Color conversion: uses color data
- Color buffer → Monochrome processing: supplies pixels
src/mono.c - CLI user → Monochrome processing: runs conversion
- Monochrome processing → RLE encoder: encodes pixels
src/rle.c - RLE encoder → Header writer: writes encoded data
- RLE encoder → Test renderer: decodes for test
- Test renderer → Display callback: calls callback