JS-HobbySoft / CameraAlign

Other
42 stars 2 forks source link

Feature Request: stop motion support #18

Open hackerb9 opened 8 months ago

hackerb9 commented 8 months ago

This app would be great for stop motion animation if it had a setting such that taking a photo also sets the static background so each new frame can be positioned relative to the last.

Nice, but not necessary extras:

JS-HobbySoft commented 8 months ago

I'm working on this idea, but it's proving to be more challenging than I first thought. The camera preview isn't treated like a normal view, so when I try the screenshot method from here I get a black box where the preview should be. When I try a different method here using media projection and a virtual display I get a completely black screenshot.

I'll keep trying to implement it but it may take some time.

hackerb9 commented 8 months ago

Could it be that the view is a ViewGroup? This method using view.getMeasuredHeight() might be relevant.

public static Bitmap getBitmapFromView(View view) {
    view.measure(MeasureSpec.UNSPECIFIED, MeasureSpec.UNSPECIFIED);
    Bitmap bitmap = Bitmap.createBitmap(view.getMeasuredWidth(), view.getMeasuredHeight(),
            Bitmap.Config.ARGB_8888);
    Canvas canvas = new Canvas(bitmap);
    view.layout(0, 0, view.getMeasuredWidth(), view.getMeasuredHeight());
    view.draw(canvas);
    return bitmap;
}