In this task, you will perform the following actions:
Load an image on which you want to perform image processing with Java2D.
Make the initial view show the original image and provide a link that the user clicks to perform the ColorConvertOp image processing operation.
Make the other view display the processed image.
Find a JPEG image that you can use with this application.
Add the image to imageprocess/public/image file.
Change to imageprocess/app/views/home directory.
Open the index.html.erb file in a text editor.
Replace the contents of this file with the following HTML markup:
<html> <body> <img src="../../images/kids.jpg"/><p> <%= link_to "Perform a ColorConvertOp on this image", :action => "seeimage" %> </body> </html> |
This page loads an image from imageprocess/public/images and provides a link that references the seeimage action. The seeimage action maps to the seeimage view, which shows the processed image.
Replace kids.jpg in the index.html.erb with the name of your image that you saved earlier in this procedure.
Save the index.html.erb file.
Open the seeimage.html.erb file in a text editor.
Replace the contents of this file with the following HTML markup:
<html> <body> <img src="/home/processimage"/><p> <%= link_to "Back", :action => "index" %> </body> </html> |
The img tag on this page accesses the processimage action in HomeController. The processimage action is where you will put the Java2D code to process the image that you loaded into index.html.erb.