JackKirk Well-Known Member Licensed User Longtime User Mar 31, 2016 #1 In this post: www.b4x.com/android/forum/threads/save-ibarcode-preview-as-a-bitmap.64405/#post-408874 JanPRO suggests a snapshot can be taken of a view by the following code: Code: Sub Snapshot(Target As View) As View Dim NaObj As NativeObject = Target Dim SnapshotView As View = NaObj.RunMethod("snapshotViewAfterScreenUpdates:",Array(True)) Return SnapshotView End Sub the snapshot itself being returned as a view. How can the returned view be processed - e.g. how can the image in the returned view be extracted as a bitmap? Thanks in advance...
In this post: www.b4x.com/android/forum/threads/save-ibarcode-preview-as-a-bitmap.64405/#post-408874 JanPRO suggests a snapshot can be taken of a view by the following code: Code: Sub Snapshot(Target As View) As View Dim NaObj As NativeObject = Target Dim SnapshotView As View = NaObj.RunMethod("snapshotViewAfterScreenUpdates:",Array(True)) Return SnapshotView End Sub the snapshot itself being returned as a view. How can the returned view be processed - e.g. how can the image in the returned view be extracted as a bitmap? Thanks in advance...
Erel B4X founder Staff member Licensed User Longtime User Apr 1, 2016 #2 It is not possible to convert the returned view to an image as this is a special type of view. Have you tried to use Canvas.DrawView with the original view? Upvote 0
It is not possible to convert the returned view to an image as this is a special type of view. Have you tried to use Canvas.DrawView with the original view?
JackKirk Well-Known Member Licensed User Longtime User Apr 1, 2016 #3 Erel, My first post of the thread I referred to above was trying to do that: https://www.b4x.com/android/forum/threads/save-ibarcode-preview-as-a-bitmap.64405/ I am still trying to get a functional preview capability out of the iBarcode library: (1) JanPRO graciously provided an iBarcode2 library with a Scanner.CaptureStillImage method which returns a bitmap. I have got this working but it has 2 problems: I have to do a bit of processing on the bitmap that is quite processor intensive which could be avoided if preview image was returned as YUV. Every call to the CaptureStillImage method results in a pseudo camera shutter noise - very unprofessional when you are doing it every 2 secs - I have also mitigated this with: https://www.b4x.com/android/forum/threads/control-ringer-volume.65140/but this in turn has its own issues: It does not turn the ringer volume right off. There seems to be an (inconclusive) opinion around the web that the calls used will render the app unpublishable on iTunes. (2) JanPRO suggested a snapshot alternative approach - but what you are saying here makes it unworkable. All these problems would disappear if an iBarcode preview existed that is taken from the video stream and is supplied as YUV, these seem to suggest it is possible: http://stackoverflow.com/questions/...deo-from-the-camera-display-it-and-process-it https://github.com/CyberAgent/iOS-N...5af3b8273a/Source/Camera/NBUCameraView.m#L699 Surely life is not meant to be this difficult with RAD tools... Upvote 0
Erel, My first post of the thread I referred to above was trying to do that: https://www.b4x.com/android/forum/threads/save-ibarcode-preview-as-a-bitmap.64405/ I am still trying to get a functional preview capability out of the iBarcode library: (1) JanPRO graciously provided an iBarcode2 library with a Scanner.CaptureStillImage method which returns a bitmap. I have got this working but it has 2 problems: I have to do a bit of processing on the bitmap that is quite processor intensive which could be avoided if preview image was returned as YUV. Every call to the CaptureStillImage method results in a pseudo camera shutter noise - very unprofessional when you are doing it every 2 secs - I have also mitigated this with: https://www.b4x.com/android/forum/threads/control-ringer-volume.65140/but this in turn has its own issues: It does not turn the ringer volume right off. There seems to be an (inconclusive) opinion around the web that the calls used will render the app unpublishable on iTunes. (2) JanPRO suggested a snapshot alternative approach - but what you are saying here makes it unworkable. All these problems would disappear if an iBarcode preview existed that is taken from the video stream and is supplied as YUV, these seem to suggest it is possible: http://stackoverflow.com/questions/...deo-from-the-camera-display-it-and-process-it https://github.com/CyberAgent/iOS-N...5af3b8273a/Source/Camera/NBUCameraView.m#L699 Surely life is not meant to be this difficult with RAD tools...