Redth / ZXing.Net.Maui

Barcode Scanning for MAUI?
MIT License
474 stars 150 forks source link

Custom Overlays #142

Open eeadie opened 1 year ago

eeadie commented 1 year ago

Hi,

Apologies if I have missed this in the documentation and it is already supported. I have previously used the Xamarin Forms version of this package which provided the ability to have a Custom Overlay during scanning. The default one consisted of a horizontal red line centred in the scanning window. Users of our app found this overlay useful when scanning barcodes.

Is there any plans to add support for Custom Overlays to ZXing.Net.Maui?

Many Thanks,

Euan

juezen commented 12 months ago

Same doubt (and need) here!

Adrianotiger commented 11 months ago

I just have used it today, but the element is just a surface, like the SkiaSharp for a direct draw.

You can put the overlay directly on your xaml-page.

Here an example:

<Grid>
    <zxing:CameraBarcodeReaderView
        x:Name="cameraBarcodeReaderView"
        BarcodesDetected="BarcodesDetected" />

    <Line Stroke="Red" X1="0" X2="300" StrokeLineCap="Round" StrokeThickness="3" Aspect="None" VerticalOptions="Center" HorizontalOptions="Center"></Line>

    <Rectangle Stroke="HotPink" StrokeThickness="4" Aspect="Uniform" WidthRequest="100" VerticalOptions="Center" HorizontalOptions="Center"></Rectangle>

    <Label Text="SCANNING..." x:Name="parsedText" VerticalOptions="End" HorizontalOptions="Center" />
</Grid>

Choose between line or rectangle and on the bottom there is a label with the parsed text.