Don't offset views rendered on top of snapshots (#733)

This commit is contained in:
fynngodau
2023-02-01 05:46:23 +01:00
committed by GitHub
parent 298c7bcbae
commit 1d30ba77b7
2 changed files with 21 additions and 4 deletions

View File

@@ -1161,7 +1161,9 @@ final class NativeMapView implements NativeMap {
} else {
Bitmap viewContent = viewCallback.getViewContent();
if (viewContent != null) {
snapshotReadyCallback.onSnapshotReady(BitmapUtils.mergeBitmap(mapContent, viewContent));
snapshotReadyCallback.onSnapshotReady(
BitmapUtils.mergeBitmaps(mapContent, viewContent)
);
}
}
}

View File

@@ -47,14 +47,29 @@ public class BitmapUtils {
}
/**
* Create a bitmap from a background and a foreground bitmap
* Create a bitmap from a background and a foreground bitmap. The foreground bitmap
* will be shifted 10px to the right and 10px to the bottom relative to the background.
*
* @param background The bitmap placed in the background
* @param foreground The bitmap placed in the foreground
* @return the merged bitmap
* @deprecated {@link #mergeBitmaps(Bitmap, Bitmap)} should be used instead, as it does not
* shift the input by 10px to the right and bottom.
*/
@Deprecated
public static Bitmap mergeBitmap(@NonNull Bitmap background, @NonNull Bitmap foreground) {
return mergeBitmap(background, foreground, 10f, 10f);
}
/**
* Create a bitmap from a background and a foreground bitmap.
*
* @param background The bitmap placed in the background
* @param foreground The bitmap placed in the foreground
* @return the merged bitmap
*/
public static Bitmap mergeBitmap(@NonNull Bitmap background, @NonNull Bitmap foreground) {
return mergeBitmap(background, foreground, 10f, 10f);
public static Bitmap mergeBitmaps(@NonNull Bitmap background, @NonNull Bitmap foreground) {
return mergeBitmap(background, foreground, 0f, 0f);
}
/**