Code example for Bitmap

Methods: getConfiggetHeightgetWidth

	 * new Bitmap using default return statement + original texture coordinates 
	 * are stored into RectF. 
	private Bitmap getTexture(Bitmap bitmap, RectF textureRect) {
		// Bitmap original size. 
		int w = bitmap.getWidth();
		int h = bitmap.getHeight();
		// Bitmap size expanded to next power of two. This is done due to 
		// the requirement on many devices, texture width and height should 
		// be power of two. 
		int newW = getNextHighestPO2(w);
		int newH = getNextHighestPO2(h);
		// TODO: Is there another way to create a bigger Bitmap and copy 
		// original Bitmap to it more efficiently? Immutable bitmap anyone? 
		Bitmap bitmapTex = Bitmap.createBitmap(newW, newH, bitmap.getConfig());
		Canvas c = new Canvas(bitmapTex);
		c.drawBitmap(bitmap, 0, 0, null);
		// Calculate final texture coordinates. 
		float texX = (float) w / newW;
Experience pair programming with AI  Get Codota for Java