i have code prints 4 rectangles, want 1 of them rotated , code works comments lines, if take them out not print rectangle4
protected void ondraw(canvas canvas) { super.ondraw(canvas); red_fill = new paint(); red_fill.setcolor(color.red); red_fill.setstyle(paint.style.fill); rectangle.set((getwidth() / 2 + 150), getheight() / 2 - 20, (getwidth() / 2) + 170, (getheight() / 2)); rectangle2.set((getwidth() /2 - 10), getheight() / 2 - 200, (getwidth()/2) + 10, (getheight()/2) - 180); rectangle3.set((getwidth() / 2 - 170), getheight() / 2 - 20, (getwidth() / 2) - 150, (getheight() / 2)); rectangle4.set((getwidth() / 2 - 130), getheight() / 2 - 120, (getwidth() / 2) - 110, (getheight() / 2) - 100); canvas.drawrect(rectangle, red_fill); canvas.drawrect(rectangle2, red_fill); canvas.drawrect(rectangle3, red_fill); //canvas.save(); //canvas.rotate(45); canvas.drawrect(rectangle4, red_fill); //canvas.restore(); invalidate(); }
Comments
Post a Comment