GradientTexture2D

Inherits: Texture2D < Texture < Resource < RefCounted < Object

Gradient-filled 2D texture.

Description

The texture uses a Gradient to fill the texture data in 2D space. The gradient is filled according to the specified fill and repeat types using colors obtained from the gradient. The texture does not necessarily represent an exact copy of the gradient, but instead an interpolation of samples obtained from the gradient at fixed steps (see width and height).

Properties

Fill

fill

0

Vector2

fill_from

Vector2(0, 0)

Vector2

fill_to

Vector2(1, 0)

Gradient

gradient

int

height

64

Repeat

repeat

0

bool

use_hdr

false

int

width

64

Enumerations

enum Fill:

  • FILL_LINEAR = 0 --- The colors are linearly interpolated in a straight line.

  • FILL_RADIAL = 1 --- The colors are linearly interpolated in a circular pattern.


enum Repeat:

  • REPEAT_NONE = 0 --- The gradient fill is restricted to the range defined by fill_from to fill_to offsets.

  • REPEAT = 1 --- The texture is filled starting from fill_from to fill_to offsets, repeating the same pattern in both directions.

  • REPEAT_MIRROR = 2 --- The texture is filled starting from fill_from to fill_to offsets, mirroring the pattern in both directions.

Property Descriptions

Default

0

Setter

set_fill(value)

Getter

get_fill()

The gradient fill type, one of the Fill values. The texture is filled by interpolating colors starting from fill_from to fill_to offsets.


Default

Vector2(0, 0)

Setter

set_fill_from(value)

Getter

get_fill_from()

The initial offset used to fill the texture specified in UV coordinates.


Default

Vector2(1, 0)

Setter

set_fill_to(value)

Getter

get_fill_to()

The final offset used to fill the texture specified in UV coordinates.


Setter

set_gradient(value)

Getter

get_gradient()

The Gradient used to fill the texture.


Default

64

Setter

set_height(value)

Getter

get_height()

The number of vertical color samples that will be obtained from the Gradient, which also represents the texture's height.


Default

0

Setter

set_repeat(value)

Getter

get_repeat()

The gradient repeat type, one of the Repeat values. The texture is filled starting from fill_from to fill_to offsets by default, but the gradient fill can be repeated to cover the entire texture.


Default

false

Setter

set_use_hdr(value)

Getter

is_using_hdr()

If true, the generated texture will support high dynamic range (Image.FORMAT_RGBAF format). This allows for glow effects to work if Environment.glow_enabled is true. If false, the generated texture will use low dynamic range; overbright colors will be clamped (Image.FORMAT_RGBA8 format).


Default

64

Setter

set_width(value)

Getter

get_width()

The number of horizontal color samples that will be obtained from the Gradient, which also represents the texture's width.