Redth / ZXing.Net.Maui

Barcode Scanning for MAUI?
MIT License
460 stars 151 forks source link

Custom Overlays #142

Open eeadie opened 11 months ago

eeadie commented 11 months 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 11 months ago

Same doubt (and need) here!

Adrianotiger commented 10 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.