Capturing the off-screen part of a Container in an Image

24 views
Skip to first unread message

timo.v...@gmail.com

unread,
Jan 14, 2014, 5:28:23 AM1/14/14
to codenameone...@googlegroups.com
I want to create an image file from an on-screen Container with Labels in a TableLayout.
As this Container does not fit the screen of phones, it is enclosed in another scrolling container.

When I let the paint(Graphics) method of the Container draw itself onto the image, the part of the table that is outside the visible screen gets clipped.
(Interestingly, the first Label does not get clipped.)

How can I prevent this clipping, so I can save the full image as a file?

timo.v...@gmail.com

unread,
Jan 14, 2014, 8:38:47 AM1/14/14
to codenameone...@googlegroups.com, timo.v...@gmail.com
I found out that the Graphics object obtained from the created image inherits a clipping area equals to the screen size.
Although this seems logical for on-screen painting, this is not appropriate for off-screen images.

Resetting the clip area to the size of the image before calling paint(g) solved the problem.

Shai Almog

unread,
Jan 14, 2014, 3:22:22 PM1/14/14
to codenameone...@googlegroups.com, timo.v...@gmail.com
Interesting, we'll fix that.
Reply all
Reply to author
Forward
0 new messages