mirror of
https://github.com/webbukkit/dynmap.git
synced 2024-11-02 16:49:56 +01:00
Fix accessory face mixing
This commit is contained in:
parent
76c8bc861d
commit
ff4b036c6a
@ -56,12 +56,16 @@ public class PlayerFaces {
|
|||||||
int[] faceaccessory = new int[64]; /* 8x8 of face accessory */
|
int[] faceaccessory = new int[64]; /* 8x8 of face accessory */
|
||||||
/* Get buffered image for face at 8x8 */
|
/* Get buffered image for face at 8x8 */
|
||||||
DynmapBufferedImage face8x8 = DynmapBufferedImage.allocateBufferedImage(8, 8);
|
DynmapBufferedImage face8x8 = DynmapBufferedImage.allocateBufferedImage(8, 8);
|
||||||
|
int[] bgcolor = new int[1];
|
||||||
|
img.getRGB(0, 0, 1, 1, bgcolor, 0, 1); /* Get BG color (for accessory face) */
|
||||||
img.getRGB(8, 8, 8, 8, face8x8.argb_buf, 0, 8); /* Read face from image */
|
img.getRGB(8, 8, 8, 8, face8x8.argb_buf, 0, 8); /* Read face from image */
|
||||||
img.getRGB(40, 8, 8, 8, faceaccessory, 0, 8); /* Read face accessory from image */
|
img.getRGB(40, 8, 8, 8, faceaccessory, 0, 8); /* Read face accessory from image */
|
||||||
/* Apply accessory to face: first element is transparency color so only ones not matching it */
|
/* Apply accessory to face: first element is transparency color so only ones not matching it */
|
||||||
for(int i = 0; i < 64; i++) {
|
for(int i = 0; i < 64; i++) {
|
||||||
if(faceaccessory[i] != faceaccessory[0])
|
if(faceaccessory[i] != bgcolor[0])
|
||||||
face8x8.argb_buf[i] = faceaccessory[i];
|
face8x8.argb_buf[i] = faceaccessory[i];
|
||||||
|
else if(face8x8.argb_buf[i] == bgcolor[0])
|
||||||
|
face8x8.argb_buf[i] = 0;
|
||||||
}
|
}
|
||||||
/* Write 8x8 file */
|
/* Write 8x8 file */
|
||||||
File img_8x8 = new File(faces8x8dir, playername + ".png");
|
File img_8x8 = new File(faces8x8dir, playername + ".png");
|
||||||
|
Loading…
Reference in New Issue
Block a user