Thanks for the help @jafal . What I’m looking for is whether it’s possible to retrieve the value(s) that you set, when you set colour dimension scale value(s) via colorMode.
You can use the keyword width to get at the width that you define in size. I was wondering if there was an analogous thing (keyword, function, property, or whatever) that you could use to retrieve the value of the upper end scale parameter, in a similar way. Is that clearer?
This is probably somewhere in the reference documentation, but I’m not really friends with it yet…
Re @scudly advice re using g, this is indeed what I was looking for. Thank you. I’ve read somewhere (probably here or in its predecessor) that using g was going offroad and not guaranteed to be stable over updates. What I’m doing at the moment is entirely disposable so it’s not likely to be an issue in practice. But I guess that’s a Good Style thing to consider.
Accepting this answer as it’s what I was asking. Though there is lots of other interesting discussion around Good Style for dealing with this type of thing. And thanks for the supplementary reference info around the same answer, @GoToLoop
Re @scudly advice re using a numerical trick using a hex value halfway round the colour wheel - this is much less intuitive to me but it’s an interesting technique I was unfamiliar with.
Re @sterretje suggesting I just assign the value via a variable, and reference the variable when I need it, yes indeed this is indeed what I am doing. But style-wise, I prefer not to proliferate global/environment variables if I can avoid it - especially if they are already built in.
Interesting point re Good Style for 3rd party libraries @quark . Thank you. At the moment I am just writing my own code - which I may reuse in a number of different contexts, as part of the explorations I am doing, and I wanted to minimise dependencies between different aspects of it.
When I first started using Processing (2009) using g was strongly discouraged but that doesn’t seem the case now.
Having said that I prefer not to use g directly. I always use getGraphics() which returns the same value as g - try this
println(g);
println(getGraphics());
and you see they refer to the same object.
Even if Processing ever makes g a private or protected member, getGraphics() will always be public
So instead of g.colorModeX you can use getGraphics().colorModeX. It’s a little more verbose but there is no real loss in efficiency due to JVM optimization.