Hi,

I need to do some drawing on a <canvas> element, is there any better way of 
creating fill styles on the fly? Currently I have to do this:

    public void drawFoo(Context2d context, int r, int g, int b, int a) {
        CssColor clr = CssColor.make("rgba(" + r + "," + g + "," + b + "," 
a + ")");
        context.setFillStyle(clr);
        context.fillRect(10, 10, 10, 10);
    }

so every time my drawFoo() method is called, I need to create a new 
CssColor instance to handle the red,green,blue,alpha components passed in. 
I don't know how efficient it is for CssColor.make() to parse the string, 
also ignoring that a string object needs to be constructed in the first 
place each time too.

Is there any better way of creating different colors on the fly like this?

Thanks

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-web-toolkit/-/5dwqIqrax-MJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to