class-description NEWS COMMUNITY STORE LABS SIGN UP LOGIN LOGOUT ROKOJORI NEWSLETTER SIGN UP LOGIN LOGOUT NEWS COMMUNITY STORE LABS TOGGLE FULLSCREEN VOLLBILD AN/AUS ObjectRefCountedResourceTexture Texture2D
Texture for 2D and 3D.

A texture works by registering an image in the video hardware, which then can be used in 3D models or 2D Sprite2D or GUI Control.

Textures are often created by loading them from a file. See @GDScript.load.

Texture2D is a base for other resources. It cannot be used directly.

void _draw<>( RID to_canvas_item=, to_canvas_item:RID=, Vector2 pos=, pos:Vector2=, Color modulate=, modulate:Color=, bool transpose=, transpose:bool=, ):void

Called when the entire Texture2D is requested to be drawn over a CanvasItem, with the top-left offset specified in pos. modulate specifies a multiplier for the colors being drawn, while transpose specifies whether drawing should be performed in column-major order instead of row-major order (resulting in 90-degree clockwise rotation).

Note: This is only used in 2D rendering, not 3D.

void _draw_rect<>( RID to_canvas_item=, to_canvas_item:RID=, Rect2 rect=, rect:Rect2=, bool tile=, tile:bool=, Color modulate=, modulate:Color=, bool transpose=, transpose:bool=, ):void

Called when the Texture2D is requested to be drawn onto CanvasItem's specified rect. modulate specifies a multiplier for the colors being drawn, while transpose specifies whether drawing should be performed in column-major order instead of row-major order (resulting in 90-degree clockwise rotation).

Note: This is only used in 2D rendering, not 3D.

void _draw_rect_region<>( RID to_canvas_item=, to_canvas_item:RID=, Rect2 rect=, rect:Rect2=, Rect2 src_rect=, src_rect:Rect2=, Color modulate=, modulate:Color=, bool transpose=, transpose:bool=, bool clip_uv=, clip_uv:bool=, ):void

Called when a part of the Texture2D specified by src_rect's coordinates is requested to be drawn onto CanvasItem's specified rect. modulate specifies a multiplier for the colors being drawn, while transpose specifies whether drawing should be performed in column-major order instead of row-major order (resulting in 90-degree clockwise rotation).

Note: This is only used in 2D rendering, not 3D.

int _get_height<>():int

Called when the Texture2D's height is queried.

int _get_width<>():int

Called when the Texture2D's width is queried.

bool _has_alpha<>():bool

Called when the presence of an alpha channel in the Texture2D is queried.

bool _is_pixel_opaque<>( int x=, x:int=, int y=, y:int=, ):bool

Called when a pixel's opaque state in the Texture2D is queried at the specified (x, y) position.

Resource create_placeholder<>():Resource

Creates a placeholder version of this resource (PlaceholderTexture2D).

void draw<>( RID canvas_item=, canvas_item:RID=, Vector2 position=, position:Vector2=, Color=, Color:=, 1=, 1:=, 1=, 1:=, 1 )=, ):1=, bool transpose=false, transpose:bool=false, ):void

Draws the texture using a CanvasItem with the RenderingServer API at the specified position.

void draw_rect<>( RID canvas_item=, canvas_item:RID=, Rect2 rect=, rect:Rect2=, bool tile=, tile:bool=, Color=, Color:=, 1=, 1:=, 1=, 1:=, 1 )=, ):1=, bool transpose=false, transpose:bool=false, ):void

Draws the texture using a CanvasItem with the RenderingServer API.

void draw_rect_region<>( RID canvas_item=, canvas_item:RID=, Rect2 rect=, rect:Rect2=, Rect2 src_rect=, src_rect:Rect2=, Color=, Color:=, 1=, 1:=, 1=, 1:=, 1 )=, ):1=, bool transpose=false, transpose:bool=false, bool clip_uv=true, clip_uv:bool=true, ):void

Draws a part of the texture using a CanvasItem with the RenderingServer API.

int get_height<>():int

Returns the texture height in pixels.

Image get_image<>():Image

Returns an Image that is a copy of data from this Texture2D (a new Image is created each time). Images can be accessed and manipulated directly.

Note: This will return null if this Texture2D is invalid.

Note: This will fetch the texture data from the GPU, which might cause performance problems when overused.

Vector2 get_size<>():Vector2

Returns the texture size in pixels.

int get_width<>():int

Returns the texture width in pixels.

bool has_alpha<>():bool

Returns true if this Texture2D has an alpha channel.




All social media brands are registrated trademarks and belong to their respective owners.





CONTACT IMPRINT TERMS OF USE PRIVACY © ROKOROJI ® 2021 rokojori.com
CONTACT IMPRINT TERMS OF USE PRIVACY © ROKOROJI ® 2021 rokojori.com
We are using cookies on this site. Read more... Wir benutzen Cookies auf dieser Seite. Mehr lesen...