mirror of
https://github.com/lovell/sharp.git
synced 2025-07-09 10:30:15 +02:00
Ensure backwards-compatibility of JSDoc introduced in ea599ad
This commit is contained in:
parent
fcbe4e1e01
commit
ac18bbbc7c
@ -145,7 +145,7 @@ See [libvips sharpen][8] operation.
|
|||||||
|
|
||||||
### Parameters
|
### Parameters
|
||||||
|
|
||||||
* `options` **[Object][2]?** if present, is an Object with optional attributes.
|
* `options` **([Object][2] | [number][1])?** if present, is an Object with attributes or (deprecated) a number for `options.sigma`.
|
||||||
|
|
||||||
* `options.sigma` **[number][1]?** the sigma of the Gaussian mask, where `sigma = 1 + radius / 2`.
|
* `options.sigma` **[number][1]?** the sigma of the Gaussian mask, where `sigma = 1 + radius / 2`.
|
||||||
* `options.m1` **[number][1]** the level of sharpening to apply to "flat" areas. (optional, default `1.0`)
|
* `options.m1` **[number][1]** the level of sharpening to apply to "flat" areas. (optional, default `1.0`)
|
||||||
@ -153,6 +153,8 @@ See [libvips sharpen][8] operation.
|
|||||||
* `options.x1` **[number][1]** threshold between "flat" and "jagged" (optional, default `2.0`)
|
* `options.x1` **[number][1]** threshold between "flat" and "jagged" (optional, default `2.0`)
|
||||||
* `options.y2` **[number][1]** maximum amount of brightening. (optional, default `10.0`)
|
* `options.y2` **[number][1]** maximum amount of brightening. (optional, default `10.0`)
|
||||||
* `options.y3` **[number][1]** maximum amount of darkening. (optional, default `20.0`)
|
* `options.y3` **[number][1]** maximum amount of darkening. (optional, default `20.0`)
|
||||||
|
* `flat` **[number][1]?** (deprecated) see `options.m1`.
|
||||||
|
* `jagged` **[number][1]?** (deprecated) see `options.m2`.
|
||||||
|
|
||||||
### Examples
|
### Examples
|
||||||
|
|
||||||
|
@ -213,17 +213,19 @@ function affine (matrix, options) {
|
|||||||
* })
|
* })
|
||||||
* .toBuffer();
|
* .toBuffer();
|
||||||
*
|
*
|
||||||
* @param {Object} [options] - if present, is an Object with optional attributes.
|
* @param {Object|number} [options] - if present, is an Object with attributes or (deprecated) a number for `options.sigma`.
|
||||||
* @param {number} [options.sigma] - the sigma of the Gaussian mask, where `sigma = 1 + radius / 2`.
|
* @param {number} [options.sigma] - the sigma of the Gaussian mask, where `sigma = 1 + radius / 2`.
|
||||||
* @param {number} [options.m1=1.0] - the level of sharpening to apply to "flat" areas.
|
* @param {number} [options.m1=1.0] - the level of sharpening to apply to "flat" areas.
|
||||||
* @param {number} [options.m2=2.0] - the level of sharpening to apply to "jagged" areas.
|
* @param {number} [options.m2=2.0] - the level of sharpening to apply to "jagged" areas.
|
||||||
* @param {number} [options.x1=2.0] - threshold between "flat" and "jagged"
|
* @param {number} [options.x1=2.0] - threshold between "flat" and "jagged"
|
||||||
* @param {number} [options.y2=10.0] - maximum amount of brightening.
|
* @param {number} [options.y2=10.0] - maximum amount of brightening.
|
||||||
* @param {number} [options.y3=20.0] - maximum amount of darkening.
|
* @param {number} [options.y3=20.0] - maximum amount of darkening.
|
||||||
|
* @param {number} [flat] - (deprecated) see `options.m1`.
|
||||||
|
* @param {number} [jagged] - (deprecated) see `options.m2`.
|
||||||
* @returns {Sharp}
|
* @returns {Sharp}
|
||||||
* @throws {Error} Invalid parameters
|
* @throws {Error} Invalid parameters
|
||||||
*/
|
*/
|
||||||
function sharpen (options) {
|
function sharpen (options, flat, jagged) {
|
||||||
if (!is.defined(options)) {
|
if (!is.defined(options)) {
|
||||||
// No arguments: default to mild sharpen
|
// No arguments: default to mild sharpen
|
||||||
this.options.sharpenSigma = -1;
|
this.options.sharpenSigma = -1;
|
||||||
@ -234,19 +236,19 @@ function sharpen (options) {
|
|||||||
// Deprecated numeric argument: specific sigma
|
// Deprecated numeric argument: specific sigma
|
||||||
this.options.sharpenSigma = options;
|
this.options.sharpenSigma = options;
|
||||||
// Deprecated control over flat areas
|
// Deprecated control over flat areas
|
||||||
if (is.defined(arguments[1])) {
|
if (is.defined(flat)) {
|
||||||
if (is.number(arguments[1]) && is.inRange(arguments[1], 0, 10000)) {
|
if (is.number(flat) && is.inRange(flat, 0, 10000)) {
|
||||||
this.options.sharpenM1 = arguments[1];
|
this.options.sharpenM1 = flat;
|
||||||
} else {
|
} else {
|
||||||
throw is.invalidParameterError('flat', 'number between 0 and 10000', arguments[1]);
|
throw is.invalidParameterError('flat', 'number between 0 and 10000', flat);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Deprecated control over jagged areas
|
// Deprecated control over jagged areas
|
||||||
if (is.defined(arguments[2])) {
|
if (is.defined(jagged)) {
|
||||||
if (is.number(arguments[2]) && is.inRange(arguments[2], 0, 10000)) {
|
if (is.number(jagged) && is.inRange(jagged, 0, 10000)) {
|
||||||
this.options.sharpenM2 = arguments[2];
|
this.options.sharpenM2 = jagged;
|
||||||
} else {
|
} else {
|
||||||
throw is.invalidParameterError('jagged', 'number between 0 and 10000', arguments[2]);
|
throw is.invalidParameterError('jagged', 'number between 0 and 10000', jagged);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (is.plainObject(options)) {
|
} else if (is.plainObject(options)) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user