CSE 113 - Spring 2009 - Banner
UB -
University at Buffalo, The State University of New York Computer Science and Engineering
  • CSE 113 - Spring 2009
CSE 113 - Spring 2009 - Navigation
CSE 113 - Spring 2009 - Announcements

Picture and Pixel Methods

CSE 113 - Spring 2009 - Announcements

Here is a listing of methods that you can use when working with a Picture object.

explore() Opens the picture in a picture explorer that allows for zoom and exploration of specific pixels of the picture.
getHeight() Returns the height of the picture (in pixels) as an integer.
getPixel(int x, int y) Returns the Pixel object that the coordinate (x, y) as passed into the parameters.
getWidth() Returns the width of the picture (in pixels) as an integer.
hide() Makes the picture disappear from the screen (opposite of showing).
show() Makes the picture appear on the screen.

Here is a listing of methods that you can use when working with a Pixel object.

colorDistance(java.awt.Color) Computes the distance between the pixel's current color and the color passed in as a parameter. Returns the distance as a double.
getBlue() Returns the blue component of a pixel as an integer.
getColor() Returns the color of a pixel as a java.awt.Color.
getGreen() Returns the green component of a pixel as an integer.
getRed() Returns the red component of a pixel as an integer.
getX() Returns the x coordinate of a pixel as an integer.
getY() Returns the y coordinate of a pixel as an integer.
setBlue(int blueValue) Sets the blue component of a pixel to the value passed in as a parameter.
setColor(java.awt.Color) Sets the color of a pixel to the color passed in as a parameter.
setGreen(int greenValue) Sets the green component of a pixel to the value passed in as a parameter.
setRed(int redValue) Sets the red component of a pixel to the value passed in as a parameter.

 

CSE 113 - Spring 2009 - Footer

Page maintained by Adrienne Decker

Contact: adrienne@cse.buffalo.edu | 130 Bell Hall | (716)645-3180 x 161