Code example for Bitmap

Methods: getHeightgetPixelsgetWidth

0
	 
	public static native void nativeLoadResizedJpegBitmap(byte[] jpegData, int size, int maxPixels);
	public static native void nativeResizeBitmap(int newWidth, int newHeight);
	 
	private static void sendBitmapToNative(Bitmap bitmap) {
		int width = bitmap.getWidth();
		int height = bitmap.getHeight();
		nativeInitBitmap(width, height);
		int[] pixels = new int[width];
		for (int y = 0; y < height; y++) {
			bitmap.getPixels(pixels, 0, width, 0, y, width, 1);
			nativeSetBitmapRow(y, pixels);
		} 
	} 
	 
	private static Bitmap getBitmapFromNative(Bitmap bitmap) {
		int width = nativeGetBitmapWidth();
		int height = nativeGetBitmapHeight();
		 
		if (bitmap == null || width != bitmap.getWidth() || height != bitmap.getHeight() || !bitmap.isMutable()) { //in case it was rotated and the dimensions changed