ImageWindow Class Reference

« GraphicsCanvas | ReferenceGuide | ColorNames »

This class defines a basic top level window that contains a color digital image. The color digital image is comprised of a grid of pixels divided into rows and columns. 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

ImageWindow()
Creates a new image window with a default sized image.
ImageWindow(width, height)
Creates a new image window with an image of the given size.
close()
Closes and destroys the window.
getPixel(row, col)
Returns the RGB color of a given pixel.
quit()
Terminates the event loop.
setPixel(row, col, red, green, blue)
Sets a specific pixel within the image to the given RGB color.
setTitle(title)
Sets the title of the window.
wait()
Starts the event loop that processes various window events.

Detailed Description

ImageWindow()
Creates a new image window with a default sized image. The image is initially empty and has a size of 400 x 400 pixels.
ImageWindow(width, height)
Creates a new image window with an image of the given size. The image is initially empty and has a size of width x height.
Parameters:
width
The horizontal size of the image in pixels.
height
The vertical size of the canvas in pixels.
wait()
Starts the event loop that processes various window events. This causes the sequential execution of the program to stop and wait for the user to click the close button on the main window or to call the quit() method on any window. This method should only be called on the main window.
setTitle(title)
Sets the title of the window. The title is displayed in the title bar of the top-level window. By default, the window has no title.
Parameters:
title
A text string to which the title of the window is set. To remove the title, pass an empty string to the method.
quit()
Terminates the event loop. When the event loop terminates, the program will continue execution at the point immediately after the call to the wait method.
close()
Closes and destroys the window. The object still exist, but the window is not valid and can not be used.
setPixel(row, col, red, green, blue)
Sets a specific pixel within the image to the given RGB color.
Parameters:
row, col
The pixel coordinates.
red, green, blue
The discrete RGB color components in the range [0..255].
getPixel(row, col)
Returns the RGB color of a given pixel. 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.
Parameters:
row, col
The pixel coordinates.
Returns:
An RGB color in a tuple of 3 elements.


« GraphicsCanvas | ReferenceGuide | ColorNames »

Last modified: October 12, 2014, at 08:20 PM.