Texture

From Multiverse

Jump to: navigation, search

A Texture widget displays an image.

Derived from: LayeredRegion.

Contents

Tag

<Texture
hidden=[true|false]
inherits=parentWidgetName
name=widgetName
setAllPoints=[true|false]
virtual=[true|false]
 alphaMode="BLEND"
 file=fileName
>
...
</Texture>

Attributes

Texture has these special attributes:

  • alphaMode - the alpha blend mode; Only "BLEND" is supported currently.
  • file - the imageset and image to use for the texture.


All widgets have these attributes that they inherit from Region:

  • hidden - Boolean; whether the widget is initially hidden.
  • inherits - name of the widget from which to inherit all attribute values. Must be widget of the same type as this widget (or an ancestor type).
  • name - name of the widget. The name must be unique across all widgets in the UI.
  • setAllPoints - Boolean (Not currently implemented)
  • virtual - Boolean; if true, indicates this widget is not actually created, but will be used as a template for other widgets.

Property Elements

Texture can contain these property elements:


All widgets can contain these property elements:

  • Anchors - contains one or more Anchor elements that specify the positioning of the widget relative to its parent.
  • Size - specifies the size of the widget with an AbsDimension element.

Methods

The following table describes the methods of the Texture widget.

Method Description Parameters
SetTexCoord(Xmin, Xmax, Ymin, Ymax) Set the texture coordinates for the texture object. This allows for the display of a portion of the base texture. Xmin - x coordinate of the left(from 0 to 1)

Ymin - y coordinate of the top (from 0 to 1)
Xmax - x coordinate of the right (from 0 to 1)
Ymax - y coordinate of the bottom (from 0 to 1)

SetTexCoord(ul_x, ul_y, ll_x, ll_y, ur_x, ur_y, lr_x, lr_y) The complex way of setting up coordinates for situations where the texture is either not being laid out with its default orientation or not rectangular. ul_x - x coordinate of the upper left corner (from 0 to 1)

ul_y- y coordinate of the upper left corner (from 0 to 1)
ll_x - x coordinate of the lower left corner (from 0 to 1)
ll_y - y coordinate of the lower left corner (from 0 to 1)
ur_x - x coordinate of the upper right corner (from 0 to 1)
ur_y - y coordinate of the upper right corner (from 0 to 1)
lr_x - x coordinate of the lower right corner (from 0 to 1)
lr_y - y coordinate of the lower right corner (from 0 to 1)

SetTexture(texturePath) Set the image texture to use. texturePath: a three part string, like 'Interface\\ContainerFrame\\UI-Backpack-Background'. The

first portion is ignored, the second portion indicates the imageset to use, and the third portion indicates which image within that imageset to use.

Methods Inherited from LayeredRegion
GetDrawLayer() Returns the draw layer of the region. One of the following:
  • BACKGROUND
  • ARTWORK
  • BORDER
  • OVERLAY
None
SetDrawLayer(layer) Sets the draw layer for the region. layer: the draw layer for the region. One of the following:
  • BACKGROUND
  • ARTWORK
  • BORDER
  • OVERLAY
SetVertexColor(r, g, b) Sets the vertex color for the region. r: red value

g: green value
b: blue value

SetVertexColor(r, g, b, alpha) Sets the vertex color for the region. r: red value

g: green value
b: blue value
alpha: alpha value

Methods Inherited from Region
ClearAllPoints() Clears all the anchors for the widget None
GetAlpha() Returns the opacity (alpha) of the texture object, from 0 to 1. This does not include the effect of the alpha values of the parent widgets. None
GetBottom() Returns the y coordinate of the bottom edge of the frame. NOTE: This method is available on FontString and Texture widgets only with 1.5. None
GetHeight() Returns the height of the widget None
GetLeft() Returns the x coordinate of the left edge of the frame.

NOTE: This method is available on FontString and Texture widgets only with 1.5.

None
GetName() Returns the name of the widget. None
GetParent() Returns the parent widget of the frame. NOTE: This method is available on FontString and Texture widgets only with 1.5. None
GetRight() Returns the x coordinate of the right edge of the frame. NOTE: This method is available on FontString and Texture widgets only with 1.5. None
GetTop() Returns the y coordinate of the top of the frame, but inverted so that 0 is the bottom of the screen. NOTE: This method is available on FontString and Texture widgets only with 1.5. None
GetWidth() Returns the width of the widget None
Hide() Mark the widget as hidden. If the widget, or any of the widget's parents are hidden, the widget will not be displayed. None
IsVisible() Returns true if the widget is visible, false otherwise. If the widget, or any of the widget's parents are hidden, the widget will not be displayed. None
SetAlpha(alpha) Set the alpha value (opacity) of the widget. alpha - a measure of opacity: zero (0) means transparent, while one (1) means opaque.
SetHeight(height) Set the height of the widget. height -height in pixels (integer)
SetPoint( point,

relativeTo,
relativePoint
[, xOffset, yOffset] )

Set an anchor point for the widget. Valid values for point and relativePoint arguments:
  • "TOPLEFT"
  • "TOPRIGHT"
  • "BOTTOMLEFT"
  • "BOTTOMRIGHT"
  • "TOP"
  • "BOTTOM"
  • "LEFT"
  • "RIGHT"
  • "CENTER"
point - Point on the widget that is anchored.

relativeTo - Name of the widget being achored to.
relativePoint - Point on the target being anchored to.
xOffset - Horizontal offset in pixels from the target (optional)
yOffset - Vertical offset in pixels from the target (optional). Higher points on the screen have a larger yOffset.
NOTE: You must specify both xOffset and yOffset or neither.

SetWidth(width) Set the width of the widget width - width in pixels(integer)
Show() Mark the widget as visible. If the widget, or any of the widget's parents are hidden, the widget will not be displayed. None


Event Handlers

None.

Example

 <Texture name="$parentIconTexture">
   <Size>
     <AbsDimension x="41" y="41"/>
   </Size>
   <Anchors>
     <Anchor point="TOPLEFT">
       <Offset>
 	<AbsDimension x="0" y="0"/>
       </Offset>
     </Anchor>
   </Anchors>
 </Texture>
Personal tools