MultiImage Control: Difference between revisions

From Official Kodi Wiki
Jump to navigation Jump to search
>Jmarshall
(28 intermediate revisions by 10 users not shown)
Line 1: Line 1:
<section begin="main content" />
The MultiImage control is used for displaying a slideshow of images from a folder in XBMC. You can choose the position and size of the slideshow, as well as timing information.
The MultiImage control is used for displaying a slideshow of images from a folder in XBMC. You can choose the position and size of the slideshow, as well as timing information.
===Example===
=== Example ===
<xml>
<syntaxhighlight lang="xml" enclose="div">
<control type="multiimage" id="1">
<control type="multiimage" id="1">
       <description>My first slideshow control</description>
       <description>My first slideshow control</description>
       <posx>80</posx>
       <left>80</left>
       <posy>60</posy>
       <top>60</top>
       <width>250</width>
       <width>250</width>
       <height>200</height>
       <height>200</height>
       <visible>true</visible>
       <visible>true</visible>
       <imagepath>myimagepath</imagepath>
       <imagepath>myimagepath</imagepath>
      <info></info>
       <timeperimage>5000</timeperimage>
       <timeperimage>5000</timeperimage>
       <fadetime>2000</fadetime>
       <fadetime>2000</fadetime>
Line 18: Line 18:
       <aspectratio>stretch</aspectratio>
       <aspectratio>stretch</aspectratio>
</control>
</control>
</xml>
</syntaxhighlight>


===Image Size and Type Restrictions===
=== 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:
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:
====Size====
==== Formats ====
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). For example, an image of size 513x513 pixels will use 4 times the memory as one of size 512x512. The XBMCTex program that does the image injection into Textures.xpr will warn you of this, but it pays to know it before you start.
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. 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.


====Formats====
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.
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.
=== Available tags and attributes ===
===Available Tags and Attributes===
In addition to the [[Default Control Tags|default control tags]], the following tags are available. Note that each tag is '''lower case only.''' This is important, as xml tags are case-sensitive.
{| class="dtable"
{| class="prettytable"
|- class="userrow"
! Tag !! Description
| class="usercell" | '''description'''
|-  
| class="usercell" | Only used to make things clear for the skinner. Not read by XBMC at all.
|  '''imagepath'''
|- class="userrow"
| Specifies the path containing the images to use for the slideshow. Kodi will first look inside the compressed Textures.xbt file for images, and then will look in the actual folder. The path is relative to the media/ folder if it is not specified completely.
| class="usercell" | '''type'''
|-  
| class="usercell" | Should be multiimage for a multiimage control.
| '''timeperimage'''
|- class="userrow"
| Time in milliseconds that an image is shown for.
| class="usercell" | '''id'''
|-  
| class="usercell" | 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 are under the complete control of the skinner.
| '''fadetime'''
|- class="userrow"
| Time in milliseconds to fade between images.
| class="usercell" | '''posx'''
|-  
| class="usercell" | Specifies where the left edge of the image should be drawn. This is offset from the window's or control group's coordinates (from the left of the screen).  Note that specifying "180r" will take the position from the reverse edge (i.e. window or control group's right edge).
| '''pauseatend'''
|- class="userrow"
| Time in milliseconds to pause (in addition to <timeperimage>) on the last image at the end of a complete cycle through the images.  Only useful if <loop> is set to yes.
| class="usercell" | '''posy'''
|-  
| class="usercell" | Specifies where the top edge of the image should be drawn. This is offset from the window's or control group's coordinates (from the top of the screen).  Note that specifying "180r" will take the position from the reverse edge (i.e. window or control group's bottom edge).
| '''loop'''
|- class="userrow"
| If set to no, the last image will display indefinitely. Setting it to yes will loop around once they reach the last image. Defaults to yes.
| class="usercell" | '''width'''
|-  
| class="usercell" | Specifies the width that should be used to draw the image. The image will be resized to fit into this width.
| '''aspectratio'''
|- class="userrow"
| This specifies how the image will be drawn inside the box defined by <width> and <height>. [[Aspect Ratio|See here for more info]]
| class="usercell" | '''height'''
| class="usercell" | Specifies the height that should be used to draw the image. The image will be resized to fit into this height.
|- class="userrow"
| class="usercell" | <strong>visible</strong>
| class="usercell" | Specifies a condition as to when this control will be visible. Can be true, false, or a condition. [[Conditional Visibility|See here for&nbsp;more information.]] Defaults to true.
|- class="userrow"
| class="usercell" | <strong>animation</strong>
| class="usercell" | Specifies the animation to be run when the control enters a particular state. [[Animating Your Skin|See here for more information]]
|- class="userrow"
| class="usercell" | '''imagepath'''
| class="usercell" | Specifies the path containing the images to use for the slideshow. XBMC will first look inside the compressed Textures.xpr file for images, and then will look in the actual folder. The path is relative to the media/ folder if it is not specified completely. It must be a local path (ie on the xbox harddisk).
|- class="userrow"
| class="usercell" | <strong>info</strong>
| class="usercell" | Specifies the information that this image control is presenting. XBMC will select the texture to use based on this tag. [[InfoLabels|See here for&nbsp;more information.]]
|- class="userrow"
| class="usercell" | '''timeperimage'''
| class="usercell" | Time in milliseconds that an image is shown for.
|- class="userrow"
| class="usercell" | '''fadetime'''
| class="usercell" | Time in milliseconds to fade between images.
|- class="userrow"
| class="usercell" | '''pauseatend'''
| class="usercell" | Time in milliseconds to pause (in addition to <timeperimage>) on the last image at the end of a complete cycle through the images.  Only useful if <loop> is set to yes.
|- class="userrow"
| class="usercell" | '''loop'''
| class="usercell" | If set to no, the last image will display indefinitely. Setting it to yes will loop around once they reach the last image. Defaults to yes.
|- class="userrow"
| class="usercell" | '''aspectratio'''
| class="usercell" | 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.
|}
|}
[[category:Skin Development]]
 
<section end="main content" />
 
== See also ==
'''Development:'''
* [[Add-on development]]
* [[Skinning]]
 
[[Category:Skin development]]

Revision as of 21:39, 22 February 2019

The MultiImage control is used for displaying a slideshow of images from a folder in XBMC. You can choose the position and size of the slideshow, as well as timing information.

Example

<control type="multiimage" id="1">
      <description>My first slideshow control</description>
      <left>80</left>
      <top>60</top>
      <width>250</width>
      <height>200</height>
      <visible>true</visible>
      <imagepath>myimagepath</imagepath>
      <timeperimage>5000</timeperimage>
      <fadetime>2000</fadetime>
      <pauseatend>10000</pauseatend>
      <randomize>true</randomize>
      <loop>no</loop>
      <aspectratio>stretch</aspectratio>
</control>

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:

Formats

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. 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.

Available tags and attributes

In addition to the default control tags, the following tags are available. Note that each tag is lower case only. This is important, as xml tags are case-sensitive.

Tag Description
imagepath Specifies the path containing the images to use for the slideshow. Kodi will first look inside the compressed Textures.xbt file for images, and then will look in the actual folder. The path is relative to the media/ folder if it is not specified completely.
timeperimage Time in milliseconds that an image is shown for.
fadetime Time in milliseconds to fade between images.
pauseatend Time in milliseconds to pause (in addition to <timeperimage>) on the last image at the end of a complete cycle through the images. Only useful if <loop> is set to yes.
loop If set to no, the last image will display indefinitely. Setting it to yes will loop around once they reach the last image. Defaults to yes.
aspectratio This specifies how the image will be drawn inside the box defined by <width> and <height>. See here for more info


See also

Development: