Attention: Here be dragons

This is the latest (unstable) version of this documentation, which may document features not available in or compatible with released stable versions of Godot.

DPITexture

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

Eredita: Texture2D < Texture < Resource < RefCounted < Object

Una Texture2D automaticamente ridimensionabile basata su un immagine SVG.

Descrizione

Una Texture2D automaticamente ridimensionabile basata su un immagine SVG. Le DPITexture servono per ri-rasterizzare automaticamente icone e altri elementi del tema dell'interfaccia utente basati sulle texture, in modo che corrispondano alla scala della viewport e al sovracampionamento dei font. Vedi anche ProjectSettings.display/window/stretch/mode (modalità "canvas_items") e Viewport.oversampling_override.

Proprietà

float

base_scale

1.0

Dictionary

color_map

{}

bool

fix_alpha_border

false

bool

premult_alpha

false

bool

resource_local_to_scene

false (overrides Resource)

float

saturation

1.0

Metodi

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)


Descrizioni delle proprietà

float base_scale = 1.0 🔗

  • void set_base_scale(value: float)

  • float get_base_scale()

Scala della texture. 1.0 è la dimensione originale dell'SVG. Valori più alti risultano in un'immagine più grande.


Dictionary color_map = {} 🔗

Se impostato, rimappa i colori della texture in base alla mappa Color-Color.


bool fix_alpha_border = false 🔗

  • void set_fix_alpha_border(value: bool)

  • bool get_fix_alpha_border()

Se true, inserisce pixel dello stesso colore circostante in transizione dalle aree trasparenti alle aree opache. Per le texture visualizzate con il filtro bilineare, questo aiuta a ridurre l'effetto contorno quando si esportano immagini da un editor di immagini.


bool premult_alpha = false 🔗

  • void set_premult_alpha(value: bool)

  • bool get_premult_alpha()

An alternative to fixing darkened borders with fix_alpha_border is to use premultiplied alpha. By enabling this option, the texture will be converted to this format. A premultiplied alpha texture requires specific materials to be displayed correctly:


float saturation = 1.0 🔗

  • void set_saturation(value: float)

  • float get_saturation()

Sostituisce la saturazione della texture.


Descrizioni dei metodi

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

Creates a new DPITexture and initializes it by allocating and setting the SVG data to source.


RID get_scaled_rid() const 🔗

Restituisce il RID della texture rasterizzata per corrispondere al sovracampionamento dell'elemento canvas attualmente disegnato.


String get_source() const 🔗

Returns this SVG texture's source code.


void set_size_override(size: Vector2i) 🔗

Ridimensiona la texture alle dimensioni specificate.


void set_source(source: String) 🔗

Sets this SVG texture's source code.