The image control is used for displaying images in XBMC. You can choose the position, size, transparency and contents of the image to be displayed.
<xml> <control type="image" id="1">
<description>My first image control</description> <posx>80</posx> <posy>60</posy> <width>250</width> <height>200</height> <visible>true</visible> <colordiffuse>FFFFFFFF</colordiffuse> <colorkey>FFFF00FF</colorkey> <texture border="5" flipY="true" flipX="false">mytexture.png</texture> <info>MusicPlayer.Cover</info> <aspectratio>keep</aspectratio>
2 Image Size and Type Restrictions
For the <texture> tags, and for all <texture> tags in other controls, there is a small set of rules that you should follow if at all possible:
Images should be as close as possible to the nearest highest power of 2 in width and height. The reason for this is XBMC uses swizzled textures which are quicker to render and quicker to load once they're compressed into the Textures.xpr file. Note that the image does not need to be square, and will not be scaled into a power of 2 size. Rather, any pixels outside of a power of two size will simply be dead space (wasted memory). If you cannot manage this, then XBMCTex will opt for a linear (non-swizzled) texture format which must be aligned to 64 pixels in the horizontal, but has no restrictions in the vertical direction. These are slightly slower to load and render, but for the most part there's not a lot of difference. The XBMCTex program that does the image injection into Textures.xpr will tell you what format it's using, and how much pixel wastage (memory waste) is contained in each image.
If you wish to use full 8 bit transparency, then use PNG. If you only need a single transparent colour, then you can specify this in the <colorkey> tag, so any image will be fine. It is suggested that you use PNG and JPG as much as possible. Note that once the images are injected into Textures.xpr, they are not stored as JPG or PNG – rather they are stored in a xbox native format for faster loading. The size of the images (in kb) is therefore not as important as the size of the images in pixels – so feel free to store them in a lossless (eg PNG) manner if you wish.
The only exception to this is if you require an animated texture. In this case, we only support animated GIF. 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.
3 Available Tags and Attributes
Note that each tag is lower case only. This is important, as xml tags are case-sensitive.
|description||Only used to make things clear for the skinner. Not read by XBMC at all.|
|type||Should be image for an image control.|
|id||Specifies the control's id. The value this takes depends on the control type, and the window that you are using the control on. There are special control id's that must be present in each window. Any other controls that the skinner adds can be any id they like. Most image controls don't need an id as they're completely under the skinner's control.|
|posx||Specifies where the left edge of the image should be drawn. This is offset from the window's or control group's coordinates (measure from the left edge). If and "r" is included (eg 180r) then the measurement is taken from the window or control group's right edge (in the left direction).|
|posy||Specifies where the top edge of the image should be drawn. This is offset from the window's or control group's coordinates (measure from the top edge). If and "r" is included (eg 180r) then the measurement is taken from the window or control group's bottom edge (in the up direction).|
|width||Specifies the width that should be used to draw the image. The image will be resized to fit into this width.|
|height||Specifies the height that should be used to draw the image. The image will be resized to fit into this height.|
|visible||Specifies a condition as to when this control will be visible. Can be true, false, or a condition. See here for more information. Defaults to true.|
|animation||Specifies the animation to be run when the control enters a particular state. See here for more information|
|aspectratio||This specifies how the image will be drawn inside the box defined by <width> and <height>. When set to “keep” the images aspect ratio will be kept, and the image will be resized to fit inside the <width>,<height> box (with transparent bars if the ratios are not the same). When set to “stretch”, the image will be stretched to <width> by <height> pixels (it's aspect ratio will therefore be lost). When set to “scale” then the box will be resized so that it completely fills the <width>,<height> box and any portions of the image outside the box will be cropped off.|
|texture||Specifies the image file which should be displayed. You can use animated gif's, jpgs, pngs, or bmps. This should be the path to the image file from the media/ folder of your skin directory. XBMC will first look inside the compresses Textures.xpr file, and if not found, will look inside the media/ folder for the actual skin file. Compressing textures into Textures.xpr means far faster loading times. In addition, there's some attributes that govern how the image is drawn. See here for more information.|
|info||Specifies the information that this image control is presenting. XBMC will select the texture to use based on this tag. See here for more information.|
|colordiffuse||TThis specifies the color to be used for the texture basis. It's in hex AARRGGBB format. If you define <colordiffuse>FFFF00FF</colordiffuse> (magenta), the image will be given a magenta tint when rendered. Defaults to FFFFFFFF (no tint).|
|colorkey||This specifies the color in the image file that should be considered transparent. All pixels of this colour will be replaced by transparent black. Defaults to 0 (none)|