Git Product home page Git Product logo

Comments (3)

g0dkar avatar g0dkar commented on June 18, 2024 1

For international readers, the question is if it is possible to generate a Bitmap right away instead of writing to a file first. I'll translate the answer at the end as well :)


Opa! Tem sim! Por coincidência eu estava implementando justamente um exemplo com isso em mente!

Dá uma olhada nesse exemplo aqui: https://github.com/g0dkar/qrcode-kotlin/blob/main/examples/android/src/main/java/io/github/g0dkar/qrcode/QRCodeData.kt#L11

Basicamente, o objeto que é retornado quando você chama QRCode(data).render(), internamente, já tem um Bitmap (no caso do Android) pronto e você consegue acessar diretamente ele chamando o método nativeImage()

Estou finalizando um app Android de exemplo bem simples que mantém uma lista de QRCodes e os gera dinamicamente, sem salvar arquivos nem nada :)


Hey! There is! As a coincidence I was implementing exactly an example with this in mind!

Take a look at this example here: https://github.com/g0dkar/qrcode-kotlin/blob/main/examples/android/src/main/java/io/github/g0dkar/qrcode/QRCodeData.kt#L11

Basically, the object that is returned when you call QRCode(data).render(), internally, holds a Bitmap (in the case of Android) and you can access it directly by calling the nativeImage() method.

I'm finishing a really simple example Android app that keeps a list of QRCodes and generates the images dynamically, without saving files or anything :)

from qrcode-kotlin.

pastre avatar pastre commented on June 18, 2024

Updated for international readers

from qrcode-kotlin.

pastre avatar pastre commented on June 18, 2024

Cool, thanks!

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.