@@ -15,6 +15,12 @@ class BackgroundTexture:
1515
1616 The Mat3s define the scaling, rotation, and translation of the pixel data in the texture.
1717 see background_fs.glsl in resources/shaders for an implementation of this.
18+
19+ Args:
20+ texture: The texture to use as the background.
21+ offset: The offset of the texture in pixels.
22+ scale: The scale of the texture.
23+ angle: The angle of the texture in radians.
1824 """
1925
2026 def __init__ (
@@ -41,6 +47,10 @@ def pixel_transform(self):
4147
4248 @property
4349 def scale (self ) -> float :
50+ """
51+ Get or set the scale of the texture. This is a multiplier on the size of the texture.
52+ Default value is ``1.0``.
53+ """
4454 return self ._scale
4555
4656 @scale .setter
@@ -50,6 +60,10 @@ def scale(self, value: float):
5060
5161 @property
5262 def angle (self ) -> float :
63+ """
64+ Get or set the angle of the texture. This is a rotation in radians.
65+ Default value is ``0.0``.
66+ """
5367 return self ._angle
5468
5569 @angle .setter
@@ -59,6 +73,10 @@ def angle(self, value: float):
5973
6074 @property
6175 def offset (self ) -> tuple [float , float ]:
76+ """
77+ Get or set the offset of the texture. This is a translation in pixels.
78+ Default value is ``(0.0, 0.0)``.
79+ """
6280 return self ._offset
6381
6482 @offset .setter
@@ -134,6 +152,17 @@ def render_target(
134152 color_attachments : list [gl .Texture2D ] | None = None ,
135153 depth_attachment : gl .Texture2D | None = None ,
136154 ) -> gl .Framebuffer :
155+ """
156+ Create a framebuffer for the texture.
157+
158+ This framebuffer is used to render to the texture. The framebuffer is created with the
159+ texture as the color attachment.
160+
161+ Args:
162+ context: The context to use for the framebuffer.
163+ color_attachments: The color attachments to use for the framebuffer."
164+ depth_attachment: The depth attachment to use for the framebuffer."
165+ """
137166 if color_attachments is None :
138167 color_attachments = []
139168 return context .framebuffer (
@@ -149,6 +178,19 @@ def from_file(
149178 angle : float = 0.0 ,
150179 filters = (gl .NEAREST , gl .NEAREST ),
151180 ):
181+ """ "
182+ Create a BackgroundTexture from a file.
183+ This is a convenience function to create a BackgroundTexture from a file.
184+
185+ The file is loaded using PIL and converted to a texture.
186+
187+ Args:
188+ tex_src: The file to load.
189+ offset: The offset of the texture in pixels.
190+ scale: The scale of the texture.
191+ angle: The angle of the texture in radians.
192+ filters: The filters to use for the texture.
193+ """
152194 _context = get_window ().ctx
153195
154196 with Image .open (resolve (tex_src )).convert ("RGBA" ) as img :
0 commit comments