t-comm
Version:
专业、稳定、纯粹的工具库
45 lines (44 loc) • 1.36 kB
TypeScript
/**
* canvas 实现 watermark
* @param {object} params 参数
* @param {HTMLElement} params.container 容器
* @param {number} params.width 图片宽
* @param {number} params.height 图片高
* @param {string} params.textAlign 同 ctx.textAlign
* @param {string} params.textBaseline 同 ctx.textBaseline
* @param {string} params.font 同 ctx.font
* @param {string} params.fillStyle 同 ctx.fillStyle
* @param {string} params.content 内容
* @param {number} params.rotate 旋转角度
* @param {number} params.zIndex 层级
*
* @example
*
* ```ts
* const rtx = 'pony';
*
* createWatcherMark({
* content: rtx,
* width: '300',
* height: '300',
* textAlign: 'center',
* textBaseline: 'middle',
* font: '25px Microsoft Yahei',
* fillStyle: 'rgba(184, 184, 184, 0.3)',
* rotate: '-50',
* zIndex: 1000,
* });
* ```
*/
export declare function createWatcherMark({ container, width, height, textAlign, textBaseline, font, fillStyle, content, rotate, zIndex, }?: {
container?: HTMLElement | undefined;
width?: number | undefined;
height?: number | undefined;
textAlign?: string | undefined;
textBaseline?: string | undefined;
font?: string | undefined;
fillStyle?: string | undefined;
content?: string | undefined;
rotate?: number | undefined;
zIndex?: number | undefined;
}): void;