mirror of
https://gitee.com/onvia/ccc-tnt-psd2ui
synced 2024-12-26 11:48:25 +00:00
960 lines
133 KiB
JavaScript
960 lines
133 KiB
JavaScript
"use strict";
|
|
var __assign = (this && this.__assign) || function () {
|
|
__assign = Object.assign || function(t) {
|
|
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
s = arguments[i];
|
|
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
t[p] = s[p];
|
|
}
|
|
return t;
|
|
};
|
|
return __assign.apply(this, arguments);
|
|
};
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
exports.readPattern = exports.readColor = exports.readSection = exports.readDataRLE = exports.readDataZipWithoutPrediction = exports.readPsd = exports.checkSignature = exports.skipBytes = exports.readAsciiString = exports.readUnicodeStringWithLength = exports.readUnicodeString = exports.readPascalString = exports.readSignature = exports.readBytes = exports.readFixedPointPath32 = exports.readFixedPoint32 = exports.readFloat64 = exports.readFloat32 = exports.readUint32 = exports.readInt32LE = exports.readInt32 = exports.readUint16 = exports.readInt16 = exports.peekUint8 = exports.readUint8 = exports.warnOrThrow = exports.createReader = exports.supportedColorModes = void 0;
|
|
var pako_1 = require("pako");
|
|
var helpers_1 = require("./helpers");
|
|
var additionalInfo_1 = require("./additionalInfo");
|
|
var imageResources_1 = require("./imageResources");
|
|
exports.supportedColorModes = [0 /* ColorMode.Bitmap */, 1 /* ColorMode.Grayscale */, 3 /* ColorMode.RGB */];
|
|
var colorModes = ['bitmap', 'grayscale', 'indexed', 'RGB', 'CMYK', 'multichannel', 'duotone', 'lab'];
|
|
function setupGrayscale(data) {
|
|
var size = data.width * data.height * 4;
|
|
for (var i = 0; i < size; i += 4) {
|
|
data.data[i + 1] = data.data[i];
|
|
data.data[i + 2] = data.data[i];
|
|
}
|
|
}
|
|
function createReader(buffer, offset, length) {
|
|
var view = new DataView(buffer, offset, length);
|
|
return { view: view, offset: 0, strict: false, debug: false };
|
|
}
|
|
exports.createReader = createReader;
|
|
function warnOrThrow(reader, message) {
|
|
if (reader.strict)
|
|
throw new Error(message);
|
|
if (reader.debug)
|
|
console.warn(message);
|
|
}
|
|
exports.warnOrThrow = warnOrThrow;
|
|
function readUint8(reader) {
|
|
reader.offset += 1;
|
|
return reader.view.getUint8(reader.offset - 1);
|
|
}
|
|
exports.readUint8 = readUint8;
|
|
function peekUint8(reader) {
|
|
return reader.view.getUint8(reader.offset);
|
|
}
|
|
exports.peekUint8 = peekUint8;
|
|
function readInt16(reader) {
|
|
reader.offset += 2;
|
|
return reader.view.getInt16(reader.offset - 2, false);
|
|
}
|
|
exports.readInt16 = readInt16;
|
|
function readUint16(reader) {
|
|
reader.offset += 2;
|
|
return reader.view.getUint16(reader.offset - 2, false);
|
|
}
|
|
exports.readUint16 = readUint16;
|
|
function readInt32(reader) {
|
|
reader.offset += 4;
|
|
return reader.view.getInt32(reader.offset - 4, false);
|
|
}
|
|
exports.readInt32 = readInt32;
|
|
function readInt32LE(reader) {
|
|
reader.offset += 4;
|
|
return reader.view.getInt32(reader.offset - 4, true);
|
|
}
|
|
exports.readInt32LE = readInt32LE;
|
|
function readUint32(reader) {
|
|
reader.offset += 4;
|
|
return reader.view.getUint32(reader.offset - 4, false);
|
|
}
|
|
exports.readUint32 = readUint32;
|
|
function readFloat32(reader) {
|
|
reader.offset += 4;
|
|
return reader.view.getFloat32(reader.offset - 4, false);
|
|
}
|
|
exports.readFloat32 = readFloat32;
|
|
function readFloat64(reader) {
|
|
reader.offset += 8;
|
|
return reader.view.getFloat64(reader.offset - 8, false);
|
|
}
|
|
exports.readFloat64 = readFloat64;
|
|
// 32-bit fixed-point number 16.16
|
|
function readFixedPoint32(reader) {
|
|
return readInt32(reader) / (1 << 16);
|
|
}
|
|
exports.readFixedPoint32 = readFixedPoint32;
|
|
// 32-bit fixed-point number 8.24
|
|
function readFixedPointPath32(reader) {
|
|
return readInt32(reader) / (1 << 24);
|
|
}
|
|
exports.readFixedPointPath32 = readFixedPointPath32;
|
|
function readBytes(reader, length) {
|
|
var start = reader.view.byteOffset + reader.offset;
|
|
reader.offset += length;
|
|
if ((start + length) > reader.view.buffer.byteLength) {
|
|
// fix for broken PSD files that are missing part of file at the end
|
|
warnOrThrow(reader, 'Reading bytes exceeding buffer length');
|
|
if (length > (100 * 1024 * 1024))
|
|
throw new Error('Reading past end of file'); // limit to 100MB
|
|
var result = new Uint8Array(length);
|
|
var len = Math.min(length, reader.view.byteLength - start);
|
|
if (len > 0)
|
|
result.set(new Uint8Array(reader.view.buffer, start, len));
|
|
return result;
|
|
}
|
|
else {
|
|
return new Uint8Array(reader.view.buffer, start, length);
|
|
}
|
|
}
|
|
exports.readBytes = readBytes;
|
|
function readSignature(reader) {
|
|
return readShortString(reader, 4);
|
|
}
|
|
exports.readSignature = readSignature;
|
|
function readPascalString(reader, padTo) {
|
|
var length = readUint8(reader);
|
|
var text = length ? readShortString(reader, length) : '';
|
|
while (++length % padTo) {
|
|
reader.offset++;
|
|
}
|
|
return text;
|
|
}
|
|
exports.readPascalString = readPascalString;
|
|
function readUnicodeString(reader) {
|
|
var length = readUint32(reader);
|
|
return readUnicodeStringWithLength(reader, length);
|
|
}
|
|
exports.readUnicodeString = readUnicodeString;
|
|
function readUnicodeStringWithLength(reader, length) {
|
|
var text = '';
|
|
while (length--) {
|
|
var value = readUint16(reader);
|
|
if (value || length > 0) { // remove trailing \0
|
|
text += String.fromCharCode(value);
|
|
}
|
|
}
|
|
return text;
|
|
}
|
|
exports.readUnicodeStringWithLength = readUnicodeStringWithLength;
|
|
function readAsciiString(reader, length) {
|
|
var text = '';
|
|
while (length--) {
|
|
text += String.fromCharCode(readUint8(reader));
|
|
}
|
|
return text;
|
|
}
|
|
exports.readAsciiString = readAsciiString;
|
|
function skipBytes(reader, count) {
|
|
reader.offset += count;
|
|
}
|
|
exports.skipBytes = skipBytes;
|
|
function checkSignature(reader, a, b) {
|
|
var offset = reader.offset;
|
|
var signature = readSignature(reader);
|
|
if (signature !== a && signature !== b) {
|
|
throw new Error("Invalid signature: '".concat(signature, "' at 0x").concat(offset.toString(16)));
|
|
}
|
|
}
|
|
exports.checkSignature = checkSignature;
|
|
function readShortString(reader, length) {
|
|
var buffer = readBytes(reader, length);
|
|
var result = '';
|
|
for (var i = 0; i < buffer.length; i++) {
|
|
result += String.fromCharCode(buffer[i]);
|
|
}
|
|
return result;
|
|
}
|
|
function isValidSignature(sig) {
|
|
return sig === '8BIM' || sig === 'MeSa' || sig === 'AgHg' || sig === 'PHUT' || sig === 'DCSR';
|
|
}
|
|
function readPsd(reader, options) {
|
|
var _a;
|
|
if (options === void 0) { options = {}; }
|
|
// header
|
|
checkSignature(reader, '8BPS');
|
|
var version = readUint16(reader);
|
|
if (version !== 1 && version !== 2)
|
|
throw new Error("Invalid PSD file version: ".concat(version));
|
|
skipBytes(reader, 6);
|
|
var channels = readUint16(reader);
|
|
var height = readUint32(reader);
|
|
var width = readUint32(reader);
|
|
var bitsPerChannel = readUint16(reader);
|
|
var colorMode = readUint16(reader);
|
|
var maxSize = version === 1 ? 30000 : 300000;
|
|
if (width > maxSize || height > maxSize)
|
|
throw new Error("Invalid size");
|
|
if (channels > 16)
|
|
throw new Error("Invalid channel count");
|
|
if (bitsPerChannel > 32)
|
|
throw new Error("Invalid bitsPerChannel count");
|
|
if (exports.supportedColorModes.indexOf(colorMode) === -1)
|
|
throw new Error("Color mode not supported: ".concat((_a = colorModes[colorMode]) !== null && _a !== void 0 ? _a : colorMode));
|
|
var psd = { width: width, height: height, channels: channels, bitsPerChannel: bitsPerChannel, colorMode: colorMode };
|
|
var opt = __assign(__assign({}, options), { large: version === 2 });
|
|
var fixOffsets = [0, 1, -1, 2, -2, 3, -3, 4, -4];
|
|
// color mode data
|
|
readSection(reader, 1, function (left) {
|
|
if (opt.throwForMissingFeatures)
|
|
throw new Error('Color mode data not supported');
|
|
skipBytes(reader, left());
|
|
});
|
|
// image resources
|
|
readSection(reader, 1, function (left) {
|
|
var _loop_1 = function () {
|
|
var sigOffset = reader.offset;
|
|
var sig = '';
|
|
// attempt to fix broken document by realigning with the signature
|
|
for (var _i = 0, fixOffsets_1 = fixOffsets; _i < fixOffsets_1.length; _i++) {
|
|
var offset = fixOffsets_1[_i];
|
|
try {
|
|
reader.offset = sigOffset + offset;
|
|
sig = readSignature(reader);
|
|
}
|
|
catch (_a) { }
|
|
if (isValidSignature(sig))
|
|
break;
|
|
}
|
|
if (!isValidSignature(sig)) {
|
|
throw new Error("Invalid signature: '".concat(sig, "' at 0x").concat((sigOffset).toString(16)));
|
|
}
|
|
var id = readUint16(reader);
|
|
readPascalString(reader, 2); // name
|
|
readSection(reader, 2, function (left) {
|
|
var handler = imageResources_1.resourceHandlersMap[id];
|
|
var skip = id === 1036 && !!opt.skipThumbnail;
|
|
if (!psd.imageResources) {
|
|
psd.imageResources = {};
|
|
}
|
|
if (handler && !skip) {
|
|
try {
|
|
handler.read(reader, psd.imageResources, left, opt);
|
|
}
|
|
catch (e) {
|
|
if (opt.throwForMissingFeatures)
|
|
throw e;
|
|
skipBytes(reader, left());
|
|
}
|
|
}
|
|
else {
|
|
// options.logMissingFeatures && console.log(`Unhandled image resource: ${id}`);
|
|
skipBytes(reader, left());
|
|
}
|
|
});
|
|
};
|
|
while (left()) {
|
|
_loop_1();
|
|
}
|
|
});
|
|
// layer and mask info
|
|
var globalAlpha = false;
|
|
readSection(reader, 1, function (left) {
|
|
globalAlpha = readLayerInfo(reader, psd, opt);
|
|
// SAI does not include this section
|
|
if (left() > 0) {
|
|
var globalLayerMaskInfo = readGlobalLayerMaskInfo(reader);
|
|
if (globalLayerMaskInfo)
|
|
psd.globalLayerMaskInfo = globalLayerMaskInfo;
|
|
}
|
|
else {
|
|
// revert back to end of section if exceeded section limits
|
|
// opt.logMissingFeatures && console.log('reverting to end of section');
|
|
skipBytes(reader, left());
|
|
}
|
|
while (left() > 0) {
|
|
// sometimes there are empty bytes here
|
|
while (left() && peekUint8(reader) === 0) {
|
|
// opt.logMissingFeatures && console.log('skipping 0 byte');
|
|
skipBytes(reader, 1);
|
|
}
|
|
if (left() >= 12) {
|
|
readAdditionalLayerInfo(reader, psd, psd, opt);
|
|
}
|
|
else {
|
|
// opt.logMissingFeatures && console.log('skipping leftover bytes', left());
|
|
skipBytes(reader, left());
|
|
}
|
|
}
|
|
}, undefined, opt.large);
|
|
var hasChildren = psd.children && psd.children.length;
|
|
var skipComposite = opt.skipCompositeImageData && (opt.skipLayerImageData || hasChildren);
|
|
if (!skipComposite) {
|
|
readImageData(reader, psd, globalAlpha, opt);
|
|
}
|
|
// TODO: show converted color mode instead of original PSD file color mode
|
|
// but add option to preserve file color mode (need to return image data instead of canvas in that case)
|
|
// psd.colorMode = ColorMode.RGB; // we convert all color modes to RGB
|
|
return psd;
|
|
}
|
|
exports.readPsd = readPsd;
|
|
function readLayerInfo(reader, psd, options) {
|
|
var globalAlpha = false;
|
|
readSection(reader, 2, function (left) {
|
|
var layerCount = readInt16(reader);
|
|
if (layerCount < 0) {
|
|
globalAlpha = true;
|
|
layerCount = -layerCount;
|
|
}
|
|
var layers = [];
|
|
var layerChannels = [];
|
|
for (var i = 0; i < layerCount; i++) {
|
|
var _a = readLayerRecord(reader, psd, options), layer = _a.layer, channels = _a.channels;
|
|
layers.push(layer);
|
|
layerChannels.push(channels);
|
|
}
|
|
if (!options.skipLayerImageData) {
|
|
for (var i = 0; i < layerCount; i++) {
|
|
readLayerChannelImageData(reader, psd, layers[i], layerChannels[i], options);
|
|
}
|
|
}
|
|
skipBytes(reader, left());
|
|
if (!psd.children)
|
|
psd.children = [];
|
|
var stack = [psd];
|
|
for (var i = layers.length - 1; i >= 0; i--) {
|
|
var l = layers[i];
|
|
var type = l.sectionDivider ? l.sectionDivider.type : 0 /* SectionDividerType.Other */;
|
|
if (type === 1 /* SectionDividerType.OpenFolder */ || type === 2 /* SectionDividerType.ClosedFolder */) {
|
|
l.opened = type === 1 /* SectionDividerType.OpenFolder */;
|
|
l.children = [];
|
|
stack[stack.length - 1].children.unshift(l);
|
|
stack.push(l);
|
|
}
|
|
else if (type === 3 /* SectionDividerType.BoundingSectionDivider */) {
|
|
stack.pop();
|
|
// this was workaround because I didn't know what `lsdk` section was, now it's probably not needed anymore
|
|
// } else if (l.name === '</Layer group>' && !l.sectionDivider && !l.top && !l.left && !l.bottom && !l.right) {
|
|
// // sometimes layer group terminator doesn't have sectionDivider, so we just guess here (PS bug ?)
|
|
// stack.pop();
|
|
}
|
|
else {
|
|
stack[stack.length - 1].children.unshift(l);
|
|
}
|
|
}
|
|
}, undefined, options.large);
|
|
return globalAlpha;
|
|
}
|
|
function readLayerRecord(reader, psd, options) {
|
|
var layer = {};
|
|
layer.top = readInt32(reader);
|
|
layer.left = readInt32(reader);
|
|
layer.bottom = readInt32(reader);
|
|
layer.right = readInt32(reader);
|
|
var channelCount = readUint16(reader);
|
|
var channels = [];
|
|
for (var i = 0; i < channelCount; i++) {
|
|
var channelID = readInt16(reader);
|
|
var channelLength = readUint32(reader);
|
|
if (options.large) {
|
|
if (channelLength !== 0)
|
|
throw new Error('Sizes larger than 4GB are not supported');
|
|
channelLength = readUint32(reader);
|
|
}
|
|
channels.push({ id: channelID, length: channelLength });
|
|
}
|
|
checkSignature(reader, '8BIM');
|
|
var blendMode = readSignature(reader);
|
|
if (!helpers_1.toBlendMode[blendMode])
|
|
throw new Error("Invalid blend mode: '".concat(blendMode, "'"));
|
|
layer.blendMode = helpers_1.toBlendMode[blendMode];
|
|
layer.opacity = readUint8(reader) / 0xff;
|
|
layer.clipping = readUint8(reader) === 1;
|
|
var flags = readUint8(reader);
|
|
layer.transparencyProtected = (flags & 0x01) !== 0;
|
|
layer.hidden = (flags & 0x02) !== 0;
|
|
// 0x04 - obsolete
|
|
// 0x08 - 1 for Photoshop 5.0 and later, tells if bit 4 has useful information
|
|
// 0x10 - pixel data irrelevant to appearance of document
|
|
// 0x20 - ???
|
|
// if (flags & 0x20) (layer as any)._2 = true; // TEMP !!!!
|
|
skipBytes(reader, 1);
|
|
readSection(reader, 1, function (left) {
|
|
var mask = readLayerMaskData(reader, options);
|
|
if (mask)
|
|
layer.mask = mask;
|
|
/*const blendingRanges =*/ readLayerBlendingRanges(reader);
|
|
layer.name = readPascalString(reader, 4);
|
|
while (left()) {
|
|
readAdditionalLayerInfo(reader, layer, psd, options);
|
|
}
|
|
});
|
|
return { layer: layer, channels: channels };
|
|
}
|
|
function readLayerMaskData(reader, options) {
|
|
return readSection(reader, 1, function (left) {
|
|
if (!left())
|
|
return undefined;
|
|
var mask = {};
|
|
mask.top = readInt32(reader);
|
|
mask.left = readInt32(reader);
|
|
mask.bottom = readInt32(reader);
|
|
mask.right = readInt32(reader);
|
|
mask.defaultColor = readUint8(reader);
|
|
var flags = readUint8(reader);
|
|
mask.positionRelativeToLayer = (flags & 1 /* LayerMaskFlags.PositionRelativeToLayer */) !== 0;
|
|
mask.disabled = (flags & 2 /* LayerMaskFlags.LayerMaskDisabled */) !== 0;
|
|
mask.fromVectorData = (flags & 8 /* LayerMaskFlags.LayerMaskFromRenderingOtherData */) !== 0;
|
|
if (flags & 16 /* LayerMaskFlags.MaskHasParametersAppliedToIt */) {
|
|
var params = readUint8(reader);
|
|
if (params & 1 /* MaskParams.UserMaskDensity */)
|
|
mask.userMaskDensity = readUint8(reader) / 0xff;
|
|
if (params & 2 /* MaskParams.UserMaskFeather */)
|
|
mask.userMaskFeather = readFloat64(reader);
|
|
if (params & 4 /* MaskParams.VectorMaskDensity */)
|
|
mask.vectorMaskDensity = readUint8(reader) / 0xff;
|
|
if (params & 8 /* MaskParams.VectorMaskFeather */)
|
|
mask.vectorMaskFeather = readFloat64(reader);
|
|
}
|
|
if (left() > 2) {
|
|
options.logMissingFeatures && console.log('Unhandled extra mask params');
|
|
// TODO: handle these values
|
|
/*const realFlags =*/ readUint8(reader);
|
|
/*const realUserMaskBackground =*/ readUint8(reader);
|
|
/*const top2 =*/ readInt32(reader);
|
|
/*const left2 =*/ readInt32(reader);
|
|
/*const bottom2 =*/ readInt32(reader);
|
|
/*const right2 =*/ readInt32(reader);
|
|
}
|
|
skipBytes(reader, left());
|
|
return mask;
|
|
});
|
|
}
|
|
function readLayerBlendingRanges(reader) {
|
|
return readSection(reader, 1, function (left) {
|
|
var compositeGrayBlendSource = readUint32(reader);
|
|
var compositeGraphBlendDestinationRange = readUint32(reader);
|
|
var ranges = [];
|
|
while (left()) {
|
|
var sourceRange = readUint32(reader);
|
|
var destRange = readUint32(reader);
|
|
ranges.push({ sourceRange: sourceRange, destRange: destRange });
|
|
}
|
|
return { compositeGrayBlendSource: compositeGrayBlendSource, compositeGraphBlendDestinationRange: compositeGraphBlendDestinationRange, ranges: ranges };
|
|
});
|
|
}
|
|
function readLayerChannelImageData(reader, psd, layer, channels, options) {
|
|
var layerWidth = (layer.right || 0) - (layer.left || 0);
|
|
var layerHeight = (layer.bottom || 0) - (layer.top || 0);
|
|
var cmyk = psd.colorMode === 4 /* ColorMode.CMYK */;
|
|
var imageData;
|
|
if (layerWidth && layerHeight) {
|
|
if (cmyk) {
|
|
imageData = { width: layerWidth, height: layerHeight, data: new Uint8ClampedArray(layerWidth * layerHeight * 5) };
|
|
for (var p = 4; p < imageData.data.byteLength; p += 5)
|
|
imageData.data[p] = 255;
|
|
}
|
|
else {
|
|
imageData = (0, helpers_1.createImageData)(layerWidth, layerHeight);
|
|
(0, helpers_1.resetImageData)(imageData);
|
|
}
|
|
}
|
|
if (helpers_1.RAW_IMAGE_DATA)
|
|
layer.imageDataRaw = [];
|
|
for (var _i = 0, channels_1 = channels; _i < channels_1.length; _i++) {
|
|
var channel = channels_1[_i];
|
|
if (channel.length === 0)
|
|
continue;
|
|
if (channel.length < 2)
|
|
throw new Error('Invalid channel length');
|
|
var start = reader.offset;
|
|
var compression = readUint16(reader);
|
|
if (channel.id === -2 /* ChannelID.UserMask */) {
|
|
var mask = layer.mask;
|
|
if (!mask)
|
|
throw new Error("Missing layer mask data");
|
|
var maskWidth = (mask.right || 0) - (mask.left || 0);
|
|
var maskHeight = (mask.bottom || 0) - (mask.top || 0);
|
|
if (maskWidth && maskHeight) {
|
|
var maskData = (0, helpers_1.createImageData)(maskWidth, maskHeight);
|
|
(0, helpers_1.resetImageData)(maskData);
|
|
var start_1 = reader.offset;
|
|
readData(reader, channel.length, maskData, compression, maskWidth, maskHeight, 0, options.large, 4);
|
|
if (helpers_1.RAW_IMAGE_DATA) {
|
|
layer.maskDataRaw = new Uint8Array(reader.view.buffer, reader.view.byteOffset + start_1, reader.offset - start_1);
|
|
}
|
|
setupGrayscale(maskData);
|
|
if (options.useImageData) {
|
|
mask.imageData = maskData;
|
|
}
|
|
else {
|
|
mask.canvas = (0, helpers_1.createCanvas)(maskWidth, maskHeight);
|
|
mask.canvas.getContext('2d').putImageData(maskData, 0, 0);
|
|
}
|
|
}
|
|
}
|
|
else {
|
|
var offset = (0, helpers_1.offsetForChannel)(channel.id, cmyk);
|
|
var targetData = imageData;
|
|
if (offset < 0) {
|
|
targetData = undefined;
|
|
if (options.throwForMissingFeatures) {
|
|
throw new Error("Channel not supported: ".concat(channel.id));
|
|
}
|
|
}
|
|
readData(reader, channel.length, targetData, compression, layerWidth, layerHeight, offset, options.large, cmyk ? 5 : 4);
|
|
if (helpers_1.RAW_IMAGE_DATA) {
|
|
layer.imageDataRaw[channel.id] = new Uint8Array(reader.view.buffer, reader.view.byteOffset + start + 2, channel.length - 2);
|
|
}
|
|
reader.offset = start + channel.length;
|
|
if (targetData && psd.colorMode === 1 /* ColorMode.Grayscale */) {
|
|
setupGrayscale(targetData);
|
|
}
|
|
}
|
|
}
|
|
if (imageData) {
|
|
if (cmyk) {
|
|
var cmykData = imageData;
|
|
imageData = (0, helpers_1.createImageData)(cmykData.width, cmykData.height);
|
|
cmykToRgb(cmykData, imageData, false);
|
|
}
|
|
if (options.useImageData) {
|
|
layer.imageData = imageData;
|
|
}
|
|
else {
|
|
layer.canvas = (0, helpers_1.createCanvas)(layerWidth, layerHeight);
|
|
layer.canvas.getContext('2d').putImageData(imageData, 0, 0);
|
|
}
|
|
}
|
|
}
|
|
function readData(reader, length, data, compression, width, height, offset, large, step) {
|
|
if (compression === 0 /* Compression.RawData */) {
|
|
readDataRaw(reader, data, width, height, step, offset);
|
|
}
|
|
else if (compression === 1 /* Compression.RleCompressed */) {
|
|
readDataRLE(reader, data, width, height, step, [offset], large);
|
|
}
|
|
else if (compression === 2 /* Compression.ZipWithoutPrediction */) {
|
|
readDataZipWithoutPrediction(reader, length, data, width, height, step, offset);
|
|
}
|
|
else if (compression === 3 /* Compression.ZipWithPrediction */) {
|
|
throw new Error("Compression type not supported: ".concat(compression));
|
|
}
|
|
else {
|
|
throw new Error("Invalid Compression type: ".concat(compression));
|
|
}
|
|
}
|
|
function readGlobalLayerMaskInfo(reader) {
|
|
return readSection(reader, 1, function (left) {
|
|
if (!left())
|
|
return undefined;
|
|
var overlayColorSpace = readUint16(reader);
|
|
var colorSpace1 = readUint16(reader);
|
|
var colorSpace2 = readUint16(reader);
|
|
var colorSpace3 = readUint16(reader);
|
|
var colorSpace4 = readUint16(reader);
|
|
var opacity = readUint16(reader) / 0xff;
|
|
var kind = readUint8(reader);
|
|
skipBytes(reader, left()); // 3 bytes of padding ?
|
|
return { overlayColorSpace: overlayColorSpace, colorSpace1: colorSpace1, colorSpace2: colorSpace2, colorSpace3: colorSpace3, colorSpace4: colorSpace4, opacity: opacity, kind: kind };
|
|
});
|
|
}
|
|
function readAdditionalLayerInfo(reader, target, psd, options) {
|
|
var sig = readSignature(reader);
|
|
if (sig !== '8BIM' && sig !== '8B64')
|
|
throw new Error("Invalid signature: '".concat(sig, "' at 0x").concat((reader.offset - 4).toString(16)));
|
|
var key = readSignature(reader);
|
|
// `largeAdditionalInfoKeys` fallback, because some keys don't have 8B64 signature even when they are 64bit
|
|
var u64 = sig === '8B64' || (options.large && helpers_1.largeAdditionalInfoKeys.indexOf(key) !== -1);
|
|
readSection(reader, 2, function (left) {
|
|
var handler = additionalInfo_1.infoHandlersMap[key];
|
|
if (handler) {
|
|
try {
|
|
handler.read(reader, target, left, psd, options);
|
|
}
|
|
catch (e) {
|
|
if (options.throwForMissingFeatures)
|
|
throw e;
|
|
}
|
|
}
|
|
else {
|
|
options.logMissingFeatures && console.log("Unhandled additional info: ".concat(key));
|
|
skipBytes(reader, left());
|
|
}
|
|
if (left()) {
|
|
options.logMissingFeatures && console.log("Unread ".concat(left(), " bytes left for additional info: ").concat(key));
|
|
skipBytes(reader, left());
|
|
}
|
|
}, false, u64);
|
|
}
|
|
function readImageData(reader, psd, globalAlpha, options) {
|
|
var compression = readUint16(reader);
|
|
if (exports.supportedColorModes.indexOf(psd.colorMode) === -1)
|
|
throw new Error("Color mode not supported: ".concat(psd.colorMode));
|
|
if (compression !== 0 /* Compression.RawData */ && compression !== 1 /* Compression.RleCompressed */)
|
|
throw new Error("Compression type not supported: ".concat(compression));
|
|
var imageData = (0, helpers_1.createImageData)(psd.width, psd.height);
|
|
(0, helpers_1.resetImageData)(imageData);
|
|
switch (psd.colorMode) {
|
|
case 0 /* ColorMode.Bitmap */: {
|
|
var bytes = void 0;
|
|
if (compression === 0 /* Compression.RawData */) {
|
|
bytes = readBytes(reader, Math.ceil(psd.width / 8) * psd.height);
|
|
}
|
|
else if (compression === 1 /* Compression.RleCompressed */) {
|
|
bytes = new Uint8Array(psd.width * psd.height);
|
|
readDataRLE(reader, { data: bytes, width: psd.width, height: psd.height }, psd.width, psd.height, 1, [0], options.large);
|
|
}
|
|
else {
|
|
throw new Error("Bitmap compression not supported: ".concat(compression));
|
|
}
|
|
(0, helpers_1.decodeBitmap)(bytes, imageData.data, psd.width, psd.height);
|
|
break;
|
|
}
|
|
case 3 /* ColorMode.RGB */:
|
|
case 1 /* ColorMode.Grayscale */: {
|
|
var channels = psd.colorMode === 1 /* ColorMode.Grayscale */ ? [0] : [0, 1, 2];
|
|
if (psd.channels && psd.channels > 3) {
|
|
for (var i = 3; i < psd.channels; i++) {
|
|
// TODO: store these channels in additional image data
|
|
channels.push(i);
|
|
}
|
|
}
|
|
else if (globalAlpha) {
|
|
channels.push(3);
|
|
}
|
|
if (compression === 0 /* Compression.RawData */) {
|
|
for (var i = 0; i < channels.length; i++) {
|
|
readDataRaw(reader, imageData, psd.width, psd.height, 4, channels[i]);
|
|
}
|
|
}
|
|
else if (compression === 1 /* Compression.RleCompressed */) {
|
|
var start = reader.offset;
|
|
readDataRLE(reader, imageData, psd.width, psd.height, 4, channels, options.large);
|
|
if (helpers_1.RAW_IMAGE_DATA)
|
|
psd.imageDataRaw = new Uint8Array(reader.view.buffer, reader.view.byteOffset + start, reader.offset - start);
|
|
}
|
|
if (psd.colorMode === 1 /* ColorMode.Grayscale */) {
|
|
setupGrayscale(imageData);
|
|
}
|
|
break;
|
|
}
|
|
case 4 /* ColorMode.CMYK */: {
|
|
if (psd.channels !== 4)
|
|
throw new Error("Invalid channel count");
|
|
var channels = [0, 1, 2, 3];
|
|
if (globalAlpha)
|
|
channels.push(4);
|
|
if (compression === 0 /* Compression.RawData */) {
|
|
throw new Error("Not implemented");
|
|
// TODO: ...
|
|
// for (let i = 0; i < channels.length; i++) {
|
|
// readDataRaw(reader, imageData, channels[i], psd.width, psd.height);
|
|
// }
|
|
}
|
|
else if (compression === 1 /* Compression.RleCompressed */) {
|
|
var cmykImageData = {
|
|
width: imageData.width,
|
|
height: imageData.height,
|
|
data: new Uint8Array(imageData.width * imageData.height * 5),
|
|
};
|
|
var start = reader.offset;
|
|
readDataRLE(reader, cmykImageData, psd.width, psd.height, 5, channels, options.large);
|
|
cmykToRgb(cmykImageData, imageData, true);
|
|
if (helpers_1.RAW_IMAGE_DATA)
|
|
psd.imageDataRaw = new Uint8Array(reader.view.buffer, reader.view.byteOffset + start, reader.offset - start);
|
|
}
|
|
break;
|
|
}
|
|
default: throw new Error("Color mode not supported: ".concat(psd.colorMode));
|
|
}
|
|
if (options.useImageData) {
|
|
psd.imageData = imageData;
|
|
}
|
|
else {
|
|
psd.canvas = (0, helpers_1.createCanvas)(psd.width, psd.height);
|
|
psd.canvas.getContext('2d').putImageData(imageData, 0, 0);
|
|
}
|
|
}
|
|
function cmykToRgb(cmyk, rgb, reverseAlpha) {
|
|
var size = rgb.width * rgb.height * 4;
|
|
var srcData = cmyk.data;
|
|
var dstData = rgb.data;
|
|
for (var src = 0, dst = 0; dst < size; src += 5, dst += 4) {
|
|
var c = srcData[src];
|
|
var m = srcData[src + 1];
|
|
var y = srcData[src + 2];
|
|
var k = srcData[src + 3];
|
|
dstData[dst] = ((((c * k) | 0) / 255) | 0);
|
|
dstData[dst + 1] = ((((m * k) | 0) / 255) | 0);
|
|
dstData[dst + 2] = ((((y * k) | 0) / 255) | 0);
|
|
dstData[dst + 3] = reverseAlpha ? 255 - srcData[src + 4] : srcData[src + 4];
|
|
}
|
|
// for (let src = 0, dst = 0; dst < size; src += 5, dst += 4) {
|
|
// const c = 1 - (srcData[src + 0] / 255);
|
|
// const m = 1 - (srcData[src + 1] / 255);
|
|
// const y = 1 - (srcData[src + 2] / 255);
|
|
// // const k = srcData[src + 3] / 255;
|
|
// dstData[dst + 0] = ((1 - c * 0.8) * 255) | 0;
|
|
// dstData[dst + 1] = ((1 - m * 0.8) * 255) | 0;
|
|
// dstData[dst + 2] = ((1 - y * 0.8) * 255) | 0;
|
|
// dstData[dst + 3] = reverseAlpha ? 255 - srcData[src + 4] : srcData[src + 4];
|
|
// }
|
|
}
|
|
function readDataRaw(reader, pixelData, width, height, step, offset) {
|
|
var size = width * height;
|
|
var buffer = readBytes(reader, size);
|
|
if (pixelData && offset < step) {
|
|
var data = pixelData.data;
|
|
for (var i = 0, p = offset | 0; i < size; i++, p = (p + step) | 0) {
|
|
data[p] = buffer[i];
|
|
}
|
|
}
|
|
}
|
|
function readDataZipWithoutPrediction(reader, length, pixelData, width, height, step, offset) {
|
|
var compressed = readBytes(reader, length);
|
|
var decompressed = (0, pako_1.inflate)(compressed);
|
|
var size = width * height;
|
|
if (pixelData && offset < step) {
|
|
var data = pixelData.data;
|
|
for (var i = 0, p = offset | 0; i < size; i++, p = (p + step) | 0) {
|
|
data[p] = decompressed[i];
|
|
}
|
|
}
|
|
}
|
|
exports.readDataZipWithoutPrediction = readDataZipWithoutPrediction;
|
|
function readDataRLE(reader, pixelData, _width, height, step, offsets, large) {
|
|
var data = pixelData && pixelData.data;
|
|
var lengths;
|
|
if (large) {
|
|
lengths = new Uint32Array(offsets.length * height);
|
|
for (var o = 0, li = 0; o < offsets.length; o++) {
|
|
for (var y = 0; y < height; y++, li++) {
|
|
lengths[li] = readUint32(reader);
|
|
}
|
|
}
|
|
}
|
|
else {
|
|
lengths = new Uint16Array(offsets.length * height);
|
|
for (var o = 0, li = 0; o < offsets.length; o++) {
|
|
for (var y = 0; y < height; y++, li++) {
|
|
lengths[li] = readUint16(reader);
|
|
}
|
|
}
|
|
}
|
|
var extraLimit = (step - 1) | 0; // 3 for rgb, 4 for cmyk
|
|
for (var c = 0, li = 0; c < offsets.length; c++) {
|
|
var offset = offsets[c] | 0;
|
|
var extra = c > extraLimit || offset > extraLimit;
|
|
if (!data || extra) {
|
|
for (var y = 0; y < height; y++, li++) {
|
|
skipBytes(reader, lengths[li]);
|
|
}
|
|
}
|
|
else {
|
|
for (var y = 0, p = offset | 0; y < height; y++, li++) {
|
|
var length_1 = lengths[li];
|
|
var buffer = readBytes(reader, length_1);
|
|
for (var i = 0; i < length_1; i++) {
|
|
var header = buffer[i];
|
|
if (header > 128) {
|
|
var value = buffer[++i];
|
|
header = (256 - header) | 0;
|
|
for (var j = 0; j <= header; j = (j + 1) | 0) {
|
|
data[p] = value;
|
|
p = (p + step) | 0;
|
|
}
|
|
}
|
|
else if (header < 128) {
|
|
for (var j = 0; j <= header; j = (j + 1) | 0) {
|
|
data[p] = buffer[++i];
|
|
p = (p + step) | 0;
|
|
}
|
|
}
|
|
else {
|
|
// ignore 128
|
|
}
|
|
// This showed up on some images from non-photoshop programs, ignoring it seems to work just fine.
|
|
// if (i >= length) throw new Error(`Invalid RLE data: exceeded buffer size ${i}/${length}`);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
exports.readDataRLE = readDataRLE;
|
|
function readSection(reader, round, func, skipEmpty, eightBytes) {
|
|
if (skipEmpty === void 0) { skipEmpty = true; }
|
|
if (eightBytes === void 0) { eightBytes = false; }
|
|
var length = readUint32(reader);
|
|
if (eightBytes) {
|
|
if (length !== 0)
|
|
throw new Error('Sizes larger than 4GB are not supported');
|
|
length = readUint32(reader);
|
|
}
|
|
if (length <= 0 && skipEmpty)
|
|
return undefined;
|
|
var end = reader.offset + length;
|
|
if (end > reader.view.byteLength)
|
|
throw new Error('Section exceeds file size');
|
|
var result = func(function () { return end - reader.offset; });
|
|
if (reader.offset !== end) {
|
|
if (reader.offset > end) {
|
|
warnOrThrow(reader, 'Exceeded section limits');
|
|
}
|
|
else {
|
|
warnOrThrow(reader, "Unread section data"); // : ${end - reader.offset} bytes at 0x${reader.offset.toString(16)}`);
|
|
}
|
|
}
|
|
while (end % round)
|
|
end++;
|
|
reader.offset = end;
|
|
return result;
|
|
}
|
|
exports.readSection = readSection;
|
|
function readColor(reader) {
|
|
var colorSpace = readUint16(reader);
|
|
switch (colorSpace) {
|
|
case 0 /* ColorSpace.RGB */: {
|
|
var r = readUint16(reader) / 257;
|
|
var g = readUint16(reader) / 257;
|
|
var b = readUint16(reader) / 257;
|
|
skipBytes(reader, 2);
|
|
return { r: r, g: g, b: b };
|
|
}
|
|
case 1 /* ColorSpace.HSB */: {
|
|
var h = readUint16(reader) / 0xffff;
|
|
var s = readUint16(reader) / 0xffff;
|
|
var b = readUint16(reader) / 0xffff;
|
|
skipBytes(reader, 2);
|
|
return { h: h, s: s, b: b };
|
|
}
|
|
case 2 /* ColorSpace.CMYK */: {
|
|
var c = readUint16(reader) / 257;
|
|
var m = readUint16(reader) / 257;
|
|
var y = readUint16(reader) / 257;
|
|
var k = readUint16(reader) / 257;
|
|
return { c: c, m: m, y: y, k: k };
|
|
}
|
|
case 7 /* ColorSpace.Lab */: {
|
|
var l = readInt16(reader) / 10000;
|
|
var ta = readInt16(reader);
|
|
var tb = readInt16(reader);
|
|
var a = ta < 0 ? (ta / 12800) : (ta / 12700);
|
|
var b = tb < 0 ? (tb / 12800) : (tb / 12700);
|
|
skipBytes(reader, 2);
|
|
return { l: l, a: a, b: b };
|
|
}
|
|
case 8 /* ColorSpace.Grayscale */: {
|
|
var k = readUint16(reader) * 255 / 10000;
|
|
skipBytes(reader, 6);
|
|
return { k: k };
|
|
}
|
|
default:
|
|
throw new Error('Invalid color space');
|
|
}
|
|
}
|
|
exports.readColor = readColor;
|
|
function readPattern(reader) {
|
|
readUint32(reader); // length
|
|
var version = readUint32(reader);
|
|
if (version !== 1)
|
|
throw new Error("Invalid pattern version: ".concat(version));
|
|
var colorMode = readUint32(reader);
|
|
var x = readInt16(reader);
|
|
var y = readInt16(reader);
|
|
// we only support RGB and grayscale for now
|
|
if (colorMode !== 3 /* ColorMode.RGB */ && colorMode !== 1 /* ColorMode.Grayscale */ && colorMode !== 2 /* ColorMode.Indexed */) {
|
|
throw new Error("Unsupported pattern color mode: ".concat(colorMode));
|
|
}
|
|
var name = readUnicodeString(reader);
|
|
var id = readPascalString(reader, 1);
|
|
var palette = [];
|
|
if (colorMode === 2 /* ColorMode.Indexed */) {
|
|
for (var i = 0; i < 256; i++) {
|
|
palette.push({
|
|
r: readUint8(reader),
|
|
g: readUint8(reader),
|
|
b: readUint8(reader),
|
|
});
|
|
}
|
|
skipBytes(reader, 4); // no idea what this is
|
|
}
|
|
// virtual memory array list
|
|
var version2 = readUint32(reader);
|
|
if (version2 !== 3)
|
|
throw new Error("Invalid pattern VMAL version: ".concat(version2));
|
|
readUint32(reader); // length
|
|
var top = readUint32(reader);
|
|
var left = readUint32(reader);
|
|
var bottom = readUint32(reader);
|
|
var right = readUint32(reader);
|
|
var channelsCount = readUint32(reader);
|
|
var width = right - left;
|
|
var height = bottom - top;
|
|
var data = new Uint8Array(width * height * 4);
|
|
for (var i = 3; i < data.byteLength; i += 4) {
|
|
data[i] = 255;
|
|
}
|
|
for (var i = 0, ch = 0; i < (channelsCount + 2); i++) {
|
|
var has = readUint32(reader);
|
|
if (!has)
|
|
continue;
|
|
var length_2 = readUint32(reader);
|
|
var pixelDepth = readUint32(reader);
|
|
var ctop = readUint32(reader);
|
|
var cleft = readUint32(reader);
|
|
var cbottom = readUint32(reader);
|
|
var cright = readUint32(reader);
|
|
var pixelDepth2 = readUint16(reader);
|
|
var compressionMode = readUint8(reader); // 0 - raw, 1 - zip
|
|
var dataLength = length_2 - (4 + 16 + 2 + 1);
|
|
var cdata = readBytes(reader, dataLength);
|
|
if (pixelDepth !== 8 || pixelDepth2 !== 8) {
|
|
throw new Error('16bit pixel depth not supported for patterns');
|
|
}
|
|
var w = cright - cleft;
|
|
var h = cbottom - ctop;
|
|
var ox = cleft - left;
|
|
var oy = ctop - top;
|
|
if (compressionMode === 0) {
|
|
if (colorMode === 3 /* ColorMode.RGB */ && ch < 3) {
|
|
for (var y_1 = 0; y_1 < h; y_1++) {
|
|
for (var x_1 = 0; x_1 < w; x_1++) {
|
|
var src = x_1 + y_1 * w;
|
|
var dst = (ox + x_1 + (y_1 + oy) * width) * 4;
|
|
data[dst + ch] = cdata[src];
|
|
}
|
|
}
|
|
}
|
|
if (colorMode === 1 /* ColorMode.Grayscale */ && ch < 1) {
|
|
for (var y_2 = 0; y_2 < h; y_2++) {
|
|
for (var x_2 = 0; x_2 < w; x_2++) {
|
|
var src = x_2 + y_2 * w;
|
|
var dst = (ox + x_2 + (y_2 + oy) * width) * 4;
|
|
var value = cdata[src];
|
|
data[dst + 0] = value;
|
|
data[dst + 1] = value;
|
|
data[dst + 2] = value;
|
|
}
|
|
}
|
|
}
|
|
if (colorMode === 2 /* ColorMode.Indexed */) {
|
|
// TODO:
|
|
throw new Error('Indexed pattern color mode not implemented');
|
|
}
|
|
}
|
|
else if (compressionMode === 1) {
|
|
// console.log({ colorMode });
|
|
// require('fs').writeFileSync('zip.bin', Buffer.from(cdata));
|
|
// const data = require('zlib').inflateRawSync(cdata);
|
|
// const data = require('zlib').unzipSync(cdata);
|
|
// console.log(data);
|
|
// throw new Error('Zip compression not supported for pattern');
|
|
// throw new Error('Unsupported pattern compression');
|
|
console.error('Unsupported pattern compression');
|
|
name += ' (failed to decode)';
|
|
}
|
|
else {
|
|
throw new Error('Invalid pattern compression mode');
|
|
}
|
|
ch++;
|
|
}
|
|
// TODO: use canvas instead of data ?
|
|
return { id: id, name: name, x: x, y: y, bounds: { x: left, y: top, w: width, h: height }, data: data };
|
|
}
|
|
exports.readPattern = readPattern;
|
|
|
|
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInBzZFJlYWRlci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7Ozs7OztBQUFBLDZCQUErQjtBQUsvQixxQ0FHbUI7QUFDbkIsbURBQW1EO0FBQ25ELG1EQUF1RDtBQVcxQyxRQUFBLG1CQUFtQixHQUFHLDhFQUFzRCxDQUFDO0FBQzFGLElBQU0sVUFBVSxHQUFHLENBQUMsUUFBUSxFQUFFLFdBQVcsRUFBRSxTQUFTLEVBQUUsS0FBSyxFQUFFLE1BQU0sRUFBRSxjQUFjLEVBQUUsU0FBUyxFQUFFLEtBQUssQ0FBQyxDQUFDO0FBRXZHLFNBQVMsY0FBYyxDQUFDLElBQWU7SUFDdEMsSUFBTSxJQUFJLEdBQUcsSUFBSSxDQUFDLEtBQUssR0FBRyxJQUFJLENBQUMsTUFBTSxHQUFHLENBQUMsQ0FBQztJQUUxQyxLQUFLLElBQUksQ0FBQyxHQUFHLENBQUMsRUFBRSxDQUFDLEdBQUcsSUFBSSxFQUFFLENBQUMsSUFBSSxDQUFDLEVBQUU7UUFDakMsSUFBSSxDQUFDLElBQUksQ0FBQyxDQUFDLEdBQUcsQ0FBQyxDQUFDLEdBQUcsSUFBSSxDQUFDLElBQUksQ0FBQyxDQUFDLENBQUMsQ0FBQztRQUNoQyxJQUFJLENBQUMsSUFBSSxDQUFDLENBQUMsR0FBRyxDQUFDLENBQUMs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