Added cool new reconstructors™️

This commit is contained in:
Anuken
2020-06-09 23:11:02 -04:00
parent 9fbe421905
commit a51a8d7473
12 changed files with 1803 additions and 1826 deletions

View File

@ -4,6 +4,7 @@ sourceSets.main.java.srcDirs = ["src/"]
import arc.struct.*
import arc.graphics.*
import arc.packer.*
import arc.util.Tmp
import javax.imageio.ImageIO
import java.awt.*
@ -261,6 +262,35 @@ task swapColors(){
}
}
task genPalette(){
doLast{
def total = 0
def size = 32
def outImage = new BufferedImage(size, size, BufferedImage.TYPE_INT_ARGB)
def colorsUsed = new IntSet()
fileTree(dir: '../core/assets-raw/sprites/blocks', include: "**/*.png").visit{ file ->
if(file.isDirectory()) return
def img = ImageIO.read(file.file)
for(x in (0..img.getWidth() - 1)){
for(y in (0..img.getHeight() - 1)){
def c = img.getRGB(x, y)
if(Tmp.c1.argb8888(c).a > 0.999f && colorsUsed.add(c)){
outImage.setRGB((int)(total / size), total % size, c)
total ++
}
}
}
}
ImageIO.write(outImage, "png", new File("palette.png"))
println "Found $total colors."
}
}
task antialiasImages(){
doLast{
for(def img : project.getProperty("images").split(",")){