1

here may have some code into java it is working correctly but I want to convert this code into JNI is it possible or not if possible then how I can use Matrix and Canvas into JNI please any body help me for this task.

public static Bitmap myBitmapTest(Bitmap src) {
        Bitmap dst = Bitmap.createBitmap(src.getWidth(), src.getHeight(), Bitmap.Config.ARGB_8888);
        Canvas canvas = new Canvas(dst);
        Matrix matrix = new Matrix();
        Paint paint = new Paint();
        matrix.setRotate(90, src.getWidth() / 2, src.getHeight() / 2);
        canvas.drawBitmap(src, matrix, paint);
        return dst;
    }
Kishan Donga
  • 2,851
  • 2
  • 23
  • 35

1 Answers1

0

You should pass your full bitmap through JNI.

There is a similar question here: Rotating a bitmap using JNI & NDK

Where rotation of a bitmap is performed as a JNI operation. The dude also published a whole subject here about JNI bitmap operations: JNI bitmap operations , for helping to avoid OOM when using large images

Community
  • 1
  • 1
w00ly
  • 455
  • 1
  • 5
  • 18
  • hello @w00ly may also refer all this library but here this library only perform operation on bitmap for example take transpose of the matrix it will be give 90 degree rotation and so may thing but how I can combine canvas and matrix. – Kishan Donga Feb 21 '17 at 09:17
  • Well, in your sample you load your Bitmap in your Canvas in order to apply a transformation to the image using the Matrix, right ? Is your goal the rotation ? If yes, the sample linked before can help you achieve the transformation using JNI. – w00ly Feb 21 '17 at 10:13