red-agate-barcode
Version:
red-agate barcode tag library.
79 lines (78 loc) • 2.95 kB
TypeScript
import { SvgCanvas } from 'red-agate-svg-canvas/modules/drawing/canvas/SvgCanvas';
import { WebColor } from 'red-agate-svg-canvas/modules/drawing/canvas/WebColor';
import { ShapeProps, Shape, ImagingShapeBasePropsMixin } from 'red-agate/modules/red-agate/tags/Shape';
export interface BarcodeBaseProps extends ShapeProps, ImagingShapeBasePropsMixin {
fillColor?: string | WebColor;
font?: string;
rotation?: number;
height?: number;
quietWidth?: number;
quietHeight?: number;
unit?: string;
drawText?: boolean;
useRawDataAsText?: boolean;
textHeight?: number;
data?: string;
text?: string;
asDataUrl?: boolean;
asImgTag?: boolean;
}
export interface BarcodeBasePropsNoUndefined extends ShapeProps, ImagingShapeBasePropsMixin {
fillColor: string | WebColor;
font: string;
rotation: number;
height: number;
quietWidth: number;
quietHeight: number;
unit?: string;
drawText: boolean;
useRawDataAsText: boolean;
textHeight: number;
data?: string;
text?: string;
asDataUrl?: boolean;
asImgTag?: boolean;
}
export declare const barcodeBasePropsDefault: BarcodeBasePropsNoUndefined;
export declare class BarcodeBase<T extends BarcodeBaseProps> extends Shape<T> {
protected charactersMap: Map<string, {
index: number;
pattern: string;
}>;
constructor(props: T, charactersMap: Map<string, {
index: number;
pattern: string;
}>);
toImgTag(): string;
toElementStyle(): string;
toDataUrl(): string;
toSvg(): string;
toRendered(): string;
render(contexts: Map<string, any>, children: string): string;
protected calcSymbolSize(data: string, startChar: string, stopChar: string, cdChar: string): {
tw: number;
th: number;
};
protected calcCheckDigit(data: string): string;
protected encodeData(data: string): {
data: string;
heightData?: string;
labelText?: string;
startChar: string;
stopChar: string;
};
protected getBarSpaceWidth(): number[];
protected getBarSpaceHeight(): Array<Array<{
offset: number;
height: number;
}>>;
protected getRenderStartCoodinate(data: string, text: string): {
rx: number;
ry: number;
};
protected get isHeightModulated(): boolean;
protected renderBarData(canvas: SvgCanvas, tw: number, th: number, data: string, heightData: string | undefined, text: string): void;
protected renderHeightModulatedBarData(canvas: SvgCanvas, tw: number, th: number, data: string, heightData: string | undefined, text: string): void;
protected renderAdditional(canvas: SvgCanvas, tw: number, th: number, data: string, text: string): void;
protected renderText(canvas: SvgCanvas, tw: number, th: number, data: string, text: string): void;
}