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