문제

I'm trying to draw a rectangle with text on it, but all I see is the rectangle, there is no text. Am I doing something wrong? This is the part of the code that does the drawing:

CanvasImage image = PlayN.graphics().createImage(100, 50);
Canvas canvas = image.canvas();

canvas.setFillColor(color);
canvas.fillRect(0, 0, 100, 50);

canvas.setFillColor(textColor);
canvas.setStrokeColor(textColor);
canvas.drawText("test", 0, 0);

layer.surface().drawImage(image, 0, 0);

Thanks

btw, I'm running the HTML version.

도움이 되었습니까?

해결책

The problem was that the text is drawen up from the y coordinate and I was setting y to 0 so the text wasn't shown.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top