ID:1928063
 
(See the best response by Nadrew.)
Currently invert colors of icons on the fly using mapcolors but it's expensive to do this very much and if there is a way to achieve this effect using the blend_mode variable that'd be great.

I do know that you can do it with difference but we apparently don't have that.
No direct inversion, no. Only overlay, Add, subtract, and multiply are available.
In response to Ter13
Ter13 wrote:
No direct inversion, no. Only overlay, Add, subtract, and multiply are available.

I know direct inversion isn't directly available, i was mainly wondering if anybody knew a way to achieve it using the modes we have available.
Best response
MapColors() is actually your best bet, to reduce overhead you should be caching the results of the call and reusing them as needed.
To demonstrate why this is impossible:

Let's assume you have an icon that is black and white.

We need to reduce the rgb of all white to 0,0,0, and increase the rgb of all black to 255,255,255.

There is no single function using any combination of multiplicative, additive, and subtractive blending that will do this on a single icon with these two colors without generating masks for each specific color area.

If at this point, you are generating an icon_state color mask per color to acheive this, it would actually be faster and more efficient to do it via the icon procs.
In response to Nadrew
Nadrew wrote:
MapColors() is actually your best bet, to reduce overhead you should be caching the results of the call and reusing them as needed.

Ter13 wrote:
To demonstrate why this is impossible:

Let's assume you have an icon that is black and white.

We need to reduce the rgb of all white to 0,0,0, and increase the rgb of all black to 255,255,255.

There is no single function using any combination of multiplicative, additive, and subtractive blending that will do this on a single icon with these two colors without generating masks for each specific color area.

If at this point, you are generating an icon_state color mask per color to acheive this, it would actually be faster and more efficient to do it via the icon procs.

Yeah I use mapcolors right now and do cache the result when i can. Was worth a shot asking if there was a way outside of icon operations because certain atoms require an additional icon operation to be done before using mapcolors due to them abusing overlays.
I'd still really like to see if I can get color matrices working in 509. It largely depends on what I can learn about shaders.
On a related note, is there a way to convert the appearance of an atom into an /icon directly?
In response to Clusterfack
Nope. There's currently no routine built for that.