Code example for Bitmap

Methods: createBitmapextractAlphagetHeightgetWidth

0
	} 
 
	private void startDragging(Bitmap bitmap, int y) {
		stopDragging(); 
 
		if (bitmap.getHeight() > maximumDragViewHeight) {
			bitmap = Bitmap.createBitmap(bitmap, 0, 0, bitmap.getWidth(), maximumDragViewHeight);
		} 
 
		ImageView imageView = getGlowingBorder(bitmap);
 
		WindowManager.LayoutParams dragViewParameters = createLayoutParameters();
		if (isScrolling) {
			isScrolling = false;
 
			dragViewParameters.y = getHeight() / 2 - bitmap.getHeight() / 2;
		} else { 
			dragViewParameters.y = y - bitmap.getHeight() / 2;
		} 
		dragViewParameters.windowAnimations = R.style.brick_new;
 
		WindowManager windowManager = getWindowManager();
 
		windowManager.addView(imageView, dragViewParameters);
 
		dragView = imageView;
	} 
 
	public ImageView getGlowingBorder(Bitmap bitmap) {
		ImageView imageView = new ImageView(getContext());
		imageView.setBackgroundColor(DRAG_BACKGROUND_COLOR);
 
		Bitmap glowingBitmap = Bitmap.createBitmap(bitmap.getWidth() + 30, bitmap.getHeight() + 30,
				Bitmap.Config.ARGB_8888);
		Canvas glowingCanvas = new Canvas(glowingBitmap);
		Bitmap alpha = bitmap.extractAlpha();
		Paint paintBlur = new Paint();
		paintBlur.setColor(Color.WHITE);
		glowingCanvas.drawBitmap(alpha, 15, 15, paintBlur);
		BlurMaskFilter blurMaskFilter = new BlurMaskFilter(15.0f, BlurMaskFilter.Blur.OUTER);
		paintBlur.setMaskFilter(blurMaskFilter);
Experience pair programming with AI  Get Codota for Java