Aspect Ratio: Difference between revisions

From Official Kodi Wiki
Jump to navigation Jump to search
m (Bot: Automated text replacement (-class="wikitable" +class="prettytable" & -Available Tags +Available tags & -<source +<syntaxhighlight & -</source> +</syntaxhighlight>))
mNo edit summary
 
(2 intermediate revisions by one other user not shown)
Line 3: Line 3:
=== XML tag format ===
=== XML tag format ===
The tag format is:
The tag format is:
<syntaxhighlight lang="xml">
<syntaxhighlight lang="xml" enclose="div">
   <aspectratio scalediffuse="false" align="left" aligny="top">keep</aspectratio>
   <aspectratio scalediffuse="false" align="left" aligny="top">keep</aspectratio>
</syntaxhighlight>
</syntaxhighlight>
Line 16: Line 16:
|-   
|-   
|  '''stretch'''
|  '''stretch'''
|  Aspect ratio is not kept - the image will be stretched so that it exactly fits the box.
|  Aspect ratio is not kept - the image will be stretched so that it exactly fits the box. (default value).
|-   
|-   
|  '''scale'''
|  '''scale'''
Line 41: Line 41:
* [[Skinning]]
* [[Skinning]]


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

Latest revision as of 23:27, 25 November 2014

The <aspectratio> tag allows the aspect ratio of images (and multiimages) to be defined, and in addition, on how the image should be aligned within the standard <width>,<height> box.

XML tag format

The tag format is:

  <aspectratio scalediffuse="false" align="left" aligny="top">keep</aspectratio>

Allowed values

The values allowed for the aspect ratio are keep, stretch, scale, and center. These do the following: 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.

keep Aspect ratio will be kept, and the image will be scaled down or up so that it fits inside the box, with transparent bars either side if the ratios are not the same.
stretch Aspect ratio is not kept - the image will be stretched so that it exactly fits the box. (default value).
scale Aspect ratio is kept, and the image is scaled up so that it fills the box, with any portions that lie outside the box being cropped off.
center Aspect ratio is kept, and the image is left unscaled, centered within the box. It may be cropped if the image is larger than the box, or may have a transparent border if the image is smaller than the box.

Attributes

The align and aligny attributes specify how the image is positioned within the box. The default is to align to center in both directions.

Finally, the scalediffuse="false" attribute means the diffuse texture is not scaled to the image size. i.e. the diffuse image effectively uses aspectratio stretch in this case. This is especially useful when using the diffuse image to trim the main image in a particular way, such as to round off the corners. The default is scalediffuse="true".

Example

The image below shows the various combinations. The aspect ratios are from left to right: keep, scale, stretch, center. The top images use scalediffuse="true" and the lower images use scalediffuse="false".

Aspectratio image.jpg


See also

Development: