Seite 1 von 2

Beschriftung deutlicher, geht das?

Verfasst: 10.07.2016 13:28
von Fanpost
Schon wieder ich!?

Ich erstelle den Code39 mit dem Code von NUM3. Es wird ein einwandfreier Strichcode
erzeugt aber die Schrift unter dem Strichcode lässt bei Vergrößerung zu wünschen übrig.
Gibt es eine Möglichkeit das per Font o.ä. abzustellen?
Anbei der Code ohne Druckroutine, Seriennummer usw. nur mit Eingabe:

Code: Alles auswählen

; Author: Num3 (updated for PB 4.00 by Andre)
; by Num3

		;EnableExplicit
		
		Structure C39
			Char.s
			bar.b [6]
			spe.b [6]
		EndStructure
		
		Enumeration
			#save
			#text
		EndEnumeration
		
		
		Global Dim CODE39.C39 (43)
		
		; Yes, i know it's a mess, and i could make it much simpler,
		; but i can't test it, so this is more readable for errors ;)
			
			CODE39(0)\Char = "0"
			CODE39(0)\bar[1] = 0
			CODE39(0)\spe[1] = 0
			CODE39(0)\bar[2] = 0
			CODE39(0)\spe[2] = 1
			CODE39(0)\bar[3] = 1
			CODE39(0)\spe[3] = 0
			CODE39(0)\bar[4] = 1
			CODE39(0)\spe[4] = 0
			CODE39(0)\bar[5] = 0
			CODE39(0)\spe[5] = 0
			
			CODE39(1)\Char = "1"
			CODE39(1)\bar[1] = 1
			CODE39(1)\spe[1] = 0
			CODE39(1)\bar[2] = 0
			CODE39(1)\spe[2] = 1
			CODE39(1)\bar[3] = 0
			CODE39(1)\spe[3] = 0
			CODE39(1)\bar[4] = 0
			CODE39(1)\spe[4] = 0
			CODE39(1)\bar[5] = 1
			CODE39(1)\spe[5] = 0
			
			CODE39(2)\Char = "2"
			CODE39(2)\bar[1] = 0
			CODE39(2)\spe[1] = 0
			CODE39(2)\bar[2] = 1
			CODE39(2)\spe[2] = 1
			CODE39(2)\bar[3] = 0
			CODE39(2)\spe[3] = 0
			CODE39(2)\bar[4] = 0
			CODE39(2)\spe[4] = 0
			CODE39(2)\bar[5] = 1
			CODE39(2)\spe[5] = 0
			
			CODE39(3)\Char = "3"
			CODE39(3)\bar[1] = 1
			CODE39(3)\spe[1] = 0
			CODE39(3)\bar[2] = 1
			CODE39(3)\spe[2] = 1
			CODE39(3)\bar[3] = 0
			CODE39(3)\spe[3] = 0
			CODE39(3)\bar[4] = 0
			CODE39(3)\spe[4] = 0
			CODE39(3)\bar[5] = 0
			CODE39(3)\spe[5] = 0
			
			CODE39(4)\Char = "4"
			CODE39(4)\bar[1] = 0
			CODE39(4)\spe[1] = 0
			CODE39(4)\bar[2] = 0
			CODE39(4)\spe[2] = 1
			CODE39(4)\bar[3] = 1
			CODE39(4)\spe[3] = 0
			CODE39(4)\bar[4] = 0
			CODE39(4)\spe[4] = 0
			CODE39(4)\bar[5] = 1
			CODE39(4)\spe[5] = 0
			
			CODE39(5)\Char = "5"
			CODE39(5)\bar[1] = 1
			CODE39(5)\spe[1] = 0
			CODE39(5)\bar[2] = 0
			CODE39(5)\spe[2] = 1
			CODE39(5)\bar[3] = 1
			CODE39(5)\spe[3] = 0
			CODE39(5)\bar[4] = 0
			CODE39(5)\spe[4] = 0
			CODE39(5)\bar[5] = 0
			CODE39(5)\spe[5] = 0
			
			CODE39(6)\Char = "6"
			CODE39(6)\bar[1] = 0
			CODE39(6)\spe[1] = 0
			CODE39(6)\bar[2] = 1
			CODE39(6)\spe[2] = 1
			CODE39(6)\bar[3] = 1
			CODE39(6)\spe[3] = 0
			CODE39(6)\bar[4] = 0
			CODE39(6)\spe[4] = 0
			CODE39(6)\bar[5] = 0
			CODE39(6)\spe[5] = 0
			
			CODE39(7)\Char = "7"
			CODE39(7)\bar[1] = 0
			CODE39(7)\spe[1] = 0
			CODE39(7)\bar[2] = 0
			CODE39(7)\spe[2] = 1
			CODE39(7)\bar[3] = 0
			CODE39(7)\spe[3] = 0
			CODE39(7)\bar[4] = 1
			CODE39(7)\spe[4] = 0
			CODE39(7)\bar[5] = 1
			CODE39(7)\spe[5] = 0
			
			CODE39(8)\Char = "8"
			CODE39(8)\bar[1] = 1
			CODE39(8)\spe[1] = 0
			CODE39(8)\bar[2] = 0
			CODE39(8)\spe[2] = 1
			CODE39(8)\bar[3] = 0
			CODE39(8)\spe[3] = 0
			CODE39(8)\bar[4] = 1
			CODE39(8)\spe[4] = 0
			CODE39(8)\bar[5] = 0
			CODE39(8)\spe[5] = 0
			CODE39(9)\Char = "9"
			CODE39(9)\bar[1] = 0
			CODE39(9)\spe[1] = 0
			CODE39(9)\bar[2] = 1
			CODE39(9)\spe[2] = 1
			CODE39(9)\bar[3] = 0
			CODE39(9)\spe[3] = 0
			CODE39(9)\bar[4] = 1
			CODE39(9)\spe[4] = 0
			CODE39(9)\bar[5] = 0
			CODE39(9)\spe[5] = 0
			
			CODE39(10)\Char = "A"
			CODE39(10)\bar[1] = 1
			CODE39(10)\spe[1] = 0
			CODE39(10)\bar[2] = 0
			CODE39(10)\spe[2] = 0
			CODE39(10)\bar[3] = 0
			CODE39(10)\spe[3] = 1
			CODE39(10)\bar[4] = 0
			CODE39(10)\spe[4] = 0
			CODE39(10)\bar[5] = 1
			CODE39(10)\spe[5] = 0
			
			CODE39(11)\Char = "B"
			CODE39(11)\bar[1] = 0
			CODE39(11)\spe[1] = 0
			CODE39(11)\bar[2] = 1
			CODE39(11)\spe[2] = 0
			CODE39(11)\bar[3] = 0
			CODE39(11)\spe[3] = 1
			CODE39(11)\bar[4] = 0
			CODE39(11)\spe[4] = 0
			CODE39(11)\bar[5] = 1
			CODE39(11)\spe[5] = 0
			
			CODE39(12)\Char = "C"
			CODE39(12)\bar[1] = 1
			CODE39(12)\spe[1] = 0
			CODE39(12)\bar[2] = 1
			CODE39(12)\spe[2] = 0
			CODE39(12)\bar[3] = 0
			CODE39(12)\spe[3] = 1
			CODE39(12)\bar[4] = 0
			CODE39(12)\spe[4] = 0
			CODE39(12)\bar[5] = 0
			CODE39(12)\spe[5] = 0
			
			CODE39(13)\Char = "D"
			CODE39(13)\bar[1] = 0
			CODE39(13)\spe[1] = 0
			CODE39(13)\bar[2] = 0
			CODE39(13)\spe[2] = 0
			CODE39(13)\bar[3] = 1
			CODE39(13)\spe[3] = 1
			CODE39(13)\bar[4] = 0
			CODE39(13)\spe[4] = 0
			CODE39(13)\bar[5] = 1
			CODE39(13)\spe[5] = 0
			
			CODE39(14)\Char = "E"
			CODE39(14)\bar[1] = 1
			CODE39(14)\spe[1] = 0
			CODE39(14)\bar[2] = 0
			CODE39(14)\spe[2] = 0
			CODE39(14)\bar[3] = 1
			CODE39(14)\spe[3] = 1
			CODE39(14)\bar[4] = 0
			CODE39(14)\spe[4] = 0
			CODE39(14)\bar[5] = 0
			CODE39(14)\spe[5] = 0
			
			CODE39(15)\Char = "F"
			CODE39(15)\bar[1] = 0
			CODE39(15)\spe[1] = 0
			CODE39(15)\bar[2] = 1
			CODE39(15)\spe[2] = 0
			CODE39(15)\bar[3] = 1
			CODE39(15)\spe[3] = 1
			CODE39(15)\bar[4] = 0
			CODE39(15)\spe[4] = 0
			CODE39(15)\bar[5] = 0
			CODE39(15)\spe[5] = 0
			
			CODE39(16)\Char = "G"
			CODE39(16)\bar[1] = 0
			CODE39(16)\spe[1] = 0
			CODE39(16)\bar[2] = 0
			CODE39(16)\spe[2] = 0
			CODE39(16)\bar[3] = 0
			CODE39(16)\spe[3] = 1
			CODE39(16)\bar[4] = 1
			CODE39(16)\spe[4] = 0
			CODE39(16)\bar[5] = 1
			CODE39(16)\spe[5] = 0
			
			CODE39(17)\Char = "H"
			CODE39(17)\bar[1] = 1
			CODE39(17)\spe[1] = 0
			CODE39(17)\bar[2] = 0
			CODE39(17)\spe[2] = 0
			CODE39(17)\bar[3] = 0
			CODE39(17)\spe[3] = 1
			CODE39(17)\bar[4] = 1
			CODE39(17)\spe[4] = 0
			CODE39(17)\bar[5] = 0
			CODE39(17)\spe[5] = 0
			
			CODE39(18)\Char = "I"
			CODE39(18)\bar[1] = 0
			CODE39(18)\spe[1] = 0
			CODE39(18)\bar[2] = 1
			CODE39(18)\spe[2] = 0
			CODE39(18)\bar[3] = 0
			CODE39(18)\spe[3] = 1
			CODE39(18)\bar[4] = 1
			CODE39(18)\spe[4] = 0
			CODE39(18)\bar[5] = 0
			CODE39(18)\spe[5] = 0
			
			CODE39(19)\Char = "J"
			CODE39(19)\bar[1] = 0
			CODE39(19)\spe[1] = 0
			CODE39(19)\bar[2] = 0
			CODE39(19)\spe[2] = 0
			CODE39(19)\bar[3] = 1
			CODE39(19)\spe[3] = 1
			CODE39(19)\bar[4] = 1
			CODE39(19)\spe[4] = 0
			CODE39(19)\bar[5] = 0
			CODE39(19)\spe[5] = 0
			
			CODE39(20)\Char = "K"
			CODE39(20)\bar[1] = 1
			CODE39(20)\spe[1] = 0
			CODE39(20)\bar[2] = 0
			CODE39(20)\spe[2] = 0
			CODE39(20)\bar[3] = 0
			CODE39(20)\spe[3] = 0
			CODE39(20)\bar[4] = 0
			CODE39(20)\spe[4] = 1
			CODE39(20)\bar[5] = 1
			CODE39(20)\spe[5] = 0
			
			CODE39(21)\Char = "L"
			CODE39(21)\bar[1] = 0
			CODE39(21)\spe[1] = 0
			CODE39(21)\bar[2] = 1
			CODE39(21)\spe[2] = 0
			CODE39(21)\bar[3] = 0
			CODE39(21)\spe[3] = 0
			CODE39(21)\bar[4] = 0
			CODE39(21)\spe[4] = 1
			CODE39(21)\bar[5] = 1
			CODE39(21)\spe[5] = 0
			
			CODE39(22)\Char = "M"
			CODE39(22)\bar[1] = 1
			CODE39(22)\spe[1] = 0
			CODE39(22)\bar[2] = 1
			CODE39(22)\spe[2] = 0
			CODE39(22)\bar[3] = 0
			CODE39(22)\spe[3] = 0
			CODE39(22)\bar[4] = 0
			CODE39(22)\spe[4] = 1
			CODE39(22)\bar[5] = 0
			CODE39(22)\spe[5] = 0
			
			CODE39(23)\Char = "N"
			CODE39(23)\bar[1] = 0
			CODE39(23)\spe[1] = 0
			CODE39(23)\bar[2] = 0
			CODE39(23)\spe[2] = 0
			CODE39(23)\bar[3] = 1
			CODE39(23)\spe[3] = 0
			CODE39(23)\bar[4] = 0
			CODE39(23)\spe[4] = 1
			CODE39(23)\bar[5] = 1
			CODE39(23)\spe[5] = 0
			
			CODE39(24)\Char = "O"
			CODE39(24)\bar[1] = 1
			CODE39(24)\spe[1] = 0
			CODE39(24)\bar[2] = 0
			CODE39(24)\spe[2] = 0
			CODE39(24)\bar[3] = 1
			CODE39(24)\spe[3] = 0
			CODE39(24)\bar[4] = 0
			CODE39(24)\spe[4] = 1
			CODE39(24)\bar[5] = 0
			CODE39(24)\spe[5] = 0
			
			CODE39(25)\Char = "P"
			CODE39(25)\bar[1] = 0
			CODE39(25)\spe[1] = 0
			CODE39(25)\bar[2] = 1
			CODE39(25)\spe[2] = 0
			CODE39(25)\bar[3] = 1
			CODE39(25)\spe[3] = 0
			CODE39(25)\bar[4] = 0
			CODE39(25)\spe[4] = 1
			CODE39(25)\bar[5] = 0
			CODE39(25)\spe[5] = 0
			
			CODE39(26)\Char = "Q"
			CODE39(26)\bar[1] = 0
			CODE39(26)\spe[1] = 0
			CODE39(26)\bar[2] = 0
			CODE39(26)\spe[2] = 0
			CODE39(26)\bar[3] = 0
			CODE39(26)\spe[3] = 0
			CODE39(26)\bar[4] = 1
			CODE39(26)\spe[4] = 1
			CODE39(26)\bar[5] = 1
			CODE39(26)\spe[5] = 0
			
			CODE39(27)\Char = "R"
			CODE39(27)\bar[1] = 1
			CODE39(27)\spe[1] = 0
			CODE39(27)\bar[2] = 0
			CODE39(27)\spe[2] = 0
			CODE39(27)\bar[3] = 0
			CODE39(27)\spe[3] = 0
			CODE39(27)\bar[4] = 1
			CODE39(27)\spe[4] = 1
			CODE39(27)\bar[5] = 0
			CODE39(27)\spe[5] = 0
			
			CODE39(28)\Char = "S"
			CODE39(28)\bar[1] = 0
			CODE39(28)\spe[1] = 0
			CODE39(28)\bar[2] = 1
			CODE39(28)\spe[2] = 0
			CODE39(28)\bar[3] = 0
			CODE39(28)\spe[3] = 0
			CODE39(28)\bar[4] = 1
			CODE39(28)\spe[4] = 1
			CODE39(28)\bar[5] = 0
			CODE39(28)\spe[5] = 0
			
			CODE39(29)\Char = "T"
			CODE39(29)\bar[1] = 0
			CODE39(29)\spe[1] = 0
			CODE39(29)\bar[2] = 0
			CODE39(29)\spe[2] = 0
			CODE39(29)\bar[3] = 1
			CODE39(29)\spe[3] = 0
			CODE39(29)\bar[4] = 1
			CODE39(29)\spe[4] = 1
			CODE39(29)\bar[5] = 0
			CODE39(29)\spe[5] = 0
			
			CODE39(30)\Char = "U"
			CODE39(30)\bar[1] = 1
			CODE39(30)\spe[1] = 1
			CODE39(30)\bar[2] = 0
			CODE39(30)\spe[2] = 0
			CODE39(30)\bar[3] = 0
			CODE39(30)\spe[3] = 0
			CODE39(30)\bar[4] = 0
			CODE39(30)\spe[4] = 0
			CODE39(30)\bar[5] = 1
			CODE39(30)\spe[5] = 0
			
			CODE39(31)\Char = "V"
			CODE39(31)\bar[1] = 0
			CODE39(31)\spe[1] = 1
			CODE39(31)\bar[2] = 1
			CODE39(31)\spe[2] = 0
			CODE39(31)\bar[3] = 0
			CODE39(31)\spe[3] = 0
			CODE39(31)\bar[4] = 0
			CODE39(31)\spe[4] = 0
			CODE39(31)\bar[5] = 1
			CODE39(31)\spe[5] = 0
			
			CODE39(32)\Char = "W"
			CODE39(32)\bar[1] = 1
			CODE39(32)\spe[1] = 1
			CODE39(32)\bar[2] = 1
			CODE39(32)\spe[2] = 0
			CODE39(32)\bar[3] = 0
			CODE39(32)\spe[3] = 0
			CODE39(32)\bar[4] = 0
			CODE39(32)\spe[4] = 0
			CODE39(32)\bar[5] = 0
			CODE39(32)\spe[5] = 0
			
			CODE39(33)\Char = "X"
			CODE39(33)\bar[1] = 0
			CODE39(33)\spe[1] = 1
			CODE39(33)\bar[2] = 0
			CODE39(33)\spe[2] = 0
			CODE39(33)\bar[3] = 1
			CODE39(33)\spe[3] = 0
			CODE39(33)\bar[4] = 0
			CODE39(33)\spe[4] = 0
			CODE39(33)\bar[5] = 1
			CODE39(33)\spe[5] = 0
			
			CODE39(34)\Char = "Y"
			CODE39(34)\bar[1] = 1
			CODE39(34)\spe[1] = 1
			CODE39(34)\bar[2] = 0
			CODE39(34)\spe[2] = 0
			CODE39(34)\bar[3] = 1
			CODE39(34)\spe[3] = 0
			CODE39(34)\bar[4] = 0
			CODE39(34)\spe[4] = 0
			CODE39(34)\bar[5] = 0
			CODE39(34)\spe[5] = 0
			
			CODE39(35)\Char = "Z"
			CODE39(35)\bar[1] = 0
			CODE39(35)\spe[1] = 1
			CODE39(35)\bar[2] = 1
			CODE39(35)\spe[2] = 0
			CODE39(35)\bar[3] = 1
			CODE39(35)\spe[3] = 0
			CODE39(35)\bar[4] = 0
			CODE39(35)\spe[4] = 0
			CODE39(35)\bar[5] = 0
			CODE39(35)\spe[5] = 0
			
			CODE39(36)\Char = "-"
			CODE39(36)\bar[1] = 0
			CODE39(36)\spe[1] = 1
			CODE39(36)\bar[2] = 0
			CODE39(36)\spe[2] = 0
			CODE39(36)\bar[3] = 0
			CODE39(36)\spe[3] = 0
			CODE39(36)\bar[4] = 1
			CODE39(36)\spe[4] = 0
			CODE39(36)\bar[5] = 1
			CODE39(36)\spe[5] = 0
			
			CODE39(37)\Char = "."
			CODE39(37)\bar[1] = 1
			CODE39(37)\spe[1] = 1
			CODE39(37)\bar[2] = 0
			CODE39(37)\spe[2] = 0
			CODE39(37)\bar[3] = 0
			CODE39(37)\spe[3] = 0
			CODE39(37)\bar[4] = 1
			CODE39(37)\spe[4] = 0
			CODE39(37)\bar[5] = 0
			CODE39(37)\spe[5] = 0
			
			CODE39(38)\Char = " "
			CODE39(38)\bar[1] = 0
			CODE39(38)\spe[1] = 1
			CODE39(38)\bar[2] = 1
			CODE39(38)\spe[2] = 0
			CODE39(38)\bar[3] = 0
			CODE39(38)\spe[3] = 0
			CODE39(38)\bar[4] = 1
			CODE39(38)\spe[4] = 0
			CODE39(38)\bar[5] = 0
			CODE39(38)\spe[5] = 0
			
			CODE39(39)\Char = "$"
			CODE39(39)\bar[1] = 0
			CODE39(39)\spe[1] = 1
			CODE39(39)\bar[2] = 0
			CODE39(39)\spe[2] = 1
			CODE39(39)\bar[3] = 0
			CODE39(39)\spe[3] = 1
			CODE39(39)\bar[4] = 0
			CODE39(39)\spe[4] = 0
			CODE39(39)\bar[5] = 0
			CODE39(39)\spe[5] = 0
			
			CODE39(40)\Char = "/"
			CODE39(40)\bar[1] = 0
			CODE39(40)\spe[1] = 1
			CODE39(40)\bar[2] = 0
			CODE39(40)\spe[2] = 1
			CODE39(40)\bar[3] = 0
			CODE39(40)\spe[3] = 0
			CODE39(40)\bar[4] = 0
			CODE39(40)\spe[4] = 1
			CODE39(40)\bar[5] = 0
			CODE39(40)\spe[5] = 0
			
			CODE39(41)\Char = "+"
			CODE39(41)\bar[1] = 0
			CODE39(41)\spe[1] = 1
			CODE39(41)\bar[2] = 0
			CODE39(41)\spe[2] = 0
			CODE39(41)\bar[3] = 0
			CODE39(41)\spe[3] = 1
			CODE39(41)\bar[4] = 0
			CODE39(41)\spe[4] = 1
			CODE39(41)\bar[5] = 0
			CODE39(41)\spe[5] = 0
			
			CODE39(42)\Char = "%"
			CODE39(42)\bar[1] = 0
			CODE39(42)\spe[1] = 0
			CODE39(42)\bar[2] = 0
			CODE39(42)\spe[2] = 1
			CODE39(42)\bar[3] = 0
			CODE39(42)\spe[3] = 1
			CODE39(42)\bar[4] = 0
			CODE39(42)\spe[4] = 1
			CODE39(42)\bar[5] = 0
			CODE39(42)\spe[5] = 0
			
			CODE39(43)\Char = "*"
			CODE39(43)\bar[1] = 0
			CODE39(43)\spe[1] = 1
			CODE39(43)\bar[2] = 0
			CODE39(43)\spe[2] = 0
			CODE39(43)\bar[3] = 1
			CODE39(43)\spe[3] = 0
			CODE39(43)\bar[4] = 1
			CODE39(43)\spe[4] = 0
			CODE39(43)\bar[5] = 0
			CODE39(43)\spe[5] = 0
			
			
			Procedure AscTo39(c.s)
				AscTo39 = -1
				If c >= "0" And c <= "9"
					AscTo39 = Val(c)
				Else
					c = UCase(c)
					If c >= "A" And c <= "Z"
						AscTo39 = Asc(c) - 55
					Else
						Select c
						Case "-"
							AscTo39 = 36
						Case "."
							AscTo39 = 37
						Case " "
							AscTo39 = 38
						Case "*"
							AscTo39 = 43
						Case "$"
							AscTo39 = 39
						Case "/"
							AscTo39 = 40
						Case "+"
							AscTo39 = 41
						Case "%"
							AscTo39 = 42
						EndSelect
					EndIf
				EndIf
				ProcedureReturn AscTo39
			EndProcedure
			
			
			
			Procedure PaintCodeBar39(h.l, wf.l, text.s, tf.b)
				
				xpos = 0 ; linker Seitenabstand des Barcodes vom Rand
				ypos = 0 ; Abstand oberhalb des Barcodes
				width=Len(text)*wf*16 + xpos ; 1 bar unit = 16 pixels * barwidth !!
				xa = width/4
				lang =Len(text)-2
				lang1=lang/2
				ta=xa+lang1;textanfang unter dem strichcode
				la$ = Mid ( text , 2 , lang )
				height=h + ypos
				;tf = 0/1; kein Text unter dem Strichcode
				If tf
					height + 20 ; Platz für die Textanzeige unter dem Barcode
				EndIf
				CreateImage(0,width,height)
				StartDrawing(ImageOutput(0))
				Box(0,0,width,height,RGB(255,255,255))
				chrspace=(width-16)/Len(text)
				For j = 1 To Len(text) ;Anzahl der Zeichen im Eingabetext
					d.s = Mid(text, j, 1) ;einzelne Zeichen werden ausgelesen
					N39 = AscTo39(d)
					For bs = 1 To 5
						;Bar
						If CODE39(N39)\bar[bs]
							w = 3 ;Wide
						Else
							w = 1 ;Narrow
						EndIf
						;Draw line for bar
							For i = 1 To w * wf
								;Line (xpos, ypos, 1, ypos + h,RGB(20,20,20))
								Line (xpos, ypos, 1, ypos + h,RGB(0,0,0))
								xpos  + 1
							Next
							;Space
							If CODE39(N39)\spe[bs]
								xpos = xpos + 3 * wf ;Wide
							Else
								xpos = xpos + 1 * wf ;Narrow
							EndIf
						Next
						; Sichtbare Zahlen
						
						If tf
							DrawingMode(#PB_2DDrawing_Transparent); Schrift ohne schwaren Hintergrund
							y = 3; Platz zwischen Strichcode und Text
							DrawText(ta,y+h,la$,RGB(0, 0, 0))
						EndIf
					Next
					StopDrawing()
					; SaveImage(0,"teste.bmp")
				EndProcedure
				
				
				
				If OpenWindow(0, 100,100,220,120, "Code39", #WS_OVERLAPPEDWINDOW | #PB_Window_ScreenCentered)
				If CreateGadgetList(WindowID(0))
					TextGadget(#PB_Any,10, 10,  80, 30,  "Code-Text:")
					StringGadget(#text, 90, 10, 90, 19,  "")
					SendMessage_(GadgetID(#text), #EM_SETLIMITTEXT, 10, 0); Anzahl der Eingangszeichen auf 10 begrenzen
					SetActiveGadget(#text)
					ButtonGadget(#save,70,60,90,19,"Code erzeugen")
				EndIf
				
				Repeat
					ev=WaitWindowEvent()
					If ev=#PB_Event_Gadget
						Select EventGadget()
						Case #save
							code$ = GetGadgetText(#text)
							PaintCodeBar39(40,1,"*"+code$+"*",1)
							SaveImage(0,"Test-Code.bmp")
						EndSelect
					EndIf
				Until ev=#PB_Event_CloseWindow
			EndIf




Re: Beschriftung deutlicher, geht das?

Verfasst: 10.07.2016 14:37
von man-in-black
Hi,

was genau verstehst du unter Vergrößern? Das Nachskalieren des Bildes oder das Erstellen des Strichcodes mit
größeren Eingangswerten? Im letzteren Fall ist "Font" doch schon ein guter Ansatz.

Code: Alles auswählen

 Procedure PaintCodeBar39(h.l, wf.l, text.s, tf.b)
           
                                              <--- LoadFont(0,"Arial",??)     
                                                    ?? vllt von der Strichbreite abhängig machen?
    ...
    If tf
       height + ??                        <--- Größe anpassen
    EndIf
            
    CreateImage(0,width,height)
    ...
    If tf
      ...
                                              <---   DrawingFont(FontID(0))
      DrawText(ta,y+h,la$,RGB(0, 0, 0))
    EndIf
    ...
                                              <---   FreeFont(0)
  EndProcedure
MFG
MIB

Re: Beschriftung deutlicher, geht das?

Verfasst: 10.07.2016 15:14
von Fanpost
Zum Verständnis, falls nicht richtig dargestellt:

- ich erstelle einen Barcode
- ich öffne z.B. mit Paint und sehe den Strichcode
- ich vergrößere das Bild unter Paint und sehe dann die besch.... Schrift unter dem Strichcode

Wie kann man das ändern?

Re: Beschriftung deutlicher, geht das?

Verfasst: 10.07.2016 15:27
von mhs
Dein Bild besteht aus Pixeln und wenn du es in Paint vergrößerst, werden die Pixel von Paint hochgerechnet und dadurch entsteht ein unscharfes Bild. Beim Barcode selbst fällt es nicht auf, weil es gerade Linien mit einer harten Kante (hoher Kontrast) sind, bei Schriften dagegen hast du viele Kurven und Bögen mit einer weichen Kante (viele Farbabstufungen).

Spricht etwas dagegen, dass du den Barcode (also das Bild) in einer höheren Auflösung erstellst?

Re: Beschriftung deutlicher, geht das?

Verfasst: 10.07.2016 15:45
von Fanpost
@mhs

Nach so einer Lösung (höhere Auflösung) suche ich, sehe aber den Wald vor lauter Bäumen nicht!?

Re: Beschriftung deutlicher, geht das?

Verfasst: 10.07.2016 15:54
von man-in-black
Hi,

dann gib deinem Strichcodegenerator doch einfach höhere Eingabewerte?!
(q&d kannst du einfach deine Ints in Floats abändern
!!für was ordentliches muss aber nochn bissel Gehirnschmalz bzgl. der Schleifen dazu!!)

Edit:
z.B. so:

Code: Alles auswählen

Faktor.f = 2.5
PaintCodeBar39(40*Faktor,1*Faktor,"*"+code$+"*",1)
MFG
MIB

Re: Beschriftung deutlicher, geht das?

Verfasst: 10.07.2016 17:01
von Fanpost
@ MIB

Mit dem Faktor hatte ich schon gespielt, kann aber das Ergebnis nicht gebrauchen, da das erzeugte Etikett
für den Druck die Schrift noch schlechter darstellt.

https://www.dropbox.com/s/wsxgc7hzi23rn ... 5.gif?dl=0
man-in-black hat geschrieben:!!für was ordentliches muss aber nochn bissel Gehirnschmalz bzgl. der Schleifen dazu!!)
Das Hauptprog besteht z.Zt. aus ca 960 Zeilen und beinhaltet die Erzeugung von Druckzeilen inkl. Druckersteuerzeichen
für ein externes Etiketten-Druckprogramm, fortlaufende Seriennummer, Etikettenvorschau usw.

Re: Beschriftung deutlicher, geht das?

Verfasst: 10.07.2016 17:18
von man-in-black
Hi,

die Schrift muss natürlich mitskaliert werden. Soooo einfach gehts dann doch nicht.
Guck dir einfach mal meine erste Antwort an. Ich könnte dir jetzt mein funktionierendes Beispiel geben,
aber ein bisschen an Arbeit musst du schon selbst reinstecken (learning by doing :P)
Das Hauptprog besteht z.Zt. aus ca 960 Zeilen und beinhaltet die Erzeugung von Druckzeilen inkl. Druckersteuerzeichen
für ein externes Etiketten-Druckprogramm, fortlaufende Seriennummer, Etikettenvorschau usw.
Darum gings mir gar nicht. Beim Skalieren mit gebrochenen Faktoren bekommst du Probleme mit den
ganzzahligen Pixelabständen. Q&d mag das gut aussehen. Aber mögllicherweise fällt dir das irgendwann auf die Füße
(-> Parameter der Schleifen).

edit:
Wieso ist dein angehängtes Bild eigentlich horizontal gestaucht? Bei gleichem Faktor für Breite und Höhe
(also gleichbleibendem Seitenverhältnis), muss doch nachträglich nichts korrigiert werden. Die Auflösung ist einfach größer?!
Wenn du Probleme hast, deinen Code richtig zu drucken, leite aus der dpi-Angabe deine notwendige Codebreite und somit den
Skalierungsfaktor ab ...

MFG
MIB

Re: Beschriftung deutlicher, geht das?

Verfasst: 10.07.2016 19:07
von Fanpost
Die Skalierung, d.h. gestauchtes Bild, kommt vom Etikettendruckprogramm. Das kann ich ändern.
Ich habe mal mit einem Font gearbeitet und das Ergebnis ist noch bescheidener.

https://www.dropbox.com/s/olspqboxmcuwh ... 8.bmp?dl=0

Der Text ist "coloriert" - wie beseitigen? Gibt es ein FontColor? Ich habe nichts gefunden!

Gleichbleibene Seitenverhältnisse sind ein Problem bei den Etikettenformaten. Da kann es
bei einem Etikett von 24x21mm Probleme mit der Höhe des Barcodes geben. Die kann dann
nur 5mm betragen!? Also da steckt noch einiges an Arbeit drin.

Re: Beschriftung deutlicher, geht das?

Verfasst: 10.07.2016 19:25
von man-in-black
Der Text ist "coloriert" - wie beseitigen? Gibt es ein FontColor? Ich habe nichts gefunden!
Ich seh da nichts farbiges?! FrontColor gibts; nur nicht unter Font sondern 2DDrawing ...
Gleichbleibene Seitenverhältnisse sind ein Problem bei den Etikettenformaten ...
Verstehe ich jetzt nicht. Wenn dein Code vorher wunderbar angenommen wurde, wieso sollte dann
jetzt auf einmal das Seitenverhältnis bei einer größeren Auflösung nichtmehr passen? (pxl ist ja nicht gleich mm)

Wenn du mit deiner Procedure alle möglichen Größen (mm) erschlagen willst, ohne das Etikett nachträglich noch skalieren zu müssen,
musst du deine Procedure eben noch erweitern. Da führt kein Weg dran vorbei, wenn der Text auch noch gut aussehen soll...
(Ich denke da jetzt an einen Bedingungsblock für die Auswahl eines passenden Etikettenformates (Seitenverhältnis, Schriftgröße, ...))