From aa9dbb984ad7cfefecd424626235606b4fb733ec Mon Sep 17 00:00:00 2001 From: Andreas Hocevar Date: Sat, 4 Jun 2016 00:28:30 +0200 Subject: [PATCH] Work around undetected types in {function(argType):returnType} types --- examples/color-manipulation.js | 8 ++++---- examples/raster.js | 2 +- src/ol/typedefs.js | 30 ++++++++++++------------------ 3 files changed, 17 insertions(+), 23 deletions(-) diff --git a/examples/color-manipulation.js b/examples/color-manipulation.js index 6e6f8565b3..2cd424efa3 100644 --- a/examples/color-manipulation.js +++ b/examples/color-manipulation.js @@ -22,8 +22,8 @@ var twoPi = 2 * Math.PI; /** * Convert an RGB pixel into an HCL pixel. - * @param {ol.raster.Pixel} pixel A pixel in RGB space. - * @return {ol.raster.Pixel} A pixel in HCL space. + * @param {Array.} pixel A pixel in RGB space. + * @return {Array.} A pixel in HCL space. */ function rgb2hcl(pixel) { var red = rgb2xyz(pixel[0]); @@ -57,8 +57,8 @@ function rgb2hcl(pixel) { /** * Convert an HCL pixel into an RGB pixel. - * @param {ol.raster.Pixel} pixel A pixel in HCL space. - * @return {ol.raster.Pixel} A pixel in RGB space. + * @param {Array.} pixel A pixel in HCL space. + * @return {Array.} A pixel in RGB space. */ function hcl2rgb(pixel) { var h = pixel[0]; diff --git a/examples/raster.js b/examples/raster.js index e4a38ae29f..395ac7dcbd 100644 --- a/examples/raster.js +++ b/examples/raster.js @@ -15,7 +15,7 @@ var bins = 10; /** * Calculate the Vegetation Greenness Index (VGI) from an input pixel. This * is a rough estimate assuming that pixel values correspond to reflectance. - * @param {ol.raster.Pixel} pixel An array of [R, G, B, A] values. + * @param {Array.} pixel An array of [R, G, B, A] values. * @return {number} The VGI value for the given pixel. */ function vgi(pixel) { diff --git a/src/ol/typedefs.js b/src/ol/typedefs.js index 877bff5089..5bea318867 100644 --- a/src/ol/typedefs.js +++ b/src/ol/typedefs.js @@ -611,29 +611,23 @@ ol.proj.ProjectionLike; /** * A function that takes an array of input data, performs some operation, and - * returns an array of ouput data. For `'pixel'` type operations, functions - * will be called with an array of {@link ol.raster.Pixel} data and should - * return an array of the same. For `'image'` type operations, functions will - * be called with an array of {@link ImageData - * https://developer.mozilla.org/en-US/docs/Web/API/ImageData} and should return - * an array of the same. The operations are called with a second "data" - * argument, which can be used for storage. The data object is accessible - * from raster events, where it can be initialized in "beforeoperations" and - * accessed again in "afteroperations". + * returns an array of ouput data. + * For `pixel` type operations, the function will be called with an array of + * pixels, where each pixel is an array of four numbers (`[r, g, b, a]`) in the + * range of 0 - 255. It should return an array of the same. + * For `'image'` type operations, functions will be called with an array of + * {@link ImageData https://developer.mozilla.org/en-US/docs/Web/API/ImageData} + * and should return an array of the same. The operations are called with a + * second "data" argument, which can be used for storage. The data object is + * accessible from raster events, where it can be initialized in + * "beforeoperations" and accessed again in "afteroperations". * - * @typedef {function((Array.|Array.), Object): - * (Array.|Array.)} + * @typedef {function((Array.>|Array.), Object): + * (Array.>|Array.)} */ ol.raster.Operation; -/** - * An array of numbers representing pixel values. - * @typedef {Array.} ol.raster.Pixel - */ -ol.raster.Pixel; - - /** * @typedef {{x: number, y: number, width: number, height: number}} */