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
Comments
Post a Comment