Image Control: Difference between revisions

From Official Kodi Wiki
Jump to navigation Jump to search
>Ronie
No edit summary
(16 intermediate revisions by 7 users not shown)
Line 1: Line 1:
<section begin="main content" />
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.
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.
=== Example ===
=== Example ===
<source lang="xml">
<syntaxhighlight lang="xml" enclose="div">
<control type="image" id="1">
<control type="image" id="1">
       <description>My first image control</description>
       <description>My first image 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>
Line 14: Line 15:
       <bordertexture border="5">mybordertexture.png</bordertexture>
       <bordertexture border="5">mybordertexture.png</bordertexture>
       <bordersize>5</bordersize>
       <bordersize>5</bordersize>
      <info>MusicPlayer.Cover</info>
       <aspectratio>keep</aspectratio>
       <aspectratio>keep</aspectratio>
</control>
</control>
</source>
</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 ====
==== Size ====
Images can be any size, though some graphics cards allow only power of 2 textures, so this may be a consideration. For the most case, it doesn't really matter what size things are - XBMC will quite happily load most files.
Images can be any size, though some graphics cards allow only power of 2 textures, so this may be a consideration. For the most case, it doesn't really matter what size things are - Kodi will quite happily load most files.


==== Formats ====
==== Formats ====
Line 29: Line 29:
The only exception to this is if you require an animated texture. In this case, we support only 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.
The only exception to this is if you require an animated texture. In this case, we support only 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.
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="wikitable" border="0"
{| class="prettytable"
! Tag !! Description
|-  
|-  
|  '''aspectratio'''
|  '''aspectratio'''
|  This specifies how the image will be drawn inside the box defined by <width> and <height>. [[Aspect Ratio|See here for more information]].
|  This specifies how the image will be drawn inside the box defined by <code><width></code> and <code><height></code>. [[Aspect Ratio|See here for more information]].
|-  
|-  
|  '''texture'''
|  '''texture'''
Line 41: Line 42:
|-  
|-  
|  '''bordertexture'''
|  '''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.
|  Specifies the image file which should be displayed as a border around the image.  Use the <code><bordersize></code> to specify the size of the border. The <code><width></code>,<code><height></code> box specifies the size of the image plus border.
|-  
|-  
|  '''bordersize'''
|  '''bordersize'''
Line 47: Line 48:
|-  
|-  
|  '''info'''
|  '''info'''
|  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.]]
|  Specifies the information that this image control is presenting. Kodi will select the texture to use based on this tag. [[InfoLabels|See here for&nbsp;more information.]]
|-  
|-  
|  '''fadetime'''
|  '''fadetime'''
|  This specifies a crossfade time that will be used whenever the underline <texture> filename changes.  The previous image will be held until the new image is ready, and then they will be crossfaded.  This is particularly useful for a large thumbnail image showing the focused item in a list, or for fanart or other large backdrops.
|  This specifies a crossfade time that will be used whenever the underlying <texture> filename changes.  The previous image will be held until the new image is ready, and then they will be crossfaded.  This is particularly useful for a large thumbnail image showing the focused item in a list, or for fanart or other large backdrops.
|-
|  '''background'''
|  For images inside a container, you can specify background="true" to load the textures in a background worker thread. [[Background Image Loader|See here for additional information about background loading.]]
|}
|}


==See also==
<section end="main content" />
 
== See also ==
'''Development:'''
'''Development:'''
* [[Add-on development]]
* [[Add-on development]]
* [[Skinning]]
* [[Skinning]]


[[Category:Skin Development]]
[[Category:Skin development]]

Revision as of 21:27, 10 December 2018

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.

Example

<control type="image" id="1">
      <description>My first image control</description>
      <left>80</left>
      <top>60</top>
      <width>250</width>
      <height>200</height>
      <visible>true</visible>
      <colordiffuse>FFFFFFFF</colordiffuse>
      <fadetime>200</fadetime>
      <texture border="5" flipy="true" flipx="false">mytexture.png</texture>
      <bordertexture border="5">mybordertexture.png</bordertexture>
      <bordersize>5</bordersize>
      <aspectratio>keep</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:

Size

Images can be any size, though some graphics cards allow only power of 2 textures, so this may be a consideration. For the most case, it doesn't really matter what size things are - Kodi will quite happily load most files.

Formats

If you wish to use transparency, then use PNG. It is suggested that you use PNG and JPG as much as possible. Note that once the images are injected into Textures.xbt, they are not stored as JPG or PNG – rather they are stored in a native format used for GPUs for faster loading, such as ARGB or DXTc textures. 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 support only 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
aspectratio This specifies how the image will be drawn inside the box defined by <width> and <height>. See here for more information.
texture Specifies the image file which should be displayed. See here for additional information about textures.
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.
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,top,right,bottom values.
info Specifies the information that this image control is presenting. Kodi will select the texture to use based on this tag. See here for more information.
fadetime This specifies a crossfade time that will be used whenever the underlying <texture> filename changes. The previous image will be held until the new image is ready, and then they will be crossfaded. This is particularly useful for a large thumbnail image showing the focused item in a list, or for fanart or other large backdrops.
background For images inside a container, you can specify background="true" to load the textures in a background worker thread. See here for additional information about background loading.


See also

Development: