Comments (4)
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.
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.
Can I suggest Quil use unchecked-int
rather than int
given that hex colours are part of the processing API?
from quil.
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)
- `:model` text mode discards some characters
- `core.stroke` and `core.fill` perform poorly because of `save-current-` functionality HOT 1
- Constant ENABLE_NATIVE_FONTS isn't mapped, so can't be hinted
- with-graphics unable to handle floating point textures - fails when using very low opacity layers HOT 1
- quil.core/set-pixel should be type hinted if it expects an int for color (currently invoking reflection)
- CLJS warning: abs already refers to: cljs.core/abs being replaced by: quil.core/abs HOT 2
- Updating ClojureScript Tooling: lein-cljsbuild, lein-figwheel to shadow-cljs? HOT 3
- Merge processing4 and docs? HOT 4
- Add instructions for using with CLI tools HOT 3
- Get 'cannot run sketch without a display' when working on wsl2 HOT 1
- SNAPSHOT-4.3: M1 Mac missing arm64 instructions HOT 2
- Local root dependency on batik causes classpath issue with deps.edn HOT 4
- New processing/p5.js features HOT 4
- Convert lein tests to use deps.edn test-runner HOT 1
- `key-as-keyword` returns bogus keyword for return/enter
- mouse-wheel event on Clojurescript is different from what the docs say HOT 1
- `key-pressed` doesn't register press-and-hold key presses HOT 1
- `random-gaussian` in cljs is missing arity 1 and 2 HOT 1
- `q/begin-shape` webgl/p3d mode not rendering properly HOT 3
- Overriding escape key HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from quil.