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.
Checking the stable version of the documentation...
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à
|
||
|
||
|
||
|
||
resource_local_to_scene |
|
|
|
Metodi
create_from_string(source: String, scale: float = 1.0, saturation: float = 1.0, color_map: Dictionary = {}) static |
|
get_scaled_rid() const |
|
get_source() const |
|
void |
set_size_override(size: Vector2i) |
void |
set_source(source: String) |
Descrizioni delle proprietà
Scala della texture. 1.0 è la dimensione originale dell'SVG. Valori più alti risultano in un'immagine più grande.
Dictionary color_map = {} 🔗
void set_color_map(value: Dictionary)
Dictionary get_color_map()
Se impostato, rimappa i colori della texture in base alla mappa Color-Color.
bool fix_alpha_border = false 🔗
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.
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:
In 2D, a CanvasItemMaterial will need to be created and configured to use the CanvasItemMaterial.BLEND_MODE_PREMULT_ALPHA blend mode on CanvasItems that use this texture. In custom
canvas_itemshaders,render_mode blend_premul_alpha;should be used.In 3D, a BaseMaterial3D will need to be created and configured to use the BaseMaterial3D.BLEND_MODE_PREMULT_ALPHA blend mode on materials that use this texture. In custom
spatialshaders,render_mode blend_premul_alpha;should be used.
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.
Restituisce il RID della texture rasterizzata per corrispondere al sovracampionamento dell'elemento canvas attualmente disegnato.
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.