MCPcopy
hub / github.com/zxing-js/library / toString

Function toString

src/core/LuminanceSource.ts:129–151  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

127
128 /*@Override*/
129 public toString(): string {
130 const row = new Uint8ClampedArray(this.width);
131 let result = new StringBuilder();
132 for (let y = 0; y < this.height; y++) {
133 const sourceRow = this.getRow(y, row);
134 for (let x = 0; x < this.width; x++) {
135 const luminance = sourceRow[x] & 0xFF;
136 let c;
137 if (luminance < 0x40) {
138 c = '#';
139 } else if (luminance < 0x80) {
140 c = '+';
141 } else if (luminance < 0xC0) {
142 c = '.';
143 } else {
144 c = ' ';
145 }
146 result.append(c);
147 }
148 result.append('\n');
149 }
150 return result.toString();
151 }
152
153}
154

Callers

nothing calls this directly

Calls 3

appendMethod · 0.95
toStringMethod · 0.95
getRowMethod · 0.45

Tested by

no test coverage detected