From: Toby D. <tjd...@gm...> - 2005-07-09 19:53:52
|
I've been looking at the original feature list for the harriet release, and it needs to be changed and firmed up given what has actually been implemented in the casey version. I think the main change in harriet should be a fundamental re- structuring of TheMatrix. Right now, TheMatrix combines the behaviour of a BufferedImage and a JFrame into one class. This is simple and convenient for beginners, but it makes it awkward to do more advanced things, such as adding your own buttons to the frame, or put the image in some other frame in a window. The current way around this is to use TheMatrix.getImage() to get a reference to the BufferedImage, and then use the plain BufferedImage as needed. This works, but the problem is that the extracted BufferedImage lacks all the nice extra features that TheMatrix implements for it (e.g. making copies, multiple set/get methods, saving/loading, etc.). So the "obvious" solution (which in fact has taken me some time to realize as obvious) is to create a new class that extends BufferedImage, and implements all the nifty extra methods we want for BufferedImage. Then, we create special JFrame-derived methods for displaying these images. While we should be able to keep the original calling behaviour of TheMatrix, this new design will allow calling code like this: FancyBufferedImage im = new FancyBufferedImage("pic.jpeg"); // ... process the pixels of im without displaying it ... show.asPlainFrame(im); We can make as many "show" methods as we like (maybe with better names). Any comments? Toby -- Dr. Toby Donaldson School of Computing Science Simon Fraser University (Surrey) |