screen shot of a specific screen area in android - android

I was trying to take screen shot of a specific area of a Android screen programatically, i can take screen shot of a particular view, but is there any way to capture a specific area of a screen or view. I was trying with Surface view and want to capture specific co-ordinates.
Thanks

is there any way to capture a specific area of a screen or view
Capture something larger, then cut out the "specific area" into a separate Bitmap, probably using one of the createBitmap() methods.

Related

Flutter: Avoid wallpaper streching across multiple screens

I'm using a Wallpaper Manager for setting an image as Home screen. It works fine for Lock Screen, but not for Home screen. This image that I want to set as Home screen is as wide and long as the screen, so it gets blurred when stretched across multiple screens. I'd like for this image to be repeated on each screen, not stretched across all. Is there any solution? I'm open to any idea, even if it doesn't include wallpaper manager.
I get it too, bro. But this package have a function called setWallpaperFromFileWithCrop
so you can let user crop image to set wallpaper as you want.

How to retrieve the visible part of a SurfaceView in Android

I have a layout where the top part is used to display some data (eg. simple UI widgets) and the bottom part has a SurfaceView where I display a CameraPreview.
In order for this SurfaceView to extend the whole width of the screen and at the same time maintain a correct aspect ratio, the SurfaceView actually goes offscreen which is fine since I actually want the app to be divided evenly between the top part and the bottom part.
The problem is that I now want to retrieve only the visible part of the SurfaceView (ideally as a bitmap) but if I try to do it by setting a PictureCallBack, the aspect ratios of the picture data returned are just not quite the same as the ones shown in the SurfaceView (I've tried with all of the available getSupportedPictureSizes).
Any ideas how to tackle this problem? I've attached an image which better illustrates this problem.
https://code.google.com/p/zxing/downloads/list
it contains a barcode scanner project in that they have used a rectangle and capture particular area from the surfaceview it will be useful for u .. Hope so they use viewFinderView class to capture the area from the surface

Cropping the Android camera

I'm developing an Android app that uses ZBar as a QR code library, and things are going sweet. Now, however, I'm building the interface for the app, and it requires that I show only a certain portion of the camera's feed at the bottom of the screen, something like this:
The camera view below should be full-sized, i.e. a cropped view and not a resized one. However setting the width and height of the FrameLayout has caused it to resize and squash the entire image into the tiny frame.
Is there a way to crop it? I know I could probably place an overlay over the original image, but how does one create a transparent square in the middle to display what I need?Besides, the QR reader would catch anything the camera captures, so if the user brought the QR code in front of the camera and it captured it "off screen" (by the part that's actually covered by the overlay), it would be extremely confusing.
So I guess what I'm saying is, I can't use an overlay to "crop" the picture. Is there any other way to do it?
As far my knowledge one cannot crop camera view but what you can do is re-size the frame and then capture the image.
Still i would suggest to refer this post
The first thought that comes to mind is to put your CameraPreview in a view inside a FrameLayout. Then add more views on top of the CameraPreview view to hide the parts that you do not want to be visible.
Or Perhaps just one view super-imposing the camera preview view with a PNG which covers everything with "cropped" area set as transparent.

Android game programming big layouts

I wanna start a new project. A little "Jump n Run", but I have questions:
The levels will be bigger than the screen. How can I make a big Layout and edit it?
And how do the view "follows" the player, if he moves.
I dont want code samples. I only want basic ideas how to do it.
I suggest you have a look at the SurfaceView. It allows you to render bitmaps to the screen. In your case you could create a bitmap that is larger than the screen and have the user navigate it with the use of their finger (so you'll also have to also use your touchscreen). Basically what you will be changing when the user wants to go to a new location would be the src rect parameter in the drawBitmap method.
I hope this gets you started.
You could specify the layout to whatever pixel size you want (even if it's larger than any screen size would be), and then use scroll views to allow the user to scroll to other areas of the screen. Check out the Android developer docs on horizontal scroll view.

how to create a box at the bottom right of my application that runs the android camera

So, I have an application that uses a canvas and animated a moving block. What I would ultimately like to do is have the camera running capturing the user's face without showing the camera screen on the app or have a box at the bottom right of my screen that showing what the camera sees.
Is it possible to have a mini screen at the bottom right of my app that is displaying the camera or does the camera have to take the full screen?
Or if it is possible just to quickly snap a picture and display a bitmap without losing my application, that would be fine also.
Any help would be great!
Thanks.
Is it possible to have a mini screen at the bottom right of my app that is displaying the camera or does the camera have to take the full screen?
It is possible, See the 1st Screenshot here. Theirs is in top left instead of bottom right, but it should work just the same. In this Qik application the full screen shows the other person you are talking with, and the small box shows the live view from your camera.
I wouldn't know how they did that, but I imagine if you follow along with Building a Camera App in the docs it would get you most the way there. You just need to adjust the size of the preview canvas, and figure out how to use the front camera instead of back.

Categories

Resources