Image Control

From DevWiki

Jump to: navigation, search

Applications,Boxee GUI API,Controls

Contents


Overview

Image controls are used to display images and textures on the window and in other controls such as lists. Image properties include position, size, transparency and such and can be set statically or changed dynamically from python script

For the <texture> property in the image control and for all <texture> properties in other controls it is suggested to use PNG and JPG as much as possible. For transparency use PNG. For animated texture only animated GIF is supported. There are also SOME animated GIFs that may not work. Use ImageReady CS and make sure you set the gif-anim to restore to background and they should work fine.


Example

  1. <control type="image" id="1">
  2.  <description>example image control</description>
  3.  <posx>80</posx>
  4.  <posy>60</posy>
  5.  <width>250</width>
  6.  <height>200</height>
  7.  <colordiffuse>FF88FFFF</colordiffuse>
  8.  <fadetime>200</fadetime>
  9.  <texture border="5" flipY="true" flipX="false">logo.png</texture>
  10.  <aspectratio>keep</aspectratio>
  11. </control>


Available Tags

In addition to the Default Control Properties the following tags are available. Note that all XML tags are in lower case.

Element Description Required
texture Specifies the image file which will be displayed. It can be a texture file from the media folder or using $INFO also a GUI information. Note HTTP links to textures are not supported currently. Yes, if info is not specified.
info Specifies the information showed in the image taken from GUI information. Yes, if texture is not specified.
bordertexture Specifies the image file which should be displayed as a border around the image. Use the <bordersize> to specify the size of the border. The <width>, <height> box specifies the size of the image plus border. No
bordersize Specifies the size of the border. A single number specifies the border should be the same size all the way around the image, whereas a comma separated list of 4 values indicates left, right, top, bottom values. No
aspectratio This specifies how the image will be drawn inside the box defined by <width> and <height>. See below for more info on aspect ratio. No
fadetime This specifies a crossfade time that will be used whenever the <texture> file name changes. The previous image will be held until the new image is ready, and then they will be crossfaded. No


Aspect Ratio


Python Integration

In addition to the default control methods (disable/enable, visibility and focus), the following is also available for this control type.

GetImage(controlId:Integer):Image
Represents an image control in the user interface.

  1. image = mc.GetWindow(14000).GetImage(3900)
  1. <onclick lang="python"><![CDATA[
  2. image = mc.GetWindow(14000).GetImage(3900)
  3. ]]></onclick>


SetTexture

SetTexture(imagePath:String):Void
Set the texture of the image by specifying the full path where the image resides. Should be a local file only. Supported formats: PNG, GIF, JPG.

  1. path = mc.GetApp().GetAppMediaDir() + "/image.png"
  2. image.SetTexture(path)
Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox