How to Fix Upside Down Java Pictures




(5.00 out of 5)



(5.00 out of 5)



(5.00 out of 5)



(5.00 out of 5)



(5.00 out of 5)



(5.00 out of 5)



(5.00 out of 5)





How to Fix Upside Down Java Pictures
Log in to answer.
Copyright © dBuggr LLC - All Rights Reserved.
nishantbaxi 11:23 pm on March 23, 2010
Step 1Type “import java.awt.Graphics;” at the beginning of your program to import the proper Method library, which contains the drawImage.
Step 2Enter “public boolean drawImage(Image img, int x, int y, int width, int height, ImageObserver observer)” for the drawImage signature, where “img” is the name of the image to be manipulated.
Step 3Type “g.drawImage (img, 0, 0, img.getWidth(this), img.getHeight(this), 0, 0, img.getWidth(this), img.getHeight(this), this);” which is the standard way of displaying an image. If this method hasn’t fixed the upside down image, proceed to the next step.
Step 4Switch the coordinates so that the previously entered line now reads “g.drawImage (img, 0, img.getHeight(this), img.getWidth(this),0, 0, 0, img.getWidth(this), img.getHeight(this), this);” which will switch the “x” and “y” coordinates so that the image is displayed with a 180-degree rotation.