bmp_rs

Crates.iobmp_rs
lib.rsbmp_rs
version0.0.9
sourcesrc
created_at2017-08-13 14:37:21.717129
updated_at2018-02-24 22:33:53.040026
descriptionA bitmap file decoder for Microsoft bmp files
homepagehttp://www.drywa.me
repositoryhttps://github.com/TheSatoshiChiba/bmp_rs
max_upload_size
id27405
size43,886
Daniel Drywa (TheSatoshiChiba)

documentation

README

bmp_rs

A bitmap file decoder for Microsoft bmp files.

Development Status

The following is a rough list of things that are already supported or will be in the future:

  • 1-bit bitmap
  • 4-bit uncompressed bitmap
  • 4-bit compressed bitmap
  • 8-bit uncompressed bitmap
  • 8-bit compressed bitmap
  • 16-bit bitmap
  • 24-bit bitmap
  • 32-bit bitmap
  • Microsoft BMP Version 1 header
  • Microsoft BMP Version 2 header
  • Microsoft BMP Version 3 header
  • Microsoft BMP Version 4 header
  • Microsoft BMP Version 5 header
  • IBM OS/2 1.x BMP header (32k x 32k limit)
  • IBM OS/2 2.x BMP header
  • OS/2 Bitmap Array type
  • OS/2 Color Icon type
  • OS/2 Color Pointer type
  • OS/2 Struct Icon type
  • OS/2 Pointer type
  • Extended decoding that returns header data
  • Bitmap Encoding
  • Test suite
  • Documentation
  • Examples

Example

use std::fs::File;
use bmp_rs::{
    Result,
    Decoder,
};

struct ImageDecoder {
    // Your builder type that is able to construct an image
}

struct Image {
    // Your image type that represents a bitmap
}

impl Decoder for ImageDecoder {
    type TResult = Image; // Your image type

    fn set_size( &mut self, width: u32, height: u32 ) {
        // Set image size
    }

    fn set_pixel( &mut self, x: u32, y: u32, r: u8, g: u8, b: u8, a: u8 ) {
        // Set a specific pixel within that image to the given color
    }

    fn build( &mut self ) -> Result<Self::TResult> {
        // Build and return your final image
        Ok ( Image { } )
    }
}

fn main() {
    let mut file = File::open( "image.bmp" ).unwrap();
    let image = bmp_rs::decode( &mut file, ImageDecoder { } );
    // Do something with your image
}

License

See LICENSE file.

Commit count: 0

cargo fmt