Base class for elements in the avg tree that define an area on the screen. Responsible for coordinate transformations and event handling. See http://www.libavg.de/wiki/ProgrammersGuide/CoordinateSystems for an explanation of coordinate systems and reference points.
Returns the size in pixels of the media in the node. Image nodes return the bitmap size, Camera nodes the size of a camera frame and Words nodes the amount of space the text takes. Video nodes return the video size if decoding has started or (0,0) if not. Decoding starts after play() or pause() is called and the node can be rendered.
This is the horizontal position of the node’s reference point relative to its parent node.
This is the vertical position of the node’s reference point relative to its parent node.
This is the position of the node’s reference point relative to its parent node.
The angle that the node is rotated to in radians. 0 is unchanged, 3.14 is upside-down.
The size that the node takes on the canvas. Node types usually have sensible defaults for the size. For media nodes, this is generally the size of the media (so size == getMediaSize()). For DivNodes, the default size is infinite.
The position of the point that the node is rotated around. Default is the center of the node.
Root node of an onscreen avg tree. Defines the properties of the display and handles key press events. The AVGNode’s width and height define the coordinate system for the display and are the default for the window size used (i.e. by default, the coordinate system is pixel-based).
Camera controls are camera configuration parameters like brightness and white balance. A CameraControl object contains information about the supported maximum and minimum values as well as defaults for a specific control.
String which tells which control is meant. Read-only.
CameraImageFormat objects contain information about a supported image format of a camera.
List of supported frame rates in images per second for that image format as floats. Read-only.
A point which represents the resolution in width and height. Read-only.
CameraInfo objects contain data about camera capabilities. The data can be used to create create objects of class CameraNode. The unique value to identify the camera is stored in device, whereas driver tells which driver is used to call the camera itself. Information about supported camera controls or imageFormats are stored in two separate lists.
String which contains the unique id of the camera. Read-only.
String which contains the name of the driver. Read-only.
A node that displays the image of a camera. The attributes correspond to the camera properties in .avgtrackerrc and are explained under http://www.libavg.de/wiki/ProgrammersGuide/Tracker. An easy way to find the appropriate parameters for your camera is to use avg_showcamera.py.
CameraNodes open the camera device on construction and set the chosen camera parameters immediately.
The number of frames the camera has read since playback started. Read-only.
Returns a copy of the last camera frame.
Returns True if there is a working device that can deliver images attached to the CameraNode.
Starts reading images from the camera device and displays them. Note that the camera device is opened on construction of the CameraNode.
Stops camera playback.
Returns a list of CameraInfo objects, one for for each connected camera.
Frees all allocated bandwidth and devices on the firewire bus. Helpful if a program using a firewire device has crashed leaving resources allocated. Note that all firewire devices (including for instance external hard drives) are affected.
A div node is a node that groups other nodes logically and visually. Its position is used as point of origin for the coordinates of its child nodes. Its extents can be used to clip the children if crop is set to True. Its opacity is used as base opacity for the child nodes’ opacities. The children of a div node are drawn in the order they are found in the avg file, so the first one is below all others in z-order.
Boolean that turns clipping on or off.
Allows debugging of div node nesting by rendering the outlines of this div and all its div children in the specified color (given in html hex format). Turn off by setting the color to the empty string.
Deprecated since version 1.7: Seldom used, error-prone and slow.
The directory that the media files for the children of this node are in. Relative mediadirs are taken to mean subdirectories of the parent node’s mediadir.
Returns the number of immediate children that this div contains.
Returns the child at index i.
Adds a new child to the container behind the last existing child.
Adds a new child to the container before the existing node oldChild. In z-order, the new child ist behind the old one.
Adds a new child to the container after the existing node oldChild. In z-order, the new child ist in front of the old one.
Adds a new child to the container at index i.
Removes the child given by node from the div. Note that as long as other references to the node exist, the node is not deleted.
Removes the child at index i from the div. Note that as long a` other references to the node exist, the node is not deleted.
Moves the child at oldIndex so it is at newIndex. This function can be used to change the order in which the children are drawn.
Moves the child node so it is at index newPos. This function can be used to change the order in which the children are drawn.
Returns the index of the node given. Throws an exception if node isn’t a child of the DivNode.
Returns the node’s effective mediadir by traversing the node hierarchy up to the root node.
A static raster image on the screen. The content of an ImageNode can be loaded from a file. It can also come from a Bitmap object or from an OffscreenCanvas. Alpha channels of the image files are used as transparency information.
The texture compression used for this image. Currently, none and B5G6R5 are supported. B5G6R5 causes the bitmap to be compressed to 16 bit per pixel on load and is only valid if the source is a filename. Read-only.
In the standard case, this is the source filename of the image. To use a bitmap as source, call setBitmap(). To use an offscreen canvas as source, use the canvas: protocol: href="canvas:id".
Returns a copy of the bitmap that the node contains.
Sets a bitmap to use as content for the ImageNode. Sets href to an empty string.
Base class for all nodes that have a direct 2D raster representation. This includes Image, Word, Camera, and Video nodes. The base class implements color controls (contrast, intensity, gamma), alpha masks (maskhref, maskpos, masksize), several blend modes that define how compositing is done and mipmapping support.
Any Raster Node can have a GPU-based effect added to it by using setEffect().
In addition, RasterNodes can be warped. By default, a RasterNode is rectangular. However, it can be subdivided into a grid of reference points using maxtilewidth and maxtileheight. The position of each of these points can be changed with getOrigVertexCoords(), getWarpedVertexCoords() and setWarpedVertexCoords(), yielding arbitrary shapes.
Deprecated since version 1.7.
The method of compositing the node with the nodes under it. Valid values are blend, add, min and max. For min and max blend modes, opacity is ignored.
A control for the color contrast of the node. contrast is a triple that contains separate float values for red, green, and blue. A contrast value of 1.0 in all channels leaves the image unchanged.
Allows node-specific gamma correction. gamma is a triple that contains separate float values for red, green, and blue. A gamma value of 1.0 in all channels leaves the image unchanged. Higher gamma values increase, lower values decrease the brightness. In all cases, black and white pixels are not affected by gamma. See also http://en.wikipedia.org/wiki/Gamma_correction.
A control for the brightness of the node. intensity is a triple that contains separate float values for red, green, and blue. An intensity value of 1.0 in all channels leaves the image unchanged. This value corresponds to the photoshop brightness value.
The source filename for a mask image to be used as alpha channel. Where this file is white, the node is shown. Where it is black, the node is transparent. If the node is an image with an alpha channel, the alpha channel is replaced by the mask.
An offset for the mask image. For images and videos, the offset is given in image or video pixels, respectively. For words nodes, the offset is given in screen pixels. If portions of the node extend outside the mask, the border pixels of the mask are taken. Note that the maskpos is an offset from the top left of the node, even for WordsNode objects that have alignment Center or Right.
The size of the mask image. For images and videos, the size is given in image or video pixels, respectively. For words nodes, the size is given in screen pixels. If portions of the node extend outside the mask, the border pixels of the mask are taken.
The maximum height of the tiles used for warping. The effective tile size is also dependent on hardware and driver limits. Read-only.
The maximum width of the tiles used for warping. The effective tile size is also dependent on hardware and driver limits. Read-only.
Determines whether mipmaps (http://en.wikipedia.org/wiki/Mipmap) are generated for this node. Setting this to True improves the quality of minified nodes. Depending on the graphics card in use, turning on mipmaps may cause an extreme performance hit for every image change or have no performance cost at all. Read-only.
Returns the unwarped coordinate of all vertices as a list of lists.
Returnes the current coordinate of all vertices as a list of lists.
Changes the current coordinates of all vertices. grid is a list of lists of coordinate tuples. setWarpedVertexCoords() can only be called if the node is in a renderable state. This means that Player.play() must have been called and the node must be inserted in a Canvas. There must also be something to render (for instance, play() must be called before setWarpedVertexCoords() in the case of a CameraNode). The grid submitted is lost if the node loses renderable status.
A sound played from a file.
The duration of the sound file in milliseconds. Some file formats don’t store valid durations; in this case, 0 is returned. Read-only.
The source filename of the sound.
Whether to start the sound again when it has ended. Read-only.
Audio playback volume for this sound. 0 is silence, 1 passes media file volume through unchanged. Values higher than 1 can be used to amplify sound if the sound file doesn’t use the complete dynamic range.
Returns the codec used as a string such as "mp2".
Returns the sample rate in samples per second (for example, 44100).
Returns milliseconds of playback time since audio start.
Returns the number of channels. 2 for stereo, etc.
Stops audio playback but doesn’t close the object. The playback cursor stays at the same position.
Starts audio playback.
Moves the playback cursor to the time given in milliseconds.
Deprecated since version 1.8: Use the message interface instead.
Sets a python callable to be invoked when the audio reaches end of file.
Stops audio playback. Closes the object and ‘rewinds’ the playback cursor.
Video nodes display a video file. Video formats and codecs supported are all formats that ffmpeg/libavcodec supports. Usage is described thoroughly in the libavg wiki: https://www.libavg.de/wiki/ProgrammersGuide/VideoNode.
On construction, set to True if hardware acceleration should be used to decode this video. Later queries of the attribute return True if acceleration is actually being used. Read-only.
On construction, set to True if any audio present in the video file should be played back as well. A value of False ignores audio and just plays a silent video.
The nominal frames per second the object should display at. Read-only.
The source filename of the video.
Whether to start the video again when it has ended. Read-only.
The length of the decoder queue in video frames. This is the number of frames that can be decoded before the first one is displayed. A higher number increases memory consumption but also resilience against data source latency (i.e. hiccups during disk reads). Can only be set at node construction. Can’t be set if threaded=False, since there is no queue in that case.
Whether to use separate threads to decode the video. The default is True. Setting this attribute to False makes seeking much quicker. On the other hand, it also disables audio and prevents libavg from distributing the CPU load over several cores of a multi-core computer.
Audio playback volume for this video. 0 is silence, 1 passes media file volume through unchanged. Values higher than 1 can be used to amplify sound if the sound file doesn’t use the complete dynamic range. If there is no audio track, volume is ignored.
Returns the audio codec used as a string such as mp2.
Returns the sample rate in samples per second (for example, 44100).
Returns the number of bits in the file per second.
Returns the video file format. This is a string such as avi or mpeg.
Returns the index of the video frame currently playing.
Returns milliseconds of playback time since video start.
Returns the duration of the video in milliseconds. Some file formats don’t store valid durations; in this case, 0 is returned. Read-only.
Returns the number of frames in the video.
Returns the number of audio channels. 2 for stereo, etc.
Returns the number of frames already decoded and waiting for playback.
Returns the pixel format of the video file as a string. Possible pixel formats are described in http://ffmpeg.mplayerhq.hu/doxygen/trunk/pixfmt_8h.html#60883d4958a60b91661e97027a85072a
Returns the video codec used as a string such as mpeg4.
Returns True if the video contains an alpha (transparency) channel. Throws an exception if the video has not been opened yet.
Returns True if the video contains an audio stream. Throws an exception if the video has not been opened yet.
Stops video playback but doesn’t close the object. The playback cursor stays at the same position and the decoder queues remain full.
Starts video playback.
Moves the playback cursor to the frame given.
Moves the playback cursor to the time given.
Deprecated since version 1.8: Use the message interface instead.
Sets a python callable to be invoked when the video reaches end of file.
Stops video playback. Closes the file, ‘rewinds’ the playback cursor and clears the decoder queues.
Returns either NO_ACCELERATION if the current configuration does not support hardware-accelerated video decoding or VDPAU if VDPAU can be used to decode videos.
A words node displays formatted text. All properties are set in pixels. International and multi-byte character sets are fully supported. Words nodes use UTF-8 to encode international characters (use python unicode strings for this).
The pos attribute of a words node is the logical top left of the first character for left-aligned text. For centered and right-aligned text, it is the top center and right of the first line, respectively. For latin text, the logical top usually corresponds to the height of the ascender. There may be cases where portions of the text are rendered to the left of or above the logical position, for instance when italics are used.
Words nodes are rendered using pango internally.
The paragraph alignment. Possible values are left, center and right.
Defines a gamma-correction value for the alpha (transparency) of the text rendered. Using this attibute, it is possible to fine-tune the text antialiasing and make sure rendering is smooth.
The color of the text in standard html color notation: FF0000 is red, 00FF00 green, etc.
The family name of the truetype font to use. Font files can either be installed in the system, be in a fonts/ subdirectory of the current directory, or be in a directory specified using addFontDir(). To figure out which fonts and variants are available, use the avg_showfonts.py utility.
The font size in pixels. Fractional sizes are supported.
A FontStyle object that encapsulates all font attributes of the node. As a constructor parameter, this attribute sets the default attributes and other constructor arguments can override these. If set during WordsNode use, all relevant attributes are set to the new values.
Whether or not hinting (http://en.wikipedia.org/wiki/Font_hinting) should be used when rendering the text. Unfortunately, this setting does not override the fontconfig settings in /etc/fonts/conf.d/*-hinting.conf or other fontconfig configuration files.
The indentation of the first line of the text.
Whether each complete line should be stretched to fill the entire width of the layout. Default is false.
The amount of space between the idividual glyphs of the text in pixels, with 0 being standard spacing and negative values indicating packed text (less letter spacing than normal). Only active when text attribute markup is not being used.
The number of pixels between different lines of a paragraph. Setting this to -1 results in default line spacing.
Sets whether the text should be parsed to apply markup (False, default) or interpreted as raw string (True).
The string to display. If the node is created using xml, this is either the text attribute of the words node or the content of the words node itself. In the second case, the string can be formatted using the pango text attribute markup language described at http://developer.gnome.org/pango/unstable/PangoMarkupFormat.html. Markup can also be used if the text is set using the python attribute.
Markup parsing can be turned on or off with rawtextmode attribute.
The variant (bold, italic, etc.) of the font to use.
Controls at which points text can wrap to the next line. Possible values are word (split lines at the nearest whitespace, default), char (split at any position, ignoring word breaks) and wordchar (split at word boundaries but fall back to char mode if there is no free space for a full word).
Returns the index of the character at the coordinates pos, or None if there is no character at that position. pos is relative to the node position. Formatting markup such as <b> or <i> is treated as zero chars, <br/> is treated as one char. To get the text matched to this use getTextAsDisplayed().
Returns the position of the glyph at character index i in the layout. The position is in pixels relative to the words node. Formatting markup such as <b> or <i> is treated as zero chars, <br/> is treated as one char.
Returns the size in pixels of the glyph at character index i in the layout. Formatting markup such as <b> or <i> is treated as zero chars, <br/> is treated as one char.
Returns the width and height of the specified line in pixels.
Returns the number of lines in the layout.
Returns the text without text attribute markup language. <br/> is replaced by \n.
Adds a directory to be searched for fonts. May only be called before Player.play().
Returns a list of strings containing all font names available.
Returns a list of available variants (Regular, Bold, etc.) of a font.