react-native-scanbot-sdk
Version:
Scanbot Document and Barcode Scanner SDK React Native Plugin for Android and iOS
236 lines (213 loc) • 6.64 kB
JavaScript
/// Auto-generated with ScanbotSDKCodegenV3. Modifications will be overwritten.
/// Generated from core/schemas/TIFFTypes.yaml
import { ParametricFilter } from '../image_filters/ParametricFilters';
import { PartiallyConstructible } from '../utils/utils';
/**
TIFF compression type.
- `NONE`:
Dump mode.
- `CCITTRLE`:
CCITT modified Huffman RLE. For binarized images only.
- `CCITT_T4`:
CCITT T.4 (CCITTFAX3, CCITT Group 3 fax encoding, TIFF 6 name). For binarized images only.
- `CCITT_T6`:
CCITT T.6 (CCITTFAX4, CCITT Group 4 fax encoding, TIFF 6 name). For binarized images only.
- `LZW`:
Lempel-Ziv and Welch.
- `JPEG`:
%JPEG DCT compression.
- `CCITTRLEW`:
#1 w/ word alignment. For binarized images only.
- `PACKBITS`:
Macintosh RLE.
- `DEFLATE`:
Deflate compression. Legacy Deflate codec identifier.
- `ADOBE_DEFLATE`:
Deflate compression, as recognized by Adobe. More widely supported.
*/
export const CompressionModeValues = ['NONE', 'CCITTRLE', 'CCITT_T4', 'CCITT_T6', 'LZW', 'JPEG', 'CCITTRLEW', 'PACKBITS', 'DEFLATE', 'ADOBE_DEFLATE'];
/**
Binarization behavior to apply when adding pages to a TIFF.
- `DISABLED`:
Do not binarize the image. Image will be stored as a grayscale or color TIFF.
- `ENABLED`:
Binarize the image. Image will be stored as a 1-bit TIFF. If the input image is not black-and-white, a simple thresholding is applied.
- `ENABLED_IF_BINARIZATION_FILTER_SET`:
Same behavior as ENABLED if a binarization filter (TIFFGeneratorParameters.binarizationFilter) is set,
otherwise same behavior as DISABLED. This is the default.
*/
export const BinarizationValues = ['DISABLED', 'ENABLED', 'ENABLED_IF_BINARIZATION_FILTER_SET'];
/**
User-defined TIFF field value.
*/
/** @internal */
export let UserFieldValue;
(function (_UserFieldValue) {
function From(source) {
const _type = source._type;
switch (_type) {
case 'UserFieldDoubleValue':
return new UserFieldDoubleValue(source);
case 'UserFieldStringValue':
return new UserFieldStringValue(source);
case 'UserFieldIntValue':
return new UserFieldIntValue(source);
default:
throw `Unknown child class name: ${_type}`;
}
}
_UserFieldValue.From = From;
})(UserFieldValue || (UserFieldValue = {}));
/**
Double value (TIFF_DOUBLE).
*/
export class UserFieldDoubleValue extends PartiallyConstructible {
_type = 'UserFieldDoubleValue';
/**
Value.
*/
/** @param source {@displayType `DeepPartial<UserFieldDoubleValue>`} */
constructor(source = {}) {
super();
if (source.value !== undefined) {
this.value = source.value;
} else {
throw new Error('value must be present in constructor argument');
}
}
}
/**
ASCII string value (TIFF_ASCII).
*/
export class UserFieldStringValue extends PartiallyConstructible {
_type = 'UserFieldStringValue';
/**
Value.
*/
/** @param source {@displayType `DeepPartial<UserFieldStringValue>`} */
constructor(source = {}) {
super();
if (source.value !== undefined) {
this.value = source.value;
} else {
throw new Error('value must be present in constructor argument');
}
}
}
/**
32-bit int value (TIFF_LONG).
*/
export class UserFieldIntValue extends PartiallyConstructible {
_type = 'UserFieldIntValue';
/**
Value.
*/
/** @param source {@displayType `DeepPartial<UserFieldIntValue>`} */
constructor(source = {}) {
super();
if (source.value !== undefined) {
this.value = source.value;
} else {
throw new Error('value must be present in constructor argument');
}
}
}
/**
User-defined TIFF field.
*/
export class UserField extends PartiallyConstructible {
/**
Numeric tag.
*/
/**
Field name.
*/
/**
Value.
*/
/** @param source {@displayType `DeepPartial<UserField>`} */
constructor(source = {}) {
super();
if (source.tag !== undefined) {
this.tag = source.tag;
} else {
throw new Error('tag must be present in constructor argument');
}
if (source.name !== undefined) {
this.name = source.name;
} else {
throw new Error('name must be present in constructor argument');
}
if (source.value !== undefined) {
this.value = UserFieldValue.From(source.value);
} else {
throw new Error('value must be present in constructor argument');
}
}
}
/**
TIFF generator parameters.
*/
export class TiffGeneratorParameters extends PartiallyConstructible {
/**
Compression.
Default is LZW
*/
compression = 'LZW';
/**
JPEG quality (TIFFTAG_JPEGQUALITY). Values range from 0 to 100.
Default is 80
*/
jpegQuality = 80;
/**
ZIP/Deflate compression level (TIFFTAG_ZIPQUALITY). Values range from 1 to 9.
Default is 6
*/
zipCompressionLevel = 6;
/**
DPI value.
Default is 72
*/
dpi = 72;
/**
User-defined fields.
*/
userFields = [];
/**
Filter to apply to the input image when adding pages with binarization.
If set, the filter is applied to the input image and the resulting image is stored as a 1-bit TIFF.
When storing documents it's typically best to use the BINARY_DOCUMENT_OPTIMIZED_COMPRESSION compression mode (CCITT_T6)
instead of the default, as it tends to produce the smallest file sizes.
If not set, simple thresholding is applied to the image, instead.
*/
binarizationFilter = null;
/** @param source {@displayType `DeepPartial<TiffGeneratorParameters>`} */
constructor(source = {}) {
super();
if (source.compression !== undefined) {
this.compression = source.compression;
}
if (source.jpegQuality !== undefined) {
this.jpegQuality = source.jpegQuality;
}
if (source.zipCompressionLevel !== undefined) {
this.zipCompressionLevel = source.zipCompressionLevel;
}
if (source.dpi !== undefined) {
this.dpi = source.dpi;
}
if (source.userFields !== undefined) {
this.userFields = source.userFields.map(it => {
return new UserField(it);
});
}
if (source.binarizationFilter !== undefined) {
this.binarizationFilter = source.binarizationFilter != null ? ParametricFilter.From(source.binarizationFilter) : null;
}
}
}
(function (_TiffGeneratorParameters) {
const defaultCompression = _TiffGeneratorParameters.defaultCompression = 'LZW';
const binaryDocumentOptimizedCompression = _TiffGeneratorParameters.binaryDocumentOptimizedCompression = 'CCITT_T6';
})(TiffGeneratorParameters || (TiffGeneratorParameters = {}));
//# sourceMappingURL=TiffTypes.js.map