How to "reset" the color (mojo2)?
Monkey Forums/Monkey Programming/How to "reset" the color (mojo2)?
| ||
Hi all, I am using mojo2 and have ran into a problem with canvas.SetColor(). I have an application in which I have drawn a lot of images. It all works fine. So far, I have not called canvas.SetColor() anywhere in the code. But now I reached a point where I want to draw a rectangle using a specific color, so I used canvas.SetColor() to set a color and then draw the rectangle. That works fine for the rectangle, but after that drawing, all other colors get messed up. So, how to I "reset" the color back to what it was before I called the canvas.SetColor() for the first time? Thanks! |
| ||
I'd guess the standard color is just white? |
| ||
Like ratking said, just reset to white.canvas.SetColor(1.0,1.0,1.0) |
| ||
You are both right. Thanks! Strange, I am pretty sure I tried that before posting here because that was what I thought too. But it didn't work... but it works now... Confused, but happy! :-) |
| ||
Changing current color to "white" using canvas.SetColor( r, g, b, a ) isn't exactly "resetting to original". You could retrieve and save current/original device color into a float array using canvas.GetColor( c#[] ), then at some point revert back with canvas.SetColor( c[0], c[1], c[2], c[3] ) |
| ||
Or set up a couple of PushColor / PopColor functions. But anyway, what he wanted was the default colour, not the original. I use a function called SetColorNull that sets colour to white, just to make it obvious what the purpose is. |
| ||
Thanks for these additional hints! :-) |