DPITexture

Experimental: This class may be changed or removed in future versions.

Inherits:Texture2D<Texture<Resource<RefCounted<Object

An automatically scalableTexture2D based on an SVG image.

Description

An automatically scalableTexture2D based on an SVG image.DPITextures are used to automatically re-rasterize icons and other texture based UI theme elements to match viewport scale and font oversampling. See alsoProjectSettings.display/window/stretch/mode ("canvas_items" mode) andViewport.oversampling_override.

Properties

float

base_scale

1.0

Dictionary

color_map

{}

bool

resource_local_to_scene

false (overridesResource)

float

saturation

1.0

Methods

DPITexture

create_from_string(source:String, scale:float = 1.0, saturation:float = 1.0, color_map:Dictionary = {})static

RID

get_scaled_rid()const

String

get_source()const

void

set_size_override(size:Vector2i)

void

set_source(source:String)


Property Descriptions

floatbase_scale =1.0🔗

Texture scale.1.0 is the original SVG size. Higher values result in a larger image.


Dictionarycolor_map ={}🔗

If set, remaps texture colors according toColor-Color map.


floatsaturation =1.0🔗

Overrides texture saturation.


Method Descriptions

DPITexturecreate_from_string(source:String, scale:float = 1.0, saturation:float = 1.0, color_map:Dictionary = {})static🔗

Creates a newDPITexture and initializes it by allocating and setting the SVG data from string.


RIDget_scaled_rid()const🔗

Returns theRID of the texture rasterized to match the oversampling of the currently drawn canvas item.


Stringget_source()const🔗

Returns SVG source code.


voidset_size_override(size:Vector2i)🔗

Resizes the texture to the specified dimensions.


voidset_source(source:String)🔗

Sets SVG source code.


User-contributed notes

Please read theUser-contributed notes policy before submitting a comment.