canvas-editor-engine 1.1.13 → 1.1.14
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.
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import type { IFilterOptions, IImageOptions, TFilterMethod } from "../../types/image";
|
|
1
|
+
import type { IFilterOptions, IImageLoggingDataVague, IImageOptions, TFilterMethod } from "../../types/image";
|
|
2
2
|
import { Filter } from "../../utils/filter";
|
|
3
3
|
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): Promise<
|
|
7
|
+
on(action: TFilterMethod, filterOptions: IFilterOptions): Promise<IImageLoggingDataVague>;
|
|
8
8
|
pixel(imageData: ImageData, filterOptions: IFilterOptions): ImageData;
|
|
9
9
|
private getQualityBuff;
|
|
10
10
|
private getMostCommonQuanlityBuff;
|
|
@@ -12,10 +12,22 @@ class VagueFilter extends filter_1.Filter {
|
|
|
12
12
|
}
|
|
13
13
|
on(action, filterOptions) {
|
|
14
14
|
return new Promise((resolve) => {
|
|
15
|
-
const
|
|
15
|
+
const options = this.options;
|
|
16
|
+
const imageData = this.copy(options);
|
|
16
17
|
const rowImageData = this[action](imageData, filterOptions);
|
|
17
|
-
this.update(rowImageData,
|
|
18
|
-
return resolve(
|
|
18
|
+
this.update(rowImageData, options);
|
|
19
|
+
return resolve({
|
|
20
|
+
imageData: rowImageData,
|
|
21
|
+
position: {
|
|
22
|
+
x: options.x,
|
|
23
|
+
y: options.y,
|
|
24
|
+
},
|
|
25
|
+
size: {
|
|
26
|
+
width: rowImageData.width,
|
|
27
|
+
height: rowImageData.height,
|
|
28
|
+
},
|
|
29
|
+
quality: filterOptions.quality,
|
|
30
|
+
});
|
|
19
31
|
});
|
|
20
32
|
}
|
|
21
33
|
pixel(imageData, filterOptions) {
|
|
@@ -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): Promise<
|
|
14
|
+
vague(options: IImageOptions, filterOptions: IFilterOptions): Promise<import("../types/image").IImageLoggingDataVague>;
|
|
15
15
|
}
|
|
@@ -27,7 +27,18 @@ class DrawService {
|
|
|
27
27
|
static drawSmoothImage(useStore, options, filterOptions) {
|
|
28
28
|
const filterArgs = DrawService.getFilterArgs(useStore, options);
|
|
29
29
|
event_service_1.default.dispatch('loading-start');
|
|
30
|
-
this.scImage.vague(filterArgs, filterOptions)
|
|
30
|
+
this.scImage.vague(filterArgs, filterOptions)
|
|
31
|
+
.then(({ imageData, position, size, quality }) => {
|
|
32
|
+
store_1.default.store.imageState.reduce({
|
|
33
|
+
tempImageData: imageData,
|
|
34
|
+
position: position,
|
|
35
|
+
size: {
|
|
36
|
+
width: size.width,
|
|
37
|
+
height: size.height,
|
|
38
|
+
}
|
|
39
|
+
}, `[Filter Vague] quality: ${quality}`);
|
|
40
|
+
})
|
|
41
|
+
.finally(() => {
|
|
31
42
|
event_service_1.default.dispatch('loading-end');
|
|
32
43
|
});
|
|
33
44
|
}
|
package/dist/types/history.d.ts
CHANGED
|
@@ -1,6 +1,15 @@
|
|
|
1
|
+
import { IPosition, ISize } from "./general";
|
|
1
2
|
export interface IHistoryLine {
|
|
2
3
|
stateName: string;
|
|
3
4
|
stateValue: any;
|
|
4
5
|
view: string;
|
|
5
6
|
}
|
|
6
7
|
export type TReducerNames = 'SET_HISTORY' | 'UPDATE_HISTORY' | 'UNDO' | 'REDO';
|
|
8
|
+
export interface IImageLoggingData {
|
|
9
|
+
imageData: ImageData;
|
|
10
|
+
size: ISize;
|
|
11
|
+
position: IPosition;
|
|
12
|
+
}
|
|
13
|
+
export interface IImageLoggingDataVague extends IImageLoggingData {
|
|
14
|
+
quality: number;
|
|
15
|
+
}
|
package/dist/types/image.d.ts
CHANGED
|
@@ -35,3 +35,10 @@ export interface IExtendedImageDataModel {
|
|
|
35
35
|
imageData: ImageData;
|
|
36
36
|
size: ISize;
|
|
37
37
|
}
|
|
38
|
+
export interface IImageLoggingData {
|
|
39
|
+
imageData: ImageData;
|
|
40
|
+
size: ISize;
|
|
41
|
+
position: IPosition;
|
|
42
|
+
}
|
|
43
|
+
export interface IImageLoggingDataVague extends IImageLoggingData, IFilterOptions {
|
|
44
|
+
}
|