All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class Pixmap.Pixmap

java.lang.Object
   |
   +----java.awt.Component
           |
           +----java.awt.Canvas
                   |
                   +----Pixmap.Pixmap

public class Pixmap
extends Canvas
implements ActionListener
 Class for manipulating graphics images
 originally developed in C++
 revision history for C++ version
 

Modified: 3/21/94 11/29/94 4/13/95

Ported: 10/16/1996 to Java (Syam Gadde) re-implemented, ported to 1.1 6/1/97 (Owen Astrachan)

this class represents an image that supports manipulation, i.e., reflection, expansion, inversion, etc. It has an analog in C++ for comparison between the two languages although there is more support in Java for images than there is in C++.

Creating a pixmap requires a filename that should be a gif or jpg image (or others if getImage() supports them). Currently the filename represents a local image, but changing the URL to support network retrievable images should be straightforward

Author:
Owen Astrachan, Syam Gadde

Constructor Index

 o Pixmap(Frame, PixController, String)
create a pixmap (by reading a local file), the pixmap is added to a PixApp, and displayed in a frame

Method Index

 o actionPerformed(ActionEvent)
redisplays this pixmap as the active pixmap
 o expand(int, int)
 o getIcon()
 o getPreferredSize()
overrides Component.getPreferredSize()
 o horizReflect()
reflect this horizontally (which means through a vertical line drawn through the middle of the Pixmap) ---> | <---
 o invert()
turn all pixels to there 'opposite color'.
 o paint(Graphics)
overrides Component.paint()
 o vertReflect()

Constructors

 o Pixmap
 public Pixmap(Frame parent,
               PixController control,
               String filename)
create a pixmap (by reading a local file), the pixmap is added to a PixApp, and displayed in a frame

Parameters:
parent - the frame in which the pixmap is displayed
app - the Application to which this pixmap will be added
filename - complete pathname of the local file that can be read by getImage()

Methods

 o actionPerformed
 public void actionPerformed(ActionEvent ev)
redisplays this pixmap as the active pixmap

Parameters:
ev - the action event causing the redisplay
 o getIcon
 public PixIcon getIcon()
Returns:
the PixIcon associated with this Pixmap
 o getPreferredSize
 public Dimension getPreferredSize()
overrides Component.getPreferredSize()

Overrides:
getPreferredSize in class Component
 o paint
 public void paint(Graphics g)
overrides Component.paint()

Overrides:
paint in class Canvas
 o vertReflect
 public void vertReflect()
 o horizReflect
 public void horizReflect()
reflect this horizontally (which means through a vertical line drawn through the middle of the Pixmap) ---> | <---

 o expand
 public void expand(int rowExpand,
                    int colExpand)
 o invert
 public void invert()
turn all pixels to there 'opposite color'. Black to white, white to black, and invert RGB pixel by taking negative relative to 255 (max RGB value), i.e., red = 255 - red, and similarly for blue and green pixel values


All Packages  Class Hierarchy  This Package  Previous  Next  Index