mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-07-23 14:17:48 +07:00
Added cool new reconstructors™️
This commit is contained in:
@ -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(",")){
|
||||
|
Reference in New Issue
Block a user