You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#![allow(non_snake_case)]use lodepng::*;use std::process::Command;// used to execute OS commands that calls a PNG image viewerfnmain(){// PNG encode a simple tri-color imageconstW:usize = 300;constH:usize = 600;letmut img = [[0_u8;4];W*H];for frame in1..6{let f8 :u8 = 30*frame asu8;for h in0..H{for w in0..W{ img[h*W +w ] =
match h/200{0 => [ f8,0_u8,0_u8,255_u8],1 => [0_u8, f8,0_u8,255_u8],
_ => [0_u8,0_u8, f8,255_u8],};}}//Save image: the buffer can be a slice of any type that has 4 bytes per element e.g. struct RGBA or [u8; 4]let _result =encode32_file("out.png",&img,W,H);// set up cmd that calls The OS PNG viewer...below the Linux feh viewer is called// let result =Command::new("feh").arg("out.png").status()//.output().expect("failed to execute command");}}
The text was updated successfully, but these errors were encountered:
The text was updated successfully, but these errors were encountered: