Skip to content

Commit 9fdd47d

Browse files
authored
Merge pull request #2049 from VantaTree/main
added consistent dest_surface description in transform.rst
2 parents a47efab + 2ad1afd commit 9fdd47d

File tree

1 file changed

+47
-12
lines changed

1 file changed

+47
-12
lines changed

docs/reST/ref/transform.rst

Lines changed: 47 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,13 @@ Instead, always begin with the original image and scale to the desired size.)
4242
Resizes the Surface to a new size, given as (width, height).
4343
This is a fast scale operation that does not sample the results.
4444

45-
An optional destination surface can be used, rather than have it create a
46-
new one. This is quicker if you want to repeatedly scale something. However
47-
the destination must be the same size as the size (width, height) passed in. Also
48-
the destination surface must be the same format.
45+
An optional destination surface can be passed which is faster than creating a new
46+
Surface. This destination surface must be the same as the size (width, height) passed
47+
in, and the same depth and format as the source Surface.
48+
49+
.. versionchanged:: 2.3.0 internal scaling algorithm was replaced with a nearly
50+
equivalent one that is 40% faster. Scale results will be very slightly
51+
different.
4952

5053
.. versionchanged:: 2.3.0 internal scaling algorithm was replaced with a nearly
5154
equivalent one that is 40% faster. Scale results will be very slightly
@@ -65,6 +68,10 @@ Instead, always begin with the original image and scale to the desired size.)
6568
separately. For example, :code:`transform.scale_by(surf, (2, 1))` doubles
6669
the image width but keeps the height the same.
6770

71+
An optional destination surface can be passed which is faster than creating a new
72+
Surface. This destination surface must have the scaled dimensions
73+
(width * factor, height * factor) and same depth and format as the source Surface.
74+
6875
.. versionadded:: 2.1.3
6976

7077
.. ## pygame.transform.scale_by ##
@@ -110,11 +117,10 @@ Instead, always begin with the original image and scale to the desired size.)
110117
This really only has an effect on simple images with solid colors. On
111118
photographic and antialiased images it will look like a regular unfiltered
112119
scale.
113-
114-
An optional destination surface can be used, rather than have it create a
115-
new one. This is quicker if you want to repeatedly scale something. However
116-
the destination must be twice the size of the source surface passed in. Also
117-
the destination surface must be the same format.
120+
121+
An optional destination surface can be passed which is faster than creating a new
122+
Surface. This destination surface must have double the dimensions
123+
(width * 2, height * 2) and same depth and format as the source Surface.
118124

119125
.. ## pygame.transform.scale2x ##
120126
@@ -132,6 +138,10 @@ Instead, always begin with the original image and scale to the desired size.)
132138
surfaces. An exception will be thrown if the input surface bit depth is less
133139
than 24.
134140

141+
An optional destination surface can be passed which is faster than creating a new
142+
Surface. This destination surface must be the same as the size (width, height) passed
143+
in, and the same depth and format as the source Surface.
144+
135145
.. versionadded:: 1.8
136146

137147
.. ## pygame.transform.smoothscale ##
@@ -149,6 +159,10 @@ Instead, always begin with the original image and scale to the desired size.)
149159
:code:`transform.smoothscale_by(surf, (2, 1))` doubles the image width but
150160
keeps the height the same.
151161

162+
An optional destination surface can be passed which is faster than creating a new
163+
Surface. This destination surface must have the scaled dimensions
164+
(width * factor, height * factor) and same depth and format as the source Surface.
165+
152166
.. versionadded:: 2.1.3
153167

154168
.. ## pygame.transform.smoothscale_by ##
@@ -204,6 +218,10 @@ Instead, always begin with the original image and scale to the desired size.)
204218
205219
Finds the edges in a surface using the laplacian algorithm.
206220

221+
An optional destination surface can be passed which is faster than creating a new
222+
Surface. This destination surface must have the same dimensions (width, height) and
223+
depth as the source Surface.
224+
207225
.. versionadded:: 1.8
208226

209227
.. ## pygame.transform.laplacian ##
@@ -218,6 +236,10 @@ Instead, always begin with the original image and scale to the desired size.)
218236
This function does not work for indexed surfaces.
219237
An exception will be thrown if the input is an indexed surface.
220238

239+
An optional destination surface can be passed which is faster than creating a new
240+
Surface. This destination surface must have the same dimensions (width, height) and
241+
depth and format as the source Surface.
242+
221243
.. versionadded:: 2.2.0
222244

223245
.. ## pygame.transform.box_blur ##
@@ -233,6 +255,10 @@ Instead, always begin with the original image and scale to the desired size.)
233255
This function does not work for indexed surfaces.
234256
An exception will be thrown if the input is an indexed surface.
235257

258+
An optional destination surface can be passed which is faster than creating a new
259+
Surface. This destination surface must have the same dimensions (width, height) and
260+
depth and format as the source Surface.
261+
236262
.. versionadded:: 2.2.0
237263

238264
.. ## pygame.transform.gaussian_blur ##
@@ -252,6 +278,10 @@ Instead, always begin with the original image and scale to the desired size.)
252278
Note, this function currently does not handle palette using surfaces
253279
correctly.
254280

281+
An optional destination surface can be passed which is faster than creating a new
282+
Surface. This destination surface must have the same dimensions (width, height) and
283+
depth as the first passed source Surface.
284+
255285
.. versionadded:: 1.8
256286
.. versionadded:: 1.9 ``palette_colors`` argument
257287

@@ -275,7 +305,11 @@ Instead, always begin with the original image and scale to the desired size.)
275305
| :sl:`inverts the RGB elements of a surface`
276306
| :sg:`average_color(surface, dest_surface=None) -> Surface`
277307
278-
Inverts each RGB pixel contained within the Surface, does not affect alpha channel. Can also be used with a destination Surface.
308+
Inverts each RGB pixel contained within the Surface, does not affect alpha channel.
309+
310+
An optional destination surface can be passed which is faster than creating a new
311+
Surface. This destination surface must have the same dimensions (width, height) and
312+
depth as the source Surface.
279313

280314
.. versionadded:: 2.2.0
281315

@@ -288,8 +322,9 @@ Instead, always begin with the original image and scale to the desired size.)
288322
289323
Returns a grayscaled version of the original surface using the luminosity formula which weights red, green and blue according to their wavelengths.
290324

291-
An optional destination surface can be passed which is faster than creating a new Surface.
292-
This destination surface must have the same dimensions (width, height) and depth as the source Surface.
325+
An optional destination surface can be passed which is faster than creating a new
326+
Surface. This destination surface must have the same dimensions (width, height) and
327+
depth as the source Surface.
293328

294329
.. versionadded:: 2.1.4
295330

0 commit comments

Comments
 (0)