nullpomino / nullpomino

An action puzzle game
BSD 3-Clause "New" or "Revised" License
528 stars 76 forks source link

Unsupported PNG Bit Depth in Slick Implementation #89

Open careyes17 opened 2 years ago

careyes17 commented 2 years ago

What is the problem?

When doing a clean clone of the repository, building, and then launching into the Slick implementation with NullpoMinoSlick.launch, I get the following exception for certain PNG files:

18:56:27,196 [main] DEBUG ResourceHolderSlick: Loading image from res/graphics/menu.png
18:56:27,199 [main] WARN  Slick: class org.newdawn.slick.opengl.PNGImageData failed to read the data
java.io.IOException: Unsupported bit depth
    at org.newdawn.slick.opengl.PNGImageData.readIHDR(PNGImageData.java:370)
    at org.newdawn.slick.opengl.PNGImageData.init(PNGImageData.java:106)
    at org.newdawn.slick.opengl.PNGImageData.loadImage(PNGImageData.java:680)
    at org.newdawn.slick.opengl.CompositeImageData.loadImage(CompositeImageData.java:62)
    at org.newdawn.slick.opengl.CompositeImageData.loadImage(CompositeImageData.java:43)
    at org.newdawn.slick.opengl.InternalTextureLoader.getTexture(InternalTextureLoader.java:292)
    at org.newdawn.slick.opengl.InternalTextureLoader.getTexture(InternalTextureLoader.java:254)
    at org.newdawn.slick.opengl.InternalTextureLoader.getTexture(InternalTextureLoader.java:187)
    at org.newdawn.slick.Image.<init>(Image.java:192)
    at org.newdawn.slick.Image.<init>(Image.java:166)
    at org.newdawn.slick.Image.<init>(Image.java:154)
    at org.newdawn.slick.Image.<init>(Image.java:132)
    at mu.nu.nullpo.gui.slick.ResourceHolderSlick.loadNormalImage(ResourceHolderSlick.java:327)
    at mu.nu.nullpo.gui.slick.ResourceHolderSlick.loadImage(ResourceHolderSlick.java:314)
    at mu.nu.nullpo.gui.slick.ResourceHolderSlick.load(ResourceHolderSlick.java:156)
    at mu.nu.nullpo.gui.slick.StateLoading.enter(StateLoading.java:88)
    at org.newdawn.slick.state.StateBasedGame.init(StateBasedGame.java:175)
    at org.newdawn.slick.AppGameContainer.setup(AppGameContainer.java:394)
    at org.newdawn.slick.AppGameContainer.start(AppGameContainer.java:318)
    at mu.nu.nullpo.gui.slick.NullpoMinoSlick.main(NullpoMinoSlick.java:404)

Notice that when Loading image from res/graphics/menu.png an IOException: Unsupported bit depth is raised.

Files affected

Question

Is there a reason why a bit depth of 2 is used here for these files? I suspect there isn't because other similar background files like fieldbg2_small.png use a bit depth of 8.

Possible corrections

Simply convert the files with a bit depth of 2 into a bit depth of 8. I've done this in my local environment and it's done the trick of removing this exception.

Environment

careyes17 commented 2 years ago

Upon further inspection, it seems like issue #60 might have impacted this move to 2 bit depth. This might be worth rolling back. Or at least changing the images I listed above to a bit depth of 8.

On a side note, would it be acceptable to contribute testing (and some refactoring) to this project?