Well, maybe something is missing for me, but I'm stuck for hours. I am creating an application in which the user draws a dimension line above the image. Now I also want to draw some selection points that show that the line is selected. These points are a specific bitmap that should be at the end of the line (after the arrow) and rotated in accordance with the arrow. I created a DrawSelectionPoint class that extends the view, and I can rotate the bitmap like this:
selectionPoint = BitmapFactory.decodeResource(context.getResources(), R.drawable.selectionpoint); Matrix matrix = new Matrix(); matrix.postRotate((float)Math.toDegrees(angle)); canvas.drawBitmap(selectionPoint, matrix, null);
(where the angle is the angle of the line), so my bitmap rotates the way I want it, but it is painted at the point 0,0 (top left of the screen).
If I use something like
canvas.save(); canvas.rotate(); canvas.drawBitmap(selectionPoint, x, y, null); canvas.restore();
then itβs too difficult for me to draw a bitmap in the exact place that I want (since I draw on a rotated canvas, which I then turn back). I tried some transformations of Euclidean rotation, but I had no luck.
Is there a way to apply the rotation of the matrix, as well as indicate the points at which I need a bitmap? Thank you in advance!
source share