AutoMovie API
    Preparing search index...

    Class AutoMovieRasterSheet

    A contact sheet of pictures, filled one picture at a time: each picture is reduced into its cell in row-major order, and its caption is written in a dark strip under the cell, outside the picture, so the caption hides no part of the subject or its legend and stays legible however small the cell is. A caption longer than the cell is wide wraps onto further lines at word boundaries, so it keeps every word that identifies the cell; the sheet's strip holds the number of lines its constructor states, which AutoMovieRasterSheet.lines and AutoMovieRasterSheet.caption let a layout size from its captions before any picture is added. Reduction averages every source pixel a cell pixel covers (area, the default), or copies the source pixel at the cell pixel's centre (nearest), which keeps exact colours for a review that reads pixel values.

    A cell takes any picture, a drawn frame, a difference image or a decoded still alike. Pictures are reduced as they arrive, so a sheet never holds more than its own pixels; the finished sheet is an ordinary picture for encodeAutoMovieRasterPng, cut to the cells that were filled.

    const sheet = new AutoMovieRasterSheet(20, 5, 180, 320);
    for (const [seconds, frame] of frames) sheet.add(frame, `${seconds}s`);
    await writeFile("sheet.png", await encodeAutoMovieRasterPng(sheet.finish()));
    Index
    • Allocate an empty sheet.

      Parameters

      • capacity: number

        Number of cells, a positive integer.

      • columns: number

        Cells per row, a positive integer.

      • cellWidth: number

        Cell width in pixels, a positive integer.

      • cellHeight: number

        Cell height in pixels, a positive integer, not counting the caption strip under it.

      • reduction: "area" | "nearest" = "area"

        area to average the pixels a cell pixel covers, nearest to copy the one at its centre.

      • lines: number = 1

        Lines of caption the strip under each cell holds, a positive integer; a caption that wraps onto more lines keeps its first ones.

      Returns AutoMovieRasterSheet

    • The sheet as filled so far, cut to the rows and columns that hold a picture.

      A sheet filled short of its capacity gives a picture no larger than its filled cells: as wide as the cells of its first row and as tall as its started rows, with the unfilled cells of a last row left black. That picture is the caller's own, so a later add does not change it. It throws when no picture was added.

      Returns IAutoMovieRasterImage

    • Height in pixels of the caption strip a sheet writes under a cell of the given height, holding lines lines: the label stamp's 3 × 5 font at a scale of one font pixel per 90 cell pixels, at least one, one font pixel between lines and two of margin above and below.

      Parameters

      • cellHeight: number
      • lines: number = 1

      Returns number

    • The most lines any of the captions takes under a cell of the given size, at least one, which a sheet's strip must hold.

      Parameters

      • captions: readonly string[]
      • cellWidth: number
      • cellHeight: number

      Returns number

    • The lines a caption takes under a cell of the given size: its words in order, as many to a line as the stamp fits in the cell's width, a word longer than a line broken across lines.

      Parameters

      • caption: string
      • cellWidth: number
      • cellHeight: number

      Returns string[]