Note that there are some explanatory texts on larger screens.

plurals
  1. POOverlay camera with resizeable/re-positionable item than upon click merge the images together
    primarykey
    data
    text
    <p>I need to let a user move an image around on the screen and resize it too. </p> <p>That part I have accomplished already.</p> <p>The part that I can't figure out is how to, upon taking a picture, freeze the moveable/resizable Image on the photo-image than merge the two together to make 1 Bitmap.</p> <p>I don't really have any "snippets" of code to post. I am just hoping some people may have had an experience with this before and might care to shed some light.</p> <p>EDIT. I understand that when I take the picture the image is already frozen on the screen. At that instance I capture the items location on canvas. What I need to do is to take the canvas that I already have something drawn on and somehow overlay that onto another canvas that I assigned the photo too.</p> <p>EDIT #2</p> <p>OK ladies and gentlemen. I figured it out. Here is the code for making an overlay for the camera (as described by mmeyer.)</p> <pre><code> Camera.PictureCallback mPictureCallback = new Camera.PictureCallback() { public void onPictureTaken(byte[] imageData, Camera c) { Context ct = new Context; RelativeLayout relativeview = new RelativeLayout(ct); if (imageData != null) { Context ct = HagsCamera.this; new Intent(ct, PreviewandSend.class); Bitmap photo = BitmapFactory.decodeByteArray(imageData, 0, imageData.length); int picwidth= (photo.getWidth()/2); int picheight = (photo.getHeight()/2); Bitmap photocopy = Bitmap.createScaledBitmap(photo, picwidth, picheight, false); Canvas c2 = crv.canvastoreturn; c2.setBitmap(photocopy); //photo.recycle(); ImageView newImage = new ImageView(ct); relativeview.addView(newImage); relativeview.draw(c2); RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams( photo.getWidth()/2, photo.getHeight()/2); relativeview.setLayoutParams(lp); </code></pre> <p>Good luck to you all. I hope this helps save alot of headaches.</p> <p>In short: Make a Bitmap of your picture.<br> Make a canvas for your overlay and toss your stuff up on there<br> Get a copy of your overlay's canvas<br> .setBitmap() that canvas and set it to your photo-bitmap.<br> Make a RelativeLayout and add a new ImageView to that.<br> Draw your canvas on the ImageView.<br> then figure out your layout parameters for your RelativeLayout. </p> <p>Now that I think about it, maybe you can just set the top layer canvas to your Photo's Bitmap...and just save that...... You can test that yourself.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload