<< Chapter < Page Chapter >> Page >
This module contains review questions and answers keyed to the module titled Java3022: Scaling, Rotating, and Translating Images using Affine Transforms.

Revised: Mon Apr 04 09:07:14 CDT 2016

This page is included in the following Books:

Table of contents


This module contains review questions and answers keyed to the module titled Java3022: Scaling, Rotating, and Translating Images using Affine Transforms .

The questions and the answers are connected by hyperlinks to make it easy for you to navigate from the question to the answer and back again.


Question 1 .

Given the input image in Figure 1 , which of the following output images is produced by the code in Listing 1 ?

A. Figure 2

B. Figure 3

Listing 1 - Question 1.
/*File Java3022ra Copyright 2013 R.G.Baldwin Revised 02/17/13*********************************************************/ import java.awt.Graphics2D;import java.awt.geom.AffineTransform; import java.awt.geom.Rectangle2D;import java.awt.Graphics; public class Java3022ra{public static void main(String[] args){new Java3022raRunner().run(); }//end main method}//end class Java3022ra //======================================================//class Java3022raRunner{ public void run(){procPix(new Picture("Prob01.jpg").scale(0.7,0.7),-30); }//end run//----------------------------------------------------// private void procPix(Picture pic,double angle){AffineTransform xformA = new AffineTransform(); xformA.rotate(Math.toRadians(angle),pic.getWidth()/2,pic.getHeight()/2); Rectangle2D rectangle2D =pic.getTransformEnclosingRect(xformA); int resultWidth = (int)(rectangle2D.getWidth());int resultHeight = (int)(rectangle2D.getHeight()); AffineTransform xformB = new AffineTransform();xformB.translate((resultWidth - pic.getWidth())/2, (resultHeight - pic.getHeight())/2);xformB.concatenate(xformA); Picture result = new Picture(resultWidth,resultHeight); Graphics2D g2 = (Graphics2D)result.getGraphics();g2.drawImage(pic.getImage(),xformB,null); result.explore();}//end //----------------------------------------------------//}//end class Java3022raRunner

Figure 1 - Prob01.jpg.

Image of a beach scene.

Figure 2 - Possible output image.

Image of a beach scene scaled slightly and rotated 30 degrees clockwise.

Figure 3 - Possible output image.

Image of a beach scene scaled more and rotated 30 degrees counter-clockwise.

Answer 1



What is the meaning of the following two images?

This image was inserted here simply to insert some space between the questions and the answers to keep them from being visible on the screen at thesame time.

The image is also an example of the kinds of things that we do in my course titled ITSE 2321, Object-Oriented Programming.

Spacer image of a rabbit and a penguin.

This image was also inserted for the purpose of inserting space between the questions and the answers.

Spacer image of a penguin in the snow in front of some houses.


Answer 1

The code in Listing 1 produces the output image shown in Figure 3 .

Back to Question 1


This section contains a variety of miscellaneous information.

Housekeeping material
  • Module name: Java3022r Review
  • File: Java3022r.htm
  • Published: 02/17/13

Financial : Although the Connexions site makes it possible for you to download aPDF file for this module at no charge, and also makes it possible for you to purchase a pre-printed version of the PDF file, youshould be aware that some of the HTML elements in this module may not translate well into PDF.

I also want you to know that, I receive no financial compensation from the Connexions website even if you purchase the PDF version ofthe module.

In the past, unknown individuals have copied my modules from cnx.org, converted them to Kindle books, and placed them for sale onAmazon.com showing me as the author. I neither receive compensation for those sales nor do I know who does receive compensation. If youpurchase such a book, please be aware that it is a copy of a module that is freely available on cnx.org and that it was made andpublished without my prior knowledge.

Affiliation : I am a professor of Computer Information Technology at Austin Community College in Austin, TX.


Questions & Answers

What is captalizeg
Saminu Reply
What is socializing
What is socializing
What is socializing
what is demand
Oforiwaa Reply
demand is the quantity of a good that consumers are willing and able to purchase at various prices during a given period of time.
what is opportunity cost
Aboubakar Reply
what is gini coefficient?
Khalipha Reply
Never heard of that!!!!
ive heard about it Actually i know it..
In that case, you have to help us.
Another name for Absolute cost advantage
fatimah Reply
what is the difference between demand and supply
Peter Reply
what is the national income
Kamara Reply
oils and resources
it is the sum of all incomes earned by factors of production usually a year
What's current account?
Che Reply
Demand refers to goods and services that the buyer is willing and able to buy at a price over a period of time
Can it be possible to have two level of comparative advantage in a country ?
Louise Reply
.no.its not possible
Why ?
I think no possible
No resources are scare for a country to have a comparative advantage and it discourages external trade
each country are meant to Specialize on 1 production activities
why do oligopoly increase on the elastic segment of the demand curve
Tintswalo Reply
what is all about production possibility curve
Nice Reply
help me about the assumption of possibility curve
-The quantity and quality of economic resources are fixed. -only two types of goods can be produce out of this resources (that is,producer and consumer goods). -Resources are fully utilised. -The resources are mobile. -The state of technology is constant.
What is utility
chisom Reply
it is the satisfaction derived from d consumption of goods and services
what is opportunity cost
what is the meaning of money and inflation
Tinuke Reply
Money can be define as anything acceptable as a medium of exchange and mean of payment
inflation is when everything seemed to cost so much less
Inflation is d persistent rise in level of goods and services in a country
Inflation is the persistent increase in d general price level of goods n services
what is a bar chart
Godwin Reply
what's economic
John Reply
Economics can be define as a study of how human beings make decisions in the face of scarcity it can also be define as using one wealth to make more wealth
Or in Nigerian way Economics is a science (social science) which studies human behavior as a relationship between Ends and Scarce which have alternative uses
Economics is the study of how human make decision in the face of scarcity
Got questions? Join the online conversation and get instant answers!
Jobilize.com Reply

Get Jobilize Job Search Mobile App in your pocket Now!

Get it on Google Play Download on the App Store Now

Source:  OpenStax, Object-oriented programming (oop) with java. OpenStax CNX. Jun 29, 2016 Download for free at https://legacy.cnx.org/content/col11441/1.201
Google Play and the Google Play logo are trademarks of Google Inc.

Notification Switch

Would you like to follow the 'Object-oriented programming (oop) with java' conversation and receive update notifications?