reckfellENGINE

GradientTexture2D

A Gradient texture with linear, radial, square or conic fill.

On this page
class GradientTexture2DReckfellSharpInherits Texture2D

Assign Gradient, dimensions and normalized FillFrom/FillTo coordinates. Defaults are 64×64, Fill=Linear, FillFrom=(0,0), FillTo=(1,0), Repeat=None, UseHdr=false and Gradient=null. The constructor does not create a Gradient.

Linear uses projection onto an axis, Radial distance, Square maximum axis distance, and Conic angle. Repeat changes coordinates while generating the pattern; it does not configure the finished texture’s material sampler. Coincident FillFrom and FillTo make every pixel sample Gradient.Sample(0).

This complete checked factory creates a horizontal ramp; assign the returned Texture2D to a compatible element’s Texture property:

C#
using Reckfell;

public static class GradientRamp
{
    public static GradientTexture2D Create()
    {
        using var gradient = new Gradient
        {
            Offsets = new[] { 0.0f, 1.0f },
            Colors = new[] { Colors.Black, Colors.White },
            InterpolationMode = Gradient.InterpolationModeEnum.Linear,
            InterpolationColorSpace = Gradient.ColorSpace.Srgb,
        };
        return new GradientTexture2D
        {
            Gradient = gradient,
            Width = 256,
            Height = 32,
            Fill = GradientTexture2D.FillEnum.Linear,
            FillFrom = Vector2.Zero,
            FillTo = new Vector2(1, 0),
            Repeat = GradientTexture2D.RepeatEnum.None,
        };
    }
}

Changing the shared Gradient updates connected textures; GetImage forces pending generation to finish. Its image data is independent. A null source does not erase existing pixels. UseHdr selects RGBAF instead of clamped RGBA8 but does not enable environment effects or monitor HDR.

Fill modes, Repeat/Mirror, HDR/LDR, regeneration and independent resource reload were checked in Forward+/Vulkan. The example generates texture data, not a graphics-quality illustration. Shader sampling, all resolutions, performance and other backends were not established by this run.

Declarations checked against C# SDK 1.0.0. Expand a name to see declarations and documentation.

Constructors1

GradientTexture2DConstructor
# GradientTexture2D
C#
public GradientTexture2D();

Creates a texture with no assigned Gradient and no generated pixels. Default parameter values do not mean an image already exists.

Properties8

FillProperty
# Fill
C#
public GradientTexture2D.FillEnum Fill { get; set; }

Sampling-coordinate shape: Linear projects onto FillFrom→FillTo; Radial uses distance from FillFrom; Square uses the maximum axis distance; Conic uses the angle around FillFrom with its zero ray toward FillTo. Defaults to Linear.

FillFromProperty
# FillFrom
C#
public Vector2 FillFrom { get; set; }

Fill origin in normalized texture coordinates, initially (0, 0). It is the center for Radial, Square and Conic. These are not pixel coordinates; the setter does not clamp the vector to 0…1.

FillToProperty
# FillTo
C#
public Vector2 FillTo { get; set; }

Second normalized point, initially (1, 0). Defines the linear-axis end, Radial/Square scale or Conic zero ray. When equal to FillFrom, every pixel samples Gradient.Sample(0), regardless of Repeat.

GradientProperty
# Gradient
C#
public Gradient Gradient { get; set; }

Color source, null in the C# constructor by default. This is a shared reference, not a copy. Gradient changes queue pixel regeneration; GetImage synchronously handles a pending update. Assigning null disconnects the source but does not clear pixels already created.

HeightProperty
# Height
C#
public int Height { get; set; }

Height in pixels, initially 64. Accepted range is 1…16384; the image remains a two-dimensional grid. This resource does not generate mipmaps.

RepeatProperty
# Repeat
C#
public GradientTexture2D.RepeatEnum Repeat { get; set; }

Gradient-coordinate handling outside 0…1: None clamps, Repeat wraps with period 1, Mirror reflects with period 2. Repeat maps an exact coordinate of 1 to 0. This generates the pattern; it is not the sampler-repeat mode for the finished texture.

UseHdrProperty
# UseHdr
C#
public bool UseHdr { get; set; }

False by default: RGBA8 pixels with 0…1 clamping and quantization. True selects RGBAF and retains extended range, including values above 1. This controls texture data format; it does not independently enable glow or HDR window output.

WidthProperty
# Width
C#
public int Width { get; set; }

Width in pixels, initially 64. The setter accepts 1…16384, which does not guarantee available GPU memory. Changing it queues image regeneration.

Methods14

GetFillGradientTexture2D.FillEnum
# GetFill
C#
public GradientTexture2D.FillEnum GetFill();

Returns the value of GradientTexture2D.Fill.

Returns GradientTexture2D.FillEnum

The current GradientTexture2D.Fill value.

GetFillFromVector2
# GetFillFrom
C#
public Vector2 GetFillFrom();

Returns the value of GradientTexture2D.FillFrom.

Returns Vector2

The current GradientTexture2D.FillFrom value.

GetFillToVector2
# GetFillTo
C#
public Vector2 GetFillTo();

Returns the value of GradientTexture2D.FillTo.

Returns Vector2

The current GradientTexture2D.FillTo value.

GetGradientGradient
# GetGradient
C#
public Gradient GetGradient();

Returns the value of GradientTexture2D.Gradient.

Returns Gradient

The current Gradient source, or null when unassigned. This is a shared reference, not a copy.

GetRepeatGradientTexture2D.RepeatEnum
# GetRepeat
C#
public GradientTexture2D.RepeatEnum GetRepeat();

Returns the value of GradientTexture2D.Repeat.

Returns GradientTexture2D.RepeatEnum

The current GradientTexture2D.Repeat value.

IsUsingHdrbool
# IsUsingHdr
C#
public bool IsUsingHdr();

Returns the value of GradientTexture2D.UseHdr.

Returns bool

The current GradientTexture2D.UseHdr value.

SetFillvoid
# SetFill
C#
public void SetFill(GradientTexture2D.FillEnum fill);

Assigns the value of GradientTexture2D.Fill.

Parameters
NameTypeDefault
fillGradientTexture2D.FillEnum—
fill

Linear, Radial, Square or Conic mode.

SetFillFromvoid
# SetFillFrom
C#
public void SetFillFrom(Vector2 fillFrom);

Assigns the value of GradientTexture2D.FillFrom.

Parameters
NameTypeDefault
fillFromVector2—
fillFrom

A normalized origin or center, not a pixel position.

SetFillTovoid
# SetFillTo
C#
public void SetFillTo(Vector2 fillTo);

Assigns the value of GradientTexture2D.FillTo.

Parameters
NameTypeDefault
fillToVector2—
fillTo

A normalized second point defining the axis, scale or zero ray.

SetGradientvoid
# SetGradient
C#
public void SetGradient(Gradient gradient);

Assigns the value of GradientTexture2D.Gradient.

Parameters
NameTypeDefault
gradientGradient—
gradient

A shared Gradient or null. Null does not remove previously generated pixels.

SetHeightvoid
# SetHeight
C#
public void SetHeight(int height);

Assigns the value of GradientTexture2D.Height.

Parameters
NameTypeDefault
heightint—
height

Height in pixels, 1…16384; account for the selected size’s memory cost.

SetRepeatvoid
# SetRepeat
C#
public void SetRepeat(GradientTexture2D.RepeatEnum repeat);

Assigns the value of GradientTexture2D.Repeat.

Parameters
NameTypeDefault
repeatGradientTexture2D.RepeatEnum—
repeat

None, Repeat or Mirror for the generated pattern coordinate.

SetUseHdrvoid
# SetUseHdr
C#
public void SetUseHdr(bool enabled);

Assigns the value of GradientTexture2D.UseHdr.

Parameters
NameTypeDefault
enabledbool—
enabled

True for RGBAF, false for clamped and quantized RGBA8.

SetWidthvoid
# SetWidth
C#
public void SetWidth(int width);

Assigns the value of GradientTexture2D.Width.

Parameters
NameTypeDefault
widthint—
width

Width in pixels, 1…16384; available GPU memory depends on the device.

GradientTexture2D.FillEnum

ValueDescription
Conic = 3

The colors are linearly interpolated in a cone pattern.

Linear = 0

The colors are linearly interpolated in a straight line.

Radial = 1

The colors are linearly interpolated in a circular pattern.

Square = 2

The colors are linearly interpolated in a square pattern.

GradientTexture2D.RepeatEnum

ValueDescription
Mirror = 2

The texture is filled starting from GradientTexture2D.FillFrom to GradientTexture2D.FillTo offsets, mirroring the pattern in both directions.

None = 0

The gradient fill is restricted to the range defined by GradientTexture2D.FillFrom to GradientTexture2D.FillTo offsets.

Repeat = 1

The texture is filled starting from GradientTexture2D.FillFrom to GradientTexture2D.FillTo offsets, repeating the same pattern in both directions.

Reckfell Engine documentationBack to top ↑
QUICK LINKSGetting startedEntity hierarchyC# & .NET 10Scenes and prefabs
Reckfell guides and full API K
reckfellENGINE
RECKFELL ACCOUNT

Sign in

Sign in to your Reckfell account.

One account for the entire Reckfell platform.