Nathan Sprague
int
or String
.Filled diamonds represent composition. An Image is composed of at least one pixel and those pixels generally cease to exist with the Image. | |
Open diamonds represent aggregation. A MimpApp object may contain zero or one Image objects, but either could exist without the other.
|
|
Dotted arrow represents dependency. ImageTransforms must interact with instances of Image and Pixel . Changing the public interfaces of Image or Pixel might require us to make changes to ImageTransforms .
|
vs. |
ImageTransform
methods are only used by MimpApp
. Let’s get rid of ImageTransform
and move those methods into MimpApp
.vs. |
ImageTransform
methods into Image
class and make them non-static:
Image gray = colorImage.convertToGrayscale();
vs. |
Channel
class to handle range limiting color values to 0-255.vs. |
Image
class by removing getPixel
/setPixel
and replacing them with methods like:
getRed(int x, int y)
getGreen(int x, int y)
getBlue(int x, int y)
setPixelColor(int x, int y, int red, int green, int blue)
Image
class will still use Pixel
objects internally)Pixel
and ImageTransforms
Image
and Pixel
Image
vs. |
Image
s contain two-dimensional arrays of length-three arrays containing the three color values.Image
class is still cohesive