Android bitmap bitmap

bmpAndroidMarker = BitmapFactory.decodeResource(context.getResources(), R.drawable.t_move2);
                        bmpAndroidMarkerResult = Bitmap.createBitmap(bmpAndroidMarker.getWidth(), bmpAndroidMarker.getHeight(), Bitmap.Config.ARGB_8888);
                        Canvas tempCanvas = new Canvas(bmpAndroidMarkerResult);
                        tempCanvas.rotate(direction+45, bmpAndroidMarker.getWidth()/2, bmpAndroidMarker.getHeight()/2);
                        tempCanvas.drawBitmap(bmpAndroidMarker, 0, 0, null);

This is the code that I wrote (borrowed). The icon is created inside the image, inside the list.

My problem is that when you turn this “arrow” it seems that it “pinches” part of the distant edges, as if they retained the original size of the bitmap images. I cannot figure out how to allow "overflow" and display the correct size image.

Is there any way to do this?

+1
source share
2 answers

You rotate the image 45 degrees, so the resulting bitmap should be the width of the original plus the width of the dialogs of the original (Pythagorean theorem should help).

AFAIK Maths Bitmap, , , , .

+2

ImageView FrameLayout , . , ...

<FrameLayout
        android:layout_alignParentLeft="true"
        android:layout_alignParentTop="true"
        android:layout_width="YOUR IMAGE WIDTH"
        android:layout_height="YOUR IMAGE HEIGHT">
        <ImageView
            android:scaleType="matrix"
            android:layout_width="YOUR IMAGE WIDTH"
            android:layout_height="YOUR IMAGE HEIGHT"
            android:src="@drawable/YOUR IMAGE FILE" />
    </FrameLayout>

... , FrameLayout , ImageView .

, android: scaleType = "matrix", .

. , !

0

All Articles