With 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 on it.
Make the other view display the processed image.
Find a JPEG image that you can use with this application.
Add the image to <JRUBY_HOME>/samples/imageprocess/public/image file.
Go to <JRUBY_HOME>/samples/imageprocess/app/views/home file.
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 <JRUBY_HOME>/samples/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 from line 3 of index.html.erb with the name of your image that you saved from step 3 of this procedure.
Save index.html.erb file.
Open 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 you loaded into index.html.erb.