Giter VIP home page Giter VIP logo

Comments (7)

alexzhirkevich avatar alexzhirkevich commented on June 14, 2024

Random colors for individual pixels are not available at the moment. As for random shapes, you can do it the same way as for deprecated one:

class RandomPixelShape(
    private val from : List<QrVectorShapeModifier>
) : QrVectorPixelShape {
    override fun createPath(size: Float, neighbors: Neighbors): Path {
        return from.random().createPath(size, neighbors)
    }
}
 shapes {
    darkPixel = RandomPixelShape(
        listOf(
            QrVectorPixelShape.Circle(.3f),
            QrVectorPixelShape.Circle(.5f),
            QrVectorPixelShape.Circle(.7f),
        )
    )
}
image

from custom-qr-generator.

michaelWuensch avatar michaelWuensch commented on June 14, 2024

Thanks, this worked! I now wanted to try to make random solid colors (3 slightly different variations).
I tried to make it similar like your example above, but for some reason always one color is chosen randomly for the whole QR code instead of the pixels.
Does CreatePaint not get executed for every pixel?

from custom-qr-generator.

alexzhirkevich avatar alexzhirkevich commented on June 14, 2024

Random colors for individual pixels are not available at the moment.

Well...

Does CreatePaint not get executed for every pixel?

All pixels are combined to a single path before applying a paint so you can make them gradient

from custom-qr-generator.

michaelWuensch avatar michaelWuensch commented on June 14, 2024

Ok, thanks, so it is not possible with the vector method. Damn.
Thanks for your help anyway.

from custom-qr-generator.

alexzhirkevich avatar alexzhirkevich commented on June 14, 2024

Will be possible after #35.

You can test it now in a com.github.alexzhirkevich:custom-qr-generator:separate_painting-SNAPSHOT snapshot and give a feedback

from custom-qr-generator.

michaelWuensch avatar michaelWuensch commented on June 14, 2024

Thanks, that one was fast!
I am looking forward to the next release!

from custom-qr-generator.

alexzhirkevich avatar alexzhirkevich commented on June 14, 2024

Available in 2.0.0-alpha01

from custom-qr-generator.

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.