import { DcController } from "../DcController.js"; import { PcmMaterial, PcmMaterialMinimalData } from "../pcm/material.js"; import { PcmPatternEmbossing, PcmPatternEmbossingDefinition } from "../pcm/pattern-embossing.js"; type MaterialId = string; type MaterialAlias = string; /** * A 2D layer. */ export type Layer = { /** * The id of the material or the material or the material with definition. */ material: MaterialId | PcmMaterial | PcmMaterialMinimalData; /** * The name of the layer. * * The name can later be used to interact with the layer, e.g. to highlight * it. */ name?: string; /** * Whether or not the layer is visible. * * Defaults to `true`. */ visible?: boolean; /** * The texture of the layer, either a url or a blob. * * For non PNG images the file format must be specified either in the URL * itself or via a TextureUrl and TextureUrlCollection object */ texture?: string | TextureUrl | Blob | TextureBlob; /** * Whether or not the layer is overprinted with the texture. * * Defaults to `false`. */ overprintContent?: boolean; /** * A color that overprints the layer. * * Depending on the material, the color either completely replaces the texture * or is multiplied with it (i.e., the texture is tinted). * * The color is in HEX format, optionally with alpha (e.g., #FF0000FF). */ overprintColor?: string; /** * A pattern embossing that is applied to the layer. * * Either an id of a pcm definition. */ patternEmbossing?: { /** * The id of of an embossing preset or a pcm pattern embossing. */ preset: string | PcmPatternEmbossing | PcmPatternEmbossingDefinition; /** * The offset of the embossing in pixels. */ offset?: [number, number]; /** * The rotation of the embossing in radiants. */ rotation?: number; }; }; /** * A texture specified via a URL. */ export interface TextureUrl { /** * The public url of the texture */ url: string; /** * Define the file extension of the texture. * * This is only necessary, if the url does not contain the extension itself * (e.g. ".png", ".ktx2") */ fileExtension?: string; } /** * A texture specified from a blob. */ export interface TextureBlob { /** * The texture itself as an Blob */ blob: Blob; /** * Define the file extension of the texture (e.g. ".png", ".jpg", ".ktx2") */ fileExtension?: string; /** * Wether or not Mipmaps should be generated for the texture. * @default true */ generateMipmaps?: boolean; } /** * Sets the layers. * * @param dcController The DcController object obtained from the init function. * @param layers An array with layers. Layer objects later in the array overlay * the layers that come before them. * @returns A promise that resolves when the layers have been set. */ export declare const setLayers: typeof _setLayers; declare function _setLayers(dcController: DcController, layers: Layer[], opts?: { addWatermark?: boolean; }): Promise; /** * Takes a material in various representations (id, pcm material) and returns * the corresponding pcm material with its definition. * * @internal */ export declare function getPcmMaterialWithDefinition(dcController: DcController, material: MaterialId | MaterialAlias | PcmMaterial | PcmMaterialMinimalData): Promise; export {};