GraphicsImage Class Reference« ImageWindow | ReferenceGuide | GraphicsMenu » This class defines an RGB digital image that is comprised of a grid of pixels divided into rows and columns with (0,0) being in the upper-left corner. The x-coordinate indicates a horizontal position in the image while the y-coordinate indicates a vertical position. Each pixel, which can be accessed by row and column coordinates, contains a color in the discrete RGB color space. An RGB color is represented by three color components: red, green, and blue. Each color component has a discrete value in the range [0..255]. Public Methods
Detailed DescriptionGraphicsImage(filename)
v2.0 Creates a new graphics image from the given file. The image file format can either be GIF or PPM.
GraphicsImage(width, height)
v2.0 Creates a new image of the given size. The image is initially empty and has a size of
width x height .width()
v2.0 Returns the width of the image.
height()
v2.0 Returns the height of the image.
setPixel(row, col, red, green, blue)
v2.0 Sets a pixel to a given RGB color. The pixel within the image specified by the given row and column is set to the given RGB color.
setPixel(row, col, hexColor)
v2.0 Sets a pixel to a given RGB color. The pixel within the image indicated by the given row and column is set to the RGB color specified as a hex string.
setPixel(row, col, color)
v2.0 Sets a pixel to a given RGB color. The pixel within the image indicated by the given row and column is set to the RGB color specified as a tuple of 3 elements.
getPixel(row, col)
v2.0 Returns the RGB color of a given pixel as a tuple. The color is returned in a tuple of 3 elements with the red value in position 0, the green value in position 1, and the blue value in position 2.
getRed(row, col)
v2.0 Returns the red component of the RGB color for a given pixel.
getGreen(row, col)
v2.0 getBlue(row, col)
v2.0 Returns the blue component of the RGB color for a given pixel.
clear()
v2.0 Clears the image. All of the pixels are set to be transparent, but the size of the image remains the same.
copy()
v2.0 Creates and returns a duplicate copy of the image.
save(filename)
v2.0 Saves the digital image to the given file. The image is saved in the GIF image format.
save(filename, format)
v2.0 Saves the digital image to a file in the specified format. The image contained in the window will be saved to the given file using the indicated format.
|
|||||||||||
Last modified: August 02, 2015, at 03:21 PM.
|