File: surflock.rst.txt

package info (click to toggle)
pygame 2.1.2%2Bdfsg-5
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 32,416 kB
  • sloc: ansic: 66,042; python: 46,176; javascript: 9,214; objc: 273; sh: 78; makefile: 56; cpp: 25
file content (82 lines) | stat: -rw-r--r-- 2,725 bytes parent folder | download | duplicates (4)
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
.. include:: ../common.txt

.. highlight:: c

***********************************
  API exported by pygame.surflock
***********************************

src_c/surflock.c
================

This extension module implements SDL surface locking for the
:py:class:`pygame.Surface` type.

Header file: src_c/include/pygame.h


.. c:type:: pgLifetimeLockObject

   .. c:member:: PyObject *surface

      An SDL locked pygame surface.

   .. c:member:: PyObject *lockobj

      The Python object which owns the lock on the surface.
      This field does not own a reference to the object.

   The lifetime lock type instance.
   A lifetime lock pairs a locked pygame surface with
   the Python object that locked the surface for modification.
   The lock is removed automatically when the lifetime lock instance
   is garbage collected.

.. c:var:: PyTypeObject *pgLifetimeLock_Type

   The pygame internal surflock lifetime lock object type.

.. c:function:: int pgLifetimeLock_Check(PyObject *x)

   Return true if Python object *x* is a :c:data:`pgLifetimeLock_Type` instance,
   false otherwise.
   This will return false on :c:data:`pgLifetimeLock_Type` subclass instances as well.

.. c:function:: void pgSurface_Prep(pgSurfaceObject *surfobj)

   If *surfobj* is a subsurface, then lock the parent surface with *surfobj*
   the owner of the lock.

.. c:function:: void pgSurface_Unprep(pgSurfaceObject *surfobj)

   If *surfobj* is a subsurface, then release its lock on the parent surface.

.. c:function:: int pgSurface_Lock(pgSurfaceObject *surfobj)

   Lock pygame surface *surfobj*, with *surfobj* owning its own lock.

.. c:function:: int pgSurface_LockBy(pgSurfaceObject *surfobj, PyObject *lockobj)

   Lock pygame surface *surfobj* with Python object *lockobj* the owning
   the lock.

   The surface will keep a weak reference to object *lockobj*,
   and eventually remove the lock on itself if *lockobj* is garbage collected.
   However, it is best if *lockobj* also keep a reference to the locked surface
   and call to :c:func:`pgSurface_UnLockBy` when finished with the surface.

.. c:function:: int pgSurface_UnLock(pgSurfaceObject *surfobj)

   Remove the pygame surface *surfobj* object's lock on itself.

.. c:function:: int pgSurface_UnLockBy(pgSurfaceObject *surfobj, PyObject *lockobj)

   Remove the lock on pygame surface *surfobj* owned by Python object *lockobj*.

.. c:function:: PyObject *pgSurface_LockLifetime(PyObject *surfobj, PyObject *lockobj)

   Lock pygame surface *surfobj* for Python object *lockobj* and return a
   new :c:data:`pgLifetimeLock_Type` instance for the lock.

   This function is not called anywhere within pygame.
   It and pgLifetimeLock_Type are candidates for removal.