summaryrefslogtreecommitdiffstats
path: root/doc/classes
diff options
context:
space:
mode:
authorThaddeus Crews <repiteo@outlook.com>2024-11-27 10:47:12 -0600
committerThaddeus Crews <repiteo@outlook.com>2024-11-27 10:47:12 -0600
commit9c300a6c057c809ce093d92fc570010dba84fc05 (patch)
treec673fdde641db7cb07e7e2354675ae701eea6a0c /doc/classes
parentc5cd7c66ee417f6854fb5e36812e870849c46c3e (diff)
parent0cf99cf95d098392d7d1943aac37b12bd831a1d9 (diff)
downloadredot-engine-9c300a6c057c809ce093d92fc570010dba84fc05.tar.gz
Merge pull request #80965 from Calinou/viewport-add-get-stretch-scale-factor
Add a Viewport method to get automatically computed 2D stretch transform
Diffstat (limited to 'doc/classes')
-rw-r--r--doc/classes/Viewport.xml7
-rw-r--r--doc/classes/Window.xml2
2 files changed, 8 insertions, 1 deletions
diff --git a/doc/classes/Viewport.xml b/doc/classes/Viewport.xml
index 678b7690d9..3e772c4e88 100644
--- a/doc/classes/Viewport.xml
+++ b/doc/classes/Viewport.xml
@@ -104,6 +104,13 @@
Returns the transform from the Viewport's coordinates to the screen coordinates of the containing window manager window.
</description>
</method>
+ <method name="get_stretch_transform" qualifiers="const">
+ <return type="Transform2D" />
+ <description>
+ Returns the automatically computed 2D stretch transform, taking the [Viewport]'s stretch settings into account. The final value is multiplied by [member Window.content_scale_factor], but only for the root viewport. If this method is called on a [SubViewport] (e.g., in a scene tree with [SubViewportContainer] and [SubViewport]), the scale factor of the root window will not be applied. Using [method Transform2D.get_scale] on the returned value, this can be used to compensate for scaling when zooming a [Camera2D] node, or to scale down a [TextureRect] to be pixel-perfect regardless of the automatically computed scale factor.
+ [b]Note:[/b] Due to how pixel scaling works, the transform's X scale value may differ slightly from the Y scale, even when [member Window.content_scale_aspect] is set to a mode that preserves pixel aspect ratio. If [member Window.content_scale_aspect] is [constant Window.CONTENT_SCALE_ASPECT_IGNORE], the X value may differ [i]significantly[/i] from Y due to differences between the original aspect ratio and the window aspect ratio.
+ </description>
+ </method>
<method name="get_texture" qualifiers="const">
<return type="ViewportTexture" />
<description>
diff --git a/doc/classes/Window.xml b/doc/classes/Window.xml
index 424941b842..6e833ef25a 100644
--- a/doc/classes/Window.xml
+++ b/doc/classes/Window.xml
@@ -572,7 +572,7 @@
Specifies how the content's aspect behaves when the [Window] is resized. The base aspect is determined by [member content_scale_size].
</member>
<member name="content_scale_factor" type="float" setter="set_content_scale_factor" getter="get_content_scale_factor" default="1.0">
- Specifies the base scale of [Window]'s content when its [member size] is equal to [member content_scale_size].
+ Specifies the base scale of [Window]'s content when its [member size] is equal to [member content_scale_size]. See also [method Viewport.get_stretch_transform].
</member>
<member name="content_scale_mode" type="int" setter="set_content_scale_mode" getter="get_content_scale_mode" enum="Window.ContentScaleMode" default="0">
Specifies how the content is scaled when the [Window] is resized.