Git Product home page Git Product logo

Comments (12)

rafaellins-swile avatar rafaellins-swile commented on June 18, 2024 1

Heya! Thanks for bringing up this issue! I'll give it a try later today and I'll get back to you 😄

Might be something due to the optimization implemented.

Also, I'm working on implementing examples with all platforms of the library, but I'll definitely add a Jetpack Compose one! Thanks for suggesting it ^^

from qrcode-kotlin.

barry-irvine avatar barry-irvine commented on June 18, 2024 1

I think this is also related to our issue. We had:

  Image(
            modifier = Modifier.padding(8.dp),
            bitmap = (QRCode(barcode).render().nativeImage() as Bitmap).asImageBitmap(),
            alpha = if (expired) 0.38f else 1.0f,
            contentDescription = stringResource(R.string.alt_qr_code)
        )

And this worked fine in v3.x.x but with v4.0.2 and the QRCodeProcessor instead of QRCode we now just get a black square with no white at all.

from qrcode-kotlin.

g0dkar avatar g0dkar commented on June 18, 2024 1

Heya, I pinpointed the issue. I'm not 100% sure of what caused it, but it is because the Ints of the colors are kind of being compiled wrong on Android. Color.WHITE for example goes from 0xFFFFFFFF to -1 which makes it black... and basically the same for all other colors 🤔

Still figuring out how to fix it x_x

from qrcode-kotlin.

g0dkar avatar g0dkar commented on June 18, 2024 1

🤦‍♂️ found the issue, preparing the next version with the fix

In short, either I'm dumb or Android API is. Thing is, rectangles are described via:

(x1, y1) of the top-left corner and (x2, y2) of the bottom right corner. I assumed, as all other platforms works like this, that they were x, y, width, height...

This is what causes this weird "everything is black" state.

Edit: Now that the library draws all squares directly into the Canvas, this was what caused the issue: any black rectangles would become something like "draw from 1000,1000 to -20,-20"

from qrcode-kotlin.

barry-irvine avatar barry-irvine commented on June 18, 2024 1

@g0dkar I can confirm that the QR code now looks good in Compose (for my scenario at least)

from qrcode-kotlin.

g0dkar avatar g0dkar commented on June 18, 2024

I see! That really seems like it is related, I'll try this out right now

from qrcode-kotlin.

g0dkar avatar g0dkar commented on June 18, 2024

Might not be that, btw... Anyway, I'm still trying to figure out what is going on O_o

from qrcode-kotlin.

g0dkar avatar g0dkar commented on June 18, 2024

Also, I'll make a few adjustments to the compatibility API for the use-case @barry-irvine shared :)

Right now, since the innerSpace is being defaulted to 1, the QRCodes might end up looking like this:

image

from qrcode-kotlin.

g0dkar avatar g0dkar commented on June 18, 2024

This should fix both reported issues. I'll keep this issue open since I didn't implement Jetpack Compose examples yet 😅

from qrcode-kotlin.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.