Weird behaviour of code

edited March 2016 in Programming Questions

I have no idea if i'm missing something crucial here but:


Is giving different results... With the first line the image becomes invisible, with the second line you get a grey image if x > 0. With the third line however the image becomes black, and not transparant at all.

Is this a bug or does it have to do something with color representation?



  • It's got a lot to do with color representation. A color is really an int. And the tint() function does things differently depending on the types you pass it.

  • Ok i'm a bit confused still, looking at the reference it says:

    tint(rgb, alpha)
    tint(gray, alpha)
    tint(v1, v2, v3)
    tint(v1, v2, v3, alpha)

    but there is no tint(rgba), while tint(color(x,0)) with x>0 still does effect the image alpha? I can imagine the integer representation for alpha 0 or alpha undefined is the same but there still should be a tint(rgba) in that list right?

  • But there is no tint(rgba)...

    Actually tint(rgb) is tint(argb).

Sign In or Register to comment.