1. Creating a YOPS window

YOPS stands for "Ye Olde Photo Shoppe," an application skeleton that can be used as a starting point for a variety of projects involving image manipulation and graphics. YOPS is also a class we have implemented that provides a user interface for image manipulationa and graphics. Thus to use YOPS, you only need to construct a YOPS object like so:

import yops.*;

public class YOPSExample {
   public static void main(String args[]) {
      new YOPS();
   }
}

This creates a YOPS window with one panel of default width and height, and no tools or images pre-loaded, that looks like this:

(Screen Shot)

The main parts of this interface:

  • Panels: Each YOPS window contains one or more graphics panel in which images and graphics components (lines, rectangles, etc.) can be displayed.
  • Loading Images: The browse button above each panel can be used to select an image (gif or jpeg) to be loaded as the background image (main image) of that panel. Alternatively, a file name can be typed into the text field to load the image.
  • Adding Tools: By itself, YOPS is only a program skeleton, and so it does very little. Programmers add to the functionality of YOPS by writing tools and adding them to YOPS (see Building an Image Processor and Building a Line Tool for examples).
  • Selecting Tools: Each tool appears as a button in a list at the left edge of the YOPS window. Pressing a button makes that tool the current tool. YOPS automatically adds the tool as a listener for the user's mouse events, as described in Building a Line Tool.
  • Methods Menu: When the user selects a tool, YOPS fills the methods menu with that tool's graphics methods, as described in the Building an Image Processor.
  • Options Menu: A tool's graphics methods operate on one or more panels, depending upon the number of parameters they have, with the first parameter coming from the leftmost panel, the second parameter coming from the next panel, etc. If the method has a return value, it will be used to modify the next panel after the one corresponding to the last parameter. (For example, if a method takes two integer parameters and returns an integer, the parameter values will come from the first two panels, and the result will go to the third panel.)
    • right to left: Selecting the right to left option in the options menu will reverse the order of the panels for method calls on tools, so that methods will operate in a right to left fashion. (For example, if a method takes two integer parameters, the value of the first parameter will come from the rightmost panel, and the value of the second parameter will come from the panel to its left.)
    • in place: If the in place option is selected from the options menu, then the return value of a method will affect the panel corresponding to the last parameter. (For example, if a method takes two integers and returns an integer, then the result would affect the second panel instead of the third.)
  • The Control Panel: Certain tools provide methods for setting particular values related to that tool. When the current tool has such methods, YOPS will create a control panel (as a floating toolbar) with sliders and checkboxes for the user to set the values.
There are other options for constructing a YOPS object which are well documented in the javadoc for the YOPS class. For instance, to create a YOPS window that panels has 3 panels with widths of 250 pixels and heights of 400 pixels we can replace the constructor call in the previous example with:
      new YOPS(250, 400, 3);

Download our example YOPSExample.java

Continue to 2. Building an Image Processor >

Updates

10/4/2006: Our first release of YOPS is available for download at SourceForge.