@psdk/frame-imageb
Advanced tools
Comparing version 0.3.0 to 0.3.1
import { ImagebProcesser } from "../process"; | ||
import { ProcessedResult } from "../../types"; | ||
export declare class Pbita extends ImagebProcesser { | ||
command: string; | ||
threshold: number; | ||
@@ -8,2 +9,3 @@ compress: boolean; | ||
constructor(options: { | ||
command: string; | ||
threshold: number; | ||
@@ -15,4 +17,6 @@ compress?: boolean; | ||
_topbitimg(canvas: HTMLCanvasElement, width: number, height: number): Uint8Array; | ||
_topbitimgRaw(canvas: HTMLCanvasElement, width: number, height: number): Uint8Array; | ||
_topbitimgReverse(originBytes: Uint8Array): Uint8Array; | ||
private fastExtractPixel; | ||
} | ||
//# sourceMappingURL=pbita.d.ts.map |
@@ -10,2 +10,3 @@ import { ImagebProcesser } from "../process"; | ||
this.threshold = options.threshold; | ||
this.command = options.command; | ||
this.compress = options.compress; | ||
@@ -48,3 +49,3 @@ this.reverse = options.reverse; | ||
if (this.compress) { | ||
outputBytes = pako.deflate(outputBytes); | ||
outputBytes = pako.deflate(outputBytes, { windowBits: 10 }); | ||
} | ||
@@ -62,2 +63,10 @@ return new ProcessedResult({ | ||
_topbitimg(canvas, width, height) { | ||
if (this.command == 'tspl' && !this.compress) { | ||
return this._topbitimgReverse(this._topbitimgRaw(canvas, width, height)); | ||
} | ||
else { | ||
return this._topbitimgRaw(canvas, width, height); | ||
} | ||
} | ||
_topbitimgRaw(canvas, width, height) { | ||
var _a; | ||
@@ -100,2 +109,12 @@ const ctx = canvas.getContext('2d'); | ||
} | ||
_topbitimgReverse(originBytes) { | ||
if (originBytes == null) { | ||
return null; | ||
} | ||
const bytes = []; | ||
for (let i = 0; i < originBytes.length; i++) { | ||
bytes[i] = ~originBytes[i]; | ||
} | ||
return new Uint8Array(bytes); | ||
} | ||
fastExtractPixel(imageData, x, y, w, h) { | ||
@@ -102,0 +121,0 @@ let i, j; |
{ | ||
"name": "@psdk/frame-imageb", | ||
"version": "0.3.0", | ||
"version": "0.3.1", | ||
"description": "psdk", | ||
@@ -35,3 +35,3 @@ "main": "build/index.js", | ||
], | ||
"gitHead": "9796259a6a24ae7e334340f6c28d5ae9b3e45401" | ||
"gitHead": "e6a5cd6d59ef0ae61226a47d72fbe059a787d291" | ||
} |
Sorry, the diff of this file is not supported yet
19440
399