The filter method is very simple to use and accepts eight different constant parameters, which apply different filters to the screen content. The parameters accepted by the filter method are: INVERT, GRAY, THRESHOLD, ERODE, DILATE, OPAQUE, BLUR and POSTERIZE. The signature of the filter method is filter(MODE), where MODE is one of the parameters listed above. Some modes can also accept an integer or float, that specifies the intensity required, if no second parameter is provided, a default value is used, which is usually mid range.
Before discussing each filter in depth we will look at an image transformed by each filter mode, so we can compare the different effects.
As can be seen from the images, using the filter method and its modes, can spectacularly transform an image. Some of these effects had the filter applied several times, to emphasize the effects produced. The astute observer may have noticed, that the opaque image is no different from the original image. This is because our example image has no transparent areas. Some very dramatic animations can be created, by varying the intensity parameter of a filter and displaying each effect in a loop. We will now discuss the modes in depth. Most modes will have a small animation to illustrate their functionality.
No comments:
Post a Comment