handle NaN in images

This commit is contained in:
Max Bradbury 2020-04-28 18:12:56 +01:00
parent f899f03dbe
commit b2f601e778
2 changed files with 1 additions and 1 deletions

View File

@ -66,7 +66,6 @@ some more practical uses would be things like:
* add Bitsy HD and Bitsy 7.0 test data
* fix variables/endings becoming "DLG DLG"?
* dedupe "animation frames from string" functionality
* handle NaN in images (convert to 0? investigate)
### tidy up

View File

@ -7,6 +7,7 @@ impl From<String> for Image {
#[inline]
fn from(string: String) -> Image {
let string = string.replace("\n", "");
let string = string.replace("NaN", "0");
let pixels: Vec<&str> = string.split("").collect();
// the above seems to add an extra "" at the start and end of the vec, so strip them below
let pixels = &pixels[1..(pixels.len() - 1)];