I'm having a problem where images loaded in as a buffered image contain their alpha channels correctly. But when passed as a parameter the alpha channel is lost.
I load the images in like this:
MousePointer = ImageIO.read(getClass().getResourceAsStream("sprites/Mouse-sheet.png"));
Then I draw like this (the alpha channel remains intact):
g.drawImage(Sprites.MousePointer, mouse.x, mouse.y, 64, 64, null);
But when I draw using my own function, the alpha channel is lost:
mouseAnimation.DrawAbsolute(Sprites.MousePointer, g, mouse.x, mouse.y, 4, 4, deltaTime);
Why is the alpha channel being lost, java variables are pointers and thus pass-by-reference so it doesn't make sense? What can I do to prevent it?
You can see the results here: YouTube video I only show the images in their broken state, at the time I was confusing one method for another which resulted in nothing changing.