Git Product home page Git Product logo

Comments (4)

nbeloglazov avatar nbeloglazov commented on September 27, 2024

Hi
I've investigated this issue a bit and got following results: it's processing's issue, not quil's. For some reason in fill method is always expects color in ARGB format so if you want opaque color you have to set highest bits to FF: 0xFF0000FF instead of 0x0000FF (blue color). So if it were java adding explicit alpha part to color would be sufficient.

But we are using clojure here :\

The problem is following - value 0xFF0000FF is different in java and clojure:
java: 0xFF0000FF = -16776961 (int)
clojure: 0xFF0000FF = 4278190335 (long)

Quil tries to convert all values passed to fill method to int using int function. But clojure's int function doesn't allow overflows, so it throws exception if value is greater than max int (it's our case).

I found following ugly workaround: you can convert 0xFF0000FF to int using .intValue method of Long:

(fill (.intValue 0xFF0000FF))

from quil.

ericevans0 avatar ericevans0 commented on September 27, 2024

Wow! That's interesting. Layers and layers. It doesn't seem appropriate to workaround a bug two layers down. The difference between java and clojure makes me a bit uncomfortable. I like their choice better, but considering how important Java interop is, it seems like they should have stayed consistent.

Well, the workaround will be useful. Thanks for figuring it out and giving such a clear explanation. It seems this is not a problem with Quil as such, so I'm closing the issue.

from quil.

floybix avatar floybix commented on September 27, 2024

Can I suggest Quil use unchecked-int rather than int given that hex colours are part of the processing API?

from quil.

nbeloglazov avatar nbeloglazov commented on September 27, 2024

Thanks, it does solve the problem! I was wrong and it was quil's fault. Thanks for suggesting unchecked-int.

from quil.

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.