import type { TMat2D, TRectBounds } from '../../typedefs'; import type { TComplexPathData, TParsedAbsoluteCubicCurveCommand, TPathSegmentInfo, TPointAngle, TSimplePathData, TParsedArcCommand } from './typedefs'; import { Point } from '../../Point'; /** * Calculate bounding box of a cubic Bezier curve * Taken from http://jsbin.com/ivomiq/56/edit (no credits available) * TODO: can we normalize this with the starting points set at 0 and then translated the bbox? * @param {number} begx starting point * @param {number} begy * @param {number} cp1x first control point * @param {number} cp1y * @param {number} cp2x second control point * @param {number} cp2y * @param {number} endx end of bezier * @param {number} endy * @return {TRectBounds} the rectangular bounds */ export declare function getBoundsOfCurve(begx: number, begy: number, cp1x: number, cp1y: number, cp2x: number, cp2y: number, endx: number, endy: number): TRectBounds; /** * Converts arc to a bunch of cubic Bezier curves * @param {number} fx starting point x * @param {number} fy starting point y * @param {TParsedArcCommand} coords Arc command */ export declare const fromArcToBeziers: (fx: number, fy: number, [_, rx, ry, rot, large, sweep, tx, ty]: TParsedArcCommand) => TParsedAbsoluteCubicCurveCommand[]; /** * This function takes a parsed SVG path and makes it simpler for fabricJS logic. * Simplification consist of: * - All commands converted to absolute (lowercase to uppercase) * - S converted to C * - T converted to Q * - A converted to C * @param {TComplexPathData} path the array of commands of a parsed SVG path for `Path` * @return {TSimplePathData} the simplified array of commands of a parsed SVG path for `Path` * TODO: figure out how to remove the type assertions in a nice way */ export declare const makePathSimpler: (path: TComplexPathData) => TSimplePathData; /** * Run over a parsed and simplified path and extract some information (length of each command and starting point) * @param {TSimplePathData} path parsed path commands * @return {TPathSegmentInfo[]} path commands information */ export declare const getPathSegmentsInfo: (path: TSimplePathData) => TPathSegmentInfo[]; /** * Get the point on the path that is distance along the path * @param path * @param distance * @param infos */ export declare const getPointOnPath: (path: TSimplePathData, distance: number, infos?: TPathSegmentInfo[]) => TPointAngle | undefined; /** * * @param {string} pathString * @return {TComplexPathData} An array of SVG path commands * @example