@leafer/image 1.9.3 → 1.9.5
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.
- package/package.json +7 -7
- package/src/ImageManager.ts +1 -1
- package/src/LeaferImage.ts +2 -1
- package/types/index.d.ts +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@leafer/image",
|
|
3
|
-
"version": "1.9.
|
|
3
|
+
"version": "1.9.5",
|
|
4
4
|
"description": "@leafer/image",
|
|
5
5
|
"author": "Chao (Leafer) Wan",
|
|
6
6
|
"license": "MIT",
|
|
@@ -22,13 +22,13 @@
|
|
|
22
22
|
"leaferjs"
|
|
23
23
|
],
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@leafer/task": "1.9.
|
|
26
|
-
"@leafer/file": "1.9.
|
|
27
|
-
"@leafer/data": "1.9.
|
|
28
|
-
"@leafer/math": "1.9.
|
|
29
|
-
"@leafer/platform": "1.9.
|
|
25
|
+
"@leafer/task": "1.9.5",
|
|
26
|
+
"@leafer/file": "1.9.5",
|
|
27
|
+
"@leafer/data": "1.9.5",
|
|
28
|
+
"@leafer/math": "1.9.5",
|
|
29
|
+
"@leafer/platform": "1.9.5"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"@leafer/interface": "1.9.
|
|
32
|
+
"@leafer/interface": "1.9.5"
|
|
33
33
|
}
|
|
34
34
|
}
|
package/src/ImageManager.ts
CHANGED
|
@@ -37,7 +37,7 @@ export const ImageManager: IImageManager = {
|
|
|
37
37
|
},
|
|
38
38
|
|
|
39
39
|
isFormat(format: IExportFileType, config: ILeaferImageConfig): boolean {
|
|
40
|
-
if (config.format
|
|
40
|
+
if (config.format) return config.format === format
|
|
41
41
|
const { url } = config
|
|
42
42
|
if (url.startsWith('data:')) {
|
|
43
43
|
if (url.startsWith('data:' + FileHelper.mineType(format))) return true
|
package/src/LeaferImage.ts
CHANGED
|
@@ -106,7 +106,7 @@ export class LeaferImage implements ILeaferImage {
|
|
|
106
106
|
return this.view
|
|
107
107
|
}
|
|
108
108
|
|
|
109
|
-
public getCanvas(width: number, height: number, opacity?: number, _filters?: IObject, xGap?: number, yGap?: number): any {
|
|
109
|
+
public getCanvas(width: number, height: number, opacity?: number, _filters?: IObject, xGap?: number, yGap?: number, smooth?: boolean): any {
|
|
110
110
|
width || (width = this.width)
|
|
111
111
|
height || (height = this.height)
|
|
112
112
|
|
|
@@ -119,6 +119,7 @@ export class LeaferImage implements ILeaferImage {
|
|
|
119
119
|
const canvas = Platform.origin.createCanvas(max(floor(width + (xGap || 0)), 1), max(floor(height + (yGap || 0)), 1))
|
|
120
120
|
const ctx = canvas.getContext('2d')
|
|
121
121
|
if (opacity) ctx.globalAlpha = opacity
|
|
122
|
+
ctx.imageSmoothingEnabled = smooth === false ? false : true // 平滑绘制
|
|
122
123
|
ctx.drawImage(this.view, 0, 0, width, height)
|
|
123
124
|
|
|
124
125
|
this.cache = this.use > 1 ? { data: canvas, params: arguments } : null
|
package/types/index.d.ts
CHANGED
|
@@ -24,7 +24,7 @@ declare class LeaferImage implements ILeaferImage {
|
|
|
24
24
|
protected onProgress(progress: IProgressData): void;
|
|
25
25
|
protected onComplete(isSuccess: boolean): void;
|
|
26
26
|
getFull(_filters?: IObject): any;
|
|
27
|
-
getCanvas(width: number, height: number, opacity?: number, _filters?: IObject, xGap?: number, yGap?: number): any;
|
|
27
|
+
getCanvas(width: number, height: number, opacity?: number, _filters?: IObject, xGap?: number, yGap?: number, smooth?: boolean): any;
|
|
28
28
|
getPattern(canvas: any, repeat: string | null, transform?: IMatrixData, paint?: ILeaferImagePatternPaint): ICanvasPattern;
|
|
29
29
|
destroy(): void;
|
|
30
30
|
}
|