![]() |
Barcode generieren falsche Infos
Hallo,
Ich arbeite gerade an einem kleinen Programm das aus der ![]() soweit kein Problem die Informationen zu Verfahren habe ich aus ![]() Ganz grob es gibt 2 Teile den Vorderen und den Hinteren zu jeder Zahl gibt es 3 Kodierungstypen (A,B,C) C wird im hinteren Teil verwendet und A / B im vorderen wobei die Zahl als auch die Position entscheidet ob A/B verwendet wird. Bis jetzt definiere ich die Typen als Konstanten
Delphi-Quellcode:
Aus dem Eingegbenen Code filtere ich Teil 1 (Zeichen 2-7) und Teil 2 (Zeichen 8-13) heraus und speicher diese in den Strings part1 und part2 nun kodiere ich die Teile
const
a0 = '0001101'; b0 = '0100111'; c0 = '1110010'; a1 = '0011001'; b1 = '0110011'; c1 = '1100110'; a2 = '0010011'; b2 = '0011011'; c2 = '1101100'; a3 = '0111101'; b3 = '0100001'; c3 = '1000010'; a4 = '0100011'; b4 = '0011101'; c4 = '1011100'; a5 = '0110001'; b5 = '0111001'; c5 = '1001110'; a6 = '0101111'; b6 = '0000101'; c6 = '1010000'; a7 = '0111011'; b7 = '0010001'; c7 = '1000100'; a8 = '0110111'; b8 = '0001001'; c8 = '1001000'; a9 = '0001011'; b9 = '0010111'; c9 = '1110100';
Delphi-Quellcode:
und erhalte nachher im String Output eine Ziffernfolge (0100110...) wobei die 0 für Freiräume und die 1 für Balken steht. Diese kann ich dann als Bild in der Komponente Image1 ausgeben
//Code generieren
output := '101' ; //Randzeichen For i := 1 to 6 do begin case part1 [i] of '0' : begin case i of 1 : output := output + a0 ; 2 : output := output + a0 ; 3 : output := output + a0 ; 4 : output := output + a0 ; 5 : output := output + a0 ; 6 : output := output + a0 ; end; end; '1' : begin case i of 1 : output := output + a1 ; 2 : output := output + a1 ; 3 : output := output + b1 ; 4 : output := output + a1 ; 5 : output := output + b1 ; 6 : output := output + b1 ; end; end; '2' : begin case i of 1 : output := output + a2 ; 2 : output := output + a2 ; 3 : output := output + b2 ; 4 : output := output + b2 ; 5 : output := output + a2 ; 6 : output := output + b2 ; end; end; '3' : begin case i of 1 : output := output + a3 ; 2 : output := output + a3 ; 3 : output := output + b3 ; 4 : output := output + b3 ; 5 : output := output + b3 ; 6 : output := output + a3 ; end; end; '4' : begin case i of 1 : output := output + a4 ; 2 : output := output + b4 ; 3 : output := output + a4 ; 4 : output := output + a4 ; 5 : output := output + b4 ; 6 : output := output + b4 ; end; end; '5' : begin case i of 1 : output := output + a5 ; 2 : output := output + b5 ; 3 : output := output + b5 ; 4 : output := output + a5 ; 5 : output := output + a5 ; 6 : output := output + b5 ; end; end; '6' : begin case i of 1 : output := output + a6 ; 2 : output := output + b6 ; 3 : output := output + b6; 4 : output := output + b6 ; 5 : output := output + a6 ; 6 : output := output + a6 ; end; end; '7' : begin case i of 1 : output := output + a7 ; 2 : output := output + b7 ; 3 : output := output + a7 ; 4 : output := output + b7 ; 5 : output := output + a7 ; 6 : output := output + b7 ; end; end; '8' : begin case i of 1 : output := output + a8 ; 2 : output := output + b8 ; 3 : output := output + a8 ; 4 : output := output + b8 ; 5 : output := output + b8 ; 6 : output := output + a8 ; end; end; '9' : begin case i of 1 : output := output + a9 ; 2 : output := output + b9 ; 3 : output := output + b9 ; 4 : output := output + a9 ; 5 : output := output + b9 ; 6 : output := output + a9 ; end; end; end; end; output := output + '01010'; //Trennzeichen For i := 1 to 6 do begin case part2 [i] of '0' : output := output + c0 ; '1' : output := output + c1 ; '2' : output := output + c2 ; '3' : output := output + c3 ; '4' : output := output + c4 ; '5' : output := output + c5 ; '6' : output := output + c6 ; '7' : output := output + c7 ; '8' : output := output + c8 ; '9' : output := output + c9 ; end; end; output := output + '101' ; //Randzeichen
Delphi-Quellcode:
Das Klappt auch alles sehr gut jedoch habe ich das Gefühl das ich falsche Informationen von Wikipedia erhalte denn wenn ich es mit einen Barcode teste stimmt das Bild nicht mit dem Soll überein
//Bild ausgeben
For i := 0 to image1.Height do begin For j := 0 to 95 do begin If output[j+1] = '1' then begin Image1.Canvas.Pixels[j*2,i] := clblack ; Image1.Canvas.Pixels[j*2+1,i] := clblack ; end; If output[j+1] = '0' then begin Image1.Canvas.Pixels[j*2,i] := clwhite ; Image1.Canvas.Pixels[j*2+1,i] := clwhite ; end; end; end; ich habe bereist auf anderen Seiten nach den Codes und Tabellen zur Nutzung von Code A/B gesucht jedoch auch hier die gleichen (falschen Ergebnisse) gefunden Außerdem widerspricht sich Wikipedia selbst denn im Beispiel wir die 0 an 1. und 2. Stelle unterschiedlich Codiert obwohl beides mal der Code LINKS ungerade (A) genutzt werden müsste. Nun suche ich nach richtigen Informationen oder einem Fehler in meinen Source-Code und würde mich sehr freuen wenn mir jemand einen Tipp gibt. Gruß Christian |
AW: Barcode generieren falsche Infos
Du hast deine Logik ja auch nicht genau nach den Vorgaben der Wikipedia umgesetzt
Nehmen wir mal den Code
Code:
dann müsste laut Wikipedia der Code wie folgt zusammengebaut werden:
1111111111111
Code:
und
a1 a1 b1 a1 b1 b1 c1 c1 c1 c1 c1 c1
Code:
müsste so aussehen
10000000000000
Code:
denn abhängig von der linken Ziffer (13. Stelle) wird im linken Block zwischen Gerade und Ungerade umgeschaltet.
a0 a0 b0 a0 b0 b0 c0 c0 c0 c0 c0 c0
Dieses hast du sehr frei (und falsch) umgesetzt |
AW: Barcode generieren falsche Infos
![]() |
AW: Barcode generieren falsche Infos
Oh man
Danke das hab ich übersehen Ich := doof ; :wall: |
Alle Zeitangaben in WEZ +1. Es ist jetzt 14:33 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz