Skip to content

Commit 3c53e6b

Browse files
committed
feat: implement mask.paintMask
1 parent d81f43f commit 3c53e6b

File tree

8 files changed

+363
-195
lines changed

8 files changed

+363
-195
lines changed

src/IJS.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,8 @@ import {
6868
crop,
6969
CropOptions,
7070
grey,
71-
paintMask,
72-
PaintMaskOptions,
71+
paintMaskOnIjs,
72+
PaintMaskOnIjsOptions,
7373
split,
7474
} from './operations';
7575
import { cropAlpha, CropAlphaOptions } from './operations/cropAlpha';
@@ -752,8 +752,8 @@ export class IJS {
752752
* @param options - Paint mask options.
753753
* @returns The painted image.
754754
*/
755-
public paintMask(mask: Mask, options?: PaintMaskOptions): IJS {
756-
return paintMask(this, mask, options);
755+
public paintMask(mask: Mask, options?: PaintMaskOnIjsOptions): IJS {
756+
return paintMaskOnIjs(this, mask, options);
757757
}
758758

759759
// FILTERS

src/Mask.ts

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { ColorDepth, colorModels, IJS, ImageColorModel } from './IJS';
12
import {
23
drawLineOnMask,
34
DrawLineOnMaskOptions,
@@ -48,18 +49,15 @@ import {
4849
TopHatOptions,
4950
} from './morphology';
5051
import { erode } from './morphology/erode';
51-
import { boolToNumber } from './utils/boolToNumber';
52-
import { Point } from './utils/geometry/points';
53-
5452
import {
55-
ImageColorModel,
56-
ColorDepth,
57-
colorModels,
58-
IJS,
5953
convertColor,
60-
CopyToOptions,
6154
copyTo,
62-
} from '.';
55+
CopyToOptions,
56+
paintMaskOnMask,
57+
PaintMaskOnMaskOptions,
58+
} from './operations';
59+
import { boolToNumber } from './utils/boolToNumber';
60+
import { Point } from './utils/geometry/points';
6361

6462
export type BitValue = 1 | 0 | boolean;
6563

@@ -695,6 +693,17 @@ export class Mask {
695693
public copyTo(target: Mask, options: CopyToOptions<Mask> = {}): Mask {
696694
return copyTo(this, target, options);
697695
}
696+
697+
/**
698+
* Paint a mask onto another mask and the given position and with the given value.
699+
*
700+
* @param mask - Mask to paint.
701+
* @param options - Paint mask options.
702+
* @returns The painted mask.
703+
*/
704+
public paintMask(mask: Mask, options?: PaintMaskOnMaskOptions): Mask {
705+
return paintMaskOnMask(this, mask, options);
706+
}
698707
}
699708

700709
/**

src/operations/__tests__/paintMask.test.ts

Lines changed: 0 additions & 178 deletions
This file was deleted.

0 commit comments

Comments
 (0)