import { z } from "zod"; import { ShapeTypeEnum } from '../../../../index'; import { ShapeSprite } from "./ShapeSprite"; import { ClipStyle, ClipStyleOptions } from "../../ClipStyle"; /** * One 2D point used by polygon and Bezier-based shapes. */ export interface ShapePoint { x: number; y: number; } /** * One cubic Bezier node used by Bezier path shapes. */ export interface ShapeBezierNode { controlPoint1: ShapePoint; controlPoint2: ShapePoint; point: ShapePoint; } /** * Serializable style options specific to `ShapeStyle`. */ export interface ShapeClipStyleOptions extends ClipStyleOptions { shape: ShapeTypeEnum; fillColor?: string; strokeColor?: string; strokeWidth?: number; strokeAlpha?: number; strokeAlignment?: number; hasFill?: boolean; rectRadius?: number; nrPoints?: number; innerRadius?: number; outerRadius?: number; points?: (ShapePoint | null)[]; bezierNodes?: (ShapeBezierNode | null)[]; } /** * Zod schema for a serialized shape point. */ export declare const ShapePointSchema: z.ZodObject<{ x: z.ZodNumber; y: z.ZodNumber; }, "strip", z.ZodTypeAny, { x: number; y: number; }, { x: number; y: number; }>; /** * Zod schema for a serialized Bezier node used by path-based shapes. */ export declare const ShapeBezierNodeSchema: z.ZodObject<{ controlPoint1: z.ZodObject<{ x: z.ZodNumber; y: z.ZodNumber; }, "strip", z.ZodTypeAny, { x: number; y: number; }, { x: number; y: number; }>; controlPoint2: z.ZodObject<{ x: z.ZodNumber; y: z.ZodNumber; }, "strip", z.ZodTypeAny, { x: number; y: number; }, { x: number; y: number; }>; point: z.ZodObject<{ x: z.ZodNumber; y: z.ZodNumber; }, "strip", z.ZodTypeAny, { x: number; y: number; }, { x: number; y: number; }>; }, "strip", z.ZodTypeAny, { controlPoint1: { x: number; y: number; }; controlPoint2: { x: number; y: number; }; point: { x: number; y: number; }; }, { controlPoint1: { x: number; y: number; }; controlPoint2: { x: number; y: number; }; point: { x: number; y: number; }; }>; /** * Zod schema for the serialized shape style payload. */ export declare const ShapeStyleSchema: z.ZodObject<{ scale: z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>; width: z.ZodOptional; alpha: z.ZodNumber; rotation: z.ZodNumber; height: z.ZodOptional; mediaDataId: z.ZodOptional; clipId: z.ZodString; position: z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>; crop: z.ZodDefault>>; cropOffset: z.ZodDefault>>; zoom: z.ZodDefault>>; zIndex: z.ZodNumber; cornerRadius: z.ZodOptional>; relativeCornerRadius: z.ZodDefault>; shape: z.ZodDefault>>; fillColor: z.ZodOptional; strokeColor: z.ZodOptional; strokeWidth: z.ZodOptional; strokeAlpha: z.ZodOptional; strokeAlignment: z.ZodOptional; hasFill: z.ZodDefault>; rectRadius: z.ZodOptional; nrPoints: z.ZodOptional; innerRadius: z.ZodOptional; outerRadius: z.ZodOptional; points: z.ZodOptional, z.ZodNull]>, "many">>; bezierNodes: z.ZodOptional; controlPoint2: z.ZodObject<{ x: z.ZodNumber; y: z.ZodNumber; }, "strip", z.ZodTypeAny, { x: number; y: number; }, { x: number; y: number; }>; point: z.ZodObject<{ x: z.ZodNumber; y: z.ZodNumber; }, "strip", z.ZodTypeAny, { x: number; y: number; }, { x: number; y: number; }>; }, "strip", z.ZodTypeAny, { controlPoint1: { x: number; y: number; }; controlPoint2: { x: number; y: number; }; point: { x: number; y: number; }; }, { controlPoint1: { x: number; y: number; }; controlPoint2: { x: number; y: number; }; point: { x: number; y: number; }; }>, z.ZodNull]>, "many">>; }, "strip", z.ZodTypeAny, { shape: ShapeTypeEnum; scale: [number, number]; alpha: number; rotation: number; clipId: string; position: [number, number]; crop: [number, number, number, number]; cropOffset: [number, number]; zoom: [number, number]; zIndex: number; relativeCornerRadius: boolean; hasFill: boolean; width?: number | undefined; height?: number | undefined; mediaDataId?: string | undefined; cornerRadius?: [number, number, number, number] | undefined; fillColor?: string | undefined; strokeColor?: string | undefined; strokeWidth?: number | undefined; strokeAlpha?: number | undefined; strokeAlignment?: number | undefined; rectRadius?: number | undefined; nrPoints?: number | undefined; innerRadius?: number | undefined; outerRadius?: number | undefined; points?: ({ x: number; y: number; } | null)[] | undefined; bezierNodes?: ({ controlPoint1: { x: number; y: number; }; controlPoint2: { x: number; y: number; }; point: { x: number; y: number; }; } | null)[] | undefined; }, { scale: [number, number]; alpha: number; rotation: number; clipId: string; position: [number, number]; zIndex: number; width?: number | undefined; height?: number | undefined; mediaDataId?: string | undefined; crop?: [number, number, number, number] | undefined; cropOffset?: [number, number] | undefined; zoom?: [number, number] | undefined; cornerRadius?: [number, number, number, number] | undefined; relativeCornerRadius?: boolean | undefined; shape?: ShapeTypeEnum | undefined; fillColor?: string | undefined; strokeColor?: string | undefined; strokeWidth?: number | undefined; strokeAlpha?: number | undefined; strokeAlignment?: number | undefined; hasFill?: boolean | undefined; rectRadius?: number | undefined; nrPoints?: number | undefined; innerRadius?: number | undefined; outerRadius?: number | undefined; points?: ({ x: number; y: number; } | null)[] | undefined; bezierNodes?: ({ controlPoint1: { x: number; y: number; }; controlPoint2: { x: number; y: number; }; point: { x: number; y: number; }; } | null)[] | undefined; }>; /** * Clip style implementation for vector shapes, including fill, stroke, and shape-specific geometry settings. */ export declare class ShapeStyle extends ClipStyle { protected shape: ShapeTypeEnum; protected fillColor: string; protected strokeColor: string; protected strokeWidth: number; protected strokeAlpha: number; protected strokeAlignment: number; protected hasFill: boolean; protected rectRadius: number; protected nrPoints: number; protected innerRadius: number; protected outerRadius: number; protected points: (ShapePoint | null)[]; protected bezierNodes: (ShapeBezierNode | null)[]; /** * Creates a shape style. * * @param options Initial shape style configuration. */ constructor(options: ShapeClipStyleOptions); /** * Sets the shape primitive type rendered by the clip. * * @param shape Shape type to render. * @returns Nothing. */ setShape(shape: ShapeTypeEnum): void; /** * Returns the shape primitive type rendered by the clip. * * @returns The configured shape type. */ getShape(): ShapeTypeEnum; /** * Sets the fill color used to render the shape. * * @param fillColor CSS-like color string. * @returns Nothing. */ setFillColor(fillColor: string): void; /** * Returns the fill color used to render the shape. * * @returns The fill color string. */ getFillColor(): string; /** * Sets the stroke color used to render the shape outline. * * @param strokeColor CSS-like color string. * @returns Nothing. */ setStrokeColor(strokeColor: string): void; /** * Returns the stroke color used to render the shape outline. * * @returns The stroke color string. */ getStrokeColor(): string; /** * Sets the shape outline width. * * @param strokeWidth Outline width in pixels. * @returns Nothing. */ setStrokeWidth(strokeWidth: number): void; /** * Returns the shape outline width. * * @returns The outline width in pixels. */ getStrokeWidth(): number; /** * Sets the outline opacity. * * @param strokeAlpha Outline opacity multiplier. * @returns Nothing. */ setStrokeAlpha(strokeAlpha: number): void; /** * Returns the outline opacity. * * @returns The outline opacity multiplier. */ getStrokeAlpha(): number; /** * Returns the stroke alignment used by the vector graphics renderer. * * @returns The stroke alignment value. */ getStrokeAlignment(): number; /** * Enables or disables filling the interior of the shape. * * @param hasFill Whether the shape should be filled. * @returns Nothing. */ setHasFill(hasFill: boolean): void; /** * Indicates whether the shape interior is filled. * * @returns `true` if fill rendering is enabled; otherwise `false`. */ getHasFill(): boolean; /** * Sets the corner radius used when rendering rounded rectangles. * * @param rectRadius Corner radius in pixels. * @returns Nothing. */ setRectRadius(rectRadius: number): void; /** * Returns the corner radius used for rounded rectangles. * * @returns The corner radius in pixels. */ getRectRadius(): number; /** * Sets the number of points used when rendering a star shape. * * @param nrPoints Number of star points. * @returns Nothing. */ setNrPoints(nrPoints: number): void; /** * Returns the number of points used for the star shape. * * @returns The number of star points. */ getNrPoints(): number; /** * Sets the inner radius used when rendering a star shape. * * @param innerRadius Inner radius in pixels. * @returns Nothing. */ setInnerRadius(innerRadius: number): void; /** * Returns the inner radius used for the star shape. * * @returns The inner radius in pixels. */ getInnerRadius(): number; /** * Sets the outer radius used when rendering a star shape. * * @param outerRadius Outer radius in pixels. * @returns Nothing. */ setOuterRadius(outerRadius: number): void; /** * Returns the outer radius used for the star shape. * * @returns The outer radius in pixels. */ getOuterRadius(): number; /** * Sets the polygon point list used for polygon-based shapes. * * @param points Polygon points, with `null` entries preserved for serialized compatibility. * @returns Nothing. */ setPoints(points: (ShapePoint | null)[]): void; /** * Returns the polygon point list used for polygon-based shapes. * * @returns The configured polygon points. */ getPoints(): (ShapePoint | null)[]; /** * Sets the Bezier control nodes used for Bezier path shapes. * * @param bezierNodes Bezier node list, with `null` entries preserved for serialized compatibility. * @returns Nothing. */ setBezierNodes(bezierNodes: (ShapeBezierNode | null)[]): void; /** * Returns the Bezier control nodes used for Bezier path shapes. * * @returns The configured Bezier nodes. */ getBezierNodes(): (ShapeBezierNode | null)[]; setScale(scaleX: number, scaleY: number): void; update(container: ShapeSprite, redraw?: boolean): void; /** * Serializes the shape style. * * @returns The serialized shape style payload. */ serialize(): { shape: ShapeTypeEnum; scale: [number, number]; alpha: number; rotation: number; clipId: string; position: [number, number]; crop: [number, number, number, number]; cropOffset: [number, number]; zoom: [number, number]; zIndex: number; relativeCornerRadius: boolean; hasFill: boolean; width?: number | undefined; height?: number | undefined; mediaDataId?: string | undefined; cornerRadius?: [number, number, number, number] | undefined; fillColor?: string | undefined; strokeColor?: string | undefined; strokeWidth?: number | undefined; strokeAlpha?: number | undefined; strokeAlignment?: number | undefined; rectRadius?: number | undefined; nrPoints?: number | undefined; innerRadius?: number | undefined; outerRadius?: number | undefined; points?: ({ x: number; y: number; } | null)[] | undefined; bezierNodes?: ({ controlPoint1: { x: number; y: number; }; controlPoint2: { x: number; y: number; }; point: { x: number; y: number; }; } | null)[] | undefined; }; /** * Creates a shape style instance from serialized data. * * @param payload Serialized shape style payload. * @returns The deserialized shape style. */ static deserialize(payload: object): ShapeStyle; }