ID:149942
 
is there a way to invert the colors in an icon?

Thanks,
FIREking

p.s. if there are multiple ways, could you show me all of them?
The new swap button..
In response to Nadrew
im talking about at run time, with code...

FIREking
In response to FIREking
I think there's also a swap() proc.
In response to Nadrew
but how would i invert it?
Sure you can swap one color with another color in an icon, but i would have to do that with all the rgb values? or is there a mathematical formula for calculating the invert?

Thats what i want to know, what is the formula and procedure for making any possible combination icon inverted.

FIREking
In response to FIREking
rgb(255,255,255)-icon
In response to Xooxer
Xooxer wrote:
rgb(255,255,255)-icon

so basically

src.icon += rgb(255,255,255)-src.icon

?
or

src.icon = rgb(255,255,255)-src.icon

?

Thanks,
FIREking
In response to FIREking
FIREking wrote:
src.icon = rgb(255,255,255)-src.icon

You're inverting the colours, not adding/subtracting anything.. think about it.

--Tarmas.
In response to FIREking
I believe:

src.icon -= rgb(255,255,255)

would be what you need...

~X
In response to Xooxer
Thanks for being nice and helping me. Im not too swift when it comes to icon minipulation.

Plus ive been in the ugly world of direct x for a few days, and havent been in the byond environment for a little while.

[edit]
and one more thing. I seem to be having trouble restoring the icon to what it was before the change. For almost any operation. I want to be able to restore the icon back to what it was, without using initial because initial uses the VERY first instance of the icon, i would like to change it to the instance before the icon change.

Ive tried something like

mob/verb/test()
var/icon/I = icon(src.icon,src.icon_state)
var/icon/mem = icon(src.icon,src.icon_state)
I.icon -= rgb(255,255,255)
src.icon = I
sleep(20)
src.icon = mem

but to no avial(right or wrong?), that fails the second or third time.

and i was thinking about trying

mob/verb/test()
var/icon/I = icon(src.icon,src.icon_state)
I.icon -= rgb(255,255,255)
src.icon = I
sleep(20)
I.icon += rgb(255,255,255)
src.icon = I

but it seems that would not work. =\ Because im thinking that just adds the color white...
[/edit]

FIREking
In response to FIREking
That was something I had requested a while back, and remembered that Lummox JR ( i think it was ) said that code snipet would invert the colors. I basicly pulled it from a previous post....

I have been trying to keep a professional attitude here as of late, so whatever my personal feelings are towards anyone, I'm trying not to let them interfere. In other words, your welcome.

~X :-)