WoW:XML/Texture: Difference between revisions

From AddOn Studio
< XML
Jump to navigation Jump to search
(Started work on making this page much more robust)
m (Move page script moved page XML/Texture to XML/Texture without leaving a redirect)
 
(4 intermediate revisions by 2 users not shown)
Line 1: Line 1:
A '''Texture''' is a [[XML/LayoutFrame|LayoutFrame]] XML element that describes a graphic. The graphic may be an image loaded by Blizzard or an addon, or it may be a solid color or gradient. Textures support partially transparent images and different strategies for blending these into other images. They may be changed to show only a portion of a loaded image using ''texture coordinates''.
{{uixmlelem}}
A '''Texture''' is a [[XML/LayoutFrame|LayoutFrame]] XML element that describes a graphic or display in the UI. Textures, along with [[XML/FontString|FontStrings]] are layered UI elements, meaning they must be inside <nowiki><Layers><Layer></nowiki> tags.


==Images==
== Inheritance ==
Textures are the means to display images in the game. The image must be either a [http://en.wikipedia.org/wiki/Truevision_TGA TGA] or [http://en.wikipedia.org/wiki/.BLP BLP] image file. Textures may only load images whose dimensions are powers of two, such as 2x2, 4x8, and so on. Images that have non-power of two dimensions will show up as solid green textures. The image does not need to be square, however, so rectangular dimensions like 32x128 are also valid.
: Inherited by: none, Inherits: <[[XML/LayoutFrame|LayoutFrame]]>, Runtime object: [[UIOBJECT_Texture|Texture]]
: Defined in: [[XML/Layers|Layers]], [[XML/Ui|Ui]]


==Virtual Textures==
==Elements==
* <[[XML/TexCoords|TexCoords]]>
* <[[XML/Color elements|Color]]>
* <[[XML/Gradient|Gradient]]>


Virtual textures are textures that are allowed to be used as a template for other textures. This is useful in situations where textures vary by a small amount. In this case, the similarity can be put in a virtual texture, and the children need to only describe their differences.
== Attributes ==
* file (string) - resource file path to the texture image
* alphaMode ([[XML/ALPHAMODE|ALPHAMODE]]) - Blending mode


==Elements==
== Summary ==
<[[XML/TexCoords|TexCoords]]>, [[XML/Color elements|Color]], Gradient
The graphic may be an image loaded by Blizzard or an addon, or it may be a solid color or gradient. Textures support partially transparent images and different strategies for blending these into other images. They may be changed to show only a portion of a loaded image using 'texture coordinates'. Note: The Texture must be within a [[XML_User_Interface#Layers_and_Textures|Layer]].


==Attributes==
=== Example ===
;file
<Texture name="MyTexture" file="Interface\ItemSocketingFrame\UI-ItemSockets" alphaMode="ADD">
:{{attrtype|string}} File name
  <Size>
;[[UITYPE AlphaMode|alphaMode]]
    <AbsDimension x="13" y="13"/>
:{{attrtype|string}} Blending mode
  </Size>
  <Anchors>
    <Anchor point="CENTER">
      <Offset>
        <AbsDimension x="0" y="0"/>
      </Offset>
    </Anchor>
  </Anchors>
  <TexCoords left="0.398" right="0.445" top="0.402" bottom="0.449"/>
</Texture>


==Notes==
== Details ==
Note: The Texture must be within a ''[[XML_User_Interface#Layers_and_Textures|<Layer>]]''
=== Images ===
Textures are the means to display images in the game. The image must be either a [[TGA file]] (http://en.wikipedia.org/wiki/Truevision_TGA) or [[BLP file]] (http://en.wikipedia.org/wiki/.BLP) image file. Textures may only load images whose dimensions are powers of two, such as 2x2, 4x8, and so on. Images that have non-power of two dimensions will show up as solid green textures. The image does not need to be square, however, so rectangular dimensions like 32x128 are also valid.


==Examples==
=== Virtual Textures ===
 
Virtual textures are textures that are allowed to be used as a template for other textures. This is useful in situations where textures vary by a small amount. In this case, the similarity can be put in a virtual texture, and the children need to only describe their differences.
<pre>
<Texture name="SparkleTextureNormal" file="Interface\ItemSocketingFrame\UI-ItemSockets" alphaMode="ADD" hidden="true">
<Size>
<AbsDimension x="13" y="13"/>
</Size>
<Anchors>
<Anchor point="CENTER">
<Offset>
<AbsDimension x="0" y="0"/>
</Offset>
</Anchor>
</Anchors>
<TexCoords left="0.3984375" right="0.4453125" top="0.40234375" bottom="0.44921875"/>
</Texture>
</pre>
[[Category:XML elements]]
[[Category:XML elements]]

Latest revision as of 04:49, 15 August 2023

XML UI ← XML elements < Texture

A Texture is a LayoutFrame XML element that describes a graphic or display in the UI. Textures, along with FontStrings are layered UI elements, meaning they must be inside <Layers><Layer> tags.

Inheritance[edit]

Inherited by: none, Inherits: <LayoutFrame>, Runtime object: Texture
Defined in: Layers, Ui

Elements[edit]

Attributes[edit]

  • file (string) - resource file path to the texture image
  • alphaMode (ALPHAMODE) - Blending mode

Summary[edit]

The graphic may be an image loaded by Blizzard or an addon, or it may be a solid color or gradient. Textures support partially transparent images and different strategies for blending these into other images. They may be changed to show only a portion of a loaded image using 'texture coordinates'. Note: The Texture must be within a Layer.

Example[edit]

<Texture name="MyTexture" file="Interface\ItemSocketingFrame\UI-ItemSockets" alphaMode="ADD">
  <Size>
    <AbsDimension x="13" y="13"/>
  </Size>
  <Anchors>
    <Anchor point="CENTER">
      <Offset>
        <AbsDimension x="0" y="0"/>
      </Offset>
    </Anchor>
  </Anchors>
  <TexCoords left="0.398" right="0.445" top="0.402" bottom="0.449"/>
</Texture>

Details[edit]

Images[edit]

Textures are the means to display images in the game. The image must be either a TGA file (http://en.wikipedia.org/wiki/Truevision_TGA) or BLP file (http://en.wikipedia.org/wiki/.BLP) image file. Textures may only load images whose dimensions are powers of two, such as 2x2, 4x8, and so on. Images that have non-power of two dimensions will show up as solid green textures. The image does not need to be square, however, so rectangular dimensions like 32x128 are also valid.

Virtual Textures[edit]

Virtual textures are textures that are allowed to be used as a template for other textures. This is useful in situations where textures vary by a small amount. In this case, the similarity can be put in a virtual texture, and the children need to only describe their differences.