ccc-tnt-psd2ui/npm-packages/win32-v3.4.+/ag-psd/dist-es/helpers.js
2023-07-24 10:36:46 +08:00

317 lines
41 KiB
JavaScript

import { fromByteArray } from 'base64-js';
import { deflate } from 'pako';
export var MOCK_HANDLERS = false;
export var RAW_IMAGE_DATA = false;
export var fromBlendMode = {};
export var toBlendMode = {
'pass': 'pass through',
'norm': 'normal',
'diss': 'dissolve',
'dark': 'darken',
'mul ': 'multiply',
'idiv': 'color burn',
'lbrn': 'linear burn',
'dkCl': 'darker color',
'lite': 'lighten',
'scrn': 'screen',
'div ': 'color dodge',
'lddg': 'linear dodge',
'lgCl': 'lighter color',
'over': 'overlay',
'sLit': 'soft light',
'hLit': 'hard light',
'vLit': 'vivid light',
'lLit': 'linear light',
'pLit': 'pin light',
'hMix': 'hard mix',
'diff': 'difference',
'smud': 'exclusion',
'fsub': 'subtract',
'fdiv': 'divide',
'hue ': 'hue',
'sat ': 'saturation',
'colr': 'color',
'lum ': 'luminosity',
};
Object.keys(toBlendMode).forEach(function (key) { return fromBlendMode[toBlendMode[key]] = key; });
export var layerColors = [
'none', 'red', 'orange', 'yellow', 'green', 'blue', 'violet', 'gray'
];
export var largeAdditionalInfoKeys = [
// from documentation
'LMsk', 'Lr16', 'Lr32', 'Layr', 'Mt16', 'Mt32', 'Mtrn', 'Alph', 'FMsk', 'lnk2', 'FEid', 'FXid', 'PxSD',
// from guessing
'cinf',
];
export function revMap(map) {
var result = {};
Object.keys(map).forEach(function (key) { return result[map[key]] = key; });
return result;
}
export function createEnum(prefix, def, map) {
var rev = revMap(map);
var decode = function (val) {
var value = val.split('.')[1];
if (value && !rev[value])
throw new Error("Unrecognized value for enum: '".concat(val, "'"));
return rev[value] || def;
};
var encode = function (val) {
if (val && !map[val])
throw new Error("Invalid value for enum: '".concat(val, "'"));
return "".concat(prefix, ".").concat(map[val] || map[def]);
};
return { decode: decode, encode: encode };
}
export var ColorSpace;
(function (ColorSpace) {
ColorSpace[ColorSpace["RGB"] = 0] = "RGB";
ColorSpace[ColorSpace["HSB"] = 1] = "HSB";
ColorSpace[ColorSpace["CMYK"] = 2] = "CMYK";
ColorSpace[ColorSpace["Lab"] = 7] = "Lab";
ColorSpace[ColorSpace["Grayscale"] = 8] = "Grayscale";
})(ColorSpace || (ColorSpace = {}));
export var LayerMaskFlags;
(function (LayerMaskFlags) {
LayerMaskFlags[LayerMaskFlags["PositionRelativeToLayer"] = 1] = "PositionRelativeToLayer";
LayerMaskFlags[LayerMaskFlags["LayerMaskDisabled"] = 2] = "LayerMaskDisabled";
LayerMaskFlags[LayerMaskFlags["InvertLayerMaskWhenBlending"] = 4] = "InvertLayerMaskWhenBlending";
LayerMaskFlags[LayerMaskFlags["LayerMaskFromRenderingOtherData"] = 8] = "LayerMaskFromRenderingOtherData";
LayerMaskFlags[LayerMaskFlags["MaskHasParametersAppliedToIt"] = 16] = "MaskHasParametersAppliedToIt";
})(LayerMaskFlags || (LayerMaskFlags = {}));
export var MaskParams;
(function (MaskParams) {
MaskParams[MaskParams["UserMaskDensity"] = 1] = "UserMaskDensity";
MaskParams[MaskParams["UserMaskFeather"] = 2] = "UserMaskFeather";
MaskParams[MaskParams["VectorMaskDensity"] = 4] = "VectorMaskDensity";
MaskParams[MaskParams["VectorMaskFeather"] = 8] = "VectorMaskFeather";
})(MaskParams || (MaskParams = {}));
export var ChannelID;
(function (ChannelID) {
ChannelID[ChannelID["Color0"] = 0] = "Color0";
ChannelID[ChannelID["Color1"] = 1] = "Color1";
ChannelID[ChannelID["Color2"] = 2] = "Color2";
ChannelID[ChannelID["Color3"] = 3] = "Color3";
ChannelID[ChannelID["Transparency"] = -1] = "Transparency";
ChannelID[ChannelID["UserMask"] = -2] = "UserMask";
ChannelID[ChannelID["RealUserMask"] = -3] = "RealUserMask";
})(ChannelID || (ChannelID = {}));
export var Compression;
(function (Compression) {
Compression[Compression["RawData"] = 0] = "RawData";
Compression[Compression["RleCompressed"] = 1] = "RleCompressed";
Compression[Compression["ZipWithoutPrediction"] = 2] = "ZipWithoutPrediction";
Compression[Compression["ZipWithPrediction"] = 3] = "ZipWithPrediction";
})(Compression || (Compression = {}));
export function offsetForChannel(channelId, cmyk) {
switch (channelId) {
case 0 /* ChannelID.Color0 */: return 0;
case 1 /* ChannelID.Color1 */: return 1;
case 2 /* ChannelID.Color2 */: return 2;
case 3 /* ChannelID.Color3 */: return cmyk ? 3 : channelId + 1;
case -1 /* ChannelID.Transparency */: return cmyk ? 4 : 3;
default: return channelId + 1;
}
}
export function clamp(value, min, max) {
return value < min ? min : (value > max ? max : value);
}
export function hasAlpha(data) {
var size = data.width * data.height * 4;
for (var i = 3; i < size; i += 4) {
if (data.data[i] !== 255) {
return true;
}
}
return false;
}
export function resetImageData(_a) {
var data = _a.data;
var buffer = new Uint32Array(data.buffer);
var size = buffer.length | 0;
for (var p = 0; p < size; p = (p + 1) | 0) {
buffer[p] = 0xff000000;
}
}
export function decodeBitmap(input, output, width, height) {
for (var y = 0, p = 0, o = 0; y < height; y++) {
for (var x = 0; x < width;) {
var b = input[o++];
for (var i = 0; i < 8 && x < width; i++, x++) {
var v = b & 0x80 ? 0 : 255;
b = b << 1;
output[p++] = v;
output[p++] = v;
output[p++] = v;
output[p++] = 255;
}
}
}
}
export function writeDataRaw(data, offset, width, height) {
if (!width || !height)
return undefined;
var array = new Uint8Array(width * height);
for (var i = 0; i < array.length; i++) {
array[i] = data.data[i * 4 + offset];
}
return array;
}
export function writeDataRLE(buffer, _a, offsets, large) {
var data = _a.data, width = _a.width, height = _a.height;
if (!width || !height)
return undefined;
var stride = (4 * width) | 0;
var ol = 0;
var o = (offsets.length * (large ? 4 : 2) * height) | 0;
for (var _i = 0, offsets_1 = offsets; _i < offsets_1.length; _i++) {
var offset = offsets_1[_i];
for (var y = 0, p = offset | 0; y < height; y++) {
var strideStart = (y * stride) | 0;
var strideEnd = (strideStart + stride) | 0;
var lastIndex = (strideEnd + offset - 4) | 0;
var lastIndex2 = (lastIndex - 4) | 0;
var startOffset = o;
for (p = (strideStart + offset) | 0; p < strideEnd; p = (p + 4) | 0) {
if (p < lastIndex2) {
var value1 = data[p];
p = (p + 4) | 0;
var value2 = data[p];
p = (p + 4) | 0;
var value3 = data[p];
if (value1 === value2 && value1 === value3) {
var count = 3;
while (count < 128 && p < lastIndex && data[(p + 4) | 0] === value1) {
count = (count + 1) | 0;
p = (p + 4) | 0;
}
buffer[o++] = 1 - count;
buffer[o++] = value1;
}
else {
var countIndex = o;
var writeLast = true;
var count = 1;
buffer[o++] = 0;
buffer[o++] = value1;
while (p < lastIndex && count < 128) {
p = (p + 4) | 0;
value1 = value2;
value2 = value3;
value3 = data[p];
if (value1 === value2 && value1 === value3) {
p = (p - 12) | 0;
writeLast = false;
break;
}
else {
count++;
buffer[o++] = value1;
}
}
if (writeLast) {
if (count < 127) {
buffer[o++] = value2;
buffer[o++] = value3;
count += 2;
}
else if (count < 128) {
buffer[o++] = value2;
count++;
p = (p - 4) | 0;
}
else {
p = (p - 8) | 0;
}
}
buffer[countIndex] = count - 1;
}
}
else if (p === lastIndex) {
buffer[o++] = 0;
buffer[o++] = data[p];
}
else { // p === lastIndex2
buffer[o++] = 1;
buffer[o++] = data[p];
p = (p + 4) | 0;
buffer[o++] = data[p];
}
}
var length_1 = o - startOffset;
if (large) {
buffer[ol++] = (length_1 >> 24) & 0xff;
buffer[ol++] = (length_1 >> 16) & 0xff;
}
buffer[ol++] = (length_1 >> 8) & 0xff;
buffer[ol++] = length_1 & 0xff;
}
}
return buffer.slice(0, o);
}
export function writeDataZipWithoutPrediction(_a, offsets) {
var data = _a.data, width = _a.width, height = _a.height;
var size = width * height;
var channel = new Uint8Array(size);
var buffers = [];
var totalLength = 0;
for (var _i = 0, offsets_2 = offsets; _i < offsets_2.length; _i++) {
var offset = offsets_2[_i];
for (var i = 0, o = offset; i < size; i++, o += 4) {
channel[i] = data[o];
}
var buffer = deflate(channel);
buffers.push(buffer);
totalLength += buffer.byteLength;
}
if (buffers.length > 0) {
var buffer = new Uint8Array(totalLength);
var offset = 0;
for (var _b = 0, buffers_1 = buffers; _b < buffers_1.length; _b++) {
var b = buffers_1[_b];
buffer.set(b, offset);
offset += b.byteLength;
}
return buffer;
}
else {
return buffers[0];
}
}
export var createCanvas = function () {
throw new Error('Canvas not initialized, use initializeCanvas method to set up createCanvas method');
};
export var createCanvasFromData = function () {
throw new Error('Canvas not initialized, use initializeCanvas method to set up createCanvasFromData method');
};
var tempCanvas = undefined;
export var createImageData = function (width, height) {
if (!tempCanvas)
tempCanvas = createCanvas(1, 1);
return tempCanvas.getContext('2d').createImageData(width, height);
};
if (typeof document !== 'undefined') {
createCanvas = function (width, height) {
var canvas = document.createElement('canvas');
canvas.width = width;
canvas.height = height;
return canvas;
};
createCanvasFromData = function (data) {
var image = new Image();
image.src = 'data:image/jpeg;base64,' + fromByteArray(data);
var canvas = document.createElement('canvas');
canvas.width = image.width;
canvas.height = image.height;
canvas.getContext('2d').drawImage(image, 0, 0);
return canvas;
};
}
export function initializeCanvas(createCanvasMethod, createCanvasFromDataMethod, createImageDataMethod) {
createCanvas = createCanvasMethod;
createCanvasFromData = createCanvasFromDataMethod || createCanvasFromData;
createImageData = createImageDataMethod || createImageData;
}
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImhlbHBlcnMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLGFBQWEsRUFBRSxNQUFNLFdBQVcsQ0FBQztBQUMxQyxPQUFPLEVBQUUsT0FBTyxFQUFFLE1BQU0sTUFBTSxDQUFDO0FBRy9CLE1BQU0sQ0FBQyxJQUFNLGFBQWEsR0FBRyxLQUFLLENBQUM7QUFDbkMsTUFBTSxDQUFDLElBQU0sY0FBYyxHQUFHLEtBQUssQ0FBQztBQUVwQyxNQUFNLENBQUMsSUFBTSxhQUFhLEdBQThCLEVBQUUsQ0FBQztBQUMzRCxNQUFNLENBQUMsSUFBTSxXQUFXLEdBQWlDO0lB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