java - Enlarging JFrame/JPanel Programmatically -


i have been working on java 2d game , halfway through noticed screen , sprites small. enlarging them hand pain.

is possible enlarge jframe or jpanel , of it's contents when using java 2d draw images panel?

graphics2d providing image re-size feature follows :

bufferedimage resizedimage = new bufferedimage(img_width, img_height, type); graphics2d g = resizedimage.creategraphics(); g.drawimage(originalimage, 0, 0, img_width, img_height, null); g.dispose(); 

according articles, if want increase re-sized image quality, can add renderinghints follows :

bufferedimage resizedimage = new bufferedimage(img_width, img_height, type); graphics2d g = resizedimage.creategraphics(); g.drawimage(originalimage, 0, 0, img_width, img_height, null); g.dispose(); g.setcomposite(alphacomposite.src); g.setrenderinghint(renderinghints.key_interpolation,renderinghints.value_interpolation_bilinear); g.setrenderinghint(renderinghints.key_rendering,renderinghints.value_render_quality); g.setrenderinghint(renderinghints.key_antialiasing,renderinghints.value_antialias_on); 

source: http://www.mkyong.com/java/how-to-resize-an-image-in-java/

other links worth checking out:

http://www.javaprogrammingforums.com/algorithms-recursion/818-change-size-image.html

http://www.gotoquiz.com/web-coding/programming/java-programming/resize-images-in-java-preserving-image-quality/

http://ajax911.com/resize-images-java-java2d-method/


Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -