-
Notifications
You must be signed in to change notification settings - Fork 156
/
Copy pathcanvas-interface.ts
114 lines (106 loc) · 3.12 KB
/
canvas-interface.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
/**
* svg renderer
*/
import { createHtmlElement } from '../utility/dom-util';
import { IBarcodeRenderer } from './IRenderer';
/** @private */
export interface BaseAttributes {
x: number;
y: number;
width: number;
height: number;
color: string;
string?: string;
stringSize?: number;
visibility?: boolean;
fontStyle?: string;
id?: string;
strokeColor?: string;
imageSource?: any;
}
/** @private */
export interface EncodingResult {
checksum: number;
result: string;
}
/** @private */
export interface PdfDataMatrixSymbolAttribute {
SymbolRow: number;
SymbolColumn: number;
HorizontalDataRegion: number;
VerticalDataRegion: number;
DataCodewords: number;
CorrectionCodewords: number;
InterleavedBlock: number;
InterleavedDataBlock: number;
}
/** @private */
export interface Code93ExtendedValues {
value: string;
checkDigit: number;
bars: string;
}
/** @private */
export interface Code93ExtendedArrayAttribute {
character: string;
keyword?: string;
value?: string;
}
/** @private */
export interface ValidateEvent {
message: string;
}
/** @private */
export class BarcodeSVGRenderer implements IBarcodeRenderer {
/**
* Draw the root element for the barcode.\
*
* @returns {HTMLElement} Draw the barcode SVG .
* @param {Object} attribute - Provide the canvas element .
* @private
*/
// eslint-disable-next-line
public renderRootElement(attribute: Object): HTMLElement {
const canvasObj: HTMLCanvasElement = createHtmlElement('canvase', attribute) as HTMLCanvasElement;
return canvasObj;
}
/**
* Draw the rect for the barcode.\
*
* @returns {HTMLElement} Draw the barcode SVG .
* @param {Object} canvas - Provide the canvas element .
* @param {Object} attribute - Provide the canvas element .
* @private
*/
// eslint-disable-next-line
public renderRect(canvas: Object, attribute: Object): HTMLElement {
const canvasObj: HTMLCanvasElement = createHtmlElement('canvase', attribute) as HTMLCanvasElement;
return canvasObj;
}
/**
* Draw the horizontal line for the barcode.\
*
* @returns {HTMLElement} Draw the barcode SVG .
* @param {Object} canvas - Provide the canvas element .
* @param {Object} attribute - Provide the canvas element .
* @private
*/
// eslint-disable-next-line
public renderLine(canvas: Object, attribute: Object): HTMLElement {
const canvasObj: HTMLCanvasElement = createHtmlElement('canvase', attribute) as HTMLCanvasElement;
return canvasObj;
}
/**
* Draw the text for the barcode.\
*
* @returns {HTMLElement} Draw the barcode SVG .
* @param {Object} canvas - Provide the canvas element .
* @param {Object} attribute - Provide the canvas element .
* @private
*/
// eslint-disable-next-line
public renderText(canvas: Object, attribute: Object): HTMLElement {
const canvasObj: HTMLCanvasElement = createHtmlElement('canvase', attribute) as HTMLCanvasElement;
return canvasObj;
}
}