|
1 |
| -Method called `subtract` ,as the name suggests, takes another mask and makes a subtraction between each respective bit of the mask. |
| 1 | +Method called `subtract` ,as the name suggests, takes another image and makes a subtraction between each respective bit of both images. |
2 | 2 | It works like this:
|
3 | 3 |
|
4 | 4 | ```ts
|
5 |
| -let image = new Mask(3, 3, { |
| 5 | +let image = new Image(3, 3, { |
6 | 6 | data: new Uint8Array([1, 1, 1, 1, 1, 1, 1, 1, 1]),
|
7 | 7 | });
|
8 |
| -let mask2 = new Mask(3, 3, { |
| 8 | +let image2 = new Image(3, 3, { |
9 | 9 | data: new Uint8Array([1, 1, 1, 2, 2, 2, 2, 2, 2]),
|
10 | 10 | });
|
11 |
| -mask = mask.subtract(mask2); |
12 |
| -// expect mask to equal [0,0,0,1,1,1,1,1,1] |
| 11 | +mask = image.subtract(image2); |
| 12 | +// expect image to equal [0,0,0,1,1,1,1,1,1] |
13 | 13 | ```
|
14 | 14 |
|
15 | 15 | :::caution
|
16 |
| -Masks must have the same size for compatibility reasons. |
17 |
| -::: |
18 |
| - |
19 |
| -:::info |
20 |
| -Mask method calls already preexisting `subtract` function. To learn more about how the function works click on this link(link) |
| 16 | +Images must have the same size for compatibility reasons. |
21 | 17 | :::
|
22 | 18 |
|
23 | 19 | ### Parameters and default values
|
24 | 20 |
|
25 |
| -- [`mask`](https://image-js.github.io/image-js-typescript/classes/Mask.html#subtract 'github.io link') |
| 21 | +- [`image`](https://image-js.github.io/image-js-typescript/classes/Image.html#subtract 'github.io link') |
26 | 22 |
|
27 |
| -- [`options`](https://image-js.github.io/image-js-typescript/classes/Mask.html#subtract 'github.io link') |
| 23 | +- [`options`](https://image-js.github.io/image-js-typescript/classes/Image.html#subtract 'github.io link') |
0 commit comments