codename one how to place component on an image viewer that capture camera? - camera

I have a GUI Builder created form in codename one, how can i open the camera in a resizable view at the show() of the form and place container like text area or anything else on it?
I saw the camera demo but i don't understand it very well because on the simulator it open a file picker.
My purpose is to create a form with a camera resizable capture when you have two labels and you can also write or paint on your photo used in background, I do this only for hobby and fun, i do what i can, Any advice is well accepted, thank you for the attenction

You can now place a component on top of a camera view with a new cn1lib: https://github.com/codenameone/CameraKitCodenameOne
Original answer below:
I'm assuming you mean overlay on a live camera view. While this is possible it's not supported at this time in the Java API layer.
If you mean grabbing a photo and setting it as a background for the form for overlay you can create an image with the result of the Capture API and use setBgImage() to set that image to the background of a component or form.

Related

How to place transparent image over camera view in codename one

First of all, thanks to everything of codenameone.
I would like to customize camera view, simply overlaying PNG image on the full camera view screen.
Any way how to do it?
Here is code snippet.
Form mainForm = new Form();
ImageViewer iv = new ImageViewer();
mainForm.getToolbar().addMaterialCommandToRightBar("",
FontImage.MATERIAL_CAMERA_ALT, 4, (ev) -> {
filePath = Capture.capturePhoto();
setImage(filePath, iv);
});
I couldn't any view component of camera view, because Capture.capturePhoto() works automatically.
Or is there any way to build custom camera component in codename one?
I googled and got about PeerComponents, however don't know how to use it.
Just please provide some small sample code for me.
Best regards.
Currently Capture.capturePhoto() opens its own "window" over the app so you can't customize it. In the future we will likely add a more flexible API to embed the camera into your UI, especially now that we have Z-layering (we can draw over top of native widgets).
If you need this functionality right now, you would need to write a native interface and make your own capture component.

Codenameone form with header picture - how to navigate?

I'm writing a codenameone application where I want to have an image displayed across the top of the screen as a header. I do not want to include this image in every form/container that I create so therefore I came up with the following solution:
I have a Main form which contains the image (North) and a container (Center) which will then hold all the components of the specific screen that I want to show.
I will then create containers that represent each individual screen. My idea was to add these containers to the container of the main form, one by one and that navigation between them would be handled by changing the contents of that main screen container.
But I cannot find out how to make this work. As long as I have one single screen to show it is easy... The main form container can be an embedded container that is set to show the container for the single screen. But when I try to navigate to another I cannot make it work.
So, is there another approach I should use?
If not, how should I handle navigation between screens?
Is this with a GUI builder app or with a handcoded app?
Either way a simple way of customizing this if your app has a side menu or Toolbar would be to customize the TitleArea UIID to include your background image. E.g. start with a modern theme like the Business Theme and in the designer theme change the title area border property to be "Empty".
Then define the background image to be the image you want with "scaled to fit" or "aligned bottom" depending on what you want. Make sure to include enough space in the image for the title are and use a multi image so it will adapt for other OS's.

Can we access Retake image of Default camera

I am new in iOS. I want to know if it is possible to access the retake image button of UIImagePickerController. If so, how do you call a function on that button?
My problem is that I am using UIImagePickerController to take an image from the camera and save the image in the documents directory. I have done my task using a UIImageView and UIAlertView on an other view, but the problem is that I want to save the image before retake image button pressed in camera. What I have to do to achieve this?
You can't do what you want using UIImagePickerController. Instead, use AVFoundation framework for capturing still images in the way you want. Please, check this Apple's sample project http://developer.apple.com/library/ios/#samplecode/AVCam/Introduction/Intro.html.

Please put me on the right track with Drag Drop on IOS

I am creating a bit of a video mash up app (like imovie) and the first function I am tackling is the ability to drag a thumbnail from a video library and drop it on a time line. I was able to add the drag code to the video thumbnail class so when you touch it, it creates a drag proxy view which moves around when you move your finger. Next I want to be able to drop it on the time line.
My Timeline is also a uiview and I am unsure of how it can receive notification that the thumbnail is being dragged over it! It will need the position of the thumbnail so that it can show it on the timeline and the duration of the clip and such (information that I have attached to my video thumbnail object)
How would you approach this issue? The App is for ipad and is on ios 5.
Thanks for any pointers!
You will most likely want to subclass the UIView. You can look at this post:
https://stackoverflow.com/a/4130641/1535038
Mainly you will want to see if the My Timeline view is being touched, and then see if you are in the middle of a drag or not.

Cropping image into popup?

How to crop an image coming from server into popup? I have image coming from web service and showing it into a popup on a click on a table. I want to add cropping functionality into it. How can I do it??
There are a number of open source image cropping libraries on cocoacontrols.com Here's one that replicates Apple's crop image feature. You can then display the editing view controller in a popover when the user selects the row.