Loaded Image java
Loaded Image is a convenient subclass of Canvas, which takes an image at construction time and asynchronously loads it using MediaTracker. Loaded Image the behaves properly inside of Layout Manager control, because it overrides the getPreferredSize( ) and getMinimumSize( ) methods. Also, it has a method called sct( ) that can be used to set a !lew Image to be displayed in this Canvas. That is how the filtered image is ,displayed after the plug-in
The Grayscale filter)s a subclass of RGBimageFilter, which means that Grayscale can use itself .IS the Imagef'ilter parameter to Fi'tteredlmageSource's constructor. Then all it needs to do is override filter RGB() to change the incoming color values. It takes the red, green, and blue values and computes the brightness of the pixel, using the NTS<:; (National Television Standards Committee) color-to-brightness conversion factor, It then simply returns a 'gray pisel that is the same.brightness as the color soUrce.
The Invert filter is also quite simple. It takes apart the red, green, and blue channels arid then inverts them by subtracting them from 255. These inverted values are packed back into a pixel value and returned.