# SUIImage

## Index

### Properties Index

| Property Name                                                                       |
| ----------------------------------------------------------------------------------- |
| SColor [**Color** ](#color)`get` `set`                                              |
| SResource [**Sprite** ](#sprite)`get` `set`                                         |
| bool [**PreserveAspect** ](#preserveaspect)`get` `set`                              |
| bool [**FillCenter** ](#fillcenter)`get` `set`                                      |
| float [**FillAmount** ](#fillamount)`get` `set`                                     |
| bool [**FillClockwise** ](#fillclockwise)`get` `set`                                |
| int [**FillOrigin** ](#fillorigin)`get` `set`                                       |
| float [**AlphaHitTestMinimumThreshold** ](#alphahittestminimumthreshold)`get` `set` |
| bool [**HasBorder** ](#hasborder)`get`                                              |
| float [**PixelsPerUnit** ](#pixelsperunit)`get`                                     |
| SMaterial [**Material** ](#material)`get` `set`                                     |
| float [**MinWidth** ](#minwidth)`get`                                               |
| float [**PreferredWidth** ](#preferredwidth)`get`                                   |
| float [**FlexibleWidth** ](#flexiblewidth)`get`                                     |
| float [**MinHeight** ](#minheight)`get`                                             |
| float [**PreferredHeight** ](#preferredheight)`get`                                 |
| float [**FlexibleHeight** ](#flexibleheight)`get`                                   |
| int [**LayoutPriority** ](#layoutpriority)`get`                                     |
| SGameObject [**GameObject** ](#gameobject)`get`                                     |

## Properties

### Color

[SColor](https://docs.sine.space/scripting/client-scripting-api-reference/types/scolor) **Color** `get` `set`

*Default Color of UIImage*

{% tabs %}
{% tab title="Lua" %}

```lua
Space.Host.ExecutingObject.UIImage.Color= Color.Red
```

{% endtab %}
{% endtabs %}

### Sprite

[SResource](https://docs.sine.space/scripting/client-scripting-api-reference/types/sresource) **Sprite** `get` `set`

*The sprite that is used to render this image.*

{% tabs %}
{% tab title="Lua" %}

```lua
Space.Host.ExecutingObject.UIImage.Sprite = Space.GetResource("resource name")
```

{% endtab %}
{% endtabs %}

### PreserveAspect

bool **PreserveAspect** `get` `set`

*Whether this image should preserve its Sprite aspect ratio.*

{% tabs %}
{% tab title="Lua" %}

```lua
Space.Host.ExecutingObject.UIImage.PreserveAspect = true 
```

{% endtab %}
{% endtabs %}

### FillCenter

bool **FillCenter** `get` `set`

*Whether or not to render the center*

{% tabs %}
{% tab title="Lua" %}

```lua
Space.Host.ExecutingObject.UIImage.FillCenter = true
```

{% endtab %}
{% endtabs %}

### FillAmount

float **FillAmount** `get` `set`

*Amount of the Image shown*

{% tabs %}
{% tab title="Lua" %}

```lua
Space.Host.ExecutingObject.UIImage.FillAmount = 0.5
```

{% endtab %}
{% endtabs %}

### FillClockwise

bool **FillClockwise** `get` `set`

*Whether the Image should be filled clockwise (true) or counter-clockwise (false).*

{% tabs %}
{% tab title="Lua" %}

```lua
Space.Host.ExecutingObject.UIImage.FillClockwise = true
```

{% endtab %}
{% endtabs %}

### FillOrigin

int **FillOrigin** `get` `set`

*Controls the origin point of the Fill process.*

{% tabs %}
{% tab title="Lua" %}

```lua
Space.Host.ExecutingObject.UIImage.FillOrigin = 0
```

{% endtab %}
{% endtabs %}

### AlphaHitTestMinimumThreshold

float **AlphaHitTestMinimumThreshold** `get` `set`

*The alpha threshold specifies the minimum alpha a pixel must have for the event to considered a "hit" on the Image. Alpha values less than the threshold will cause raycast events to pass through the Image. An value of 1 would cause only fully opaque pixels to register raycast events on the Image. The alpha tested is retrieved from the image sprite only, while the alpha of the Image Graphic.color is disregarded.*

*alphaHitTestMinimumThreshold defaults to 0; all raycast events inside the Image rectangle are considered a hit. In order for greater than 0 to values to work, the sprite used by the Image must have readable pixels. This can be achieved by enabling Read/Write enabled in the advanced Texture Import Settings for the sprite and disabling atlassing for the sprite.*

{% tabs %}
{% tab title="Lua" %}

```lua
Space.Host.ExecutingObject.UIImage.AlphaHitTestMinimumThreshold =  0
```

{% endtab %}
{% endtabs %}

### HasBorder

bool **HasBorder** `get`

*True if the sprite used has borders.*

{% tabs %}
{% tab title="Lua" %}

```lua
imgHasBorder = Space.Host.ExecutingObject.UIImage.HasBorder 
```

{% endtab %}
{% endtabs %}

### PixelsPerUnit

float **PixelsPerUnit** `get`

*Provides information about how fonts are scale to the screen.*

*For dynamic fonts, the value is equivalent to the scale factor of the canvas. For non-dynamic fonts, the value is calculated from the requested text size and the size from the font.*

{% tabs %}
{% tab title="Lua" %}

```lua
ppUnit = Space.Host.ExecutingObject.UIImage.PixelsPerUnit
```

{% endtab %}
{% endtabs %}

### Material

[SMaterial](https://docs.sine.space/scripting/client-scripting-api-reference/types/smaterial) **Material** `get` `set`

*The specified Material used by this Image. The default Material is used instead if one wasn't specified.*

{% tabs %}
{% tab title="Lua" %}

```lua
Space.Host.ExecutingObject.UIImage.Material = Space.GetResource("resource name").AsMaterial
```

{% endtab %}
{% endtabs %}

### MinWidth

float **MinWidth** `get`

*The minimum width this UIImage may be allocated. (Used by the Layout system).*

{% tabs %}
{% tab title="Lua" %}

```lua
minWidth = Space.Host.ExecutingObject.UIImage.MinWidth
```

{% endtab %}
{% endtabs %}

### PreferredWidth

float **PreferredWidth** `get`

*The preferred width this UIImage should be allocated if there is sufficient space. (Used by the Layout system)*

{% tabs %}
{% tab title="Lua" %}

```lua
prefWidth = Space.Host.ExecutingObject.UIImage.PreferredWidth
```

{% endtab %}
{% endtabs %}

### FlexibleWidth

float **FlexibleWidth** `get`

*The extra relative width this UIImage should be allocated if there is additional available space. (Used by the Layout system)*

{% tabs %}
{% tab title="Lua" %}

```lua
flexWidth = Space.Host.ExecutingObject.UIImage.FlexibleWidth
```

{% endtab %}
{% endtabs %}

### MinHeight

float **MinHeight** `get`

*The minimum height this UIImage may be allocated.(Used by the Layout system).*

{% tabs %}
{% tab title="Lua" %}

```lua
minHeight = Space.Host.ExecutingObject.UIImage.MinHeight
```

{% endtab %}
{% endtabs %}

### PreferredHeight

float **PreferredHeight** `get`

*The preferred height this UIImage should be allocated if there is sufficient space. (Used by the Layout system)*

{% tabs %}
{% tab title="Lua" %}

```lua
prefHeight = Space.Host.ExecutingObject.UIImage.PreferredHeight
```

{% endtab %}
{% endtabs %}

### FlexibleHeight

float **FlexibleHeight** `get`

*The extra relative height this UIImage should be allocated if there is additional available space. (Used by the Layout system)*

{% tabs %}
{% tab title="Lua" %}

```lua
flexHeight = Space.Host.ExecutingObject.UIImage.FlexibleHeight
```

{% endtab %}
{% endtabs %}

### LayoutPriority

int **LayoutPriority** `get`

*The layout priority of this UIText component.(Used by the Layout system.)*

{% tabs %}
{% tab title="Lua" %}

```lua
layoutPrio = Space.Host.ExecutingObject.UIImage.LayoutPriority
```

{% endtab %}
{% endtabs %}

### GameObject

[SGameObject](https://docs.sine.space/scripting/client-scripting-api-reference/types/sgameobject) **GameObject** `get`

*Property Description*

{% tabs %}
{% tab title="Lua" %}

```lua
theGameObject = Space.Host.ExecutingObject.UIImage.GameObject
```

{% endtab %}
{% endtabs %}
