0

My application is using Camera and some components over the camera like buttons and a transparent layout for the user to draw.

At this moment im able to see the camera and draw on a top layer (transparent).

I can save the picture from camera by:

camera.takepicture()

Result: Picture from camera without components (what i drew over it)

And i can take a picture from MyView (what i drew on transparent layout)

this.getWindow().getDecorView();
//create a bitmap and save it to file..

Result: Picture from the root view with black background instead of transparent, and no camera..

How can i combine Camera and rootView in a picture?

Thanks in advance.

Bugdr0id
  • 2,962
  • 6
  • 35
  • 59
  • Maybe you could explore this [recipe](http://androidcookbook.com/Recipe.seam?recipeId=4576) It stores the screen view to the PDF though. – Lukasz 'Severiaan' Grela Nov 22 '13 at 12:35
  • @Lukasz'Severiaan'Grela i didnt tried but as i understand it will save me the canvas only. I need to save the complete screen: camera + view(canvas) – Bugdr0id Nov 22 '13 at 12:44

1 Answers1

0

You must merge the SurfaceView (with camera preview) and the other views manually.

When you get this.getWindow().getDecorView(), you know what rectangle is filled by camera preview, and you can get the relevant pixels from a preview callback: camera.setOneShotPreviewCallback() (it may be significantly faster than takePicture()).

Maybe, you must apply alpha-blending to reproduce effect of semi-transparent widgets over the camera preview.

Alex Cohn
  • 56,089
  • 9
  • 113
  • 307