You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

193 lines
5.0 KiB

4 months ago
import type { RuntimeContext } from '../../runtime/types';
import type { BasePluginOptions } from '../base-plugin';
import { BasePlugin } from '../base-plugin';
/**
* <zh/>
*
* <en/> Watermark options
*/
export interface WatermarkOptions extends BasePluginOptions {
/**
* <zh/>
*
* <en/> The width of watermark(single)
* @defaultValue 200
*/
width?: number;
/**
* <zh/>
*
* <en/> The height of watermark(single)
* @defaultValue 100
*/
height?: number;
/**
* <zh/>
*
* <en/> The opacity of watermark
* @defaultValue 0.2
*/
opacity?: number;
/**
* <zh/>
*
* <en/> The rotate angle of watermark
* @defaultValue Math.PI / 12
*/
rotate?: number;
/**
* <zh/> 使使
*
* <en/> The image url, if it has a value, it will be used, otherwise it will use the text
*/
imageURL?: string;
/**
* <zh/>
*
* <en/> The text of watermark
*/
text?: string;
/**
* <zh/>
*
* <en/> The color of text watermark
* @defaultValue '#000'
*/
textFill?: string;
/**
* <zh/>
*
* <en/> The font size of text watermark
* @defaultValue 16
*/
textFontSize?: number;
/**
* <zh/>
*
* <en/> The font of text watermark
*/
textFontFamily?: string;
/**
* <zh/>
*
* <en/> The font weight of text watermark
*/
textFontWeight?: string;
/**
* <zh/>
*
* <en/> The font variant of text watermark
*/
textFontVariant?: string;
/**
* <zh/>
*
* <en/> The text align of text watermark
* @defaultValue 'center'
*/
textAlign?: 'center' | 'end' | 'left' | 'right' | 'start';
/**
* <zh/> 线
*
* <en/> The text baseline of text watermark
* @defaultValue 'middle'
*/
textBaseline?: 'alphabetic' | 'bottom' | 'hanging' | 'ideographic' | 'middle' | 'top';
/**
* <zh/>
*
* <en/> The background attachment of watermark
*/
backgroundAttachment?: string;
/**
* <zh/>
*
* <en/> The background blend of watermark
*/
backgroundBlendMode?: string;
/**
* <zh/>
*
* <en/> The background clip of watermark
*/
backgroundClip?: string;
/**
* <zh/>
*
* <en/> The background color of watermark
*/
backgroundColor?: string;
/**
* <zh/>
*
* <en/> The background image of watermark
*/
backgroundImage?: string;
/**
* <zh/>
*
* <en/> The background origin of watermark
*/
backgroundOrigin?: string;
/**
* <zh/>
*
* <en/> The background position of watermark
*/
backgroundPosition?: string;
/**
* <zh/> -x
*
* <en/> The background position-x of watermark
*/
backgroundPositionX?: string;
/**
* <zh/> -y
*
* <en/> The background position-y of watermark
*/
backgroundPositionY?: string;
/**
* <zh/>
*
* <en/> The background repeat of watermark
* @defaultValue 'repeat'
*/
backgroundRepeat?: string;
/**
* <zh/>
*
* <en/> The background size of watermark
*/
backgroundSize?: string;
}
/**
* <zh/>
*
* <en/> Watermark
* @remarks
* <zh/> 使 Graph div `background-image` css 使 canvas
*
* <en/> Support using text and image as watermark, the principle is to add the `background-image` property to the div of the Graph container, and then you can control the position and style of the watermark through css. For text, it will be converted to an image using a hidden canvas
*/
export declare class Watermark extends BasePlugin<WatermarkOptions> {
static defaultOptions: Partial<WatermarkOptions>;
private $element;
constructor(context: RuntimeContext, options: WatermarkOptions);
/**
* <zh/>
*
* <en/> Update the watermark configuration
* @param options - <zh/> | <en/> Options
* @internal
*/
update(options: Partial<WatermarkOptions>): Promise<void>;
/**
* <zh/>
*
* <en/> Destroy the watermark
* @internal
*/
destroy(): void;
}