UNPKG

capacitor-plugin-scanbot-sdk

Version:

Scanbot Document and Barcode Scanner SDK for Capacitor

389 lines (377 loc) 13.2 kB
/// Auto-generated with ScanbotSDKCodegenV3. Modifications will be overwritten. /// Generated from core/schemas/ImageRefTypes.yaml import { RefCountedObjectProfile } from '../imageRef/ObjectPoolTypes'; import { ToJsonConfiguration } from '../utils/json/JsonSerializationTypes'; import { PartiallyConstructible } from '../utils/utils'; /** Image Info. */ export class ImageInfo extends PartiallyConstructible { /** @param source {@displayType `DeepPartial<ImageInfo>`} */ constructor(source = {}) { super(); if (source.height !== undefined) { this.height = source.height; } else { throw new Error('height must be present in constructor argument'); } if (source.width !== undefined) { this.width = source.width; } else { throw new Error('width must be present in constructor argument'); } if (source.maxByteSize !== undefined) { this.maxByteSize = source.maxByteSize; } else { throw new Error('maxByteSize must be present in constructor argument'); } } serialize(config = new ToJsonConfiguration()) { return { height: this.height, width: this.width, maxByteSize: this.maxByteSize, }; } } export const PathLoadModeValues = ['EAGER', 'LAZY', 'LAZY_WITH_COPY']; export const BufferLoadModeValues = ['EAGER', 'LAZY']; export const EncodingFormatValues = ['JPEG', 'PNG']; export const EncryptionModeValues = ['REQUIRED', 'DISABLED', 'IF_AVAILABLE']; /** Basic options for loading image. */ export class BasicImageLoadOptions extends PartiallyConstructible { /** @param source {@displayType `DeepPartial<BasicImageLoadOptions>`} */ constructor(source = {}) { super(); /** Region of interest. */ this.roi = { x: 0, y: 0, width: 0, height: 0 }; if (source.roi !== undefined) { this.roi = { x: source.roi.x, y: source.roi.y, width: source.roi.width, height: source.roi.height }; } } } /** Options for loading images that come from sensor. */ export class RawImageLoadOptions extends PartiallyConstructible { /** @param source {@displayType `DeepPartial<RawImageLoadOptions>`} */ constructor(source = {}) { super(); /** Region of interest. */ this.roi = { x: 0, y: 0, width: 0, height: 0 }; /** Rotation that should be applied to the image to recover correct orientation. Default is NONE */ this.orientation = 'NONE'; if (source.roi !== undefined) { this.roi = { x: source.roi.x, y: source.roi.y, width: source.roi.width, height: source.roi.height }; } if (source.orientation !== undefined) { this.orientation = source.orientation; } } } /** Options for loading image from path. */ export class PathImageLoadOptions extends PartiallyConstructible { /** @param source {@displayType `DeepPartial<PathImageLoadOptions>`} */ constructor(source = {}) { super(); /** Region of interest. */ this.roi = { x: 0, y: 0, width: 0, height: 0 }; /** Load mode. Default is EAGER */ this.loadMode = 'EAGER'; /** Encryption mode. Default is IF_AVAILABLE */ this.encryptionMode = 'IF_AVAILABLE'; if (source.roi !== undefined) { this.roi = { x: source.roi.x, y: source.roi.y, width: source.roi.width, height: source.roi.height }; } if (source.loadMode !== undefined) { this.loadMode = source.loadMode; } if (source.encryptionMode !== undefined) { this.encryptionMode = source.encryptionMode; } } } /** Options for loading image from buffer. */ export class BufferImageLoadOptions extends PartiallyConstructible { /** @param source {@displayType `DeepPartial<BufferImageLoadOptions>`} */ constructor(source = {}) { super(); /** Region of interest. */ this.roi = { x: 0, y: 0, width: 0, height: 0 }; /** Load mode. Default is EAGER */ this.loadMode = 'EAGER'; if (source.roi !== undefined) { this.roi = { x: source.roi.x, y: source.roi.y, width: source.roi.width, height: source.roi.height }; } if (source.loadMode !== undefined) { this.loadMode = source.loadMode; } } } /** Options for saving image to a path. */ export class SaveImageOptions extends PartiallyConstructible { /** @param source {@displayType `DeepPartial<SaveImageOptions>`} */ constructor(source = {}) { super(); /** Quality parameter is for jpeg only and is in range 0 to 100. If -1, then settings from hibernation are used. In case when the Image Ref was created with a lazy load mode and originally has the same format as the requested to save, then setting quality to -1 leads to simply copying from source to destination, which is time efficient and prevents quality loss caused by jpeg encoding/decoding. Default is -1 */ this.quality = -1; /** Encryption mode. Default is IF_AVAILABLE */ this.encryptionMode = 'IF_AVAILABLE'; if (source.quality !== undefined) { this.quality = source.quality; } if (source.encryptionMode !== undefined) { this.encryptionMode = source.encryptionMode; } } } /** Options for encoding image. */ export class EncodeImageOptions extends PartiallyConstructible { /** @param source {@displayType `DeepPartial<EncodeImageOptions>`} */ constructor(source = {}) { super(); /** Quality parameter is for jpeg only and is in range 0 to 100. If -1, then settings from hibernation are used. In case when the Image Ref was created with a lazy load mode and originally has the same format as the requested to save, then setting quality to -1 leads to simply copying from source to destination, which is time efficient and prevents quality loss caused by jpeg encoding/decoding. Default is -1 */ this.quality = -1; /** Image format. Default is JPEG */ this.format = 'JPEG'; if (source.quality !== undefined) { this.quality = source.quality; } if (source.format !== undefined) { this.format = source.format; } } } export const ImageSourceTypeValues = ['API', 'PLATFORM_IMAGE', 'CAMERA', 'FILE', 'BUFFER', 'OTHER']; /** Description of source from which the ImageRef was created. */ export class ImageSource extends PartiallyConstructible { /** @param source {@displayType `DeepPartial<ImageSource>`} */ constructor(source = {}) { super(); if (source.type !== undefined) { this.type = source.type; } else { throw new Error('type must be present in constructor argument'); } if (source.filePath !== undefined) { this.filePath = source.filePath != null ? source.filePath : null; } else { throw new Error('filePath must be present in constructor argument'); } } serialize(config = new ToJsonConfiguration()) { return { type: this.type, filePath: this.filePath != null ? this.filePath : null, }; } } /** ImageRef profile part specific to image information. */ export class ImageProfile extends PartiallyConstructible { /** @param source {@displayType `DeepPartial<ImageProfile>`} */ constructor(source = {}) { super(); /** Memory consumption of a memory-backed bitmap. Zero, if the image is hibernating. Default is 0 */ this.bitmapMemoryConsumption = 0; /** Memory consumption of the hibernation buffer. Zero, if the image is not hibernating, or is hibernated to a file. Default is 0 */ this.hibernationMemoryConsumption = 0; if (source.bitmapMemoryConsumption !== undefined) { this.bitmapMemoryConsumption = source.bitmapMemoryConsumption; } if (source.hibernationMemoryConsumption !== undefined) { this.hibernationMemoryConsumption = source.hibernationMemoryConsumption; } } serialize(config = new ToJsonConfiguration()) { return { bitmapMemoryConsumption: this.bitmapMemoryConsumption, hibernationMemoryConsumption: this.hibernationMemoryConsumption, }; } } /** ImageRef profile which provides detailed information about stored object. */ export class ImageRefProfile extends PartiallyConstructible { /** @param source {@displayType `DeepPartial<ImageRefProfile>`} */ constructor(source = {}) { super(); if (source.refInfo !== undefined) { this.refInfo = new RefCountedObjectProfile(source.refInfo); } else { throw new Error('refInfo must be present in constructor argument'); } if (source.imageInfo !== undefined) { this.imageInfo = new ImageProfile(source.imageInfo); } else { throw new Error('imageInfo must be present in constructor argument'); } if (source.imageSource !== undefined) { this.imageSource = source.imageSource != null ? new ImageSource(source.imageSource) : null; } else { throw new Error('imageSource must be present in constructor argument'); } } serialize(config = new ToJsonConfiguration()) { return { refInfo: this.refInfo.serialize(config), imageInfo: this.imageInfo.serialize(config), imageSource: this.imageSource != null ? this.imageSource.serialize(config) : null, }; } } /** Snapshot of all alive ImageRefs. */ export class ImageRefPoolSnapshot extends PartiallyConstructible { /** @param source {@displayType `DeepPartial<ImageRefPoolSnapshot>`} */ constructor(source = {}) { super(); /** Estimation of total memory consumption of ImageRefs. Default is 0 */ this.totalMemoryConsumption = 0; if (source.imageRefProfiles !== undefined) { this.imageRefProfiles = source.imageRefProfiles.map((it) => { return new ImageRefProfile(it); }); } else { throw new Error('imageRefProfiles must be present in constructor argument'); } if (source.totalMemoryConsumption !== undefined) { this.totalMemoryConsumption = source.totalMemoryConsumption; } } serialize(config = new ToJsonConfiguration()) { return { imageRefProfiles: this.imageRefProfiles.map((it) => { return it.serialize(config); }), totalMemoryConsumption: this.totalMemoryConsumption, }; } } /** difference between two snapshots. */ export class ImageRefPoolSnapshotsDiff extends PartiallyConstructible { /** @param source {@displayType `DeepPartial<ImageRefPoolSnapshotsDiff>`} */ constructor(source = {}) { super(); /** Difference between total memory consumption in two snapshots. Default is 0 */ this.totalMemoryConsumptionDiff = 0; if (source.totalMemoryConsumptionDiff !== undefined) { this.totalMemoryConsumptionDiff = source.totalMemoryConsumptionDiff; } if (source.removed !== undefined) { this.removed = source.removed.map((it) => { return it; }); } else { throw new Error('removed must be present in constructor argument'); } if (source.added !== undefined) { this.added = source.added.map((it) => { return it; }); } else { throw new Error('added must be present in constructor argument'); } if (source.modified !== undefined) { this.modified = source.modified.map((it) => { return it; }); } else { throw new Error('modified must be present in constructor argument'); } } serialize(config = new ToJsonConfiguration()) { return { totalMemoryConsumptionDiff: this.totalMemoryConsumptionDiff, removed: this.removed.map((it) => { return it; }), added: this.added.map((it) => { return it; }), modified: this.modified.map((it) => { return it; }), }; } } //# sourceMappingURL=ImageRefTypes.js.map