Image Nodes¶
The simplest libavg node type is the ImageNode
. It places an image on the screen. An image node is created like this:
1imgNode = libavg.ImageNode(href="rgb24-64x64.png", pos=(10,30),
2 parent=player.getRootNode())
This statement causes the image in the file rgb24-64x64.png
to be loaded from disk and inserted into the scene graph as child of the main root avg node. As with other node types, position, size, opacity and rotation of the node can be set using attributes.
By default, the size of an image node is the size of the image in the file in pixels. This size can be determined by calling ImageNode.getMediaSize()
. There is a maximum size for image nodes which depends on the graphics driver. As examples, for many current graphics cards, the limit is 8192x8192 pixels, and Linux software rendering has a limit of 4096x4096 pixels. libavg outputs the maximum on startup if you set
1$ export AVG_LOG_CATEGORIES=CONFIG:INFO
Other than images loaded from disk, ImageNodes
can also use in-memory Bitmap objects and offscreen buffers as source for the image data. To use a bitmap object, call ImageNode.setBitmap()
. Offscreen buffers are explained on a separate page.