Xamarin - take screenshot in android - xamarin

I am working on barcode scanner integration which captures the image after barcode is scanned. I am using XZing tool to do it but it doesnt have this functionlity
So what i am trying to do is to take screenshot of the screen after successful scan of barcode. I am following below article (from one of the SO answers)
http://danielhindrikes.se/xamarin/building-a-screenshotmanager-to-capture-the-screen-with-code/
Now the problem is here that it does takes screenshot. But the camera part is coming in total black color (no image). I can see top and bottom frame of my app. I am passing "MainActivity" class in Activity property. Is there a way to solve this problem?

There are other solutions to take a "real screenshot" of what the user can see.
Have a look to MediaProjection and CreateScreenCaptureIntent:
https://github.com/xamarin/monodroid-samples/blob/master/android5.0/ScreenCapture/ScreenCapture/ScreenCaptureFragment.cs
And in Android native to screencap:
Runtime.getRuntime().exec("screencap -p /sdcard/screen.png");
I think they could work for you.

Related

How to add container or panel in flash and resize them using actionscript 3.0

I want to show some image in a flash. When I click an image, the image is up as like as image shown below.
when i click the image:
but the problem is when i click the image in that group, there is a gap between images. I want to attach them. I can not solve the problem. please anybody help me to solve the problem.
If you're using Flex, this is fairly trivial. You set the cards in an HGroup (calculating the gap will be difficult, but not impossible) and simply remove selected cards from that group and place them in another. After the card is removed, your other cards will be realigned by the layout automatically.
If you're not using Flex, I suggest extracting the code you used to layout the cards in the first place into a separate function. When a card is selected, you move the card out of the DisplayObjectContainer it is currently in and place it in another and then simply call the layout function again. This is the same method as I would use with Flex, although a little less automated due to the lack of Flex's layout engine.

customizing ios Passbook with Image

I have a Requirement where is should show a image where barcode is place in passbook, Is there any way that i could replace barcode with image or remove barcode and make a background image not blurr or place image on back side of passbook ,As per Apple documentation it seems like I can not do it,Still wanted to check if any one can help me in any way that i can reach the requirement .
Thanks in Advance .
Sadly it's not possible to do those things.
However, you could put an image into the strip position of the pass without putting any text over it.
I use this to place a 1D barcode on Passes (makemeapass.azurewebsites.net) and it works quite well.
What are you tying to achieve?

Auto-cropping image with detection of crop-lines

I am working on a project, which is Android app that uses camera to capture a photo of some ticket and does OCR recognition for only a part of it. I have no previous experience in image processing, but I know it must be some kind of tricky way, because Android applications have small RAM limits.
I have not enough reputation points to post images so I give URLs to it.
Below, I attach image before any processing:
My aim is to automatically detect these lines of (---) and crop it so that final image look like this one:
What's more - it's important to stay open-source and do it without sending photo to some external image processing service.
You can try using Hough Transform to find the lines. OpenCV has a implementation that is open source and works on Android.
HoughLineP is a very efficient Version of the HoughTransform to find Line Segments.
Olena is definitely the way to go!. It's a generic image processing library, but the interesting part is an module that's called Scribo.
Scribo will do document analysis on the picture to extract text and/or image regions, and optionally send text regions to tesseract for recognition.
Being feasible for Android or not is something that I couldn't tell. I've tried it on OSX and Linux systems and it shows great potential.

Drawing large images for ipad

I am developing an application for viewing images.
I used the example of PhotoScroller Apple to implement this application.
In my application I want to be able to draw on the image.
I had the idea to put a UIView on top with transparent background and draw the lines via touch events. This solution has become very slow because the generated images are very large, around 3700x2000 pixels.
I also tried a solution with the example of Apple GLPaint that uses OpenGL, but it has a size limitation of 2048x2048 pixels.
Anyone have any idea or example of how I implement this?
I think you should try and tile your image.
One option is using CATiledLayer. Have a look at this short tutorial.
Or you could try and use CGContextDrawTiledImage to get your stuff done. Possibly this post from S.O. could help you getting started.

WP7 - Splash Screen doesn't display correctly on launch

What I'm trying to do:
I've added a splash screen to an application I'm creating for Windows Phone 7. I did this simply by replacing the pre-existing splash screen file with my own.
What goes wrong:
The splash screen is not displayed like it should be - it is being down sampled to an 8 bit image or something weird:
-
The image I'm using
-
The image that gets displayed
It's a bit hard to see depending on your monitor, but on a phone it's reasonably obvious. There are fuzzy greenish lines that appear - basically like the image is being down sampled or the quality worsened.
Any idea what I'm doing wrong, or what might be happening?
Thanks.
Try forcing the app to display images at 32 bits per pixel (instead of the default of 16)
Add an attribute of BitsPerPixel="32" to the app element in WMAppManifest.xml
See http://forums.create.msdn.com/forums/p/85960/520394.aspx#520394
The problem is that the gradient on your splash screen is causing banding, which you can solve by dithering. Robby Ingebretsen has an action for PhotoShop that you can use: http://nerdplusart.com/photoshop-action-for-windows-phone-7-dithering
I suspect the emulator. Run the emulator at full size or run the app on an actual device.
Windows Phone is currently only supporting a color depth of 16bit, causing especially some gradients displaying downsampled for 24bit images. Some first generation firmwares by HTC had a "bug" that also allowed 24bit. Theoretically it is just a registry key, but you cannot commonly change it. Microsoft has limited the color depth to 16bit for the benefit of performance, but as far as I knnow there are some second-generation models without this limitation now.
You may try to downsample the image in Photoshop to 16bit and optimize it for this color depth.

Resources