UNPKG

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)

305 lines (304 loc) 9.45 kB
/** @format */ import { Rational } from '../common/rational.js'; import { IfdContainer } from './ifd-container.js'; import { IfdValue } from './ifd-value/ifd-value.js'; import { TypedArray } from '../common/typings.js'; /** * Represents a directory of IFD (Image File Directory) entries. */ export declare class IfdDirectory { /** * Map to store IFD values. */ private readonly _data; /** * Container for sub-IFD directories. */ private readonly _sub; /** * Gets the sub-IFD container. */ get sub(): IfdContainer; /** * Gets an iterator for the keys in the IFD directory. */ get keys(): IterableIterator<number>; /** * Gets an iterator for the values in the IFD directory. */ get values(): IterableIterator<IfdValue>; /** * Gets an iterator for the entries in the IFD directory. */ get entries(): IterableIterator<[number, IfdValue]>; /** * Gets the number of entries in the IFD directory. */ get size(): number; /** * Checks if the IFD directory is empty. */ get isEmpty(): boolean; /** * Checks if the IFD directory has a user comment. */ get hasUserComment(): boolean; /** * Gets the user comment from the IFD directory. */ get userComment(): string | undefined; /** * Sets the user comment in the IFD directory. */ set userComment(v: string | undefined); /** * Checks if the IFD directory has an image description. */ get hasImageDescription(): boolean; /** * Gets the image description from the IFD directory. */ get imageDescription(): string | undefined; /** * Sets the image description in the IFD directory. */ set imageDescription(v: string | undefined); /** * Checks if the IFD directory has a make value. */ get hasMake(): boolean; /** * Gets the make value from the IFD directory. */ get make(): string | undefined; /** * Sets the make value in the IFD directory. */ set make(v: string | undefined); /** * Checks if the IFD directory has a model value. */ get hasModel(): boolean; /** * Gets the model value from the IFD directory. */ get model(): string | undefined; /** * Sets the model value in the IFD directory. */ set model(v: string | undefined); /** * Checks if the IFD directory has an orientation value. */ get hasOrientation(): boolean; /** * Gets the orientation value from the IFD directory. */ get orientation(): number | undefined; /** * Sets the orientation value in the IFD directory. */ set orientation(v: number | undefined); /** * Checks if the IFD directory has a resolutionX value. */ get hasResolutionX(): boolean; /** * Gets the resolutionX value from the IFD directory. */ get resolutionX(): Rational | undefined; /** * Sets the resolutionX value in the IFD directory. */ set resolutionX(v: Rational | undefined); /** * Checks if the IFD directory has a resolutionY value. */ get hasResolutionY(): boolean; /** * Gets the resolutionY value from the IFD directory. */ get resolutionY(): Rational | undefined; /** * Sets the resolutionY value in the IFD directory. */ set resolutionY(v: Rational | undefined); /** * Checks if the IFD directory has a resolution unit value. */ get hasResolutionUnit(): boolean; /** * Gets the resolution unit value from the IFD directory. */ get resolutionUnit(): number | undefined; /** * Sets the resolution unit value in the IFD directory. */ set resolutionUnit(v: number | undefined); /** * Checks if the IFD directory has an image width value. */ get hasImageWidth(): boolean; /** * Gets the image width value from the IFD directory. */ get imageWidth(): number | undefined; /** * Sets the image width value in the IFD directory. */ set imageWidth(v: number | undefined); /** * Checks if the IFD directory has an image height value. */ get hasImageHeight(): boolean; /** * Gets the image height value from the IFD directory. */ get imageHeight(): number | undefined; /** * Sets the image height value in the IFD directory. */ set imageHeight(v: number | undefined); /** * Checks if the IFD directory has a software value. */ get hasSoftware(): boolean; /** * Gets the software value from the IFD directory. */ get software(): string | undefined; /** * Sets the software value in the IFD directory. */ set software(v: string | undefined); /** * Checks if the IFD directory has a copyright value. */ get hasCopyright(): boolean; /** * Gets the copyright value from the IFD directory. */ get copyright(): string | undefined; /** * Sets the copyright value in the IFD directory. */ set copyright(v: string | undefined); /** * Checks if the IFD directory has a GPS Latitude Reference. */ get hasGPSLatitudeRef(): boolean; /** * Gets the GPS Latitude Reference value from the IFD directory. */ get gpsLatitudeRef(): string | undefined; /** * Sets the GPS Latitude Reference value in the IFD directory. */ set gpsLatitudeRef(v: string | undefined); /** * Checks if the IFD directory has a GPS Latitude. */ get hasGPSLatitude(): boolean; /** * Gets the GPS Latitude value from the IFD directory. */ get gpsLatitude(): number | undefined; /** * Sets the GPS Latitude value in the IFD directory. */ set gpsLatitude(v: number | undefined); /** * Checks if the IFD directory has a GPS Longitude Reference. */ get hasGPSLongitudeRef(): boolean; /** * Gets the GPS Longitude Reference value from the IFD directory. */ get gpsLongitudeRef(): string | undefined; /** * Sets the GPS Longitude Reference value in the IFD directory. */ set gpsLongitudeRef(v: string | undefined); /** * Checks if the IFD directory has a GPS Longitude. */ get hasGPSLongitude(): boolean; /** * Gets the GPS Longitude value from the IFD directory. */ get gpsLongitude(): number | undefined; /** * Sets the GPS Longitude value in the IFD directory. */ set gpsLongitude(v: number | undefined); /** * Checks if the IFD directory has a GPS Date. */ get hasGPSDate(): boolean; /** * Gets the GPS Date value from the IFD directory. */ get gpsDate(): string | undefined; /** * Sets the GPS Date value in the IFD directory. */ set gpsDate(v: string | undefined); /** * Gets the size in bytes of the data written by this directory. * Can be used to calculate end-of-block offsets. */ get dataSize(): number; /** * Constructs an IfdDirectory instance. * @param {Map<number, IfdValue>} [data] - Optional map of IFD values. */ constructor(data?: Map<number, IfdValue>); /** * Sets a rational value in the IFD directory. * @param {number} tag - The tag number. * @param {Rational | number[] | TypedArray | unknown} value - The rational value. * @returns {boolean} True if the value was set, false otherwise. */ private setRational; /** * Creates an IfdDirectory instance from another instance. * @param {IfdDirectory} other - The other IfdDirectory instance. * @returns {IfdDirectory} A new IfdDirectory instance. */ static from(other: IfdDirectory): IfdDirectory; /** * Checks if a value is an array of rational numbers. * @param {unknown} value - The value to check. * @returns {boolean} True if the value is an array of rational numbers, false otherwise. */ static isArrayOfRationalNumbers(value: unknown): boolean; /** * Checks if the IFD directory has a specific tag. * @param {number} tag - The tag number. * @returns {boolean} True if the tag exists, false otherwise. */ has(tag: number): boolean; /** * Gets the value associated with a specific tag. * @param {number | string} tag - The tag number or name. * @returns {IfdValue | undefined} The IFD value or undefined if not found. */ getValue(tag: number | string): IfdValue | undefined; /** * Sets a value in the IFD directory. * @param {number | string} tag - The tag number or name. * @param {Rational[] | number[] | TypedArray | Rational | IfdValue | number | undefined} value - The value to set. */ setValue(tag: number | string, value: Rational[] | number[] | TypedArray | Rational | IfdValue | number | undefined): void; setGpsLocation(latitude: number, longitude: number): void; /** * Copies data from another IfdDirectory instance. * @param {IfdDirectory} other - The IfdDirectory instance to copy from. */ copyFrom(other: IfdDirectory): void; /** * Creates a clone of the current IfdDirectory instance. * @returns {IfdDirectory} A new IfdDirectory instance that is a clone of the current instance. */ clone(): IfdDirectory; }