Fixed colorswap

This commit is contained in:
Anuken
2020-06-13 12:18:18 -04:00
parent 186ae4e2a2
commit 9e96954eaa

View File

@@ -235,7 +235,7 @@ task swapColors(){
def carr = new File(getProperty("colors")).text.split("\n") def carr = new File(getProperty("colors")).text.split("\n")
def map = [:] def map = [:]
def swaps = 0 def swaps = 0
carr.each{ str -> map[Color.argb8888(Color.valueOf(str.split("=")[0]))] = Color.argb8888(Color.valueOf(str.split("=")[1])) } carr.each{ str -> map[Color.valueOf(str.split("=")[0]).argb8888()] = Color.valueOf(str.split("=")[1]).argb8888() }
def tmpc = new Color() def tmpc = new Color()
fileTree(dir: '../core/assets-raw/sprites', include: "**/*.png").visit{ file -> fileTree(dir: '../core/assets-raw/sprites', include: "**/*.png").visit{ file ->
@@ -246,7 +246,7 @@ task swapColors(){
for(x in (0..img.getWidth() - 1)){ for(x in (0..img.getWidth() - 1)){
for(y in (0..img.getHeight() - 1)){ for(y in (0..img.getHeight() - 1)){
def c = img.getRGB(x, y) def c = img.getRGB(x, y)
Color.argb8888ToColor(tmpc, c) tmpc.argb8888(c)
if(tmpc.a < 0.1f) continue if(tmpc.a < 0.1f) continue
if(map.containsKey(c)){ if(map.containsKey(c)){
img.setRGB(x, y, (int)map.get(c)) img.setRGB(x, y, (int)map.get(c))