fn load_image_gen_points(png_filename: &str) -> Vec<(f32, f32)> 
{
    // Use the open function to load an image from a Path.
    // ```open``` returns a dynamic image.
    let ResultImg = image::open(&Path::new(& png_filename));
    let img = match ResultImg {
        Ok(img) => img,
        _       => {
                        println!("Error: While reading PNG file");
                        process::exit(1);
                    }, 
    };

    let (width, height) = img.dimensions();
    
    // The dimensions method returns the images width and height
    //println!("dimensions {:?}", img.dimensions());

    // The color method returns the image's ColorType
    // println!("{:?}", img.color());
    
    let mut list_points: Vec<(f32,f32)> = vec![];

    // println!("Img width: {},  {}", width, height );
    let mut max_x: f32 = 0.0;
    let mut max_y: f32 = 0.0;
    
    for y in (0..height).step_by(2) {
        for x in (0..width).step_by(2) {
            let pixel = img.get_pixel(x, y);
            // println!(" x: {}  y: {}  Pixel: {:?}", x, y, pixel);
            if pixel == image::Rgba([0, 0, 0, 255]) {
                // println!("{:?}", pixel);
                let new_x = ((x as f32 - (width  as f32 / 2.0)) * 2.0) / (width as f32);
                let new_y = ((y as f32 - (height as f32 / 2.0)) * 2.0) / (height as f32);
                if new_x > max_x {
                    max_x = new_x;
                }
                if new_y > max_y {
                    max_y = new_y;
                }
                list_points.push( (new_x, new_y) );
            }
         }    
    }

    // Points in the limit
    list_points.push( (-1.0, -1.0) );
    list_points.push( (-1.0,  1.0) );
    list_points.push( ( 1.0, -1.0) );
    list_points.push( ( 1.0,  1.0) );
    list_points.push( ( 0.0,   0.0) );

    list_points
}
/// Load the image using `png`
Load the image using `png`
Load the image using ` png `
fn load_image_gen_points(png_filename: &str) -> Vec<(f32, f32)> 
{
    // Use the open function to load an image from a Path.
    // ```open``` returns a dynamic image.
    let ResultImg = image::open(&Path::new(& png_filename));
    let img = match ResultImg {
        Ok(img) => img,
        _       => {
                        println!("Error: While reading PNG file");
                        process::exit(1);
                    }, 
    };
    let (width, height) = img.dimensions();
    // The dimensions method returns the images width and height
    //println!("dimensions {:?}", img.dimensions());
    // The color method returns the image's ColorType
    // println!("{:?}", img.color());
    let mut list_points: Vec<(f32,f32)> = vec![];
    // println!("Img width: {},  {}", width, height );
    let mut max_x: f32 = 0.0;
    let mut max_y: f32 = 0.0;
    for y in (0..height).step_by(2) {
        for x in (0..width).step_by(2) {
            let pixel = img.get_pixel(x, y);
            // println!(" x: {}  y: {}  Pixel: {:?}", x, y, pixel);
            if pixel == image::Rgba([0, 0, 0, 255]) {
                // println!("{:?}", pixel);
                let new_x = ((x as f32 - (width  as f32 / 2.0)) * 2.0) / (width as f32);
                let new_y = ((y as f32 - (height as f32 / 2.0)) * 2.0) / (height as f32);
                if new_x > max_x {
                    max_x = new_x;
                }
                if new_y > max_y {
                    max_y = new_y;
                }
                list_points.push( (new_x, new_y) );
            }
         }    
    }
    // Points in the limit
    list_points.push( (-1.0, -1.0) );
    list_points.push( (-1.0,  1.0) );
    list_points.push( ( 1.0, -1.0) );
    list_points.push( ( 1.0,  1.0) );
    list_points.push( ( 0.0,   0.0) );
    list_points
}
fn load_image_gen_points ( png_filename : & str ) -> Vec < ( f32 , f32 ) > { // Use the open function to load an image from a Path. // ```open``` returns a dynamic image. let ResultImg = image :: open ( & Path :: new ( & png_filename ) ) ; let img = match ResultImg { Ok ( img ) => img , _ => { println ! ( " " ) ; process :: exit ( 1 ) ; } , } ; let ( width , height ) = img . dimensions ( ) ; // The dimensions method returns the images width and height //println!("dimensions {:?}", img.dimensions()); // The color method returns the image's ColorType // println!("{:?}", img.color()); let mut list_points : Vec < ( f32 , f32 ) > = vec ! [ ] ; // println!("Img width: {},  {}", width, height ); let mut max_x : f32 = 0.0 ; let mut max_y : f32 = 0.0 ; for y in ( 0 .. height ) . step_by ( 2 ) { for x in ( 0 .. width ) . step_by ( 2 ) { let pixel = img . get_pixel ( x , y ) ; // println!(" x: {}  y: {}  Pixel: {:?}", x, y, pixel); if pixel == image :: Rgba ( [ 0 , 0 , 0 , 255 ] ) { // println!("{:?}", pixel); let new_x = ( ( x as f32 - ( width as f32 / 2.0 ) ) * 2.0 ) / ( width as f32 ) ; let new_y = ( ( y as f32 - ( height as f32 / 2.0 ) ) * 2.0 ) / ( height as f32 ) ; if new_x > max_x { max_x = new_x ; } if new_y > max_y { max_y = new_y ; } list_points . push ( ( new_x , new_y ) ) ; } } } // Points in the limit list_points . push ( ( - 1.0 , - 1.0 ) ) ; list_points . push ( ( - 1.0 , 1.0 ) ) ; list_points . push ( ( 1.0 , - 1.0 ) ) ; list_points . push ( ( 1.0 , 1.0 ) ) ; list_points . push ( ( 0.0 , 0.0 ) ) ; list_points }
Load the image using `png`
Load the image using ` png `
png_filename
&str