reckfellENGINE

DpiTexture

SVG texture for scalable UI.

On this page
class DpiTextureReckfellSharpInherits Texture2D

DpiTexture stores SVG and creates raster variants for scalable UI. It is a resource for icons and other vector elements, rather than a general SVG document with a browser API. BaseScale sets base resolution; SetSizeOverride changes only logical size. Drawing can use variants for current CanvasItem oversampling.

Edit palettes through a copy: Duplicate the dictionary before editing, then SetColorMap with the changed copy. Mutating shared ColorMap in place does not refresh the internal palette. PremultAlpha requires matching material blending. For plugins, see SVG preparation and import.

Source, scale, palette and flags are stored with the resource; logical size override is not saved. Resource operations and pixel values were checked in Windows Forward+/Vulkan. Drawing at different oversampling levels, manual DPI/theme switching and visual edge acceptance were not established here.

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

Constructors1

DpiTextureConstructor
# DpiTexture
C#
public DpiTexture();

Creates an empty resource: source is empty, BaseScale and Saturation are 1, flags are disabled and the palette is empty. Set valid SVG through SetSource before requesting dimensions, an image or RID. Construction alone does not produce a usable icon.

Properties6

BaseScaleProperty
# BaseScale
C#
public float BaseScale { get; set; }

Base SVG rasterization multiplier; defaults to 1. A value of 2 produces twice as many pixels per axis and changes the natural texture size. Supply a finite positive value. The inspector hint 0.01…10 does not clamp the setter to that range. Changing it invalidates caches.

ColorMapProperty
# ColorMap
C#
public Reckfell.Collections.Dictionary ColorMap { get; set; }

Color → Color replacement dictionary; empty by default. Do not edit the returned dictionary in place: stored contents can change without refreshing the internal palette or image. Duplicate the dictionary first, edit the copy, then assign it back. The setter skips dictionaries with equal contents. This is not an automatic editor theme.

FixAlphaBorderProperty
# FixAlphaBorder
C#
public bool FixAlphaBorder { get; set; }

Defaults to false. Before GPU upload, fixes RGB in transparent edge pixels using neighboring colors. It can reduce dark fringes under filtering; it does not add an opaque outline or guarantee repair of every image. Changing it invalidates caches.

PremultAlphaProperty
# PremultAlpha
C#
public bool PremultAlpha { get; set; }

Defaults to false. Rasterization multiplies RGB by alpha while preserving alpha itself. Use matching blending, such as CanvasItemMaterial.BlendModeEnum.PremultAlpha or blend_premul_alpha in a canvas_item shader. This transforms pixel data; it does not enable material transparency.

SaturationProperty
# Saturation
C#
public float Saturation { get; set; }

Saturation multiplier; defaults to 1, while 0 produces grayscale. The setter does not clamp to the inspector hint range 0…1. Use finite values in 0…1 for ordinary UI. Changing it invalidates image caches.

_SourceProperty
# _Source
C#
public string _Source { get; set; }

Internal stored SVG-source property connected to SetSource/GetSource. Use those methods in ordinary code. It contains text, not a URI; changing it causes the same cache invalidation. This is not a separate second image source.

Methods15

CreateFromStringDpiTexture
# CreateFromString
C#
public static DpiTexture CreateFromString(string source, float scale = 1f, float saturation = 1f, Reckfell.Collections.Dictionary colorMap = null);

Creates a separate DpiTexture and sets SVG, scale, saturation and palette. This is not SVG syntax validation: rasterization is lazy when an image, dimensions or RID are requested. The factory returns no Error. Supply valid SVG and a finite positive scale.

Parameters
NameTypeDefault
sourcestring—
scalefloat1f
saturationfloat1f
colorMapReckfell.Collections.Dictionarynull
source

Valid SVG text, not a file path.

scale

Finite positive base scale; defaults to 1.

saturation

Finite saturation multiplier; defaults to 1.

colorMap

Optional Color → Color dictionary; null uses an empty one. Do not mutate the shared dictionary after assignment.

Returns DpiTexture

New resource; the caller owns its reference. Construction does not prove SVG validity.

GetBaseScalefloat
# GetBaseScale
C#
public float GetBaseScale();

Returns BaseScale. Base SVG rasterization multiplier; defaults to 1. A value of 2 produces twice as many pixels per axis and changes the natural texture size. Supply a finite positive value. The inspector hint 0.01…10 does not clamp the setter to that range. Changing it invalidates caches.

Returns float

Current base multiplier; defaults to 1.

GetColorMapReckfell.Collections.Dictionary
# GetColorMap
C#
public Reckfell.Collections.Dictionary GetColorMap();

Returns ColorMap. Color → Color replacement dictionary; empty by default. Do not edit the returned dictionary in place: stored contents can change without refreshing the internal palette or image. Duplicate the dictionary first, edit the copy, then assign it back. The setter skips dictionaries with equal contents. This is not an automatic editor theme.

Returns Reckfell.Collections.Dictionary

Shared replacement dictionary; copy before editing.

GetFixAlphaBorderbool
# GetFixAlphaBorder
C#
public bool GetFixAlphaBorder();

Returns FixAlphaBorder. Defaults to false. Before GPU upload, fixes RGB in transparent edge pixels using neighboring colors. It can reduce dark fringes under filtering; it does not add an opaque outline or guarantee repair of every image. Changing it invalidates caches.

Returns bool

Current alpha-edge-fixing state.

GetPremultAlphabool
# GetPremultAlpha
C#
public bool GetPremultAlpha();

Returns PremultAlpha. Defaults to false. Rasterization multiplies RGB by alpha while preserving alpha itself. Use matching blending, such as CanvasItemMaterial.BlendModeEnum.PremultAlpha or blend_premul_alpha in a canvas_item shader. This transforms pixel data; it does not enable material transparency.

Returns bool

Current RGB-by-alpha multiplication state.

GetSaturationfloat
# GetSaturation
C#
public float GetSaturation();

Returns Saturation. Saturation multiplier; defaults to 1, while 0 produces grayscale. The setter does not clamp to the inspector hint range 0…1. Use finite values in 0…1 for ordinary UI. Changing it invalidates image caches.

Returns float

Current saturation multiplier; defaults to 1.

GetScaledRidRid
# GetScaledRid
C#
public Rid GetScaledRid();

Returns the RID variant for the currently drawn CanvasItem oversampling. Outside drawing, oversampling = 0 falls back to base scale 1. The resource owns the handle: do not free it manually or treat it as stable after texture changes. This method does not set window or editor scale.

Returns Rid

Borrowed RID for the current variant, or the base RID outside drawing.

GetSourcestring
# GetSource
C#
public string GetSource();

Returns stored SVG text rather than a file path or raster pixels. Reading the string does not prove rasterization succeeded.

Returns string

Stored SVG string; it can be empty on a new resource.

SetBaseScalevoid
# SetBaseScale
C#
public void SetBaseScale(float baseScale);

Sets BaseScale. Base SVG rasterization multiplier; defaults to 1. A value of 2 produces twice as many pixels per axis and changes the natural texture size. Supply a finite positive value. The inspector hint 0.01…10 does not clamp the setter to that range. Changing it invalidates caches.

Parameters
NameTypeDefault
baseScalefloat—
baseScale

Finite positive rasterization multiplier.

SetColorMapvoid
# SetColorMap
C#
public void SetColorMap(Reckfell.Collections.Dictionary colorMap);

Sets ColorMap. Color → Color replacement dictionary; empty by default. Do not edit the returned dictionary in place: stored contents can change without refreshing the internal palette or image. Duplicate the dictionary first, edit the copy, then assign it back. The setter skips dictionaries with equal contents. This is not an automatic editor theme.

Parameters
NameTypeDefault
colorMapReckfell.Collections.Dictionary—
colorMap

Color → Color dictionary; edit a separate copy before assignment.

SetFixAlphaBordervoid
# SetFixAlphaBorder
C#
public void SetFixAlphaBorder(bool fixAlphaBorder);

Sets FixAlphaBorder. Defaults to false. Before GPU upload, fixes RGB in transparent edge pixels using neighboring colors. It can reduce dark fringes under filtering; it does not add an opaque outline or guarantee repair of every image. Changing it invalidates caches.

Parameters
NameTypeDefault
fixAlphaBorderbool—
fixAlphaBorder

Enable RGB fixing at transparent edges.

SetPremultAlphavoid
# SetPremultAlpha
C#
public void SetPremultAlpha(bool premultAlpha);

Sets PremultAlpha. Defaults to false. Rasterization multiplies RGB by alpha while preserving alpha itself. Use matching blending, such as CanvasItemMaterial.BlendModeEnum.PremultAlpha or blend_premul_alpha in a canvas_item shader. This transforms pixel data; it does not enable material transparency.

Parameters
NameTypeDefault
premultAlphabool—
premultAlpha

Multiply RGB by alpha during rasterization.

SetSaturationvoid
# SetSaturation
C#
public void SetSaturation(float saturation);

Sets Saturation. Saturation multiplier; defaults to 1, while 0 produces grayscale. The setter does not clamp to the inspector hint range 0…1. Use finite values in 0…1 for ordinary UI. Changing it invalidates image caches.

Parameters
NameTypeDefault
saturationfloat—
saturation

Finite multiplier; use 0…1 for ordinary UI.

SetSizeOverridevoid
# SetSizeOverride
C#
public void SetSizeOverride(Vector2I size);

Sets logical dimensions without rerasterizing SVG. A 16×16 SVG at BaseScale = 2 produces a 32×32 image; overriding to 48×24 changes GetWidth/GetHeight to 48×24 while GetImage remains 32×32. Zero restores the natural size on that axis; Vector2I.Zero clears the override. Supply nonnegative components. The override is not stored as a resource property. Use BaseScale to increase resolution.

Parameters
NameTypeDefault
sizeVector2I—
size

Nonnegative logical dimensions; 0 restores the natural size on that axis.

SetSourcevoid
# SetSource
C#
public void SetSource(string source);

Replaces SVG source and invalidates image, RID and alpha-test caches; an identical string causes no update. Supply SVG text, not a asset:// path. This void method returns no syntax error; failure can appear during subsequent rasterization.

Parameters
NameTypeDefault
sourcestring—
source

Valid SVG source text.

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.