mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-05 02:39:44 +02:00
[BitmapResource] Fix channel swaped and black icons
This commit is contained in:
parent
dbb9e7feee
commit
03593e348d
1 changed files with 5 additions and 2 deletions
|
@ -334,7 +334,7 @@ public class BitmapResource {
|
||||||
// create the color model
|
// create the color model
|
||||||
ColorSpace cs = ColorSpace.getInstance(ColorSpace.CS_sRGB);
|
ColorSpace cs = ColorSpace.getInstance(ColorSpace.CS_sRGB);
|
||||||
int[] nBits = { 8, 8, 8, 8 };
|
int[] nBits = { 8, 8, 8, 8 };
|
||||||
int[] bOffs = { 0, 1, 2, 3 };
|
int[] bOffs = { 2, 1, 0, 3 };
|
||||||
ColorModel colorModel =
|
ColorModel colorModel =
|
||||||
new ComponentColorModel(cs, nBits, true, false, Transparency.TRANSLUCENT,
|
new ComponentColorModel(cs, nBits, true, false, Transparency.TRANSLUCENT,
|
||||||
DataBuffer.TYPE_BYTE);
|
DataBuffer.TYPE_BYTE);
|
||||||
|
@ -422,11 +422,14 @@ public class BitmapResource {
|
||||||
*/
|
*/
|
||||||
protected DataImage getOnePlaneImage(MemBuffer buf) {
|
protected DataImage getOnePlaneImage(MemBuffer buf) {
|
||||||
// create the color model
|
// create the color model
|
||||||
|
int[] colormapData = getRGBData(buf);
|
||||||
|
IndexColorModel model =
|
||||||
|
new IndexColorModel(1, getClrUsed(), colormapData, 0, false, -1, DataBuffer.TYPE_BYTE);
|
||||||
|
|
||||||
// create the image
|
// create the image
|
||||||
|
|
||||||
BufferedImage image =
|
BufferedImage 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();
|
byte[] dbuf = ((DataBufferByte) image.getRaster().getDataBuffer()).getData();
|
||||||
getPixelData(buf, dbuf);
|
getPixelData(buf, dbuf);
|
||||||
return new BitmapDataImage(image);
|
return new BitmapDataImage(image);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue