1package org.libreoffice.canvas;
3import android.content.Context;
4import android.graphics.Bitmap;
5import android.graphics.Canvas;
6import android.graphics.RectF;
7import android.graphics.drawable.Drawable;
8import androidx.core.content.ContextCompat;
18 final RectF mScreenPosition;
22 mScreenPosition =
new RectF(0, 0,
mBitmap.getWidth(),
mBitmap.getHeight());
29 static Bitmap getBitmapForDrawable(Context context,
int drawableId) {
30 Drawable drawable = ContextCompat.getDrawable(context, drawableId);
32 return ImageUtils.getBitmapForDrawable(drawable);
41 canvas.drawBitmap(
mBitmap, mScreenPosition.left, mScreenPosition.top,
null);
52 return mScreenPosition.contains(
x,
y);
61 mScreenPosition.offsetTo(
x,
y);
Bitmap handle canvas element is used to show a handle on the screen.
final RectF mDocumentPosition
void reposition(float x, float y)
Change the position of the handle.
void onDraw(Canvas canvas)
Draw the bitmap handle to the canvas.
boolean onHitTest(float x, float y)
Test if the bitmap has been hit.
Common implementation to canvas elements.