(p5, fn)
| 7 | import Filters from './filters'; |
| 8 | |
| 9 | function pixels(p5, fn){ |
| 10 | /** |
| 11 | * Copies a region of pixels from one image to another. |
| 12 | * |
| 13 | * The first parameter, `srcImage`, is the |
| 14 | * <a href="#/p5.Image">p5.Image</a> object to blend. |
| 15 | * |
| 16 | * The next four parameters, `sx`, `sy`, `sw`, and `sh` determine the region |
| 17 | * to blend from the source image. `(sx, sy)` is the top-left corner of the |
| 18 | * region. `sw` and `sh` are the regions width and height. |
| 19 | * |
| 20 | * The next four parameters, `dx`, `dy`, `dw`, and `dh` determine the region |
| 21 | * of the canvas to blend into. `(dx, dy)` is the top-left corner of the |
| 22 | * region. `dw` and `dh` are the regions width and height. |
| 23 | * |
| 24 | * The tenth parameter, `blendMode`, sets the effect used to blend the images' |
| 25 | * colors. The options are `BLEND`, `DARKEST`, `LIGHTEST`, `DIFFERENCE`, |
| 26 | * `MULTIPLY`, `EXCLUSION`, `SCREEN`, `REPLACE`, `OVERLAY`, `HARD_LIGHT`, |
| 27 | * `SOFT_LIGHT`, `DODGE`, `BURN`, `ADD`, or `NORMAL` |
| 28 | * |
| 29 | * @method blend |
| 30 | * @param {p5.Image} srcImage source image. |
| 31 | * @param {Integer} sx x-coordinate of the source's upper-left corner. |
| 32 | * @param {Integer} sy y-coordinate of the source's upper-left corner. |
| 33 | * @param {Integer} sw source image width. |
| 34 | * @param {Integer} sh source image height. |
| 35 | * @param {Integer} dx x-coordinate of the destination's upper-left corner. |
| 36 | * @param {Integer} dy y-coordinate of the destination's upper-left corner. |
| 37 | * @param {Integer} dw destination image width. |
| 38 | * @param {Integer} dh destination image height. |
| 39 | * @param {(BLEND|DARKEST|LIGHTEST|DIFFERENCE|MULTIPLY|EXCLUSION|SCREEN|REPLACE|OVERLAY|HARD_LIGHT|SOFT_LIGHT|DODGE|BURN|ADD|NORMAL)} blendMode the blend mode. either |
| 40 | * BLEND, DARKEST, LIGHTEST, DIFFERENCE, |
| 41 | * MULTIPLY, EXCLUSION, SCREEN, REPLACE, OVERLAY, HARD_LIGHT, |
| 42 | * SOFT_LIGHT, DODGE, BURN, ADD or NORMAL. |
| 43 | * |
| 44 | * @example |
| 45 | * let img0; |
| 46 | * let img1; |
| 47 | * |
| 48 | * async function setup() { |
| 49 | * // Load the images. |
| 50 | * img0 = await loadImage('assets/rockies.jpg'); |
| 51 | * img1 = await loadImage('assets/bricks_third.jpg'); |
| 52 | * |
| 53 | * createCanvas(100, 100); |
| 54 | * |
| 55 | * // Use the mountains as the background. |
| 56 | * background(img0); |
| 57 | * |
| 58 | * // Display the bricks. |
| 59 | * image(img1, 0, 0); |
| 60 | * |
| 61 | * // Display the bricks faded into the landscape. |
| 62 | * blend(img1, 0, 0, 33, 100, 67, 0, 33, 100, LIGHTEST); |
| 63 | * |
| 64 | * describe('A wall of bricks in front of a mountain landscape. The same wall of bricks appears faded on the right of the image.'); |
| 65 | * } |
| 66 | * |
no test coverage detected