Skip to main content

Class ImageExtensions

Namespace: Aspid.FastTools.UIElements
Assembly: Aspid.FastTools.dll

Provides extension methods for Image.

public static class ImageExtensions

Inheritance​

object ← ImageExtensions

Methods​

SetImage<T>(T, Texture)​

Sets image.

public static T SetImage<T>(this T element, Texture value) where T : Image

Parameters​

element T

The element to modify.

value Texture

The texture to set.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

SetImageFromResources<T>(T, string)​

Loads a Texture from Resources and sets the image property.

public static T SetImageFromResources<T>(this T element, string path) where T : Image

Parameters​

element T

The element to modify.

path string

The Resources path of the texture to load.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

Remarks​

Logs a warning and leaves the element unchanged when no asset is found at path.

SetScaleMode<T>(T, ScaleMode)​

Sets scaleMode.

public static T SetScaleMode<T>(this T element, ScaleMode value) where T : Image

Parameters​

element T

The element to modify.

value ScaleMode

The scale mode to set.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

SetSourceRect<T>(T, Rect)​

Sets sourceRect.

public static T SetSourceRect<T>(this T element, Rect value) where T : Image

Parameters​

element T

The element to modify.

value Rect

The source rect to set.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

SetSprite<T>(T, Sprite)​

Sets sprite.

public static T SetSprite<T>(this T element, Sprite value) where T : Image

Parameters​

element T

The element to modify.

value Sprite

The sprite to set.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

SetSpriteFromResources<T>(T, string)​

Loads a Sprite from Resources and sets the sprite property.

public static T SetSpriteFromResources<T>(this T element, string path) where T : Image

Parameters​

element T

The element to modify.

path string

The Resources path of the sprite to load.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

Remarks​

Logs a warning and leaves the element unchanged when no asset is found at path.

SetTintColor<T>(T, Color)​

Sets tintColor.

public static T SetTintColor<T>(this T element, Color value) where T : Image

Parameters​

element T

The element to modify.

value Color

The tint color to set.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

SetUv<T>(T, Rect)​

Sets uv.

public static T SetUv<T>(this T element, Rect value) where T : Image

Parameters​

element T

The element to modify.

value Rect

The UV rect to set.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

SetVectorImage<T>(T, VectorImage)​

Sets vectorImage.

public static T SetVectorImage<T>(this T element, VectorImage value) where T : Image

Parameters​

element T

The element to modify.

value VectorImage

The vector image to set.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

SetVectorImageFromResources<T>(T, string)​

Loads a VectorImage from Resources and sets the vectorImage property.

public static T SetVectorImageFromResources<T>(this T element, string path) where T : Image

Parameters​

element T

The element to modify.

path string

The Resources path of the vector image to load.

Returns​

T

The element, for chaining.

Type Parameters​

T

The element type.

Remarks​

Logs a warning and leaves the element unchanged when no asset is found at path.