View Single Post
Old 01-28-2016, 08:47 PM   #1
Human being with feelings
ijijn's Avatar
Join Date: Apr 2012
Location: Christchurch, New Zealand
Posts: 479
Default JSFX request: gfx_getpixel(r,g,b,a) and gfx_setpixel(r,g,b,a)

Hey gang! Hope everything's going well with you.

We already have gfx_*pixel(r,g,b) but we are missing out on the wholesome goodness of gfx_*pixel(r,g,b,a). So how about extra versions of gfx_getpixel (especially) and gfx_setpixel that provide read/write access to the alpha channel as well?

Ever since Reaper 4.59 we have been able to use offscreen buffers and/or loaded images for drawing purposes. Recently I've been running into situations all the time where the alpha channel would be incredibly useful: most acutely in bitmap font bounds trimming and distance field font implementations*.

I'm now working around such limitations using various gets, sets, blits and tests^, but this is obviously much more cumbersome, problematic and inefficient than a native solution; such finely-tuned floating point comparisons can even operate differently in 32 and 64 bit versions of JSFX/ReaJS.

As a secondary point, the notion of having pixel transparency in the main buffer (ye olde -1) is not without merit. This way you could take the window background colour into account automatically for a blended and seamless experience, and avoid drawing anything altogether at times too, instead of relying on gfx_clear or similar. Of course, I would happily settle for offscreen buffers only, but thought I should mention this while we're at it.

I would find it insanely useful and I hope/imagine that others would too. If there is any chance of implementing this, I would be very grateful indeed.


* both of which are coming in the next release of ijkl and friends, due any day now
^ this is surely on the shortlist for the title of my autobiography
ijijn is offline   Reply With Quote