All files / src/lib imageSettings.ts

100% Statements 5/5
100% Branches 4/4
100% Functions 2/2
100% Lines 5/5

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39                                    16x         16x       16x       16x       16x      
/**
 * A configuration object to define the properties of an image to be scanned.
 */
export interface ImageSettings {
  /**
   * The width of the image (columns of pixels).
   */
  readonly width: number;
  /**
   * The height of the image (rows of pixels).
   */
  readonly height: number;
  /**
   * The format of the pixel data, meaning the mapping of array bytes to image pixels.
   */
  readonly format: ImageSettings.Format;
}
 
export namespace ImageSettings {
  // Warning: the values of Format are important as the engine web worker relies on them without type checking.
  /**
   * Image bytes format/layout.
   */
  export enum Format {
    /**
     * Single-channel 8-bit gray scale image.
     */
    GRAY_8U = 0,
    /**
     * RGB image with 8 bits per color channel.
     */
    RGB_8U = 1,
    /**
     * RGBA image with 8 bits per color channel.
     */
    RGBA_8U = 2,
  }
}