get picture content of diagram
Tage Johansson <frans.tage@...>
I have an object with the role ROLE_DIAGRAM. How can I retreeve the actual picture of the diagram. Or so to say, the pixels on the window corresponding to the object.
It is in firefox if that helps.
Thanks in advance,
I'm not sure if it's the best way to do this but this is how I am doing something similar for my add-ons:
left, top, width, height = nav.location #where nav is your navigator object with role ROLE_DIAGRAM
sb = screenBitmap.ScreenBitmap(width, height)
pixels = sb.captureImage(left, top, width, height) #will give you a 2D array of RBGAQuad values
# If you want to save the image as a file you can do the following
bmp = wx.EmptyBitmap(width, height, 32)
bmp.SaveFile("path_to_save_location.jpg", wx.BITMAP_TYPE_JPEG) # you can also use different image formats instead of JPEG (see here)