Platforms to show: All Mac Windows Linux Cross-Platform
/MacCG/CoreImage/Barcode Generator
Required plugins for this example: MBS MacBase Plugin, MBS MacCI Plugin, MBS Main Plugin, MBS MacCG Plugin, MBS Picture Plugin, MBS MacCF Plugin
You find this example project in your Plugins Download as a Xojo project file within the examples folder: /MacCG/CoreImage/Barcode Generator
This example is the version from Wed, 8th Dec 2015.
Project "Barcode Generator.xojo_binary_project"
Class App Inherits Application
Const kEditClear = "&Löschen"
Const kFileQuit = "Beenden"
Const kFileQuitShortcut = ""
End Class
Class Window1 Inherits Window
Control Label1 Inherits Label
ControlInstance Label1 Inherits Label
End Control
Control TextField1 Inherits TextField
ControlInstance TextField1 Inherits TextField
EventHandler Sub TextChange()
update
End EventHandler
End Control
Control Canvas1 Inherits Canvas
ControlInstance Canvas1 Inherits Canvas
End Control
Control Canvas2 Inherits Canvas
ControlInstance Canvas2 Inherits Canvas
End Control
Control Canvas3 Inherits Canvas
ControlInstance Canvas3 Inherits Canvas
End Control
EventHandler Sub Open()
update
End EventHandler
Protected Function ProportionalScaled(pic as Picture, Width as integer, Height as Integer) As picture
// Calculate scale factor
dim faktor as Double = min( Height / Pic.Height, Width / Pic.Width)
// Calculate new size
dim w as integer = Pic.Width * faktor
dim h as integer = Pic.Height * faktor
// scale without antialias
Return pic.ScaleMBS(w, h)
End Function
Protected Sub Update()
dim o as CIImageMBS
dim n as NSImageMBS
dim p as Picture
// QR Code
// L 7% , M 15% , Q 25% , H 30%
dim q as new CIFilterQRCodeGeneratorMBS
q.inputMessage = ConvertEncoding(TextField1.Text, encodings.UTF8)
q.inputCorrectionLevel = "H"
p = q.outputImage.RenderPicture
canvas1.Backdrop = ProportionalScaled(p, canvas1.Width, canvas1.Height)
// Aztec
dim a as new CIFilterAztecCodeGeneratorMBS
a.inputMessage = ConvertEncoding(TextField1.Text, encodings.UTF8)
a.inputCorrectionLevel = 80
p = a.outputImage.RenderPicture
canvas2.Backdrop = ProportionalScaled(p, canvas2.Width, canvas2.Height)
// PDF417
dim r as new CIFilterPDF417BarcodeGeneratorMBS
r.inputMessage = ConvertEncoding(TextField1.Text, encodings.UTF8)
'r.inputCorrectionLevel = 80
p = r.outputImage.RenderPicture
canvas3.Backdrop = ProportionalScaled(p, canvas3.Width, canvas3.Height)
Exception ne as NSExceptionMBS
MsgBox ne.message
End Sub
End Class
MenuBar MenuBar1
MenuItem FileMenu = "&Ablage"
MenuItem FileQuit = "#App.kFileQuit"
MenuItem EditMenu = "&Bearbeiten"
MenuItem EditUndo = "&Rückgängig"
MenuItem UntitledMenu1 = "-"
MenuItem EditCut = "&Ausschneiden"
MenuItem EditCopy = "&Kopieren"
MenuItem EditPaste = "&Einfügen"
MenuItem EditClear = "#App.kEditClear"
MenuItem UntitledMenu0 = "-"
MenuItem EditSelectAll = "&Alles auswählen"
End MenuBar
End Project
The items on this page are in the following plugins: MBS MacCG Plugin.