canvas-editor-engine 1.0.71 → 1.0.73
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4,7 +4,7 @@ export default class VagueFilter extends Filter {
|
|
4
4
|
options: IImageOptions;
|
5
5
|
filterList: TFilterMethod[];
|
6
6
|
constructor(ctx: CanvasRenderingContext2D, options: IImageOptions);
|
7
|
-
on(action: TFilterMethod, filterOptions: IFilterOptions):
|
7
|
+
on(action: TFilterMethod, filterOptions: IFilterOptions): Promise<unknown>;
|
8
8
|
pixel(imageData: ImageData, filterOptions: IFilterOptions): ImageData;
|
9
9
|
private getQualityBuff;
|
10
10
|
private getMostCommonQuanlityBuff;
|
@@ -11,9 +11,12 @@ class VagueFilter extends filter_1.Filter {
|
|
11
11
|
this.options = options;
|
12
12
|
}
|
13
13
|
on(action, filterOptions) {
|
14
|
-
|
15
|
-
|
16
|
-
|
14
|
+
return new Promise((resolve) => {
|
15
|
+
const imageData = this.copy(this.options);
|
16
|
+
const rowImageData = this[action](imageData, filterOptions);
|
17
|
+
this.update(rowImageData, this.options);
|
18
|
+
return resolve('complite');
|
19
|
+
});
|
17
20
|
}
|
18
21
|
pixel(imageData, filterOptions) {
|
19
22
|
const imageSize = {
|
@@ -11,5 +11,5 @@ export declare class SCImage {
|
|
11
11
|
constructor(src: string, ctx: CanvasRenderingContext2D);
|
12
12
|
get(): HTMLImageElement;
|
13
13
|
draw(options: IDrawImageArgs): Promise<unknown>;
|
14
|
-
vague(options: IImageOptions, filterOptions: IFilterOptions):
|
14
|
+
vague(options: IImageOptions, filterOptions: IFilterOptions): Promise<unknown>;
|
15
15
|
}
|
@@ -14,7 +14,9 @@ class DrawService {
|
|
14
14
|
static drawSmoothImage(useStore, options, filterOptions) {
|
15
15
|
const filterArgs = DrawService.getFilterArgs(useStore, options);
|
16
16
|
event_service_1.default.dispatch('loading-start');
|
17
|
-
this.scImage.vague(filterArgs, filterOptions)
|
17
|
+
this.scImage.vague(filterArgs, filterOptions).finally(() => {
|
18
|
+
event_service_1.default.dispatch('loading-end');
|
19
|
+
});
|
18
20
|
}
|
19
21
|
static getFilterArgs(useStore, options) {
|
20
22
|
let filterArgs;
|
@@ -84,7 +86,7 @@ class SCImage {
|
|
84
86
|
}
|
85
87
|
vague(options, filterOptions) {
|
86
88
|
const filter = new filters_1.VagueFilter(this.ctx, options);
|
87
|
-
filter.on('pixel', filterOptions);
|
89
|
+
return filter.on('pixel', filterOptions);
|
88
90
|
}
|
89
91
|
}
|
90
92
|
exports.SCImage = SCImage;
|