Code Monkey home page Code Monkey logo

Comments (15)

alexzhirkevich avatar alexzhirkevich commented on July 19, 2024

You can set highlighting for important areas using highlighting block in DSL builder.

from custom-qr-generator.

michaelWuensch avatar michaelWuensch commented on July 19, 2024

Ok thanks, I'll check that later. But I think it is something different. My background is already white.
I want single pixels to have that bright color, but none of the important pixels.
I could easily do this if the additional parameter was exposed.
And my solution would also allow for even more customization like having squares for the alignment patterns while having circles for the rest etc...

from custom-qr-generator.

alexzhirkevich avatar alexzhirkevich commented on July 19, 2024

It allows to set different shape and color for pixels from important areas. But its customization is limited. It probably can be extended

from custom-qr-generator.

alexzhirkevich avatar alexzhirkevich commented on July 19, 2024

The paint method of QrVectorColor ... should have an additional input parameter that gives some extra information about the current pixel.

It is impossible because in most of cases paint created for the whole dark/light pixels at once (not for one pixel). And QrVectorColor is a common interface for all types of paints like frames, balls, etc. May be it can provide info about the current component in general

from custom-qr-generator.

michaelWuensch avatar michaelWuensch commented on July 19, 2024

Makes sense. In theory wouldn't it be possible to just set this parameter to null/false/unavailable or something like that for all cases where all pixels are drawn at once?
But I am not too deep into your code, maybe there are more elegant solutions.

from custom-qr-generator.

michaelWuensch avatar michaelWuensch commented on July 19, 2024

Hi,
I now tried if the highlighting feature helps. But all I could achieve was that the pixels that are white anyway are highlighted now in a specific color. (purple in this example)
What I wanted to do though is to ensure that specific pixels are always black even though a color was used for the dark pixels (yellow in this example).
img
I also noticed that the 1 pixel frame of the version eye vanishes completely when highlighting is used. It doesn't really matter though as it doesn't help me in my situation anyway.

from custom-qr-generator.

michaelWuensch avatar michaelWuensch commented on July 19, 2024

I am actually very close now.
I changed my approach to have all dark pixels dark and add the accent color in the bright pixels.
So instead of turning some of the black pixels to yellow I turn some of the white pixels to yellow.
The highlighting feature can then be used to ensure some pixels stay white.
This way I was able to protect the eyes and the timing pattern, but I can't get the version eyes to look correct, as the highlight also overrides some of the dark pixels (the frame of the version eye).

from custom-qr-generator.

alexzhirkevich avatar alexzhirkevich commented on July 19, 2024

Highlighting will be extended in the next version and will allow to set shape and color of the highlighting as well as shape and color of the element being highlighted

from custom-qr-generator.

alexzhirkevich avatar alexzhirkevich commented on July 19, 2024

Currently shape of version eye aka alignment pattern is combined from frame and ball of corner eyes as well as its color as far as i remember

from custom-qr-generator.

alexzhirkevich avatar alexzhirkevich commented on July 19, 2024

the 1 pixel frame of the version eye vanishes completely

It is a result of applying rounded corner shape designed for 7-pixel eye to 5-pixel eye (bug). It works fine with other frame shapes

from custom-qr-generator.

alexzhirkevich avatar alexzhirkevich commented on July 19, 2024

This should help in 2.0.0-alpha01 if you rollback to random colors in dark pixels

highlighting {
    timingLines = HighlightingType.Styled(
        color = QrVectorColor.Unspecified,
        elementShape = /*your dark pixel shape goes here*/,
        elementColor =  /*your dark pixel color without randomness goes here*/
    )
    versionEyes = HighlightingType.Styled(
        color = QrVectorColor.Unspecified,
        elementShape = QrVersionEyeShape(
            frame = QrVectorFrameShape.AsPixelShape(
                pixelShape = /*your dark pixel shape goes here. */,
                size = 5
            ),
            ball = /*your dark pixel shape goes here. 
                   you can use same ball shape or call pixelShape.asBallShape() */
        ),

        elementColor =  /*your dark pixel color without randomness goes here*/
    )
}

from custom-qr-generator.

michaelWuensch avatar michaelWuensch commented on July 19, 2024

Hi,
I tried to implement the changes, but had to leave for work before I was finished.
As I use the library from within java, my implementation alway looks a bit different.
Timing pattern highlight already worked like a charm!
I was about to do the versionEye highlight when I had to leave. But it seemed there was no QrVersionEyeShape() at all.
Anyway, I'll work on it again tomorrow.
Thanks for all your help!

from custom-qr-generator.

alexzhirkevich avatar alexzhirkevich commented on July 19, 2024

it seemed there was no QrVersionEyeShape() at all.

It's a function from QrHighlighting.kt so you have to use QrHighlightingKt.QrVersionEyeShape i guess

from custom-qr-generator.

alexzhirkevich avatar alexzhirkevich commented on July 19, 2024

.asBallShape() is an extension from QVectorShapeUtils.kt (withourt 'r', wrongly named, will be changed)

from custom-qr-generator.

michaelWuensch avatar michaelWuensch commented on July 19, 2024

Hi,
everything works as expected!!
Thanks!

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.