Sub CreateCode128Barcode (Text As String) As B4XBitmap
Dim filter As NativeObject
filter = filter.Initialize("CIFilter").RunMethod("filterWithName:", Array("CICode128BarcodeGenerator"))
filter.RunMethod("setDefaults", Null)
filter.SetField("inputMessage", filter.ArrayToNSData(Text.GetBytes("UTF8")))
Dim no As NativeObject = Me
Return no.RunMethod("convertToUIImage:", Array(filter.GetField("outputImage")))
End Sub
#if OBJC
- (UIImage*) convertToUIImage:(CIImage*)img {
return [[UIImage alloc]initWithCIImage:[img imageByApplyingTransform:CGAffineTransformMakeScale(5.0, 5.0)]];
}
#End If