Hi Anthony, what OS is this?
[EMAIL PROTECTED] wrote:
Hi! I am developing a game. So I need fast drawing of images. I draw images to BufferStrategy. I have to use JDK5! If I read an image from a jpg file, drawing it takes about 0 milliseconds. I assume it is hardware accelerated. If I load the Image from a png file it takes about 10ms to draw it. I assume it is not hardware accelerated. So how do I get Images from png accelerated? I have read that translucent images cannot be accelerated. So at least I want to have transparent Images accelerated. I have tried the following to create transparent Images: Image image = ... BufferedImage buffimg= gc.createCompatibleImage(100, 100,Transparency.BITMASK); Graphics2D g = img.createGraphics(); g.setComposite(AlphaComposite.Src); g.setColor(new Color(0, 0, 0, 0)); g.fillRect(0, 0, 100, 100);
Just FYI this fillRect is redundant - will be overwritten by the next drawImage call.
g.drawImage(imgage,0,0,null); But when I draw Buffimg, it still takes to much time so I assume that acceleration doesn't work. How do I get it right?
You seem to be doing the right thing here. You don't create a buffimg on every frame I presume, or render to it on every frame before copying to the back-buffer? Another question: how large are your bitmask images? We have a certain limitation on the size of bitmask images we could accelerate. If you don't copy your image to the compatible image, does it get accelerated? Use -Dsun.java2d.trace=log to see what loops are being used. Also, a plug for the troubleshooting guide (the Java2D section): http://java.sun.com/javase/6/webnotes/trouble/TSG-Desktop/html/java2d.html Thanks, Dmitri Java2D Team
Thank you! Regards [Message sent by forum member 'anthonywarp' (anthonywarp)] http://forums.java.net/jive/thread.jspa?messageID=194213 =========================================================================== To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the message "signoff JAVA2D-INTEREST". For general help, send email to [EMAIL PROTECTED] and include in the body of the message "help".
=========================================================================== To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the message "signoff JAVA2D-INTEREST". For general help, send email to [EMAIL PROTECTED] and include in the body of the message "help".