Code example for BitmapShader

Methods: setLocalMatrix

0
			requiredPointPaint.setTextSize(requiredPointTextSizeFactor*collapsedCardHeight);
			//save card dimensions 
			collapsedCardShape = new RectF(0,0,cardWidth, collapsedCardHeight);
		}  
		finishedScalingSizes = true;
		BitmapShader shopImageShader = new BitmapShader(shopImage,
			    Shader.TileMode.CLAMP, 
			    Shader.TileMode.CLAMP);
		Matrix localmatrix = new Matrix();
		localmatrix.setScale(cardWidth*1.0f/shopImage.getWidth(), collapsedCardHeight*1.0f/shopImage.getHeight());
		shopImageShader.setLocalMatrix(localmatrix);
		shopImagePaint.setShader(shopImageShader);
	} 
	private int chooseDimension(int mode, int size) {
		if (mode == MeasureSpec.AT_MOST || mode == MeasureSpec.EXACTLY) {
			return size;
		} else { // (mode == MeasureSpec.UNSPECIFIED) 
			//in case there's no size specified, default to: 
			return 300; 
		}  
Stop searching for code, let great code find you!  Add Codota to your java IDE