HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

How do I use ARGB?

09-16-2009, 02:08 AM#1
Drain Pipe
I've already looked around and I can't find anything to give me simple instruction for using the ARGB system. All I want to do is store colors and constantly update them on floating texts, so that i can incorporate flashing, and fading effects etc. Up until now I've been pulling out my hair trying to figure out how the fuck to do this seemingly simple task. I'm not even sure how the system is supposed to work. Anyways, some clarification would be great. BTW I need to system not to take in the code as is, but using 4 integers, because constantly updating the text to accommodate fading effects is really a pain in the ass.
09-16-2009, 03:10 AM#2
Bobo_The_Kodo
Its just to store RGB + A in an integer (speed should be a bigger concern than a few bytes imo, but ...)

it works like as if it had them as values, but can define using hex: 0xFF000000||0x00FF0000||0x0000FF00||0x000000FF -> A||R||G||B

anyway:

Collapse JASS:
local ARGB color = 0xFFFFFFFF // 255 alpha,red,green,blue
set color.red = 0x0F // sets color = 0xFF0FFFFF
call BJDebugMsg(I2S(color.blue)) // displays 255

think of it as
Collapse JASS:
struct ARGB
integer alpha
integer red
integer green
integer blue
endstruct

but you can set to color code directly & not limitted to 8190

it also has some other methods for mixing colors or something which arent really needed, but meh
09-16-2009, 09:44 PM#3
Drain Pipe
What if Iwant to color a text but not bother to save the color code or anything like that. How would I go about doing that?
09-16-2009, 11:16 PM#4
Bobo_The_Kodo
ARGB(0xFFFFFFFF).str() // returns color string
-> might as well just do "|cFFFFFFFF|r"
09-17-2009, 05:43 AM#5
Drain Pipe
the only problem with that is i have to figure out a code. Can i just use the .create method each time or is that going to leak?
09-17-2009, 09:45 AM#6
Eleandor
structs extending arrays don't leak.
09-17-2009, 11:14 AM#7
Anitarf
Structs extending arrays also don't have a create method. You don't create an ARGB.
09-17-2009, 01:51 PM#8
Eleandor
ARGB has a create method. It simply returns an integer containing the rgba information, but it's still a create method.

Edit: but it doesn't have a "memory" allocate method.
09-18-2009, 12:22 AM#9
Drain Pipe
K thx, all i need to know.
09-18-2009, 01:20 AM#10
Bobo_The_Kodo
You don't need to use create

ARGB.create(0xFFFFFFFF) == ARGB(0xFFFFFFFF)
09-18-2009, 11:58 PM#11
Drain Pipe
what if I'm using integer defined values?
09-19-2009, 02:24 AM#12
Bobo_The_Kodo
Ermm... oops
It would be ARGB.create(255, 255, 255, 255) == ARGB(0xFFFFFFFF)
So you can just use create method