UNPKG

html2canvas-pro

Version:

Screenshots with JavaScript. Next generation!

66 lines (65 loc) 1.82 kB
/** * Effects Renderer * * Handles rendering effects including: * - Opacity effects * - Transform effects (matrix transformations) * - Clip effects (overflow / border-radius clipping via Path[]) * - Clip-path effects (CSS clip-path shapes: inset, circle, ellipse, polygon, path) */ import { IElementEffect } from '../effects'; import { Path } from '../path'; /** * Dependencies required for EffectsRenderer */ export interface EffectsRendererDependencies { ctx: CanvasRenderingContext2D; } /** * Path callback for clip effects */ export interface EffectsPathCallback { path(paths: Path[]): void; } /** * Effects Renderer * * Manages rendering effects stack including opacity, transforms, and clipping. * Extracted from CanvasRenderer to improve code organization and maintainability. */ export declare class EffectsRenderer { private readonly ctx; private readonly pathCallback; private readonly activeEffects; constructor(deps: EffectsRendererDependencies, pathCallback: EffectsPathCallback); /** * Apply multiple effects * Clears existing effects and applies new ones * * @param effects - Array of effects to apply */ applyEffects(effects: IElementEffect[]): void; /** * Apply a single effect * * @param effect - Effect to apply */ applyEffect(effect: IElementEffect): void; /** * Remove the most recent effect * Restores the canvas state before the effect was applied */ popEffect(): void; /** * Get the current number of active effects * * @returns Number of active effects */ getActiveEffectCount(): number; /** * Check if there are any active effects * * @returns True if there are active effects */ hasActiveEffects(): boolean; }