Ghidra is a software reverse engineering (SRE) framework
[BitmapResource] Fix channel swaped and black icons
widberg03593e348de4
diff --git a/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/program/model/data/BitmapResource.java b/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/program/model/data/BitmapResource.javaindex e4e5437018..c4e1bdbe44 100644--- a/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/program/model/data/BitmapResource.java+++ b/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/program/model/data/BitmapResource.java@@ -334,7 +334,7 @@ public class BitmapResource {// create the color modelColorSpace cs = ColorSpace.getInstance(ColorSpace.CS_sRGB);int[] nBits = { 8, 8, 8, 8 };- int[] bOffs = { 0, 1, 2, 3 };+ int[] bOffs = { 2, 1, 0, 3 };ColorModel colorModel =new ComponentColorModel(cs, nBits, true, false, Transparency.TRANSLUCENT,DataBuffer.TYPE_BYTE);@@ -422,11 +422,14 @@ public class BitmapResource {*/protected DataImage getOnePlaneImage(MemBuffer buf) {// create the color model+ int[] colormapData = getRGBData(buf);+ IndexColorModel model =+ new IndexColorModel(1, getClrUsed(), colormapData, 0, false, -1, DataBuffer.TYPE_BYTE);// create the imageBufferedImage image =- new BufferedImage(getWidth(), getHeight(), BufferedImage.TYPE_BYTE_BINARY);+ new BufferedImage(getWidth(), getHeight(), BufferedImage.TYPE_BYTE_BINARY, model);byte[] dbuf = ((DataBufferByte) image.getRaster().getDataBuffer()).getData();getPixelData(buf, dbuf);return new BitmapDataImage(image);