Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated the p5.Image filter() method documentation #5052

Merged
merged 2 commits into from
Feb 21, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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