Friday, 20 March 2009

Chunk 79 - Filter Utility

Well, apart from the odd bug, the coding of the filter utility is complete. The hardest part was getting the help panel to disappear, when applying a filter. This was achieved, by using the get() method to take a snapshot of the display screen, before showing the panel and then displaying this image, before applying a filter.
The images to be worked on should be copied to the relevant folder in the data directory. There are three directories:
The utility can deal with up to 10 files in any directory. If the reader chooses an empty directory, the program will crash, if there is time I might fix this later...
When the utility is started the reader is given a choice of which type of file to use. The uppercase or lower case 'G', 'J' or 'P' are acceptable inputs. On entering an acceptable input the reader is shown a list of files in the appropriate directory
The reader chooses the required file by entering its number. The chosen file is displayed on the screen so that it can be worked on. Pressing the 'H' or 'h' key opens a help panel, which displays the options for the program.

The choices available are:
  • I - INVERT
  • G - GRAY
  • E - ERODE
  • D - DILATE
  • B - BLUR
  • O - OPAQUE
  • S - SAVE
  • X - EXIT
    The filters are applied to the image but some e.g. posterize only work once.
    R allows the reader to choose a different file type and file.
    S saves the file and allows the user to continue working on the image.
    X exits the application.
    When a file is saved it will have "filtern" (where n is the number of the image saved this session)appended to its name. The extension of the file, will be the same as the image being worked on. All files will be saved in the ch79 directory. The files should be renamed and moved to another directory if they are needed as they might be overwritten the next time the program is run.
  • Source Code

No comments:

Post a Comment