Week 9 Exercises

  1. Write a stand-alone application which allows the user to edit some text in multiple windows. (You'll probably want to use a TextArea and a BorderLayout in each Frame. ) Include standard File and Edit menus as discussed in class. At a minimum the File menu should have New, Open, Close, Save, Save As..., Print, and Quit menu items. The Edit menu should have Cut, Copy, Paste, Clear, Select All, and Undo menu items. The New menu item should bring up a new text editing window. The Close menu item should close the current window. The Quit menu item should exit the application. All other menu items should be disabled for now. Include the standard shortcuts for those menu items that have them, (e.g. N for New, C for Copy, and so on )

  2. The simple algorithm used in class for calculating the average intensity when converting a color image to black and white does not take into account human perception. For instance, we see green much more clearly than other colors. A much better formula is:

    Intensity = 0.299*Red + 0.587*Green + 0.114*Blue

    Write an image filter which uses this formula to change a color picture to a black and white picture.

  3. Write an image filter that produces a negative of an image. The basic algorithm here is to subtract the value of each color from 255. For example a red value of 200 would be transformed into a red value of 255 - 200 = 55.

    Note: I'm not 100% sure this will actually produce a photographic negative. Consider this an experiment.


Start | Previous | Cafe au Lait

Copyright 1997, 2002 Elliotte Rusty Harold
elharo@metalab.unc.edu
Last Modified December 19, 2002