| Crates.io | bmp_rs |
| lib.rs | bmp_rs |
| version | 0.0.9 |
| created_at | 2017-08-13 14:37:21.717129+00 |
| updated_at | 2018-02-24 22:33:53.040026+00 |
| description | A bitmap file decoder for Microsoft bmp files |
| homepage | http://www.drywa.me |
| repository | https://github.com/TheSatoshiChiba/bmp_rs |
| max_upload_size | |
| id | 27405 |
| size | 43,886 |
A bitmap file decoder for Microsoft bmp files.
The following is a rough list of things that are already supported or will be in the future:
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
}
See LICENSE file.