Canvas: add more Bitmap drawing methods

This commit is contained in:
Julian Winkler
2025-02-10 18:06:49 +01:00
parent f69cff7113
commit 652715ee00
6 changed files with 50 additions and 6 deletions

View File

@@ -87,6 +87,15 @@ public class GskCanvas extends Canvas {
drawBitmap(bitmap, src, new Rect((int)dst.left, (int)dst.top, (int)dst.right, (int)dst.bottom), paint);
}
@Override
public void drawBitmap(Bitmap bitmap, Matrix matrix, Paint paint) {
save();
concat(matrix);
drawBitmap(bitmap, 0, 0, paint);
restore();
}
@Override
public void drawRoundRect(float left, float top, float right, float bottom, float rx, float ry, Paint paint) {
native_drawRoundRect(snapshot, left, top, right, bottom, rx, ry, paint != null ? paint.paint : default_paint.paint);
@@ -97,6 +106,11 @@ public class GskCanvas extends Canvas {
native_scale(snapshot, sx, sy);
}
@Override
public void concat(Matrix matrix) {
native_concat(snapshot, matrix.native_instance);
}
protected native void native_drawBitmap(long snapshot, long texture, int x, int y, int width, int height, long paint);
protected native void native_drawRect(long snapshot, float left, float top, float right, float bottom, long paint);
protected native void native_drawPath(long snapshot, long path, long paint);
@@ -108,4 +122,5 @@ public class GskCanvas extends Canvas {
protected native void native_drawText(long snapshot, String text, float x, float y, long paint);
protected native void native_drawRoundRect(long snapshot, float left, float top, float right, float bottom, float rx, float ry, long paint);
protected native void native_scale(long snapshot, float sx, float sy);
protected native void native_concat(long snapshot, long matrix);
}