Skip to content

Commit

Permalink
Merge pull request #5052 from rt1301/#5045-filter-doc
Browse files Browse the repository at this point in the history
Updated the p5.Image filter() method documentation
  • Loading branch information
montoyamoraga committed Feb 21, 2021
2 parents bb4ba44 + 435c321 commit f81bb70
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions src/image/p5.Image.js
Original file line number Diff line number Diff line change
Expand Up @@ -664,6 +664,44 @@ p5.Image.prototype.mask = function(p5Image) {
/**
* Applies an image filter to a <a href="#/p5.Image">p5.Image</a>
*
* THRESHOLD
* Converts the image to black and white pixels depending if they are above or
* below the threshold defined by the level parameter. The parameter must be
* between 0.0 (black) and 1.0 (white). If no level is specified, 0.5 is used.
*
* GRAY
* Converts any colors in the image to grayscale equivalents. No parameter
* is used.
*
* OPAQUE
* Sets the alpha channel to entirely opaque. No parameter is used.
*
* INVERT
* Sets each pixel to its inverse value. No parameter is used.
*
* POSTERIZE
* Limits each channel of the image to the number of colors specified as the
* parameter. The parameter can be set to values between 2 and 255, but
* results are most noticeable in the lower ranges.
*
* BLUR
* Executes a Gaussian blur with the level parameter specifying the extent
* of the blurring. If no parameter is used, the blur is equivalent to
* Gaussian blur of radius 1. Larger values increase the blur.
*
* ERODE
* Reduces the light areas. No parameter is used.
*
* DILATE
* Increases the light areas. No parameter is used.
*
* filter() does not work in WEBGL mode.
* A similar effect can be achieved in WEBGL mode using custom
* shaders. Adam Ferriss has written
* a <a href="https://github.com/aferriss/p5jsShaderExamples"
* target='_blank'>selection of shader examples</a> that contains many
* of the effects present in the filter examples.
*
* @method filter
* @param {Constant} filterType either THRESHOLD, GRAY, OPAQUE, INVERT,
* POSTERIZE, ERODE, DILATE or BLUR.
Expand Down

0 comments on commit f81bb70

Please sign in to comment.