07-21-2011 07:20 AM
Hi,
I am able to display realtime touch areas on screen as if we are writing something on screen.
I am just sensing the touch events and capture the coordinates and drawing points there
Now I want to capture it and save it in image file. I used screenshot for that but It captures whole screen
I want to capture small part (grey part below) where I can capture my writing and save in image as shown below.
I have tried Signature capture code but I am not seening any written part on screen, its blank (black part not visible).
Instead of getGraphics() I am using graphics object. Tried overriding paint() but still same issue.
Signature Capture is bit complicated to understand and it has few bugs as well ( a straight line drops a bit then goes straight ). There points are captured and saved in object and through paint() these objects are called and points and paths are painted on bitmap area. This is not what I want as this is very confusing.
I even try to save captured points in objects and call my draw methods from paint() and pass the points saved in objects. But no success.
How can I pass and capture graphics context using objects?
or if there is a method of capturing certain part as screenshot that will also do it for me.
Thanks
Abhinav Tyagi
Solved! Go to Solution.
07-21-2011 08:22 AM
Please Reply !!!
I want to draw on graphic object in realtime.
Abhinav Tyagi
07-21-2011 09:26 AM
use Display.ScreenShot(bitmap,x,y,width,Height)
Method of Display Class ,where u will need to construct a bitmap before calling this method.pass ur Touch Coordinate and then specified Width and Height of Area u want.
Screenshot will be captured in Bitmap.
then ucan Save thisbitmap on File or where u Want.
==================================================
feel free to press the kudos button on the left side to thank the user that helped you.
please mark posts as solved if you found a solution.
07-22-2011 12:34 AM
Thanks Vivek,
I have already mentioned that I have tried screenshot.
I need to capture anything written on grey part.
but problem is I am unable to write on screen at the moment
Abhinav Tyagi
07-22-2011 12:59 AM
ScreenShot is an overloaded method. As VivekAgar mentioned, Display.ScreenShot(bitmap,x,y,width,Height) takes a screen shot of any size, starting at the point (x,y) with a width and a height that you specify. You would be able to take a screen shot of any size with that method, but you need to know the specific (x,y) boundaries of the gray box.
Scott
07-22-2011 05:12 AM
Thanks man,
I manage to draw and capture my grey space using bitmap.
But now another issue is coming!!!
The drawing coordinates captured are correct but the drawing is getting shifted by 40:20 in X:Y axis in portrait mode by 100:20 in landscape mode. Also I am unable to click buttons using touch method.
Check below
What could be the reason and how can I improve it?
Thanks
Abhinav Tyagi
07-22-2011 05:56 AM
u can use
Ui.getUiEngineInstance().setAcceptableDirections(
in ur App's Constructor to restrict the landscape mode.
==================================================
feel free to press the kudos button on the left side to thank the user that helped you.
please mark posts as solved if you found a solution.
07-22-2011 06:57 AM
Issue is not Portrait or Landscape, but the drawn point is not at the same place where I touch the screen
Please check image file. The circle is where I am touching the screen and line is created at a distance and these distance is different in diif orientation.
eg. If I touch at 10:10 point get drawn at 50:30 in portratiat and at 110:30 in landscape
Also I am unable to use buttons via touch but can use them by scrolling touchpad
Thanks
Abhinav Tyagi
07-22-2011 11:35 AM
Where do you override your TouchEvent (screen? manager? field?)? What do you use to extract the points (getX/getY or getGlobalX/getGlobalY)?
These questions are important - the field overriding TouchEvent gets the coordinates returned by getX and getY relative to its upper-left corner. If the field is not at the manager's upper left corner and you override TouchEvent on the Manager's level, you are bound to see the shift of (field.getLeft(), field.getTop())
getGlobalX and getGlobalY, on the other hand, work relative to the Screen (not the display - non-full Screen such as PopupScreen will get global X and Y different from the physical point on the display). At least that was my impression when I worked much more closely with it.
07-23-2011 12:57 AM
arkadyz,
Thanks for directing me to right direction.
I was overriding TouchEvent at Screen level and using getGlobalX(),Y.
I override it at bitmapField and used getX(), Y . My point comes correctly on screen.
But I am also using
getMovePoints( ), and this methods draws "Shifted Points". So now I get single point correctly but array points are shifted. In the image below, First point is OK, but rest points captured by getMovePoints( ) are shifted. See the shift from the touch area.
What is the replacement for above method as getX is for getGlobalX?
Also I am still not able to click buttons using touch. Only touchpad works here ![]()
Thanks
Abhinav Tyagi