Can now save and load animations

This commit is contained in:
dalyjame
2019-07-01 12:50:01 -04:00
parent e9284e2158
commit adef7235f1
3 changed files with 95 additions and 19 deletions

View File

@@ -47,4 +47,20 @@ class Palette(val image: Image, val numAcross: Int, val numDown: Int) {
this(x, y)
}
}
}
object Palette {
def square(stream: InputStream, numAcross: Int) = {
val img = new Image(stream)
val size = img.width() / numAcross
val numDown = img.height() / size
new Palette(img, numAcross, numDown.toInt)
}
def bySize(stream: InputStream, width: Double, height: Double) = {
val img = new Image(stream)
val numAcross = img.width() / width
val numDown = img.height() / height
new Palette(img, numAcross.toInt, numDown.toInt)
}
}