import Viewer from "./Viewer"; import { Vector4 } from "./GeoMath"; /** * 画面のキャプチャ機能を提供するクラス * @example * ```ts * const capture = new Capture( viewer ); * capture.setAttribution( options: CaptureOption ); * const image1 = await capture.shoot(); * const image2 = await capture.shoot(); * ``` */ declare class Capture { private _viewer; private _mime_type; private _sync; private _attribution_content; private _attribution_font_color; private _attribution_bg_color; private _attribution_font_size; private _attribution_h_margin; private _attribution_v_margin; private _attribution_h_spacing; /** * 表示する著作権情報を管理するarray。 * undefined の場合は、キャッシュが生成されていないことを表す */ private _attribution_array?; private _attribution_height; private _attribution_width; /** * コンストラクタ * @param viewer Viewer インスタンス */ constructor(viewer: Viewer, options?: Capture.Option); /** * 著作権コンテナに表示する著作権を指定 * @example * ```ts * setAttribution([ * 'attribution sample', * '1234567890', * '', * ]) * ``` * ```ts * setAttribution( '1234567890' ); * ``` */ setAttributionContent(attribution: string | string[]): void; /** * 文字色を指定 * 値は0~1.0の正規化された色値 */ setAttributionFontColor(font_color: Vector4): void; /** * 背景色を指定 * 値は0~1.0の正規化された色値 */ setAttributionBackgroundColor(color: Vector4): void; /** * 文字サイズのpixel値 */ setAttributionFontSize(font_size: number): void; /** * マージン */ setAttributionSize(font_size: number): void; /** * 画面のキャプチャ * * @return キャプチャ画像データ (Blob) */ shoot(): Promise; /** * キャプチャ画像にロゴやアノテーションを描画 * @param context 書き込む2Dキャンバスコンテキスト */ private _postRenderForCapture; /** * キャプチャ画像用アノテーションを管理Arrayに追加(imgとtextを分離) * @param attribution_string * @param context */ private _addCaptureAttribution; /** * キャプチャ画像用アノテーション(img)を管理Arrayに追加 * @param img_string * @param context */ private _addCaptureAttributionImg; /** * キャプチャ画像用アノテーション(text)を管理Arrayに追加 * @param text * @param context */ private _addCaptureAttributionText; } declare namespace Capture { interface Option { /** * 画像の拡張子 */ type?: "jpeg" | "png"; /** * 画面の読み込みを待つかを決定する真偽値 */ sync?: boolean; /** * 著作権情報オプション */ attribution?: AttributionOption; } interface AttributionOption { /** * 著作権コンテナに表示する著作権を指定 * @example * ```ts * content: [ * 'attribution sample', * '1234567890', * '', * ] * ``` */ content?: string | string[]; /** * 文字色を指定 * 値は0~1.0の正規化された色値 */ font_color?: Vector4; /** * 背景色を指定 * 値は0~1.0の正規化された色値 */ bg_color?: Vector4; /** * 文字サイズのpixel値 */ font_size?: number; /** * 水平方向のmarginのpixel値 */ h_margin?: number; /** * 垂直方向のmarginのpixel値 */ v_margin?: number; /** * attribution間のスペースのpixel値 */ h_spacing?: number; } /** * capture用 image attribution * @private * */ interface ImageAttribution { type: "image"; img: HTMLImageElement; width: number; height: number; } /** * capture用 text attribution * @private * */ interface TextAttribution { type: "text"; text: string; width: number; height: number; } type Attribution = TextAttribution | ImageAttribution; } export default Capture; //# sourceMappingURL=Capture.d.ts.map