ec.app.mona
Class Picture
- java.lang.Object
-
- ec.app.mona.Picture
-
- All Implemented Interfaces:
- java.io.Serializable, java.lang.Cloneable
public class Picture extends java.lang.Object implements java.lang.Cloneable, java.io.SerializablePicture contains two images: an ORIGINAL image which is loaded from a file, and writable IMAGE, which you scribble on and try to make as similar to the ORIGINAL.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field and Description java.awt.Graphicsgraphicsjava.awt.image.BufferedImageimagejava.awt.image.BufferedImageoriginal
-
Constructor Summary
Constructors Constructor and Description Picture()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description voidaddPolygon(double[] vals, int offset, int numVertices)Adds a polygon with the given colors.voidclear()Erases the image.java.lang.Objectclone()java.awt.image.BufferedImagecopyImage(java.awt.image.BufferedImage image)voiddisplay(java.lang.String title)For debugging only.voiddisposeGraphics()doubleerror()Computes the sum squared error between the image and the original.voidload(java.io.File file)Loads the original and creates a new blank image to scribble on, and a new graphics object.voidsave(java.io.File file)Saves the image (not the original) out to a PNG file so you can compare.
-
-
-
Field Detail
-
original
public java.awt.image.BufferedImage original
-
image
public java.awt.image.BufferedImage image
-
graphics
public java.awt.Graphics graphics
-
-
Method Detail
-
disposeGraphics
public void disposeGraphics()
-
addPolygon
public void addPolygon(double[] vals, int offset, int numVertices)Adds a polygon with the given colors. ALL double values passed in must be 0.0 ... 1.0. The values are taken starting at vals[offset]. The first four values are colors and alpha. The remaining values are the x and y values of the polygon vertices. You must call graphics.dispose() after you're done with all your polygon-drawing.
-
clear
public void clear()
Erases the image.
-
error
public double error()
Computes the sum squared error between the image and the original. This is defined as the sum, for all pixels, and for all three colors in the pixel, of the squared difference between the images with regard to that color on that pixel. Error goes from 0 to 1.
-
load
public void load(java.io.File file)
Loads the original and creates a new blank image to scribble on, and a new graphics object.
-
display
public void display(java.lang.String title)
For debugging only.
-
save
public void save(java.io.File file)
Saves the image (not the original) out to a PNG file so you can compare.
-
clone
public java.lang.Object clone()
- Overrides:
clonein classjava.lang.Object
-
copyImage
public java.awt.image.BufferedImage copyImage(java.awt.image.BufferedImage image)
-
-
DMelt 3.0 © DataMelt by jWork.ORG