fn gray2rgba (&self, 
                    grayimage: image::ImageBuffer<image::Luma<u8>, Vec<u8>>,
                    r_factor : f32,
                    g_factor : f32,
                    b_factor : f32
                    )
                    -> image::ImageBuffer<image::Rgba<u8>, Vec<u8>> {
        let mut r: u8 ;
        let mut g: u8 ;
        let mut b: u8 ;
        let mut a: u8 ;
        let mut new_buffer = Vec::new();
        let width = grayimage.width();
        let height = grayimage.height();

        for luma in image::ImageBuffer::into_raw (grayimage) {
            if luma == 255 {
                r=255;
                g=255;
                b=255;
            }else{
            r = (luma as f32 / r_factor) as u8;
            g = (luma as f32 / g_factor) as u8;
            b = (luma as f32 / b_factor) as u8;
            }
            a = 255;
            new_buffer.push(b);
            new_buffer.push(g);
            new_buffer.push(r);
            new_buffer.push(a);
        }
        let imgbuf : image::ImageBuffer<image::Rgba<u8>, _> = image::ImageBuffer::from_raw(width as u32, height as u32, new_buffer).unwrap();
            imgbuf
    }
/// convert grayscale format image to rgba format
convert grayscale format image to rgba format
convert grayscale format image to rgba format
fn gray2rgba (&self, 
                    grayimage: image::ImageBuffer<image::Luma<u8>, Vec<u8>>,
                    r_factor : f32,
                    g_factor : f32,
                    b_factor : f32
                    )
                    -> image::ImageBuffer<image::Rgba<u8>, Vec<u8>> {
        let mut r: u8 ;
        let mut g: u8 ;
        let mut b: u8 ;
        let mut a: u8 ;
        let mut new_buffer = Vec::new();
        let width = grayimage.width();
        let height = grayimage.height();
        for luma in image::ImageBuffer::into_raw (grayimage) {
            if luma == 255 {
                r=255;
                g=255;
                b=255;
            }else{
            r = (luma as f32 / r_factor) as u8;
            g = (luma as f32 / g_factor) as u8;
            b = (luma as f32 / b_factor) as u8;
            }
            a = 255;
            new_buffer.push(b);
            new_buffer.push(g);
            new_buffer.push(r);
            new_buffer.push(a);
        }
        let imgbuf : image::ImageBuffer<image::Rgba<u8>, _> = image::ImageBuffer::from_raw(width as u32, height as u32, new_buffer).unwrap();
            imgbuf
    }
fn gray2rgba ( & self , grayimage : image :: ImageBuffer < image :: Luma < u8 > , Vec < u8 > > , r_factor : f32 , g_factor : f32 , b_factor : f32 ) -> image :: ImageBuffer < image :: Rgba < u8 > , Vec < u8 > > { let mut r : u8 ; let mut g : u8 ; let mut b : u8 ; let mut a : u8 ; let mut new_buffer = Vec :: new ( ) ; let width = grayimage . width ( ) ; let height = grayimage . height ( ) ; for luma in image :: ImageBuffer :: into_raw ( grayimage ) { if luma == 255 { r = 255 ; g = 255 ; b = 255 ; } else { r = ( luma as f32 / r_factor ) as u8 ; g = ( luma as f32 / g_factor ) as u8 ; b = ( luma as f32 / b_factor ) as u8 ; } a = 255 ; new_buffer . push ( b ) ; new_buffer . push ( g ) ; new_buffer . push ( r ) ; new_buffer . push ( a ) ; } let imgbuf : image :: ImageBuffer < image :: Rgba < u8 > , _ > = image :: ImageBuffer :: from_raw ( width as u32 , height as u32 , new_buffer ) . unwrap ( ) ; imgbuf }
convert grayscale format image to rgba format
convert grayscale format image to rgba format
&self
grayimage
image::ImageBuffer<image::Luma<u8>, Vec<u8>>
r_factor
f32
g_factor
f32
b_factor
f32
&self
grayimage
image::ImageBuffer<image::Luma<u8>, Vec<u8>>
r_factor
f32
g_factor
f32
b_factor
f32