1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334
|
.. include:: common.txt
:mod:`pygame.sdl2_video`
========================
.. module:: pygame._sdl2.video
:synopsis: Experimental pygame module for porting new SDL video systems
.. warning::
This module isn't ready for prime time yet, it's still in development.
These docs are primarily meant to help the pygame developers and super-early adopters
who are in communication with the developers. This API will change.
| :sl:`Experimental pygame module for porting new SDL video systems`
.. class:: Window
| :sl:`pygame object that represents a window`
| :sg:`Window(title="pygame", size=(640, 480), position=None, fullscreen=False, fullscreen_desktop=False, keywords) -> Window`
.. classmethod:: from_display_module
| :sl:`Creates window using window created by pygame.display.set_mode().`
| :sg:`from_display_module() -> Window`
.. attribute:: grab
| :sl:`Gets or sets whether the mouse is confined to the window.`
| :sg:`grab -> bool`
.. attribute:: relative_mouse
| :sl:`Gets or sets the window's relative mouse motion state.`
| :sg:`relative_mouse -> bool`
.. method:: set_windowed
| :sl:`Enable windowed mode (exit fullscreen).`
| :sg:`set_windowed() -> None`
.. method:: set_fullscreen
| :sl:`Enter fullscreen.`
| :sg:`set_fullscreen(desktop=False) -> None`
.. attribute:: title
| :sl:`Gets or sets whether the window title.`
| :sg:`title -> string`
.. method:: destroy
| :sl:`Destroys the window.`
| :sg:`destroy() -> None`
.. method:: hide
| :sl:`Hide the window.`
| :sg:`hide() -> None`
.. method:: show
| :sl:`Show the window.`
| :sg:`show() -> None`
.. method:: focus
| :sl:`Raise the window above other windows and set the input focus. The "input_only" argument is only supported on X11.`
| :sg:`focus(input_only=False) -> None`
.. method:: restore
| :sl:`Restore the size and position of a minimized or maximized window.`
| :sg:`restore() -> None`
.. method:: maximize
| :sl:`Maximize the window.`
| :sg:`maximize() -> None`
.. method:: minimize
| :sl:`Minimize the window.`
| :sg:`maximize() -> None`
.. attribute:: resizable
| :sl:`Gets and sets whether the window is resizable.`
| :sg:`resizable -> bool`
.. attribute:: borderless
| :sl:`Add or remove the border from the window.`
| :sg:`borderless -> bool`
.. method:: set_icon
| :sl:`Set the icon for the window.`
| :sg:`set_icon(surface) -> None`
.. attribute:: id
| :sl:`Get the unique window ID. *Read-only*`
| :sg:`id -> int`
.. attribute:: size
| :sl:`Gets and sets the window size.`
| :sg:`size -> (int, int)`
.. attribute:: position
| :sl:`Gets and sets the window position.`
| :sg:`position -> (int, int) or WINDOWPOS_CENTERED or WINDOWPOS_UNDEFINED`
.. attribute:: opacity
| :sl:`Gets and sets the window opacity. Between 0.0 (fully transparent) and 1.0 (fully opaque).`
| :sg:`opacity -> float`
.. attribute:: brightness
| :sl:`Gets and sets the brightness (gamma multiplier) for the display that owns the window.`
| :sg:`brightness -> float`
.. attribute:: display_index
| :sl:`Get the index of the display that owns the window. *Read-only*`
| :sg:`display_index -> int`
.. method:: set_modal_for
| :sl:`Set the window as a modal for a parent window. This function is only supported on X11.`
| :sg:`set_modal_for(Window) -> None`
.. class:: Texture
| :sl:`pygame object that representing a Texture.`
| :sg:`Texture(renderer, size, depth=0, static=False, streaming=False, target=False) -> Texture`
.. staticmethod:: from_surface
| :sl:`Create a texture from an existing surface.`
| :sg:`from_surface(renderer, surface) -> Texture`
.. attribute:: renderer
| :sl:`Gets the renderer associated with the Texture. *Read-only*`
| :sg:`renderer -> Renderer`
.. attribute:: width
| :sl:`Gets the width of the Texture. *Read-only*`
| :sg:`width -> int`
.. attribute:: height
| :sl:`Gets the height of the Texture. *Read-only*`
| :sg:`height -> int`
.. attribute:: alpha
| :sl:`Gets and sets an additional alpha value multiplied into render copy operations.`
| :sg:`alpha -> int`
.. attribute:: blend_mode
| :sl:`Gets and sets the blend mode for the Texture.`
| :sg:`blend_mode -> int`
.. attribute:: color
| :sl:`Gets and sets an additional color value multiplied into render copy operations.`
| :sg:`color -> color`
.. method:: get_rect
| :sl:`Get the rectangular area of the texture.`
| :sg:`get_rect(**kwargs) -> Rect`
.. method:: draw
| :sl:`Copy a portion of the texture to the rendering target.`
| :sg:`draw(srcrect=None, dstrect=None, angle=0, origin=None, flipX=False, flipY=False) -> None`
.. method:: update
| :sl:`Update the texture with a Surface. WARNING: Slow operation, use sparingly.`
| :sg:`update(surface, area=None) -> None`
.. class:: Image
| :sl:`Easy way to use a portion of a Texture without worrying about srcrect all the time.`
| :sg:`Image(textureOrImage, srcrect=None) -> Image`
.. method:: get_rect
| :sl:`Get the rectangular area of the Image.`
| :sg:`get_rect() -> Rect`
.. method:: draw
| :sl:`Copy a portion of the Image to the rendering target.`
| :sg:`draw(srcrect=None, dstrect=None) -> None`
.. attribute:: angle
| :sl:`Gets and sets the angle the Image draws itself with.`
| :sg:`angle -> float`
.. attribute:: origin
| :sl:`Gets and sets the origin. Origin=None means the Image will be rotated around its center.`
| :sg:`origin -> (float, float) or None.`
.. attribute:: flipX
| :sl:`Gets and sets whether the Image is flipped on the x axis.`
| :sg:`flipX -> bool`
.. attribute:: flipY
| :sl:`Gets and sets whether the Image is flipped on the y axis.`
| :sg:`flipY -> bool`
.. attribute:: color
| :sl:`Gets and sets the Image color modifier.`
| :sg:`color -> Color`
.. attribute:: alpha
| :sl:`Gets and sets the Image alpha modifier.`
| :sg:`alpha -> float`
.. attribute:: blend_mode
| :sl:`Gets and sets the blend mode for the Image.`
| :sg:`blend_mode -> int`
.. attribute:: texture
| :sl:`Gets and sets the Texture the Image is based on.`
| :sg:`texture -> Texture`
.. attribute:: srcrect
| :sl:`Gets and sets the Rect the Image is based on.`
| :sg:`srcrect -> Rect`
.. class:: Renderer
| :sl:`Create a 2D rendering context for a window.`
| :sg:`Renderer(window, index=-1, accelerated=-1, vsync=False, target_texture=False) -> Renderer`
.. classmethod:: from_window
| :sl:`Easy way to create a Renderer.`
| :sg:`from_window(window) -> Renderer`
.. attribute:: draw_blend_mode
| :sl:`Gets and sets the blend mode used by the drawing functions.`
| :sg:`draw_blend_mode -> int`
.. attribute:: draw_color
| :sl:`Gets and sets the color used by the drawing functions.`
| :sg:`draw_color -> Color`
.. method:: clear
| :sl:`Clear the current rendering target with the drawing color.`
| :sg:`clear() -> None`
.. method:: present
| :sl:`Updates the screen with any new rendering since previous call.`
| :sg:`present() -> None`
.. method:: get_viewport
| :sl:`Returns the drawing area on the target.`
| :sg:`get_viewport() -> Rect`
.. method:: set_viewport
| :sl:`Set the drawing area on the target. If area is None, the entire target will be used.`
| :sg:`set_viewport(area) -> None`
.. attribute:: logical_size
| :sl:`Gets and sets the logical size.`
| :sg:`logical_size -> (int width, int height)`
.. attribute:: scale
| :sl:`Gets and sets the scale.`
| :sg:`scale -> (float x_scale, float y_scale)`
.. attribute:: target
| :sl:`Gets and sets the render target. None represents the default target (the renderer).`
| :sg:`target -> Texture or None`
.. method:: blit
| :sl:`For compatibility purposes. Textures created by different Renderers cannot be shared!`
| :sg:`blit(soure, dest, area=None, special_flags=0)-> Rect`
.. method:: draw_line
| :sl:`Draws a line.`
| :sg:`draw_line(p1, p2) -> None`
.. method:: draw_point
| :sl:`Draws a point.`
| :sg:`draw_point(point) -> None`
.. method:: draw_rect
| :sl:`Draws a rectangle.`
| :sg:`draw_rect(rect)-> None`
.. method:: fill_rect
| :sl:`Fills a rectangle.`
| :sg:`fill_rect(rect)-> None`
.. method:: to_surface
| :sl:`Read pixels from current render target and create a pygame.Surface. WARNING: Slow operation, use sparingly.`
| :sg:`to_surface(surface=None, area=None)-> Surface`
|