Sorry,my English is bad.
I want rotate my bitmap about his any top.I do it next way:
- Code: Select all
angle = 1.0f;
bitmap1 = BitmapFactory.decodeResource(getResources(), R.drawable.green);
protected void onDraw(Canvas canvas)
{
canvas.rotate(scale);
canvas.drawBitmap(bitmap1, 0 , 0 ,null);
angle += 1.0f;
invalidate();
}
This good work,but i need get it use Matrix.I do it next way:
- Code: Select all
angle = 1.0f;
bitmap1 = BitmapFactory.decodeResource(getResources(), R.drawable.green);
protected void onDraw(Canvas canvas)
{
matrix = new Matrix();
matrix.setRotate(angle, 0 ,0);
bitmap2 = Bitmap.createBitmap(bitmap1, 0, 0,bitmap1.getWidth(),bitmap1.getHeight(), matrix,false);
canvas.drawBitmap(bitmap2,0,0, null);
angle += 1.0f;
invalidate();
}
This is dont work,like previous example.Bitmep rotating another,Bitmap dont have pivot point.
My problem : How make rotate Bitmap use Matrix,that bitmap rotate about any his point
(for example left top),like first example with rotate canvas.

