File: color.rst

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 (45 lines) | stat: -rw-r--r-- 1,537 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
.. include:: ../common.txt

.. highlight:: c

********************************************
  Class Color API exported by pygame.color
********************************************

src_c/color.c
=============

This extension module defines the Python type :py:class:`pygame.Color`.

Header file: src_c/include/pygame.h


.. c:var:: PyTypeObject *pgColor_Type

   The Pygame color object type :py:class:`pygame.Color`.

.. c:function:: int pgColor_Check(PyObject *obj)

   Return true if *obj* is an instance of type pgColor_Type,
   but not a pgColor_Type subclass instance.
   This macro does not check if *obj* is not ``NULL`` or indeed a Python type.

.. c:function:: PyObject* pgColor_New(Uint8 rgba[])

   Return a new :py:class:`pygame.Color` instance for the the four element array *rgba*.
   On failure, raise a Python exception and return ``NULL``.

.. c:function:: PyObject* pgColor_NewLength(Uint8 rgba[], Uint8 length)

   Return a :py:class:`new pygame.Color` instance having *length* elements,
   with element values taken from the first *length* elements of array *rgba*.
   Argument *length* must be between ``1`` and ``4`` inclusive.
   On failure, raise a Python exception and return ``NULL``.

.. c:function int pg_RGBAFromColorObj(PyObject *color, Uint8 rgba[])

   Set the four element array *rgba* to the color represented by object *color*.
   Return ``1`` on success, ``0`` otherwise.
   No Python exceptions are raised.
   This in an extension of :c:func:`pg_RGBAFromObj` optimized for pgColor_Type
   instances.