image-in-browser
Version:
Package for encoding / decoding images, transforming images, applying filters, drawing primitives on images on the client side (no need for server Node.js)
42 lines • 1.26 kB
JavaScript
import { inflate, deflate } from '../packer/packer.js';
import { ArrayUtils } from '../common/array-utils.js';
import { IccProfileCompression } from './icc-profile-compression.js';
export class IccProfile {
get name() {
return this._name;
}
get compression() {
return this._compression;
}
get data() {
return this._data;
}
constructor(name, compression, data) {
this._name = name;
this._compression = compression;
this._data = data;
}
static from(other) {
return new IccProfile(other._name, other._compression, ArrayUtils.copyUint8(other._data));
}
compressed() {
if (this._compression === IccProfileCompression.deflate) {
return this._data;
}
this._data = deflate(this._data);
this._compression = IccProfileCompression.deflate;
return this._data;
}
decompressed() {
if (this._compression === IccProfileCompression.none) {
return this._data;
}
this._data = inflate(this._data);
this._compression = IccProfileCompression.none;
return this._data;
}
clone() {
return IccProfile.from(this);
}
}
//# sourceMappingURL=icc-profile.js.map