Remove virtual environment from git tracking
This commit is contained in:
parent
18ff38fe47
commit
68b3c03423
@ -1,21 +0,0 @@
|
||||
#define NO_PYGAME_C_API
|
||||
#include "_surface.h"
|
||||
|
||||
/* The structure passed to the low level blit functions */
|
||||
typedef struct {
|
||||
int width;
|
||||
int height;
|
||||
Uint8 *s_pixels;
|
||||
int s_pxskip;
|
||||
int s_skip;
|
||||
Uint8 *d_pixels;
|
||||
int d_pxskip;
|
||||
int d_skip;
|
||||
SDL_PixelFormat *src;
|
||||
SDL_PixelFormat *dst;
|
||||
Uint8 src_blanket_alpha;
|
||||
int src_has_colorkey;
|
||||
Uint32 src_colorkey;
|
||||
SDL_BlendMode src_blend;
|
||||
SDL_BlendMode dst_blend;
|
||||
} SDL_BlitInfo;
|
@ -1,26 +0,0 @@
|
||||
/*
|
||||
pygame - Python Game Library
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
*/
|
||||
|
||||
#ifndef _CAMERA_H
|
||||
#define _CAMERA_H
|
||||
|
||||
#include "_pygame.h"
|
||||
#include "camera.h"
|
||||
|
||||
#endif
|
@ -1,374 +0,0 @@
|
||||
/*
|
||||
pygame - Python Game Library
|
||||
Copyright (C) 2000-2001 Pete Shinners
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
Pete Shinners
|
||||
pete@shinners.org
|
||||
*/
|
||||
|
||||
/* This will use PYGAMEAPI_EXTERN_SLOTS instead
|
||||
* of PYGAMEAPI_DEFINE_SLOTS for base modules.
|
||||
*/
|
||||
#ifndef _PYGAME_INTERNAL_H
|
||||
#define _PYGAME_INTERNAL_H
|
||||
|
||||
#include "pgplatform.h"
|
||||
/*
|
||||
If PY_SSIZE_T_CLEAN is defined before including Python.h, length is a
|
||||
Py_ssize_t rather than an int for all # variants of formats (s#, y#, etc.)
|
||||
*/
|
||||
#define PY_SSIZE_T_CLEAN
|
||||
#include <Python.h>
|
||||
|
||||
/* Ensure PyPy-specific code is not in use when running on GraalPython (PR
|
||||
* #2580) */
|
||||
#if defined(GRAALVM_PYTHON) && defined(PYPY_VERSION)
|
||||
#undef PYPY_VERSION
|
||||
#endif
|
||||
|
||||
#include <SDL.h>
|
||||
|
||||
/* SDL 1.2 constants removed from SDL 2 */
|
||||
typedef enum {
|
||||
SDL_HWSURFACE = 0,
|
||||
SDL_RESIZABLE = SDL_WINDOW_RESIZABLE,
|
||||
SDL_ASYNCBLIT = 0,
|
||||
SDL_OPENGL = SDL_WINDOW_OPENGL,
|
||||
SDL_OPENGLBLIT = 0,
|
||||
SDL_ANYFORMAT = 0,
|
||||
SDL_HWPALETTE = 0,
|
||||
SDL_DOUBLEBUF = 0,
|
||||
SDL_FULLSCREEN = SDL_WINDOW_FULLSCREEN,
|
||||
SDL_HWACCEL = 0,
|
||||
SDL_SRCCOLORKEY = 0,
|
||||
SDL_RLEACCELOK = 0,
|
||||
SDL_SRCALPHA = 0,
|
||||
SDL_NOFRAME = SDL_WINDOW_BORDERLESS,
|
||||
SDL_GL_SWAP_CONTROL = 0,
|
||||
TIMER_RESOLUTION = 0
|
||||
} PygameVideoFlags;
|
||||
|
||||
/* the wheel button constants were removed from SDL 2 */
|
||||
typedef enum {
|
||||
PGM_BUTTON_LEFT = SDL_BUTTON_LEFT,
|
||||
PGM_BUTTON_RIGHT = SDL_BUTTON_RIGHT,
|
||||
PGM_BUTTON_MIDDLE = SDL_BUTTON_MIDDLE,
|
||||
PGM_BUTTON_WHEELUP = 4,
|
||||
PGM_BUTTON_WHEELDOWN = 5,
|
||||
PGM_BUTTON_X1 = SDL_BUTTON_X1 + 2,
|
||||
PGM_BUTTON_X2 = SDL_BUTTON_X2 + 2,
|
||||
PGM_BUTTON_KEEP = 0x80
|
||||
} PygameMouseFlags;
|
||||
|
||||
typedef enum {
|
||||
/* Any SDL_* events here are for backward compatibility. */
|
||||
SDL_NOEVENT = 0,
|
||||
|
||||
SDL_ACTIVEEVENT = SDL_USEREVENT,
|
||||
SDL_VIDEORESIZE,
|
||||
SDL_VIDEOEXPOSE,
|
||||
|
||||
PGE_MIDIIN,
|
||||
PGE_MIDIOUT,
|
||||
PGE_KEYREPEAT, /* Special internal pygame event, for managing key-presses
|
||||
*/
|
||||
|
||||
/* DO NOT CHANGE THE ORDER OF EVENTS HERE */
|
||||
PGE_WINDOWSHOWN,
|
||||
PGE_WINDOWHIDDEN,
|
||||
PGE_WINDOWEXPOSED,
|
||||
PGE_WINDOWMOVED,
|
||||
PGE_WINDOWRESIZED,
|
||||
PGE_WINDOWSIZECHANGED,
|
||||
PGE_WINDOWMINIMIZED,
|
||||
PGE_WINDOWMAXIMIZED,
|
||||
PGE_WINDOWRESTORED,
|
||||
PGE_WINDOWENTER,
|
||||
PGE_WINDOWLEAVE,
|
||||
PGE_WINDOWFOCUSGAINED,
|
||||
PGE_WINDOWFOCUSLOST,
|
||||
PGE_WINDOWCLOSE,
|
||||
PGE_WINDOWTAKEFOCUS,
|
||||
PGE_WINDOWHITTEST,
|
||||
PGE_WINDOWICCPROFCHANGED,
|
||||
PGE_WINDOWDISPLAYCHANGED,
|
||||
|
||||
/* Here we define PGPOST_* events, events that act as a one-to-one
|
||||
* proxy for SDL events (and some extra events too!), the proxy is used
|
||||
* internally when pygame users use event.post()
|
||||
*
|
||||
* At a first glance, these may look redundant, but they are really
|
||||
* important, especially with event blocking. If proxy events are
|
||||
* not there, blocked events dont make it to our event filter, and
|
||||
* that can break a lot of stuff.
|
||||
*
|
||||
* IMPORTANT NOTE: Do not post events directly with these proxy types,
|
||||
* use the appropriate functions from event.c, that handle these proxy
|
||||
* events for you.
|
||||
* Proxy events are for internal use only */
|
||||
PGPOST_EVENTBEGIN, /* mark start of proxy-events */
|
||||
PGPOST_ACTIVEEVENT = PGPOST_EVENTBEGIN,
|
||||
PGPOST_APP_TERMINATING,
|
||||
PGPOST_APP_LOWMEMORY,
|
||||
PGPOST_APP_WILLENTERBACKGROUND,
|
||||
PGPOST_APP_DIDENTERBACKGROUND,
|
||||
PGPOST_APP_WILLENTERFOREGROUND,
|
||||
PGPOST_APP_DIDENTERFOREGROUND,
|
||||
PGPOST_AUDIODEVICEADDED,
|
||||
PGPOST_AUDIODEVICEREMOVED,
|
||||
PGPOST_CLIPBOARDUPDATE,
|
||||
PGPOST_CONTROLLERAXISMOTION,
|
||||
PGPOST_CONTROLLERBUTTONDOWN,
|
||||
PGPOST_CONTROLLERBUTTONUP,
|
||||
PGPOST_CONTROLLERDEVICEADDED,
|
||||
PGPOST_CONTROLLERDEVICEREMOVED,
|
||||
PGPOST_CONTROLLERDEVICEREMAPPED,
|
||||
PGPOST_CONTROLLERTOUCHPADDOWN,
|
||||
PGPOST_CONTROLLERTOUCHPADMOTION,
|
||||
PGPOST_CONTROLLERTOUCHPADUP,
|
||||
PGPOST_CONTROLLERSENSORUPDATE,
|
||||
PGPOST_DOLLARGESTURE,
|
||||
PGPOST_DOLLARRECORD,
|
||||
PGPOST_DROPFILE,
|
||||
PGPOST_DROPTEXT,
|
||||
PGPOST_DROPBEGIN,
|
||||
PGPOST_DROPCOMPLETE,
|
||||
PGPOST_FINGERMOTION,
|
||||
PGPOST_FINGERDOWN,
|
||||
PGPOST_FINGERUP,
|
||||
PGPOST_KEYDOWN,
|
||||
PGPOST_KEYMAPCHANGED,
|
||||
PGPOST_KEYUP,
|
||||
PGPOST_JOYAXISMOTION,
|
||||
PGPOST_JOYBALLMOTION,
|
||||
PGPOST_JOYHATMOTION,
|
||||
PGPOST_JOYBUTTONDOWN,
|
||||
PGPOST_JOYBUTTONUP,
|
||||
PGPOST_JOYDEVICEADDED,
|
||||
PGPOST_JOYDEVICEREMOVED,
|
||||
PGPOST_LOCALECHANGED,
|
||||
PGPOST_MIDIIN,
|
||||
PGPOST_MIDIOUT,
|
||||
PGPOST_MOUSEMOTION,
|
||||
PGPOST_MOUSEBUTTONDOWN,
|
||||
PGPOST_MOUSEBUTTONUP,
|
||||
PGPOST_MOUSEWHEEL,
|
||||
PGPOST_MULTIGESTURE,
|
||||
PGPOST_NOEVENT,
|
||||
PGPOST_QUIT,
|
||||
PGPOST_RENDER_TARGETS_RESET,
|
||||
PGPOST_RENDER_DEVICE_RESET,
|
||||
PGPOST_SYSWMEVENT,
|
||||
PGPOST_TEXTEDITING,
|
||||
PGPOST_TEXTINPUT,
|
||||
PGPOST_VIDEORESIZE,
|
||||
PGPOST_VIDEOEXPOSE,
|
||||
PGPOST_WINDOWSHOWN,
|
||||
PGPOST_WINDOWHIDDEN,
|
||||
PGPOST_WINDOWEXPOSED,
|
||||
PGPOST_WINDOWMOVED,
|
||||
PGPOST_WINDOWRESIZED,
|
||||
PGPOST_WINDOWSIZECHANGED,
|
||||
PGPOST_WINDOWMINIMIZED,
|
||||
PGPOST_WINDOWMAXIMIZED,
|
||||
PGPOST_WINDOWRESTORED,
|
||||
PGPOST_WINDOWENTER,
|
||||
PGPOST_WINDOWLEAVE,
|
||||
PGPOST_WINDOWFOCUSGAINED,
|
||||
PGPOST_WINDOWFOCUSLOST,
|
||||
PGPOST_WINDOWCLOSE,
|
||||
PGPOST_WINDOWTAKEFOCUS,
|
||||
PGPOST_WINDOWHITTEST,
|
||||
PGPOST_WINDOWICCPROFCHANGED,
|
||||
PGPOST_WINDOWDISPLAYCHANGED,
|
||||
|
||||
PGE_USEREVENT, /* this event must stay in this position only */
|
||||
|
||||
PG_NUMEVENTS =
|
||||
SDL_LASTEVENT /* Not an event. Indicates end of user events. */
|
||||
} PygameEventCode;
|
||||
|
||||
/* SDL1 ACTIVEEVENT state attribute can take the following values */
|
||||
/* These constant values are directly picked from SDL1 source */
|
||||
#define SDL_APPMOUSEFOCUS 0x01
|
||||
#define SDL_APPINPUTFOCUS 0x02
|
||||
#define SDL_APPACTIVE 0x04
|
||||
|
||||
/* Surface flags: based on SDL 1.2 flags */
|
||||
typedef enum {
|
||||
PGS_SWSURFACE = 0x00000000,
|
||||
PGS_HWSURFACE = 0x00000001,
|
||||
PGS_ASYNCBLIT = 0x00000004,
|
||||
|
||||
PGS_ANYFORMAT = 0x10000000,
|
||||
PGS_HWPALETTE = 0x20000000,
|
||||
PGS_DOUBLEBUF = 0x40000000,
|
||||
PGS_FULLSCREEN = 0x80000000,
|
||||
PGS_SCALED = 0x00000200,
|
||||
|
||||
PGS_OPENGL = 0x00000002,
|
||||
PGS_OPENGLBLIT = 0x0000000A,
|
||||
PGS_RESIZABLE = 0x00000010,
|
||||
PGS_NOFRAME = 0x00000020,
|
||||
PGS_SHOWN = 0x00000040, /* Added from SDL 2 */
|
||||
PGS_HIDDEN = 0x00000080, /* Added from SDL 2 */
|
||||
|
||||
PGS_HWACCEL = 0x00000100,
|
||||
PGS_SRCCOLORKEY = 0x00001000,
|
||||
PGS_RLEACCELOK = 0x00002000,
|
||||
PGS_RLEACCEL = 0x00004000,
|
||||
PGS_SRCALPHA = 0x00010000,
|
||||
PGS_PREALLOC = 0x01000000
|
||||
} PygameSurfaceFlags;
|
||||
|
||||
// TODO Implement check below in a way that does not break CI
|
||||
/* New buffer protocol (PEP 3118) implemented on all supported Py versions.
|
||||
#if !defined(Py_TPFLAGS_HAVE_NEWBUFFER)
|
||||
#error No support for PEP 3118/Py_TPFLAGS_HAVE_NEWBUFFER. Please use a
|
||||
supported Python version. #endif */
|
||||
|
||||
#define RAISE(x, y) (PyErr_SetString((x), (y)), NULL)
|
||||
#define DEL_ATTR_NOT_SUPPORTED_CHECK(name, value) \
|
||||
do { \
|
||||
if (!value) { \
|
||||
PyErr_Format(PyExc_AttributeError, "Cannot delete attribute %s", \
|
||||
name); \
|
||||
return -1; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#define DEL_ATTR_NOT_SUPPORTED_CHECK_NO_NAME(value) \
|
||||
do { \
|
||||
if (!value) { \
|
||||
PyErr_SetString(PyExc_AttributeError, "Cannot delete attribute"); \
|
||||
return -1; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
/*
|
||||
* Initialization checks
|
||||
*/
|
||||
|
||||
#define VIDEO_INIT_CHECK() \
|
||||
if (!SDL_WasInit(SDL_INIT_VIDEO)) \
|
||||
return RAISE(pgExc_SDLError, "video system not initialized")
|
||||
|
||||
#define JOYSTICK_INIT_CHECK() \
|
||||
if (!SDL_WasInit(SDL_INIT_JOYSTICK)) \
|
||||
return RAISE(pgExc_SDLError, "joystick system not initialized")
|
||||
|
||||
/* thread check */
|
||||
#ifdef WITH_THREAD
|
||||
#define PG_CHECK_THREADS() (1)
|
||||
#else /* ~WITH_THREAD */
|
||||
#define PG_CHECK_THREADS() \
|
||||
(RAISE(PyExc_NotImplementedError, "Python built without thread support"))
|
||||
#endif /* ~WITH_THREAD */
|
||||
|
||||
#define PyType_Init(x) (((x).ob_type) = &PyType_Type)
|
||||
|
||||
/* CPython 3.6 had initial and undocumented FASTCALL support, but we play it
|
||||
* safe by not relying on implementation details */
|
||||
#if PY_VERSION_HEX < 0x03070000
|
||||
|
||||
/* Macro for naming a pygame fastcall wrapper function */
|
||||
#define PG_FASTCALL_NAME(func) _##func##_fastcall_wrap
|
||||
|
||||
/* used to forward declare compat functions */
|
||||
#define PG_DECLARE_FASTCALL_FUNC(func, self_type) \
|
||||
static PyObject *PG_FASTCALL_NAME(func)(self_type * self, PyObject * args)
|
||||
|
||||
/* Using this macro on a function defined with the FASTCALL calling convention
|
||||
* adds a wrapper definition that uses regular python VARARGS convention.
|
||||
* Since it is guaranteed that the 'args' object is a tuple, we can directly
|
||||
* call PySequence_Fast_ITEMS and PyTuple_GET_SIZE on it (which are macros that
|
||||
* assume the same, and don't do error checking) */
|
||||
#define PG_WRAP_FASTCALL_FUNC(func, self_type) \
|
||||
PG_DECLARE_FASTCALL_FUNC(func, self_type) \
|
||||
{ \
|
||||
return func(self, (PyObject *const *)PySequence_Fast_ITEMS(args), \
|
||||
PyTuple_GET_SIZE(args)); \
|
||||
}
|
||||
|
||||
#define PG_FASTCALL METH_VARARGS
|
||||
|
||||
#else /* PY_VERSION_HEX >= 0x03070000 */
|
||||
/* compat macros are no-op on python versions that support fastcall */
|
||||
#define PG_FASTCALL_NAME(func) func
|
||||
#define PG_DECLARE_FASTCALL_FUNC(func, self_type)
|
||||
#define PG_WRAP_FASTCALL_FUNC(func, self_type)
|
||||
|
||||
#define PG_FASTCALL METH_FASTCALL
|
||||
|
||||
#endif /* PY_VERSION_HEX >= 0x03070000 */
|
||||
|
||||
/*
|
||||
* event module internals
|
||||
*/
|
||||
struct pgEventObject {
|
||||
PyObject_HEAD int type;
|
||||
PyObject *dict;
|
||||
};
|
||||
|
||||
/*
|
||||
* surflock module internals
|
||||
*/
|
||||
typedef struct {
|
||||
PyObject_HEAD PyObject *surface;
|
||||
PyObject *lockobj;
|
||||
PyObject *weakrefs;
|
||||
} pgLifetimeLockObject;
|
||||
|
||||
/*
|
||||
* surface module internals
|
||||
*/
|
||||
struct pgSubSurface_Data {
|
||||
PyObject *owner;
|
||||
int pixeloffset;
|
||||
int offsetx, offsety;
|
||||
};
|
||||
|
||||
/*
|
||||
* color module internals
|
||||
*/
|
||||
struct pgColorObject {
|
||||
PyObject_HEAD Uint8 data[4];
|
||||
Uint8 len;
|
||||
};
|
||||
|
||||
/*
|
||||
* include public API
|
||||
*/
|
||||
#include "include/_pygame.h"
|
||||
|
||||
/* Slot counts.
|
||||
* Remember to keep these constants up to date.
|
||||
*/
|
||||
|
||||
#define PYGAMEAPI_RECT_NUMSLOTS 5
|
||||
#define PYGAMEAPI_JOYSTICK_NUMSLOTS 2
|
||||
#define PYGAMEAPI_DISPLAY_NUMSLOTS 2
|
||||
#define PYGAMEAPI_SURFACE_NUMSLOTS 4
|
||||
#define PYGAMEAPI_SURFLOCK_NUMSLOTS 8
|
||||
#define PYGAMEAPI_RWOBJECT_NUMSLOTS 6
|
||||
#define PYGAMEAPI_PIXELARRAY_NUMSLOTS 2
|
||||
#define PYGAMEAPI_COLOR_NUMSLOTS 5
|
||||
#define PYGAMEAPI_MATH_NUMSLOTS 2
|
||||
#define PYGAMEAPI_BASE_NUMSLOTS 27
|
||||
#define PYGAMEAPI_EVENT_NUMSLOTS 6
|
||||
|
||||
#endif /* _PYGAME_INTERNAL_H */
|
@ -1,30 +0,0 @@
|
||||
/*
|
||||
pygame - Python Game Library
|
||||
Copyright (C) 2000-2001 Pete Shinners
|
||||
Copyright (C) 2007 Marcus von Appen
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
Pete Shinners
|
||||
pete@shinners.org
|
||||
*/
|
||||
|
||||
#ifndef _SURFACE_H
|
||||
#define _SURFACE_H
|
||||
|
||||
#include "_pygame.h"
|
||||
#include "surface.h"
|
||||
|
||||
#endif
|
@ -1,252 +0,0 @@
|
||||
#ifndef CAMERA_H
|
||||
#define CAMERA_H
|
||||
/*
|
||||
pygame - Python Game Library
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
*/
|
||||
|
||||
#include "pygame.h"
|
||||
#include "pgcompat.h"
|
||||
#include "doc/camera_doc.h"
|
||||
|
||||
#if defined(__unix__)
|
||||
#include <structmember.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include <fcntl.h> /* low-level i/o */
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/mman.h>
|
||||
#include <sys/ioctl.h>
|
||||
|
||||
/* on freebsd there is no asm/types */
|
||||
#ifdef linux
|
||||
#include <asm/types.h> /* for videodev2.h */
|
||||
#endif
|
||||
|
||||
#include <linux/videodev2.h>
|
||||
#endif
|
||||
|
||||
#if defined(__WIN32__)
|
||||
#define PYGAME_WINDOWS_CAMERA 1
|
||||
|
||||
#include <mfapi.h>
|
||||
#include <mfobjects.h>
|
||||
#include <mfidl.h>
|
||||
#include <mfreadwrite.h>
|
||||
#include <combaseapi.h>
|
||||
#include <mftransform.h>
|
||||
#endif
|
||||
|
||||
/* some constants used which are not defined on non-v4l machines. */
|
||||
#ifndef V4L2_PIX_FMT_RGB24
|
||||
#define V4L2_PIX_FMT_RGB24 'RGB3'
|
||||
#endif
|
||||
#ifndef V4L2_PIX_FMT_RGB444
|
||||
#define V4L2_PIX_FMT_RGB444 'R444'
|
||||
#endif
|
||||
#ifndef V4L2_PIX_FMT_YUYV
|
||||
#define V4L2_PIX_FMT_YUYV 'YUYV'
|
||||
#endif
|
||||
#ifndef V4L2_PIX_FMT_XBGR32
|
||||
#define V4L2_PIX_FMT_XBGR32 'XR24'
|
||||
#endif
|
||||
|
||||
#define CLEAR(x) memset(&(x), 0, sizeof(x))
|
||||
#define SAT(c) \
|
||||
if (c & (~255)) { \
|
||||
if (c < 0) \
|
||||
c = 0; \
|
||||
else \
|
||||
c = 255; \
|
||||
}
|
||||
#define SAT2(c) ((c) & (~255) ? ((c) < 0 ? 0 : 255) : (c))
|
||||
#define DEFAULT_WIDTH 640
|
||||
#define DEFAULT_HEIGHT 480
|
||||
#define RGB_OUT 1
|
||||
#define YUV_OUT 2
|
||||
#define HSV_OUT 4
|
||||
#define CAM_V4L \
|
||||
1 /* deprecated. the incomplete support in pygame was removed */
|
||||
#define CAM_V4L2 2
|
||||
|
||||
struct buffer {
|
||||
void *start;
|
||||
size_t length;
|
||||
};
|
||||
|
||||
#if defined(__unix__)
|
||||
typedef struct pgCameraObject {
|
||||
PyObject_HEAD char *device_name;
|
||||
int camera_type;
|
||||
unsigned long pixelformat;
|
||||
unsigned int color_out;
|
||||
struct buffer *buffers;
|
||||
unsigned int n_buffers;
|
||||
int width;
|
||||
int height;
|
||||
int size;
|
||||
int hflip;
|
||||
int vflip;
|
||||
int brightness;
|
||||
int fd;
|
||||
} pgCameraObject;
|
||||
#elif defined(PYGAME_WINDOWS_CAMERA)
|
||||
typedef struct pgCameraObject {
|
||||
PyObject_HEAD WCHAR *device_name;
|
||||
IMFSourceReader *reader;
|
||||
IMFTransform *transform;
|
||||
IMFVideoProcessorControl *control;
|
||||
IMFMediaBuffer *buf;
|
||||
IMFMediaBuffer *raw_buf;
|
||||
int buffer_ready;
|
||||
short open; /* used to signal the update_function to exit */
|
||||
HANDLE t_handle;
|
||||
HRESULT t_error;
|
||||
int t_error_line;
|
||||
int width;
|
||||
int height;
|
||||
int hflip;
|
||||
int vflip;
|
||||
int last_vflip;
|
||||
int color_out;
|
||||
unsigned long pixelformat;
|
||||
} pgCameraObject;
|
||||
|
||||
#else
|
||||
/* generic definition.
|
||||
*/
|
||||
|
||||
typedef struct pgCameraObject {
|
||||
PyObject_HEAD char *device_name;
|
||||
int camera_type;
|
||||
unsigned long pixelformat;
|
||||
unsigned int color_out;
|
||||
struct buffer *buffers;
|
||||
unsigned int n_buffers;
|
||||
int width;
|
||||
int height;
|
||||
int size;
|
||||
int hflip;
|
||||
int vflip;
|
||||
int brightness;
|
||||
int fd;
|
||||
} pgCameraObject;
|
||||
#endif
|
||||
|
||||
/* internal functions for colorspace conversion */
|
||||
void
|
||||
colorspace(SDL_Surface *src, SDL_Surface *dst, int cspace);
|
||||
void
|
||||
rgb24_to_rgb(const void *src, void *dst, int length, SDL_PixelFormat *format);
|
||||
void
|
||||
bgr32_to_rgb(const void *src, void *dst, int length, SDL_PixelFormat *format);
|
||||
void
|
||||
rgb444_to_rgb(const void *src, void *dst, int length, SDL_PixelFormat *format);
|
||||
void
|
||||
rgb_to_yuv(const void *src, void *dst, int length, unsigned long source,
|
||||
SDL_PixelFormat *format);
|
||||
void
|
||||
rgb_to_hsv(const void *src, void *dst, int length, unsigned long source,
|
||||
SDL_PixelFormat *format);
|
||||
void
|
||||
yuyv_to_rgb(const void *src, void *dst, int length, SDL_PixelFormat *format);
|
||||
void
|
||||
yuyv_to_yuv(const void *src, void *dst, int length, SDL_PixelFormat *format);
|
||||
void
|
||||
uyvy_to_rgb(const void *src, void *dst, int length, SDL_PixelFormat *format);
|
||||
void
|
||||
uyvy_to_yuv(const void *src, void *dst, int length, SDL_PixelFormat *format);
|
||||
void
|
||||
sbggr8_to_rgb(const void *src, void *dst, int width, int height,
|
||||
SDL_PixelFormat *format);
|
||||
void
|
||||
yuv420_to_rgb(const void *src, void *dst, int width, int height,
|
||||
SDL_PixelFormat *format);
|
||||
void
|
||||
yuv420_to_yuv(const void *src, void *dst, int width, int height,
|
||||
SDL_PixelFormat *format);
|
||||
|
||||
#if defined(__unix__)
|
||||
/* internal functions specific to v4l2 */
|
||||
char **
|
||||
v4l2_list_cameras(int *num_devices);
|
||||
int
|
||||
v4l2_get_control(int fd, int id, int *value);
|
||||
int
|
||||
v4l2_set_control(int fd, int id, int value);
|
||||
PyObject *
|
||||
v4l2_read_raw(pgCameraObject *self);
|
||||
int
|
||||
v4l2_xioctl(int fd, int request, void *arg);
|
||||
int
|
||||
v4l2_process_image(pgCameraObject *self, const void *image, int buffer_size,
|
||||
SDL_Surface *surf);
|
||||
int
|
||||
v4l2_query_buffer(pgCameraObject *self);
|
||||
int
|
||||
v4l2_read_frame(pgCameraObject *self, SDL_Surface *surf, int *errno_code);
|
||||
int
|
||||
v4l2_stop_capturing(pgCameraObject *self);
|
||||
int
|
||||
v4l2_start_capturing(pgCameraObject *self);
|
||||
int
|
||||
v4l2_uninit_device(pgCameraObject *self);
|
||||
int
|
||||
v4l2_init_mmap(pgCameraObject *self);
|
||||
int
|
||||
v4l2_init_device(pgCameraObject *self);
|
||||
int
|
||||
v4l2_close_device(pgCameraObject *self);
|
||||
int
|
||||
v4l2_open_device(pgCameraObject *self);
|
||||
|
||||
#elif defined(PYGAME_WINDOWS_CAMERA)
|
||||
/* internal functions specific to WINDOWS */
|
||||
WCHAR **
|
||||
windows_list_cameras(int *num_devices);
|
||||
int
|
||||
windows_init_device(pgCameraObject *self);
|
||||
int
|
||||
windows_open_device(pgCameraObject *self);
|
||||
IMFActivate *
|
||||
windows_device_from_name(WCHAR *device_name);
|
||||
int
|
||||
windows_close_device(pgCameraObject *self);
|
||||
int
|
||||
windows_read_frame(pgCameraObject *self, SDL_Surface *surf);
|
||||
int
|
||||
windows_frame_ready(pgCameraObject *self, int *result);
|
||||
PyObject *
|
||||
windows_read_raw(pgCameraObject *self);
|
||||
int
|
||||
windows_process_image(pgCameraObject *self, BYTE *data, DWORD buffer_size,
|
||||
SDL_Surface *surf);
|
||||
void
|
||||
windows_dealloc_device(pgCameraObject *self);
|
||||
int
|
||||
windows_init_device(pgCameraObject *self);
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* !CAMERA_H */
|
@ -1,15 +0,0 @@
|
||||
#ifndef PGFONT_INTERNAL_H
|
||||
#define PGFONT_INTERNAL_H
|
||||
|
||||
#include <SDL_ttf.h>
|
||||
|
||||
/* test font initialization */
|
||||
#define FONT_INIT_CHECK() \
|
||||
if (!(*(int *)PyFONT_C_API[2])) \
|
||||
return RAISE(pgExc_SDLError, "font system not initialized")
|
||||
|
||||
#include "include/pygame_font.h"
|
||||
|
||||
#define PYGAMEAPI_FONT_NUMSLOTS 3
|
||||
|
||||
#endif /* ~PGFONT_INTERNAL_H */
|
@ -1,114 +0,0 @@
|
||||
/*
|
||||
pygame - Python Game Library
|
||||
Copyright (C) 2009 Vicent Marti
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
*/
|
||||
#ifndef _PYGAME_FREETYPE_INTERNAL_H_
|
||||
#define _PYGAME_FREETYPE_INTERNAL_H_
|
||||
|
||||
#include "pgcompat.h"
|
||||
#include "pgplatform.h"
|
||||
|
||||
#include <ft2build.h>
|
||||
#include FT_FREETYPE_H
|
||||
#include FT_CACHE_H
|
||||
#include FT_XFREE86_H
|
||||
#include FT_TRIGONOMETRY_H
|
||||
|
||||
/**********************************************************
|
||||
* Global module constants
|
||||
**********************************************************/
|
||||
|
||||
/* Render styles */
|
||||
#define FT_STYLE_NORMAL 0x00
|
||||
#define FT_STYLE_STRONG 0x01
|
||||
#define FT_STYLE_OBLIQUE 0x02
|
||||
#define FT_STYLE_UNDERLINE 0x04
|
||||
#define FT_STYLE_WIDE 0x08
|
||||
#define FT_STYLE_DEFAULT 0xFF
|
||||
|
||||
/* Bounding box modes */
|
||||
#define FT_BBOX_EXACT FT_GLYPH_BBOX_SUBPIXELS
|
||||
#define FT_BBOX_EXACT_GRIDFIT FT_GLYPH_BBOX_GRIDFIT
|
||||
#define FT_BBOX_PIXEL FT_GLYPH_BBOX_TRUNCATE
|
||||
#define FT_BBOX_PIXEL_GRIDFIT FT_GLYPH_BBOX_PIXELS
|
||||
|
||||
/* Rendering flags */
|
||||
#define FT_RFLAG_NONE (0)
|
||||
#define FT_RFLAG_ANTIALIAS (1 << 0)
|
||||
#define FT_RFLAG_AUTOHINT (1 << 1)
|
||||
#define FT_RFLAG_VERTICAL (1 << 2)
|
||||
#define FT_RFLAG_HINTED (1 << 3)
|
||||
#define FT_RFLAG_KERNING (1 << 4)
|
||||
#define FT_RFLAG_TRANSFORM (1 << 5)
|
||||
#define FT_RFLAG_PAD (1 << 6)
|
||||
#define FT_RFLAG_ORIGIN (1 << 7)
|
||||
#define FT_RFLAG_UCS4 (1 << 8)
|
||||
#define FT_RFLAG_USE_BITMAP_STRIKES (1 << 9)
|
||||
#define FT_RFLAG_DEFAULTS \
|
||||
(FT_RFLAG_HINTED | FT_RFLAG_USE_BITMAP_STRIKES | FT_RFLAG_ANTIALIAS)
|
||||
|
||||
#define FT_RENDER_NEWBYTEARRAY 0x0
|
||||
#define FT_RENDER_NEWSURFACE 0x1
|
||||
#define FT_RENDER_EXISTINGSURFACE 0x2
|
||||
|
||||
/**********************************************************
|
||||
* Global module types
|
||||
**********************************************************/
|
||||
|
||||
typedef struct _scale_s {
|
||||
FT_UInt x, y;
|
||||
} Scale_t;
|
||||
typedef FT_Angle Angle_t;
|
||||
|
||||
struct fontinternals_;
|
||||
struct freetypeinstance_;
|
||||
|
||||
typedef struct {
|
||||
FT_Long font_index;
|
||||
FT_Open_Args open_args;
|
||||
} pgFontId;
|
||||
|
||||
typedef struct {
|
||||
PyObject_HEAD pgFontId id;
|
||||
PyObject *path;
|
||||
int is_scalable;
|
||||
int is_bg_col_set;
|
||||
|
||||
Scale_t face_size;
|
||||
FT_Int16 style;
|
||||
FT_Int16 render_flags;
|
||||
double strength;
|
||||
double underline_adjustment;
|
||||
FT_UInt resolution;
|
||||
Angle_t rotation;
|
||||
FT_Matrix transform;
|
||||
FT_Byte fgcolor[4];
|
||||
FT_Byte bgcolor[4];
|
||||
|
||||
struct freetypeinstance_ *freetype; /* Personal reference */
|
||||
struct fontinternals_ *_internals;
|
||||
} pgFontObject;
|
||||
|
||||
#define pgFont_IS_ALIVE(o) (((pgFontObject *)(o))->_internals != 0)
|
||||
|
||||
/* import public API */
|
||||
#include "include/pygame_freetype.h"
|
||||
|
||||
#define PYGAMEAPI_FREETYPE_NUMSLOTS 2
|
||||
|
||||
#endif /* ~_PYGAME_FREETYPE_INTERNAL_H_ */
|
@ -1,949 +0,0 @@
|
||||
/*
|
||||
pygame - Python Game Library
|
||||
Copyright (C) 2000-2001 Pete Shinners
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
Pete Shinners
|
||||
pete@shinners.org
|
||||
*/
|
||||
|
||||
#ifndef _PYGAME_H
|
||||
#define _PYGAME_H
|
||||
|
||||
/** This header file includes all the definitions for the
|
||||
** base pygame extensions. This header only requires
|
||||
** Python includes (and SDL.h for functions that use SDL types).
|
||||
** The reason for functions prototyped with #define's is
|
||||
** to allow for maximum Python portability. It also uses
|
||||
** Python as the runtime linker, which allows for late binding.
|
||||
'' For more information on this style of development, read
|
||||
** the Python docs on this subject.
|
||||
** http://www.python.org/doc/current/ext/using-cobjects.html
|
||||
**
|
||||
** If using this to build your own derived extensions,
|
||||
** you'll see that the functions available here are mainly
|
||||
** used to help convert between python objects and SDL objects.
|
||||
** Since this library doesn't add a lot of functionality to
|
||||
** the SDL library, it doesn't need to offer a lot either.
|
||||
**
|
||||
** When initializing your extension module, you must manually
|
||||
** import the modules you want to use. (this is the part about
|
||||
** using python as the runtime linker). Each module has its
|
||||
** own import_xxx() routine. You need to perform this import
|
||||
** after you have initialized your own module, and before
|
||||
** you call any routines from that module. Since every module
|
||||
** in pygame does this, there are plenty of examples.
|
||||
**
|
||||
** The base module does include some useful conversion routines
|
||||
** that you are free to use in your own extension.
|
||||
**/
|
||||
|
||||
#include "pgplatform.h"
|
||||
#include <Python.h>
|
||||
|
||||
/* version macros (defined since version 1.9.5) */
|
||||
#define PG_MAJOR_VERSION 2
|
||||
#define PG_MINOR_VERSION 5
|
||||
#define PG_PATCH_VERSION 2
|
||||
#define PG_VERSIONNUM(MAJOR, MINOR, PATCH) \
|
||||
(1000 * (MAJOR) + 100 * (MINOR) + (PATCH))
|
||||
#define PG_VERSION_ATLEAST(MAJOR, MINOR, PATCH) \
|
||||
(PG_VERSIONNUM(PG_MAJOR_VERSION, PG_MINOR_VERSION, PG_PATCH_VERSION) >= \
|
||||
PG_VERSIONNUM(MAJOR, MINOR, PATCH))
|
||||
|
||||
#include "pgcompat.h"
|
||||
|
||||
/* Flag indicating a pg_buffer; used for assertions within callbacks */
|
||||
#ifndef NDEBUG
|
||||
#define PyBUF_PYGAME 0x4000
|
||||
#endif
|
||||
#define PyBUF_HAS_FLAG(f, F) (((f) & (F)) == (F))
|
||||
|
||||
/* Array information exchange struct C type; inherits from Py_buffer
|
||||
*
|
||||
* Pygame uses its own Py_buffer derived C struct as an internal representation
|
||||
* of an imported array buffer. The extended Py_buffer allows for a
|
||||
* per-instance release callback,
|
||||
*/
|
||||
typedef void (*pybuffer_releaseproc)(Py_buffer *);
|
||||
|
||||
typedef struct pg_bufferinfo_s {
|
||||
Py_buffer view;
|
||||
PyObject *consumer; /* Input: Borrowed reference */
|
||||
pybuffer_releaseproc release_buffer;
|
||||
} pg_buffer;
|
||||
|
||||
#include "pgimport.h"
|
||||
|
||||
/*
|
||||
* BASE module
|
||||
*/
|
||||
#ifndef PYGAMEAPI_BASE_INTERNAL
|
||||
#define pgExc_SDLError ((PyObject *)PYGAMEAPI_GET_SLOT(base, 0))
|
||||
|
||||
#define pg_RegisterQuit \
|
||||
(*(void (*)(void (*)(void)))PYGAMEAPI_GET_SLOT(base, 1))
|
||||
|
||||
/**
|
||||
* \brief Convert number like object *obj* to C int and in *val*.
|
||||
*
|
||||
* \param obj The Python object to convert.
|
||||
* \param val A pointer to the C integer to store the result.
|
||||
* \returns 1 if the conversion was successful, 0 otherwise.
|
||||
*
|
||||
* \note This function will clear any Python errors.
|
||||
* \note This function will convert floats to integers.
|
||||
*/
|
||||
#define pg_IntFromObj \
|
||||
(*(int (*)(PyObject *, int *))PYGAMEAPI_GET_SLOT(base, 2))
|
||||
|
||||
/**
|
||||
* \brief Convert number like object at position *i* in sequence *obj*
|
||||
* to C int and place in argument *val*.
|
||||
*
|
||||
* \param obj The Python object to convert.
|
||||
* \param i The index of the object to convert.
|
||||
* \param val A pointer to the C integer to store the result.
|
||||
* \returns 1 if the conversion was successful, 0 otherwise.
|
||||
*
|
||||
* \note This function will clear any Python errors.
|
||||
* \note This function will convert floats to integers.
|
||||
*/
|
||||
#define pg_IntFromObjIndex \
|
||||
(*(int (*)(PyObject *, int, int *))PYGAMEAPI_GET_SLOT(base, 3))
|
||||
|
||||
/**
|
||||
* \brief Convert the two number like objects in length 2 sequence *obj* to C
|
||||
* int and place in arguments *val1* and *val2*.
|
||||
*
|
||||
* \param obj The Python two element sequence object to convert.
|
||||
* \param val A pointer to the C integer to store the result.
|
||||
* \param val2 A pointer to the C integer to store the result.
|
||||
* \returns 1 if the conversion was successful, 0 otherwise.
|
||||
*
|
||||
* \note This function will clear any Python errors.
|
||||
* \note This function will convert floats to integers.
|
||||
*/
|
||||
#define pg_TwoIntsFromObj \
|
||||
(*(int (*)(PyObject *, int *, int *))PYGAMEAPI_GET_SLOT(base, 4))
|
||||
|
||||
/**
|
||||
* \brief Convert number like object *obj* to C float and in *val*.
|
||||
*
|
||||
* \param obj The Python object to convert.
|
||||
* \param val A pointer to the C float to store the result.
|
||||
* \returns 1 if the conversion was successful, 0 otherwise.
|
||||
*
|
||||
* \note This function will clear any Python errors.
|
||||
*/
|
||||
#define pg_FloatFromObj \
|
||||
(*(int (*)(PyObject *, float *))PYGAMEAPI_GET_SLOT(base, 5))
|
||||
|
||||
/**
|
||||
* \brief Convert number like object at position *i* in sequence *obj* to C
|
||||
* float and place in argument *val*.
|
||||
*
|
||||
* \param obj The Python object to convert.
|
||||
* \param i The index of the object to convert.
|
||||
* \param val A pointer to the C float to store the result.
|
||||
* \returns 1 if the conversion was successful, 0 otherwise.
|
||||
*
|
||||
* \note This function will clear any Python errors.
|
||||
*/
|
||||
#define pg_FloatFromObjIndex \
|
||||
(*(int (*)(PyObject *, int, float *))PYGAMEAPI_GET_SLOT(base, 6))
|
||||
|
||||
/**
|
||||
* \brief Convert the two number like objects in length 2 sequence *obj* to C
|
||||
* float and place in arguments *val1* and *val2*.
|
||||
*
|
||||
* \param obj The Python two element sequence object to convert.
|
||||
* \param val A pointer to the C float to store the result.
|
||||
* \param val2 A pointer to the C float to store the result.
|
||||
* \returns 1 if the conversion was successful, 0 otherwise.
|
||||
*
|
||||
* \note This function will clear any Python errors.
|
||||
*/
|
||||
#define pg_TwoFloatsFromObj \
|
||||
(*(int (*)(PyObject *, float *, float *))PYGAMEAPI_GET_SLOT(base, 7))
|
||||
|
||||
/**
|
||||
* \brief Convert number like object *obj* to C Uint32 and in *val*.
|
||||
*
|
||||
* \param obj The Python object to convert.
|
||||
* \param val A pointer to the C int to store the result.
|
||||
* \returns 1 if the conversion was successful, 0 otherwise.
|
||||
*/
|
||||
#define pg_UintFromObj \
|
||||
(*(int (*)(PyObject *, Uint32 *))PYGAMEAPI_GET_SLOT(base, 8))
|
||||
|
||||
/**
|
||||
* \brief Convert number like object at position *i* in sequence *obj* to C
|
||||
* Uint32 and place in argument *val*.
|
||||
*
|
||||
* \param obj The Python object to convert.
|
||||
* \param i The index of the object to convert.
|
||||
* \param val A pointer to the C int to store the result.
|
||||
* \returns 1 if the conversion was successful, 0 otherwise.
|
||||
*/
|
||||
#define pg_UintFromObjIndex \
|
||||
(*(int (*)(PyObject *, int, Uint32 *))PYGAMEAPI_GET_SLOT(base, 9))
|
||||
|
||||
/**
|
||||
* \brief Initialize all of the pygame modules.
|
||||
* \returns 1 on success, 0 on failure with PyErr set.
|
||||
*/
|
||||
#define pg_mod_autoinit (*(int (*)(const char *))PYGAMEAPI_GET_SLOT(base, 10))
|
||||
|
||||
/**
|
||||
* \brief Quit all of the pygame modules.
|
||||
*/
|
||||
#define pg_mod_autoquit (*(void (*)(const char *))PYGAMEAPI_GET_SLOT(base, 11))
|
||||
|
||||
/**
|
||||
* \brief Convert the color represented by object *obj* into a red, green,
|
||||
* blue, alpha length 4 C array *RGBA*.
|
||||
*
|
||||
* The object must be a length 3 or 4 sequence of numbers having values between
|
||||
* 0 and 255 inclusive. For a length 3 sequence an alpha value of 255 is
|
||||
* assumed.
|
||||
*
|
||||
* \param obj The Python object to convert.
|
||||
* \param RGBA A pointer to the C array to store the result.
|
||||
* \returns 1 if the conversion was successful, 0 otherwise.
|
||||
*/
|
||||
#define pg_RGBAFromObj \
|
||||
(*(int (*)(PyObject *, Uint8 *))PYGAMEAPI_GET_SLOT(base, 12))
|
||||
|
||||
/**
|
||||
* \brief Given a Py_buffer, return a python dictionary representing the array
|
||||
* interface.
|
||||
*
|
||||
* \param view_p A pointer to the Py_buffer to convert to a dictionary.
|
||||
*
|
||||
* \returns A Python dictionary representing the array interface of the object.
|
||||
*/
|
||||
#define pgBuffer_AsArrayInterface \
|
||||
(*(PyObject * (*)(Py_buffer *)) PYGAMEAPI_GET_SLOT(base, 13))
|
||||
|
||||
/**
|
||||
* \brief Given a Py_buffer, return a python capsule representing the array
|
||||
* interface.
|
||||
*
|
||||
* \param view_p A pointer to the Py_buffer to convert to a capsule.
|
||||
*
|
||||
* \returns A Python capsule representing the array interface of the object.
|
||||
*/
|
||||
#define pgBuffer_AsArrayStruct \
|
||||
(*(PyObject * (*)(Py_buffer *)) PYGAMEAPI_GET_SLOT(base, 14))
|
||||
|
||||
/**
|
||||
* \brief Get a buffer object from a given Python object.
|
||||
*
|
||||
* \param obj The Python object to get the buffer from.
|
||||
* \param pg_view_p A pointer to a pg_buffer struct to store the buffer in.
|
||||
* \param flags The desired buffer access mode.
|
||||
*
|
||||
* \returns 0 on success, -1 on failure.
|
||||
*
|
||||
* \note This function attempts to get a buffer object from a given Python
|
||||
* object. If the object supports the buffer protocol, it will be used to
|
||||
* create the buffer. If not, it will try to get an array interface or
|
||||
* dictionary representation of the object and use that to create the buffer.
|
||||
* If none of these methods work, it will raise a ValueError.
|
||||
*
|
||||
*/
|
||||
#define pgObject_GetBuffer \
|
||||
(*(int (*)(PyObject *, pg_buffer *, int))PYGAMEAPI_GET_SLOT(base, 15))
|
||||
|
||||
/**
|
||||
* \brief Release a pg_buffer object.
|
||||
*
|
||||
* \param pg_view_p The pg_buffer object to release.
|
||||
*
|
||||
* \note This function releases a pg_buffer object.
|
||||
* \note some calls to this function expect this function to not clear
|
||||
* previously set errors.
|
||||
*/
|
||||
#define pgBuffer_Release (*(void (*)(pg_buffer *))PYGAMEAPI_GET_SLOT(base, 16))
|
||||
|
||||
/**
|
||||
* \brief Write the array interface dictionary buffer description *dict* into a
|
||||
* Pygame buffer description struct *pg_view_p*.
|
||||
*
|
||||
* \param pg_view_p The Pygame buffer description struct to write into.
|
||||
* \param dict The array interface dictionary to read from.
|
||||
* \param flags The PyBUF flags describing the view type requested.
|
||||
*
|
||||
* \returns 0 on success, or -1 on failure.
|
||||
*/
|
||||
#define pgDict_AsBuffer \
|
||||
(*(int (*)(pg_buffer *, PyObject *, int))PYGAMEAPI_GET_SLOT(base, 17))
|
||||
|
||||
#define pgExc_BufferError ((PyObject *)PYGAMEAPI_GET_SLOT(base, 18))
|
||||
|
||||
/**
|
||||
* \brief Get the default SDL window created by a pygame.display.set_mode()
|
||||
* call, or *NULL*.
|
||||
*
|
||||
* \return The default window, or *NULL* if no window has been created.
|
||||
*/
|
||||
#define pg_GetDefaultWindow \
|
||||
(*(SDL_Window * (*)(void)) PYGAMEAPI_GET_SLOT(base, 19))
|
||||
|
||||
/**
|
||||
* \brief Set the default SDL window created by a pygame.display.set_mode()
|
||||
* call. The previous window, if any, is destroyed. Argument *win* may be
|
||||
* *NULL*. This function is called by pygame.display.set_mode().
|
||||
*
|
||||
* \param win The new default window. May be NULL.
|
||||
*/
|
||||
#define pg_SetDefaultWindow \
|
||||
(*(void (*)(SDL_Window *))PYGAMEAPI_GET_SLOT(base, 20))
|
||||
|
||||
/**
|
||||
* \brief Return a borrowed reference to the Pygame default window display
|
||||
* surface, or *NULL* if no default window is open.
|
||||
*
|
||||
* \return The default renderer, or *NULL* if no renderer has been created.
|
||||
*/
|
||||
#define pg_GetDefaultWindowSurface \
|
||||
(*(pgSurfaceObject * (*)(void)) PYGAMEAPI_GET_SLOT(base, 21))
|
||||
|
||||
/**
|
||||
* \brief Set the Pygame default window display surface. The previous
|
||||
* surface, if any, is destroyed. Argument *screen* may be *NULL*. This
|
||||
* function is called by pygame.display.set_mode().
|
||||
*
|
||||
* \param screen The new default window display surface. May be NULL.
|
||||
*/
|
||||
#define pg_SetDefaultWindowSurface \
|
||||
(*(void (*)(pgSurfaceObject *))PYGAMEAPI_GET_SLOT(base, 22))
|
||||
|
||||
/**
|
||||
* \returns NULL if the environment variable PYGAME_BLEND_ALPHA_SDL2 is not
|
||||
* set, otherwise returns a pointer to the environment variable.
|
||||
*/
|
||||
#define pg_EnvShouldBlendAlphaSDL2 \
|
||||
(*(char *(*)(void))PYGAMEAPI_GET_SLOT(base, 23))
|
||||
|
||||
/**
|
||||
* \brief Convert number like object *obj* to C double and in *val*.
|
||||
*
|
||||
* \param obj The Python object to convert.
|
||||
* \param val A pointer to the C double to store the result.
|
||||
* \returns 1 if the conversion was successful, 0 otherwise.
|
||||
*
|
||||
* \note This function will clear any Python errors.
|
||||
*/
|
||||
#define pg_DoubleFromObj \
|
||||
(*(int (*)(PyObject *, double *))PYGAMEAPI_GET_SLOT(base, 24))
|
||||
|
||||
/**
|
||||
* \brief Convert number like object at position *i* in sequence *obj* to C
|
||||
* double and place in argument *val*.
|
||||
*
|
||||
* \param obj The Python object to convert.
|
||||
* \param i The index of the object to convert.
|
||||
* \param val A pointer to the C double to store the result.
|
||||
* \returns 1 if the conversion was successful, 0 otherwise.
|
||||
*
|
||||
* \note This function will clear any Python errors.
|
||||
*/
|
||||
#define pg_DoubleFromObjIndex \
|
||||
(*(int (*)(PyObject *, int, double *))PYGAMEAPI_GET_SLOT(base, 25))
|
||||
|
||||
/**
|
||||
* \brief Convert the two number like objects in length 2 sequence *obj* to C
|
||||
* double and place in arguments *val1* and *val2*.
|
||||
*
|
||||
* \param obj The Python two element sequence object to convert.
|
||||
* \param val A pointer to the C double to store the result.
|
||||
* \param val2 A pointer to the C double to store the result.
|
||||
* \returns 1 if the conversion was successful, 0 otherwise.
|
||||
*/
|
||||
#define pg_TwoDoublesFromObj \
|
||||
(*(int (*)(PyObject *, double *, double *))PYGAMEAPI_GET_SLOT(base, 26))
|
||||
|
||||
#define import_pygame_base() IMPORT_PYGAME_MODULE(base)
|
||||
#endif /* ~PYGAMEAPI_BASE_INTERNAL */
|
||||
|
||||
typedef struct {
|
||||
/**
|
||||
* \brief The SDL rect wrapped by this object.
|
||||
*/
|
||||
PyObject_HEAD SDL_Rect r;
|
||||
/**
|
||||
* \brief A list of weak references to this rect.
|
||||
*/
|
||||
PyObject *weakreflist;
|
||||
} pgRectObject;
|
||||
|
||||
/**
|
||||
* \brief Convert a pgRectObject to an SDL_Rect.
|
||||
*
|
||||
* \param obj A pgRectObject instance.
|
||||
* \returns the SDL_Rect field of *obj*, a pgRect_Type instance.
|
||||
*
|
||||
* \note SDL_Rect pgRect_AsRect(PyObject *obj)
|
||||
*/
|
||||
#define pgRect_AsRect(x) (((pgRectObject *)x)->r)
|
||||
|
||||
#ifndef PYGAMEAPI_RECT_INTERNAL
|
||||
|
||||
/**
|
||||
* \brief The Pygame rectangle object type pygame.Rect.
|
||||
*/
|
||||
#define pgRect_Type (*(PyTypeObject *)PYGAMEAPI_GET_SLOT(rect, 0))
|
||||
|
||||
/**
|
||||
* \brief Check if *obj* is a `pygame.Rect` instance.
|
||||
*
|
||||
* \returns true if *obj* is a `pygame.Rect` instance
|
||||
*/
|
||||
#define pgRect_Check(obj) ((obj)->ob_type == &pgRect_Type)
|
||||
|
||||
/**
|
||||
* \brief Create a new `pygame.Rect` instance.
|
||||
*
|
||||
* \param r A pointer to an SDL_Rect struct.
|
||||
* \returns a new `pygame.Rect` object for the SDL_Rect *r*.
|
||||
* Returns *NULL* on error.
|
||||
*
|
||||
* \note PyObject* pgRect_New(SDL_Rect *r)
|
||||
*/
|
||||
#define pgRect_New (*(PyObject * (*)(SDL_Rect *)) PYGAMEAPI_GET_SLOT(rect, 1))
|
||||
|
||||
/**
|
||||
* \brief Create a new `pygame.Rect` instance from x, y, w, h.
|
||||
*
|
||||
* \param x The x coordinate of the rectangle.
|
||||
* \param y The y coordinate of the rectangle.
|
||||
* \param w The width of the rectangle.
|
||||
* \param h The height of the rectangle.
|
||||
* \returns a new `pygame.Rect` object. Returns *NULL* on error.
|
||||
*
|
||||
* \note PyObject* pgRect_New4(int x, int y, int w, int h)
|
||||
*/
|
||||
#define pgRect_New4 \
|
||||
(*(PyObject * (*)(int, int, int, int)) PYGAMEAPI_GET_SLOT(rect, 2))
|
||||
|
||||
/**
|
||||
* \brief Convert a Python object to a `pygame.Rect` instance.
|
||||
*
|
||||
* \param obj A Python object.
|
||||
* A rectangle can be a length 4 sequence integers (x, y, w, h), or a length 2
|
||||
* sequence of position (x, y) and size (w, h), or a length 1 tuple containing
|
||||
* a rectangle representation, or have a method *rect* that returns a
|
||||
* rectangle.
|
||||
*
|
||||
* \param temp A pointer to an SDL_Rect struct to store the result in.
|
||||
* \returns a pointer to the SDL_Rect field of the `pygame.Rect` instance
|
||||
* *obj*. Returns *NULL* on error.
|
||||
*
|
||||
* \note This function will clear any Python errors.
|
||||
* \note SDL_Rect* pgRect_FromObject(PyObject *obj, SDL_Rect *temp)
|
||||
*/
|
||||
#define pgRect_FromObject \
|
||||
(*(SDL_Rect * (*)(PyObject *, SDL_Rect *)) PYGAMEAPI_GET_SLOT(rect, 3))
|
||||
|
||||
/**
|
||||
* \brief Normalize a `pygame.Rect` instance. A rect with a negative size
|
||||
* (negative width and/or height) will be adjusted to have a positive size.
|
||||
*
|
||||
* \param rect A pointer to a `pygame.Rect` instance.
|
||||
* \returns *rect* normalized with positive values only.
|
||||
*
|
||||
* \note void pgRect_Normalize(SDL_Rect *rect)
|
||||
*/
|
||||
#define pgRect_Normalize (*(void (*)(SDL_Rect *))PYGAMEAPI_GET_SLOT(rect, 4))
|
||||
|
||||
#define import_pygame_rect() IMPORT_PYGAME_MODULE(rect)
|
||||
#endif /* ~PYGAMEAPI_RECT_INTERNAL */
|
||||
|
||||
/*
|
||||
* JOYSTICK module
|
||||
*/
|
||||
typedef struct pgJoystickObject {
|
||||
PyObject_HEAD int id;
|
||||
SDL_Joystick *joy;
|
||||
|
||||
/* Joysticks form an intrusive linked list.
|
||||
*
|
||||
* Note that we don't maintain refcounts for these so they are weakrefs
|
||||
* from the Python side.
|
||||
*/
|
||||
struct pgJoystickObject *next;
|
||||
struct pgJoystickObject *prev;
|
||||
} pgJoystickObject;
|
||||
|
||||
#define pgJoystick_AsID(x) (((pgJoystickObject *)x)->id)
|
||||
#define pgJoystick_AsSDL(x) (((pgJoystickObject *)x)->joy)
|
||||
|
||||
#ifndef PYGAMEAPI_JOYSTICK_INTERNAL
|
||||
#define pgJoystick_Type (*(PyTypeObject *)PYGAMEAPI_GET_SLOT(joystick, 0))
|
||||
|
||||
#define pgJoystick_Check(x) ((x)->ob_type == &pgJoystick_Type)
|
||||
#define pgJoystick_New (*(PyObject * (*)(int)) PYGAMEAPI_GET_SLOT(joystick, 1))
|
||||
|
||||
#define import_pygame_joystick() IMPORT_PYGAME_MODULE(joystick)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* DISPLAY module
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
Uint32 hw_available : 1;
|
||||
Uint32 wm_available : 1;
|
||||
Uint32 blit_hw : 1;
|
||||
Uint32 blit_hw_CC : 1;
|
||||
Uint32 blit_hw_A : 1;
|
||||
Uint32 blit_sw : 1;
|
||||
Uint32 blit_sw_CC : 1;
|
||||
Uint32 blit_sw_A : 1;
|
||||
Uint32 blit_fill : 1;
|
||||
Uint32 video_mem;
|
||||
SDL_PixelFormat *vfmt;
|
||||
SDL_PixelFormat vfmt_data;
|
||||
int current_w;
|
||||
int current_h;
|
||||
} pg_VideoInfo;
|
||||
|
||||
/**
|
||||
* A pygame object that wraps an SDL_VideoInfo struct.
|
||||
* The object returned by `pygame.display.Info()`
|
||||
*/
|
||||
typedef struct {
|
||||
PyObject_HEAD pg_VideoInfo info;
|
||||
} pgVidInfoObject;
|
||||
|
||||
/**
|
||||
* \brief Convert a pgVidInfoObject to an SDL_VideoInfo.
|
||||
*
|
||||
* \note SDL_VideoInfo pgVidInfo_AsVidInfo(PyObject *obj)
|
||||
*
|
||||
* \returns the SDL_VideoInfo field of *obj*, a pgVidInfo_Type instance.
|
||||
* \param obj A pgVidInfo_Type instance.
|
||||
*
|
||||
* \note Does not check that *obj* is not `NULL` or an `pgVidInfoObject`
|
||||
* object.
|
||||
*/
|
||||
#define pgVidInfo_AsVidInfo(x) (((pgVidInfoObject *)x)->info)
|
||||
|
||||
#ifndef PYGAMEAPI_DISPLAY_INTERNAL
|
||||
/**
|
||||
* \brief The pgVidInfoObject object Python type.
|
||||
* \note pgVideoInfo_Type is used for the `pygame.display.Info()` object.
|
||||
*/
|
||||
#define pgVidInfo_Type (*(PyTypeObject *)PYGAMEAPI_GET_SLOT(display, 0))
|
||||
|
||||
/**
|
||||
* \brief Check if *obj* is a pgVidInfoObject.
|
||||
*
|
||||
* \returns true if *x* is a `pgVidInfo_Type` instance
|
||||
* \note Will return false if *x* is a subclass of `pgVidInfo_Type`.
|
||||
* \note This macro does not check that *x* is not ``NULL``.
|
||||
* \note int pgVidInfo_Check(PyObject *x)
|
||||
*/
|
||||
#define pgVidInfo_Check(x) ((x)->ob_type == &pgVidInfo_Type)
|
||||
|
||||
/**
|
||||
* \brief Create a new pgVidInfoObject.
|
||||
*
|
||||
* \param i A pointer to an SDL_VideoInfo struct.
|
||||
* \returns a new `pgVidInfoObject` object for the SDL_VideoInfo *i*.
|
||||
*
|
||||
* \note PyObject* pgVidInfo_New(SDL_VideoInfo *i)
|
||||
* \note On failure, raise a Python exception and return `NULL`.
|
||||
*/
|
||||
#define pgVidInfo_New \
|
||||
(*(PyObject * (*)(pg_VideoInfo *)) PYGAMEAPI_GET_SLOT(display, 1))
|
||||
|
||||
#define import_pygame_display() IMPORT_PYGAME_MODULE(display)
|
||||
#endif /* ~PYGAMEAPI_DISPLAY_INTERNAL */
|
||||
|
||||
/*
|
||||
* SURFACE module
|
||||
*/
|
||||
struct pgSubSurface_Data;
|
||||
struct SDL_Surface;
|
||||
|
||||
/**
|
||||
* \brief A pygame object that wraps an SDL_Surface. A `pygame.Surface`
|
||||
* instance.
|
||||
*/
|
||||
typedef struct {
|
||||
PyObject_HEAD struct SDL_Surface *surf;
|
||||
/**
|
||||
* \brief If true, the surface will be freed when the python object is
|
||||
* destroyed.
|
||||
*/
|
||||
int owner;
|
||||
/**
|
||||
* \brief The subsurface data for this surface (if a subsurface).
|
||||
*/
|
||||
struct pgSubSurface_Data *subsurface;
|
||||
/**
|
||||
* \brief A list of weak references to this surface.
|
||||
*/
|
||||
PyObject *weakreflist;
|
||||
/**
|
||||
* \brief A list of locks for this surface.
|
||||
*/
|
||||
PyObject *locklist;
|
||||
/**
|
||||
* \brief Usually a buffer object which the surface gets its data from.
|
||||
*/
|
||||
PyObject *dependency;
|
||||
} pgSurfaceObject;
|
||||
|
||||
/**
|
||||
* \brief Convert a `pygame.Surface` instance to an SDL_Surface.
|
||||
*
|
||||
* \param x A `pygame.Surface` instance.
|
||||
* \returns the SDL_Surface field of *x*, a `pygame.Surface` instance.
|
||||
*
|
||||
* \note SDL_Surface* pgSurface_AsSurface(PyObject *x)
|
||||
*/
|
||||
#define pgSurface_AsSurface(x) (((pgSurfaceObject *)x)->surf)
|
||||
|
||||
#ifndef PYGAMEAPI_SURFACE_INTERNAL
|
||||
/**
|
||||
* \brief The `pygame.Surface` object Python type.
|
||||
*/
|
||||
#define pgSurface_Type (*(PyTypeObject *)PYGAMEAPI_GET_SLOT(surface, 0))
|
||||
|
||||
/**
|
||||
* \brief Check if *x* is a `pygame.Surface` instance.
|
||||
*
|
||||
* \param x The object to check.
|
||||
* \returns true if *x* is a `pygame.Surface` instance
|
||||
*
|
||||
* \note Will return false if *x* is a subclass of `pygame.Surface`.
|
||||
* \note This macro does not check that *x* is not ``NULL``.
|
||||
* \note int pgSurface_Check(PyObject *x)
|
||||
*/
|
||||
#define pgSurface_Check(x) \
|
||||
(PyObject_IsInstance((x), (PyObject *)&pgSurface_Type))
|
||||
|
||||
/**
|
||||
* \brief Create a new `pygame.Surface` instance.
|
||||
*
|
||||
* \param s The SDL surface to wrap in a python object.
|
||||
* \param owner If true, the surface will be freed when the python object is
|
||||
* destroyed. \returns A new new pygame surface instance for SDL surface *s*.
|
||||
* Returns *NULL* on error.
|
||||
*
|
||||
* \note pgSurfaceObject* pgSurface_New2(SDL_Surface *s, int owner)
|
||||
*/
|
||||
#define pgSurface_New2 \
|
||||
(*(pgSurfaceObject * (*)(SDL_Surface *, int)) \
|
||||
PYGAMEAPI_GET_SLOT(surface, 1))
|
||||
|
||||
/**
|
||||
* \brief Sets the SDL surface for a `pygame.Surface` instance.
|
||||
*
|
||||
* \param self The `pygame.Surface` instance to set the surface for.
|
||||
* \param s The SDL surface to set.
|
||||
* \param owner If true, the surface will be freed when the python object is
|
||||
* destroyed. \returns 0 on success, -1 on failure.
|
||||
*
|
||||
* \note int pgSurface_SetSurface(pgSurfaceObject *self, SDL_Surface *s, int
|
||||
* owner)
|
||||
*/
|
||||
#define pgSurface_SetSurface \
|
||||
(*(int (*)(pgSurfaceObject *, SDL_Surface *, int))PYGAMEAPI_GET_SLOT( \
|
||||
surface, 3))
|
||||
|
||||
/**
|
||||
* \brief Blit one surface onto another.
|
||||
*
|
||||
* \param dstobj The destination surface.
|
||||
* \param srcobj The source surface.
|
||||
* \param dstrect The destination rectangle.
|
||||
* \param srcrect The source rectangle.
|
||||
* \param the_args The blit flags.
|
||||
* \return 0 for success, -1 or -2 for error.
|
||||
*
|
||||
* \note Is accessible through the C api.
|
||||
* \note int pgSurface_Blit(PyObject *dstobj, PyObject *srcobj, SDL_Rect
|
||||
* *dstrect, SDL_Rect *srcrect, int the_args)
|
||||
*/
|
||||
#define pgSurface_Blit \
|
||||
(*(int (*)(pgSurfaceObject *, pgSurfaceObject *, SDL_Rect *, SDL_Rect *, \
|
||||
int))PYGAMEAPI_GET_SLOT(surface, 2))
|
||||
|
||||
#define import_pygame_surface() \
|
||||
do { \
|
||||
IMPORT_PYGAME_MODULE(surface); \
|
||||
if (PyErr_Occurred() != NULL) \
|
||||
break; \
|
||||
IMPORT_PYGAME_MODULE(surflock); \
|
||||
} while (0)
|
||||
|
||||
#define pgSurface_New(surface) pgSurface_New2((surface), 1)
|
||||
#define pgSurface_NewNoOwn(surface) pgSurface_New2((surface), 0)
|
||||
|
||||
#endif /* ~PYGAMEAPI_SURFACE_INTERNAL */
|
||||
|
||||
/*
|
||||
* SURFLOCK module
|
||||
* auto imported/initialized by surface
|
||||
*/
|
||||
#ifndef PYGAMEAPI_SURFLOCK_INTERNAL
|
||||
#define pgLifetimeLock_Type (*(PyTypeObject *)PYGAMEAPI_GET_SLOT(surflock, 0))
|
||||
|
||||
#define pgLifetimeLock_Check(x) ((x)->ob_type == &pgLifetimeLock_Type)
|
||||
|
||||
#define pgSurface_Prep(x) \
|
||||
if ((x)->subsurface) \
|
||||
(*(*(void (*)(pgSurfaceObject *))PYGAMEAPI_GET_SLOT(surflock, 1)))(x)
|
||||
|
||||
#define pgSurface_Unprep(x) \
|
||||
if ((x)->subsurface) \
|
||||
(*(*(void (*)(pgSurfaceObject *))PYGAMEAPI_GET_SLOT(surflock, 2)))(x)
|
||||
|
||||
#define pgSurface_Lock \
|
||||
(*(int (*)(pgSurfaceObject *))PYGAMEAPI_GET_SLOT(surflock, 3))
|
||||
|
||||
#define pgSurface_Unlock \
|
||||
(*(int (*)(pgSurfaceObject *))PYGAMEAPI_GET_SLOT(surflock, 4))
|
||||
|
||||
#define pgSurface_LockBy \
|
||||
(*(int (*)(pgSurfaceObject *, PyObject *))PYGAMEAPI_GET_SLOT(surflock, 5))
|
||||
|
||||
#define pgSurface_UnlockBy \
|
||||
(*(int (*)(pgSurfaceObject *, PyObject *))PYGAMEAPI_GET_SLOT(surflock, 6))
|
||||
|
||||
#define pgSurface_LockLifetime \
|
||||
(*(PyObject * (*)(PyObject *, PyObject *)) PYGAMEAPI_GET_SLOT(surflock, 7))
|
||||
#endif
|
||||
|
||||
/*
|
||||
* EVENT module
|
||||
*/
|
||||
typedef struct pgEventObject pgEventObject;
|
||||
|
||||
#ifndef PYGAMEAPI_EVENT_INTERNAL
|
||||
#define pgEvent_Type (*(PyTypeObject *)PYGAMEAPI_GET_SLOT(event, 0))
|
||||
|
||||
#define pgEvent_Check(x) ((x)->ob_type == &pgEvent_Type)
|
||||
|
||||
#define pgEvent_New \
|
||||
(*(PyObject * (*)(SDL_Event *)) PYGAMEAPI_GET_SLOT(event, 1))
|
||||
|
||||
#define pgEvent_New2 \
|
||||
(*(PyObject * (*)(int, PyObject *)) PYGAMEAPI_GET_SLOT(event, 2))
|
||||
|
||||
#define pgEvent_FillUserEvent \
|
||||
(*(int (*)(pgEventObject *, SDL_Event *))PYGAMEAPI_GET_SLOT(event, 3))
|
||||
|
||||
#define pg_EnableKeyRepeat (*(int (*)(int, int))PYGAMEAPI_GET_SLOT(event, 4))
|
||||
|
||||
#define pg_GetKeyRepeat (*(void (*)(int *, int *))PYGAMEAPI_GET_SLOT(event, 5))
|
||||
|
||||
#define import_pygame_event() IMPORT_PYGAME_MODULE(event)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* RWOBJECT module
|
||||
* the rwobject are only needed for C side work, not accessible from python.
|
||||
*/
|
||||
#ifndef PYGAMEAPI_RWOBJECT_INTERNAL
|
||||
#define pgRWops_FromObject \
|
||||
(*(SDL_RWops * (*)(PyObject *, char **)) PYGAMEAPI_GET_SLOT(rwobject, 0))
|
||||
|
||||
#define pgRWops_IsFileObject \
|
||||
(*(int (*)(SDL_RWops *))PYGAMEAPI_GET_SLOT(rwobject, 1))
|
||||
|
||||
#define pg_EncodeFilePath \
|
||||
(*(PyObject * (*)(PyObject *, PyObject *)) PYGAMEAPI_GET_SLOT(rwobject, 2))
|
||||
|
||||
#define pg_EncodeString \
|
||||
(*(PyObject * (*)(PyObject *, const char *, const char *, PyObject *)) \
|
||||
PYGAMEAPI_GET_SLOT(rwobject, 3))
|
||||
|
||||
#define pgRWops_FromFileObject \
|
||||
(*(SDL_RWops * (*)(PyObject *)) PYGAMEAPI_GET_SLOT(rwobject, 4))
|
||||
|
||||
#define pgRWops_ReleaseObject \
|
||||
(*(int (*)(SDL_RWops *))PYGAMEAPI_GET_SLOT(rwobject, 5))
|
||||
|
||||
#define import_pygame_rwobject() IMPORT_PYGAME_MODULE(rwobject)
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
* PixelArray module
|
||||
*/
|
||||
#ifndef PYGAMEAPI_PIXELARRAY_INTERNAL
|
||||
#define PyPixelArray_Type ((PyTypeObject *)PYGAMEAPI_GET_SLOT(pixelarray, 0))
|
||||
|
||||
#define PyPixelArray_Check(x) ((x)->ob_type == &PyPixelArray_Type)
|
||||
#define PyPixelArray_New (*(PyObject * (*)) PYGAMEAPI_GET_SLOT(pixelarray, 1))
|
||||
|
||||
#define import_pygame_pixelarray() IMPORT_PYGAME_MODULE(pixelarray)
|
||||
#endif /* PYGAMEAPI_PIXELARRAY_INTERNAL */
|
||||
|
||||
/*
|
||||
* Color module
|
||||
*/
|
||||
typedef struct pgColorObject pgColorObject;
|
||||
|
||||
#ifndef PYGAMEAPI_COLOR_INTERNAL
|
||||
#define pgColor_Type (*(PyObject *)PYGAMEAPI_GET_SLOT(color, 0))
|
||||
|
||||
#define pgColor_Check(x) ((x)->ob_type == &pgColor_Type)
|
||||
#define pgColor_New (*(PyObject * (*)(Uint8 *)) PYGAMEAPI_GET_SLOT(color, 1))
|
||||
|
||||
#define pgColor_NewLength \
|
||||
(*(PyObject * (*)(Uint8 *, Uint8)) PYGAMEAPI_GET_SLOT(color, 3))
|
||||
|
||||
#define pg_RGBAFromColorObj \
|
||||
(*(int (*)(PyObject *, Uint8 *))PYGAMEAPI_GET_SLOT(color, 2))
|
||||
|
||||
#define pg_RGBAFromFuzzyColorObj \
|
||||
(*(int (*)(PyObject *, Uint8 *))PYGAMEAPI_GET_SLOT(color, 4))
|
||||
|
||||
#define pgColor_AsArray(x) (((pgColorObject *)x)->data)
|
||||
#define pgColor_NumComponents(x) (((pgColorObject *)x)->len)
|
||||
|
||||
#define import_pygame_color() IMPORT_PYGAME_MODULE(color)
|
||||
#endif /* PYGAMEAPI_COLOR_INTERNAL */
|
||||
|
||||
/*
|
||||
* Math module
|
||||
*/
|
||||
#ifndef PYGAMEAPI_MATH_INTERNAL
|
||||
#define pgVector2_Check(x) \
|
||||
((x)->ob_type == (PyTypeObject *)PYGAMEAPI_GET_SLOT(math, 0))
|
||||
|
||||
#define pgVector3_Check(x) \
|
||||
((x)->ob_type == (PyTypeObject *)PYGAMEAPI_GET_SLOT(math, 1))
|
||||
/*
|
||||
#define pgVector2_New \
|
||||
(*(PyObject*(*)) \
|
||||
PYGAMEAPI_GET_SLOT(PyGAME_C_API, 1))
|
||||
*/
|
||||
#define import_pygame_math() IMPORT_PYGAME_MODULE(math)
|
||||
#endif /* PYGAMEAPI_MATH_INTERNAL */
|
||||
|
||||
#define IMPORT_PYGAME_MODULE _IMPORT_PYGAME_MODULE
|
||||
|
||||
/*
|
||||
* base pygame API slots
|
||||
* disable slots with NO_PYGAME_C_API
|
||||
*/
|
||||
#ifdef PYGAME_H
|
||||
PYGAMEAPI_DEFINE_SLOTS(base);
|
||||
PYGAMEAPI_DEFINE_SLOTS(rect);
|
||||
PYGAMEAPI_DEFINE_SLOTS(cdrom);
|
||||
PYGAMEAPI_DEFINE_SLOTS(joystick);
|
||||
PYGAMEAPI_DEFINE_SLOTS(display);
|
||||
PYGAMEAPI_DEFINE_SLOTS(surface);
|
||||
PYGAMEAPI_DEFINE_SLOTS(surflock);
|
||||
PYGAMEAPI_DEFINE_SLOTS(event);
|
||||
PYGAMEAPI_DEFINE_SLOTS(rwobject);
|
||||
PYGAMEAPI_DEFINE_SLOTS(pixelarray);
|
||||
PYGAMEAPI_DEFINE_SLOTS(color);
|
||||
PYGAMEAPI_DEFINE_SLOTS(math);
|
||||
#else /* ~PYGAME_H */
|
||||
PYGAMEAPI_EXTERN_SLOTS(base);
|
||||
PYGAMEAPI_EXTERN_SLOTS(rect);
|
||||
PYGAMEAPI_EXTERN_SLOTS(cdrom);
|
||||
PYGAMEAPI_EXTERN_SLOTS(joystick);
|
||||
PYGAMEAPI_EXTERN_SLOTS(display);
|
||||
PYGAMEAPI_EXTERN_SLOTS(surface);
|
||||
PYGAMEAPI_EXTERN_SLOTS(surflock);
|
||||
PYGAMEAPI_EXTERN_SLOTS(event);
|
||||
PYGAMEAPI_EXTERN_SLOTS(rwobject);
|
||||
PYGAMEAPI_EXTERN_SLOTS(pixelarray);
|
||||
PYGAMEAPI_EXTERN_SLOTS(color);
|
||||
PYGAMEAPI_EXTERN_SLOTS(math);
|
||||
#endif /* ~PYGAME_H */
|
||||
|
||||
#endif /* PYGAME_H */
|
||||
|
||||
/* Use the end of this file for other cross module inline utility
|
||||
* functions There seems to be no good reason to stick to macro only
|
||||
* functions in Python 3.
|
||||
*/
|
||||
|
||||
static PG_INLINE PyObject *
|
||||
pg_tuple_couple_from_values_int(int val1, int val2)
|
||||
{
|
||||
/* This function turns two input integers into a python tuple object.
|
||||
* Currently, 5th November 2022, this is faster than using Py_BuildValue
|
||||
* to do the same thing.
|
||||
*/
|
||||
PyObject *tup = PyTuple_New(2);
|
||||
if (!tup) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
PyObject *tmp = PyLong_FromLong(val1);
|
||||
if (!tmp) {
|
||||
Py_DECREF(tup);
|
||||
return NULL;
|
||||
}
|
||||
PyTuple_SET_ITEM(tup, 0, tmp);
|
||||
|
||||
tmp = PyLong_FromLong(val2);
|
||||
if (!tmp) {
|
||||
Py_DECREF(tup);
|
||||
return NULL;
|
||||
}
|
||||
PyTuple_SET_ITEM(tup, 1, tmp);
|
||||
|
||||
return tup;
|
||||
}
|
||||
|
||||
static PG_INLINE PyObject *
|
||||
pg_tuple_triple_from_values_int(int val1, int val2, int val3)
|
||||
{
|
||||
/* This function turns three input integers into a python tuple object.
|
||||
* Currently, 5th November 2022, this is faster than using Py_BuildValue
|
||||
* to do the same thing.
|
||||
*/
|
||||
PyObject *tup = PyTuple_New(3);
|
||||
if (!tup) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
PyObject *tmp = PyLong_FromLong(val1);
|
||||
if (!tmp) {
|
||||
Py_DECREF(tup);
|
||||
return NULL;
|
||||
}
|
||||
PyTuple_SET_ITEM(tup, 0, tmp);
|
||||
|
||||
tmp = PyLong_FromLong(val2);
|
||||
if (!tmp) {
|
||||
Py_DECREF(tup);
|
||||
return NULL;
|
||||
}
|
||||
PyTuple_SET_ITEM(tup, 1, tmp);
|
||||
|
||||
tmp = PyLong_FromLong(val3);
|
||||
if (!tmp) {
|
||||
Py_DECREF(tup);
|
||||
return NULL;
|
||||
}
|
||||
PyTuple_SET_ITEM(tup, 2, tmp);
|
||||
|
||||
return tup;
|
||||
}
|
@ -1,171 +0,0 @@
|
||||
/*
|
||||
Bitmask 1.7 - A pixel-perfect collision detection library.
|
||||
|
||||
Copyright (C) 2002-2005 Ulf Ekstrom except for the bitcount
|
||||
function which is copyright (C) Donald W. Gillies, 1992.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
#ifndef BITMASK_H
|
||||
#define BITMASK_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <limits.h>
|
||||
/* Define INLINE for different compilers. If your compiler does not
|
||||
support inlining then there might be a performance hit in
|
||||
bitmask_overlap_area().
|
||||
*/
|
||||
#ifndef INLINE
|
||||
#ifdef __GNUC__
|
||||
#define INLINE inline
|
||||
#else
|
||||
#ifdef _MSC_VER
|
||||
#define INLINE __inline
|
||||
#else
|
||||
#define INLINE
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define BITMASK_W unsigned long int
|
||||
#define BITMASK_W_LEN (sizeof(BITMASK_W) * CHAR_BIT)
|
||||
#define BITMASK_W_MASK (BITMASK_W_LEN - 1)
|
||||
#define BITMASK_N(n) ((BITMASK_W)1 << (n))
|
||||
|
||||
typedef struct bitmask {
|
||||
int w, h;
|
||||
BITMASK_W bits[1];
|
||||
} bitmask_t;
|
||||
|
||||
/* Creates a bitmask of width w and height h, where
|
||||
w and h must both be greater than or equal to 0.
|
||||
The mask is automatically cleared when created.
|
||||
*/
|
||||
bitmask_t *
|
||||
bitmask_create(int w, int h);
|
||||
|
||||
/* Frees all the memory allocated by bitmask_create for m. */
|
||||
void
|
||||
bitmask_free(bitmask_t *m);
|
||||
|
||||
/* Create a copy of the given bitmask. */
|
||||
bitmask_t *
|
||||
bitmask_copy(bitmask_t *m);
|
||||
|
||||
/* Clears all bits in the mask */
|
||||
void
|
||||
bitmask_clear(bitmask_t *m);
|
||||
|
||||
/* Sets all bits in the mask */
|
||||
void
|
||||
bitmask_fill(bitmask_t *m);
|
||||
|
||||
/* Flips all bits in the mask */
|
||||
void
|
||||
bitmask_invert(bitmask_t *m);
|
||||
|
||||
/* Counts the bits in the mask */
|
||||
unsigned int
|
||||
bitmask_count(bitmask_t *m);
|
||||
|
||||
/* Returns nonzero if the bit at (x,y) is set. Coordinates start at
|
||||
(0,0) */
|
||||
static INLINE int
|
||||
bitmask_getbit(const bitmask_t *m, int x, int y)
|
||||
{
|
||||
return (m->bits[x / BITMASK_W_LEN * m->h + y] &
|
||||
BITMASK_N(x & BITMASK_W_MASK)) != 0;
|
||||
}
|
||||
|
||||
/* Sets the bit at (x,y) */
|
||||
static INLINE void
|
||||
bitmask_setbit(bitmask_t *m, int x, int y)
|
||||
{
|
||||
m->bits[x / BITMASK_W_LEN * m->h + y] |= BITMASK_N(x & BITMASK_W_MASK);
|
||||
}
|
||||
|
||||
/* Clears the bit at (x,y) */
|
||||
static INLINE void
|
||||
bitmask_clearbit(bitmask_t *m, int x, int y)
|
||||
{
|
||||
m->bits[x / BITMASK_W_LEN * m->h + y] &= ~BITMASK_N(x & BITMASK_W_MASK);
|
||||
}
|
||||
|
||||
/* Returns nonzero if the masks overlap with the given offset.
|
||||
The overlap tests uses the following offsets (which may be negative):
|
||||
|
||||
+----+----------..
|
||||
|A | yoffset
|
||||
| +-+----------..
|
||||
+--|B
|
||||
|xoffset
|
||||
| |
|
||||
: :
|
||||
*/
|
||||
int
|
||||
bitmask_overlap(const bitmask_t *a, const bitmask_t *b, int xoffset,
|
||||
int yoffset);
|
||||
|
||||
/* Like bitmask_overlap(), but will also give a point of intersection.
|
||||
x and y are given in the coordinates of mask a, and are untouched
|
||||
if there is no overlap. */
|
||||
int
|
||||
bitmask_overlap_pos(const bitmask_t *a, const bitmask_t *b, int xoffset,
|
||||
int yoffset, int *x, int *y);
|
||||
|
||||
/* Returns the number of overlapping 'pixels' */
|
||||
int
|
||||
bitmask_overlap_area(const bitmask_t *a, const bitmask_t *b, int xoffset,
|
||||
int yoffset);
|
||||
|
||||
/* Fills a mask with the overlap of two other masks. A bitwise AND. */
|
||||
void
|
||||
bitmask_overlap_mask(const bitmask_t *a, const bitmask_t *b, bitmask_t *c,
|
||||
int xoffset, int yoffset);
|
||||
|
||||
/* Draws mask b onto mask a (bitwise OR). Can be used to compose large
|
||||
(game background?) mask from several submasks, which may speed up
|
||||
the testing. */
|
||||
|
||||
void
|
||||
bitmask_draw(bitmask_t *a, const bitmask_t *b, int xoffset, int yoffset);
|
||||
|
||||
void
|
||||
bitmask_erase(bitmask_t *a, const bitmask_t *b, int xoffset, int yoffset);
|
||||
|
||||
/* Return a new scaled bitmask, with dimensions w*h. The quality of the
|
||||
scaling may not be perfect for all circumstances, but it should
|
||||
be reasonable. If either w or h is 0 a clear 1x1 mask is returned. */
|
||||
bitmask_t *
|
||||
bitmask_scale(const bitmask_t *m, int w, int h);
|
||||
|
||||
/* Convolve b into a, drawing the output into o, shifted by offset. If offset
|
||||
* is 0, then the (x,y) bit will be set if and only if
|
||||
* bitmask_overlap(a, b, x - b->w - 1, y - b->h - 1) returns true.
|
||||
*
|
||||
* Modifies bits o[xoffset ... xoffset + a->w + b->w - 1)
|
||||
* [yoffset ... yoffset + a->h + b->h - 1). */
|
||||
void
|
||||
bitmask_convolve(const bitmask_t *a, const bitmask_t *b, bitmask_t *o,
|
||||
int xoffset, int yoffset);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* End of extern "C" { */
|
||||
#endif
|
||||
|
||||
#endif
|
@ -1,102 +0,0 @@
|
||||
#if !defined(PGCOMPAT_H)
|
||||
#define PGCOMPAT_H
|
||||
|
||||
#include <Python.h>
|
||||
|
||||
/* In CPython, Py_Exit finalises the python interpreter before calling C exit()
|
||||
* This does not exist on PyPy, so use exit() directly here */
|
||||
#ifdef PYPY_VERSION
|
||||
#define PG_EXIT(n) exit(n)
|
||||
#else
|
||||
#define PG_EXIT(n) Py_Exit(n)
|
||||
#endif
|
||||
|
||||
/* define common types where SDL is not included */
|
||||
#ifndef SDL_VERSION_ATLEAST
|
||||
#ifdef _MSC_VER
|
||||
typedef unsigned __int8 uint8_t;
|
||||
typedef unsigned __int32 uint32_t;
|
||||
#else
|
||||
#include <stdint.h>
|
||||
#endif
|
||||
typedef uint32_t Uint32;
|
||||
typedef uint8_t Uint8;
|
||||
#endif /* no SDL */
|
||||
|
||||
#if defined(SDL_VERSION_ATLEAST)
|
||||
|
||||
#ifndef SDL_WINDOW_VULKAN
|
||||
#define SDL_WINDOW_VULKAN 0
|
||||
#endif
|
||||
|
||||
#ifndef SDL_WINDOW_ALWAYS_ON_TOP
|
||||
#define SDL_WINDOW_ALWAYS_ON_TOP 0
|
||||
#endif
|
||||
|
||||
#ifndef SDL_WINDOW_SKIP_TASKBAR
|
||||
#define SDL_WINDOW_SKIP_TASKBAR 0
|
||||
#endif
|
||||
|
||||
#ifndef SDL_WINDOW_UTILITY
|
||||
#define SDL_WINDOW_UTILITY 0
|
||||
#endif
|
||||
|
||||
#ifndef SDL_WINDOW_TOOLTIP
|
||||
#define SDL_WINDOW_TOOLTIP 0
|
||||
#endif
|
||||
|
||||
#ifndef SDL_WINDOW_POPUP_MENU
|
||||
#define SDL_WINDOW_POPUP_MENU 0
|
||||
#endif
|
||||
|
||||
#ifndef SDL_WINDOW_INPUT_GRABBED
|
||||
#define SDL_WINDOW_INPUT_GRABBED 0
|
||||
#endif
|
||||
|
||||
#ifndef SDL_WINDOW_INPUT_FOCUS
|
||||
#define SDL_WINDOW_INPUT_FOCUS 0
|
||||
#endif
|
||||
|
||||
#ifndef SDL_WINDOW_MOUSE_FOCUS
|
||||
#define SDL_WINDOW_MOUSE_FOCUS 0
|
||||
#endif
|
||||
|
||||
#ifndef SDL_WINDOW_FOREIGN
|
||||
#define SDL_WINDOW_FOREIGN 0
|
||||
#endif
|
||||
|
||||
#ifndef SDL_WINDOW_ALLOW_HIGHDPI
|
||||
#define SDL_WINDOW_ALLOW_HIGHDPI 0
|
||||
#endif
|
||||
|
||||
#ifndef SDL_WINDOW_MOUSE_CAPTURE
|
||||
#define SDL_WINDOW_MOUSE_CAPTURE 0
|
||||
#endif
|
||||
|
||||
#ifndef SDL_WINDOW_ALWAYS_ON_TOP
|
||||
#define SDL_WINDOW_ALWAYS_ON_TOP 0
|
||||
#endif
|
||||
|
||||
#ifndef SDL_WINDOW_SKIP_TASKBAR
|
||||
#define SDL_WINDOW_SKIP_TASKBAR 0
|
||||
#endif
|
||||
|
||||
#ifndef SDL_WINDOW_UTILITY
|
||||
#define SDL_WINDOW_UTILITY 0
|
||||
#endif
|
||||
|
||||
#ifndef SDL_WINDOW_TOOLTIP
|
||||
#define SDL_WINDOW_TOOLTIP 0
|
||||
#endif
|
||||
|
||||
#ifndef SDL_WINDOW_POPUP_MENU
|
||||
#define SDL_WINDOW_POPUP_MENU 0
|
||||
#endif
|
||||
|
||||
#ifndef SDL_MOUSEWHEEL_FLIPPED
|
||||
#define NO_SDL_MOUSEWHEEL_FLIPPED
|
||||
#endif
|
||||
|
||||
#endif /* defined(SDL_VERSION_ATLEAST) */
|
||||
|
||||
#endif /* ~defined(PGCOMPAT_H) */
|
@ -1,67 +0,0 @@
|
||||
#ifndef PGIMPORT_H
|
||||
#define PGIMPORT_H
|
||||
|
||||
/* Prefix when importing module */
|
||||
#define IMPPREFIX "pygame."
|
||||
|
||||
#include "pgcompat.h"
|
||||
|
||||
#define PYGAMEAPI_LOCAL_ENTRY "_PYGAME_C_API"
|
||||
#define PG_CAPSULE_NAME(m) (IMPPREFIX m "." PYGAMEAPI_LOCAL_ENTRY)
|
||||
|
||||
/*
|
||||
* fill API slots defined by PYGAMEAPI_DEFINE_SLOTS/PYGAMEAPI_EXTERN_SLOTS
|
||||
*/
|
||||
#define _IMPORT_PYGAME_MODULE(module) \
|
||||
{ \
|
||||
PyObject *_mod_##module = PyImport_ImportModule(IMPPREFIX #module); \
|
||||
\
|
||||
if (_mod_##module != NULL) { \
|
||||
PyObject *_c_api = \
|
||||
PyObject_GetAttrString(_mod_##module, PYGAMEAPI_LOCAL_ENTRY); \
|
||||
\
|
||||
Py_DECREF(_mod_##module); \
|
||||
if (_c_api != NULL && PyCapsule_CheckExact(_c_api)) { \
|
||||
void **localptr = (void **)PyCapsule_GetPointer( \
|
||||
_c_api, PG_CAPSULE_NAME(#module)); \
|
||||
_PGSLOTS_##module = localptr; \
|
||||
} \
|
||||
Py_XDECREF(_c_api); \
|
||||
} \
|
||||
}
|
||||
|
||||
#define PYGAMEAPI_IS_IMPORTED(module) (_PGSLOTS_##module != NULL)
|
||||
|
||||
/*
|
||||
* source file must include one of these in order to use _IMPORT_PYGAME_MODULE.
|
||||
* this is set by import_pygame_*() functions.
|
||||
* disable with NO_PYGAME_C_API
|
||||
*/
|
||||
#define PYGAMEAPI_DEFINE_SLOTS(module) void **_PGSLOTS_##module = NULL
|
||||
#define PYGAMEAPI_EXTERN_SLOTS(module) extern void **_PGSLOTS_##module
|
||||
#define PYGAMEAPI_GET_SLOT(module, index) _PGSLOTS_##module[(index)]
|
||||
|
||||
/*
|
||||
* disabled API with NO_PYGAME_C_API; do nothing instead
|
||||
*/
|
||||
#ifdef NO_PYGAME_C_API
|
||||
|
||||
#undef PYGAMEAPI_DEFINE_SLOTS
|
||||
#undef PYGAMEAPI_EXTERN_SLOTS
|
||||
|
||||
#define PYGAMEAPI_DEFINE_SLOTS(module)
|
||||
#define PYGAMEAPI_EXTERN_SLOTS(module)
|
||||
|
||||
/* intentionally leave this defined to cause a compiler error *
|
||||
#define PYGAMEAPI_GET_SLOT(api_root, index)
|
||||
#undef PYGAMEAPI_GET_SLOT*/
|
||||
|
||||
#undef _IMPORT_PYGAME_MODULE
|
||||
#define _IMPORT_PYGAME_MODULE(module)
|
||||
|
||||
#endif /* NO_PYGAME_C_API */
|
||||
|
||||
#define encapsulate_api(ptr, module) \
|
||||
PyCapsule_New(ptr, PG_CAPSULE_NAME(module), NULL)
|
||||
|
||||
#endif /* ~PGIMPORT_H */
|
@ -1,87 +0,0 @@
|
||||
/* platform/compiler adjustments */
|
||||
#ifndef PG_PLATFORM_H
|
||||
#define PG_PLATFORM_H
|
||||
|
||||
#if defined(HAVE_SNPRINTF) /* defined in python.h (pyerrors.h) and SDL.h \
|
||||
(SDL_config.h) */
|
||||
#undef HAVE_SNPRINTF /* remove GCC redefine warning */
|
||||
#endif /* HAVE_SNPRINTF */
|
||||
|
||||
#ifndef PG_INLINE
|
||||
#if defined(__clang__)
|
||||
#define PG_INLINE __inline__ __attribute__((__unused__))
|
||||
#elif defined(__GNUC__)
|
||||
#define PG_INLINE __inline__
|
||||
#elif defined(_MSC_VER)
|
||||
#define PG_INLINE __inline
|
||||
#elif defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
|
||||
#define PG_INLINE inline
|
||||
#else
|
||||
#define PG_INLINE
|
||||
#endif
|
||||
#endif /* ~PG_INLINE */
|
||||
|
||||
// Worth trying this on MSVC/win32 builds to see if provides any speed up
|
||||
#ifndef PG_FORCEINLINE
|
||||
#if defined(__clang__)
|
||||
#define PG_FORCEINLINE __inline__ __attribute__((__unused__))
|
||||
#elif defined(__GNUC__)
|
||||
#define PG_FORCEINLINE __inline__
|
||||
#elif defined(_MSC_VER)
|
||||
#define PG_FORCEINLINE __forceinline
|
||||
#elif defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
|
||||
#define PG_FORCEINLINE inline
|
||||
#else
|
||||
#define PG_FORCEINLINE
|
||||
#endif
|
||||
#endif /* ~PG_FORCEINLINE */
|
||||
|
||||
/* This is unconditionally defined in Python.h */
|
||||
#if defined(_POSIX_C_SOURCE)
|
||||
#undef _POSIX_C_SOURCE
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_SNPRINTF)
|
||||
#undef HAVE_SNPRINTF
|
||||
#endif
|
||||
|
||||
/* SDL needs WIN32 */
|
||||
#if !defined(WIN32) && \
|
||||
(defined(MS_WIN32) || defined(_WIN32) || defined(__WIN32) || \
|
||||
defined(__WIN32__) || defined(_WINDOWS))
|
||||
#define WIN32
|
||||
#endif
|
||||
|
||||
/* Commenting out SSE4_2 stuff because it does not do runtime detection.
|
||||
#ifndef PG_TARGET_SSE4_2
|
||||
#if defined(__clang__) || (defined(__GNUC__) && ((__GNUC__ == 4 &&
|
||||
__GNUC_MINOR__ >= 9) || __GNUC__ >= 5 ))
|
||||
//The old gcc 4.8 on centos used by manylinux1 does not seem to get sse4.2
|
||||
intrinsics #define PG_FUNCTION_TARGET_SSE4_2 __attribute__((target("sse4.2")))
|
||||
// No else; we define the fallback later
|
||||
#endif
|
||||
#endif
|
||||
*/
|
||||
/* ~PG_TARGET_SSE4_2 */
|
||||
|
||||
/*
|
||||
#ifdef PG_FUNCTION_TARGET_SSE4_2
|
||||
#if !defined(__SSE4_2__) && !defined(PG_COMPILE_SSE4_2)
|
||||
#if defined(__x86_64__) || defined(__i386__)
|
||||
#define PG_COMPILE_SSE4_2 1
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
*/
|
||||
/* ~PG_TARGET_SSE4_2 */
|
||||
|
||||
/* Fallback definition of target attribute */
|
||||
#ifndef PG_FUNCTION_TARGET_SSE4_2
|
||||
#define PG_FUNCTION_TARGET_SSE4_2
|
||||
#endif
|
||||
|
||||
#ifndef PG_COMPILE_SSE4_2
|
||||
#define PG_COMPILE_SSE4_2 0
|
||||
#endif
|
||||
|
||||
#endif /* ~PG_PLATFORM_H */
|
@ -1,34 +0,0 @@
|
||||
/*
|
||||
pygame - Python Game Library
|
||||
Copyright (C) 2000-2001 Pete Shinners
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
Pete Shinners
|
||||
pete@shinners.org
|
||||
*/
|
||||
|
||||
/* To allow the Pygame C api to be globally shared by all code within an
|
||||
* extension module built from multiple C files, only include the pygame.h
|
||||
* header within the top level C file, the one which calls the
|
||||
* 'import_pygame_*' macros. All other C source files of the module should
|
||||
* include _pygame.h instead.
|
||||
*/
|
||||
#ifndef PYGAME_H
|
||||
#define PYGAME_H
|
||||
|
||||
#include "_pygame.h"
|
||||
|
||||
#endif
|
@ -1,56 +0,0 @@
|
||||
/*
|
||||
pygame - Python Game Library
|
||||
Copyright (C) 2000-2001 Pete Shinners
|
||||
Copyright (C) 2007 Rene Dudfield, Richard Goedeken
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
Pete Shinners
|
||||
pete@shinners.org
|
||||
*/
|
||||
|
||||
/* Bufferproxy module C api. */
|
||||
#if !defined(PG_BUFPROXY_HEADER)
|
||||
#define PG_BUFPROXY_HEADER
|
||||
|
||||
#include <Python.h>
|
||||
|
||||
typedef PyObject *(*_pgbufproxy_new_t)(PyObject *, getbufferproc);
|
||||
typedef PyObject *(*_pgbufproxy_get_obj_t)(PyObject *);
|
||||
typedef int (*_pgbufproxy_trip_t)(PyObject *);
|
||||
|
||||
#ifndef PYGAMEAPI_BUFPROXY_INTERNAL
|
||||
|
||||
#include "pgimport.h"
|
||||
|
||||
PYGAMEAPI_DEFINE_SLOTS(bufferproxy);
|
||||
|
||||
#define pgBufproxy_Type (*(PyTypeObject *)PYGAMEAPI_GET_SLOT(bufferproxy, 0))
|
||||
|
||||
#define pgBufproxy_Check(x) ((x)->ob_type == &pgBufproxy_Type)
|
||||
|
||||
#define pgBufproxy_New (*(_pgbufproxy_new_t)PYGAMEAPI_GET_SLOT(bufferproxy, 1))
|
||||
|
||||
#define pgBufproxy_GetParent \
|
||||
(*(_pgbufproxy_get_obj_t)PYGAMEAPI_GET_SLOT(bufferproxy, 2))
|
||||
|
||||
#define pgBufproxy_Trip \
|
||||
(*(_pgbufproxy_trip_t)PYGAMEAPI_GET_SLOT(bufferproxy, 3))
|
||||
|
||||
#define import_pygame_bufferproxy() _IMPORT_PYGAME_MODULE(bufferproxy)
|
||||
|
||||
#endif /* ~PYGAMEAPI_BUFPROXY_INTERNAL */
|
||||
|
||||
#endif /* ~defined(PG_BUFPROXY_HEADER) */
|
@ -1,50 +0,0 @@
|
||||
/*
|
||||
pygame - Python Game Library
|
||||
Copyright (C) 2000-2001 Pete Shinners
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
Pete Shinners
|
||||
pete@shinners.org
|
||||
*/
|
||||
|
||||
#include <Python.h>
|
||||
#include "pgplatform.h"
|
||||
|
||||
struct TTF_Font;
|
||||
|
||||
typedef struct {
|
||||
PyObject_HEAD TTF_Font *font;
|
||||
PyObject *weakreflist;
|
||||
unsigned int ttf_init_generation;
|
||||
} PyFontObject;
|
||||
#define PyFont_AsFont(x) (((PyFontObject *)x)->font)
|
||||
|
||||
#ifndef PYGAMEAPI_FONT_INTERNAL
|
||||
|
||||
#include "pgimport.h"
|
||||
|
||||
PYGAMEAPI_DEFINE_SLOTS(font);
|
||||
|
||||
#define PyFont_Type (*(PyTypeObject *)PYGAMEAPI_GET_SLOT(font, 0))
|
||||
#define PyFont_Check(x) ((x)->ob_type == &PyFont_Type)
|
||||
|
||||
#define PyFont_New (*(PyObject * (*)(TTF_Font *)) PYGAMEAPI_GET_SLOT(font, 1))
|
||||
|
||||
/*slot 2 taken by FONT_INIT_CHECK*/
|
||||
|
||||
#define import_pygame_font() _IMPORT_PYGAME_MODULE(font)
|
||||
|
||||
#endif
|
@ -1,42 +0,0 @@
|
||||
/*
|
||||
pygame - Python Game Library
|
||||
Copyright (C) 2009 Vicent Marti
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
*/
|
||||
#ifndef PYGAME_FREETYPE_H_
|
||||
#define PYGAME_FREETYPE_H_
|
||||
|
||||
#include "pgplatform.h"
|
||||
#include "pgimport.h"
|
||||
#include "pgcompat.h"
|
||||
|
||||
#ifndef PYGAME_FREETYPE_INTERNAL
|
||||
|
||||
PYGAMEAPI_DEFINE_SLOTS(_freetype);
|
||||
|
||||
#define pgFont_Type (*(PyTypeObject *)PYGAMEAPI_GET_SLOT(_freetype, 0))
|
||||
|
||||
#define pgFont_Check(x) ((x)->ob_type == &pgFont_Type)
|
||||
|
||||
#define pgFont_New \
|
||||
(*(PyObject * (*)(const char *, long)) PYGAMEAPI_GET_SLOT(_freetype, 1))
|
||||
|
||||
#define import_pygame_freetype() _IMPORT_PYGAME_MODULE(_freetype)
|
||||
|
||||
#endif /* PYGAME_FREETYPE_INTERNAL */
|
||||
|
||||
#endif /* PYGAME_FREETYPE_H_ */
|
@ -1,45 +0,0 @@
|
||||
/*
|
||||
pygame - Python Game Library
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#ifndef PGMASK_H
|
||||
#define PGMASK_H
|
||||
|
||||
#include <Python.h>
|
||||
#include "bitmask.h"
|
||||
|
||||
typedef struct {
|
||||
PyObject_HEAD bitmask_t *mask;
|
||||
void *bufdata;
|
||||
} pgMaskObject;
|
||||
|
||||
#define pgMask_AsBitmap(x) (((pgMaskObject *)x)->mask)
|
||||
|
||||
#ifndef PYGAMEAPI_MASK_INTERNAL
|
||||
|
||||
#include "pgimport.h"
|
||||
|
||||
PYGAMEAPI_DEFINE_SLOTS(mask);
|
||||
|
||||
#define pgMask_Type (*(PyTypeObject *)PYGAMEAPI_GET_SLOT(mask, 0))
|
||||
#define pgMask_Check(x) ((x)->ob_type == &pgMask_Type)
|
||||
|
||||
#define import_pygame_mask() _IMPORT_PYGAME_MODULE(mask)
|
||||
|
||||
#endif /* ~PYGAMEAPI_MASK_INTERNAL */
|
||||
|
||||
#endif /* ~PGMASK_H */
|
@ -1,71 +0,0 @@
|
||||
/*
|
||||
pygame - Python Game Library
|
||||
Copyright (C) 2000-2001 Pete Shinners
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
Pete Shinners
|
||||
pete@shinners.org
|
||||
*/
|
||||
|
||||
#ifndef PGMIXER_H
|
||||
#define PGMIXER_H
|
||||
|
||||
#include <Python.h>
|
||||
#include <structmember.h>
|
||||
|
||||
#include "pgcompat.h"
|
||||
|
||||
struct Mix_Chunk;
|
||||
|
||||
typedef struct {
|
||||
PyObject_HEAD Mix_Chunk *chunk;
|
||||
Uint8 *mem;
|
||||
PyObject *weakreflist;
|
||||
} pgSoundObject;
|
||||
|
||||
typedef struct {
|
||||
PyObject_HEAD int chan;
|
||||
} pgChannelObject;
|
||||
|
||||
#define pgSound_AsChunk(x) (((pgSoundObject *)x)->chunk)
|
||||
#define pgChannel_AsInt(x) (((pgChannelObject *)x)->chan)
|
||||
|
||||
#include "pgimport.h"
|
||||
|
||||
#ifndef PYGAMEAPI_MIXER_INTERNAL
|
||||
|
||||
PYGAMEAPI_DEFINE_SLOTS(mixer);
|
||||
|
||||
#define pgSound_Type (*(PyTypeObject *)PYGAMEAPI_GET_SLOT(mixer, 0))
|
||||
|
||||
#define pgSound_Check(x) ((x)->ob_type == &pgSound_Type)
|
||||
|
||||
#define pgSound_New \
|
||||
(*(PyObject * (*)(Mix_Chunk *)) PYGAMEAPI_GET_SLOT(mixer, 1))
|
||||
|
||||
#define pgSound_Play \
|
||||
(*(PyObject * (*)(PyObject *, PyObject *)) PYGAMEAPI_GET_SLOT(mixer, 2))
|
||||
|
||||
#define pgChannel_Type (*(PyTypeObject *)PYGAMEAPI_GET_SLOT(mixer, 3))
|
||||
#define pgChannel_Check(x) ((x)->ob_type == &pgChannel_Type)
|
||||
|
||||
#define pgChannel_New (*(PyObject * (*)(int)) PYGAMEAPI_GET_SLOT(mixer, 4))
|
||||
|
||||
#define import_pygame_mixer() _IMPORT_PYGAME_MODULE(mixer)
|
||||
|
||||
#endif /* PYGAMEAPI_MIXER_INTERNAL */
|
||||
|
||||
#endif /* ~PGMIXER_H */
|
File diff suppressed because it is too large
Load Diff
@ -1,7 +0,0 @@
|
||||
#ifndef PGMASK_INTERNAL_H
|
||||
#define PGMASK_INTERNAL_H
|
||||
|
||||
#include "include/pygame_mask.h"
|
||||
#define PYGAMEAPI_MASK_NUMSLOTS 1
|
||||
|
||||
#endif /* ~PGMASK_INTERNAL_H */
|
@ -1,14 +0,0 @@
|
||||
#ifndef MIXER_INTERNAL_H
|
||||
#define MIXER_INTERNAL_H
|
||||
|
||||
#include <SDL_mixer.h>
|
||||
|
||||
/* test mixer initializations */
|
||||
#define MIXER_INIT_CHECK() \
|
||||
if (!SDL_WasInit(SDL_INIT_AUDIO)) \
|
||||
return RAISE(pgExc_SDLError, "mixer not initialized")
|
||||
|
||||
#define PYGAMEAPI_MIXER_NUMSLOTS 5
|
||||
#include "include/pygame_mixer.h"
|
||||
|
||||
#endif /* ~MIXER_INTERNAL_H */
|
@ -1,123 +0,0 @@
|
||||
/*
|
||||
pygame - Python Game Library
|
||||
Copyright (C) 2000-2001 Pete Shinners
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
Pete Shinners
|
||||
pete@shinners.org
|
||||
*/
|
||||
|
||||
#ifndef PALETTE_H
|
||||
#define PALETTE_H
|
||||
|
||||
#include <SDL.h>
|
||||
|
||||
/* SDL 2 does not assign a default palette color scheme to a new 8 bit
|
||||
* surface. Instead, the palette is set all white. This defines the SDL 1.2
|
||||
* default palette.
|
||||
*/
|
||||
static const SDL_Color default_palette_colors[] = {
|
||||
{0, 0, 0, 255}, {0, 0, 85, 255}, {0, 0, 170, 255},
|
||||
{0, 0, 255, 255}, {0, 36, 0, 255}, {0, 36, 85, 255},
|
||||
{0, 36, 170, 255}, {0, 36, 255, 255}, {0, 73, 0, 255},
|
||||
{0, 73, 85, 255}, {0, 73, 170, 255}, {0, 73, 255, 255},
|
||||
{0, 109, 0, 255}, {0, 109, 85, 255}, {0, 109, 170, 255},
|
||||
{0, 109, 255, 255}, {0, 146, 0, 255}, {0, 146, 85, 255},
|
||||
{0, 146, 170, 255}, {0, 146, 255, 255}, {0, 182, 0, 255},
|
||||
{0, 182, 85, 255}, {0, 182, 170, 255}, {0, 182, 255, 255},
|
||||
{0, 219, 0, 255}, {0, 219, 85, 255}, {0, 219, 170, 255},
|
||||
{0, 219, 255, 255}, {0, 255, 0, 255}, {0, 255, 85, 255},
|
||||
{0, 255, 170, 255}, {0, 255, 255, 255}, {85, 0, 0, 255},
|
||||
{85, 0, 85, 255}, {85, 0, 170, 255}, {85, 0, 255, 255},
|
||||
{85, 36, 0, 255}, {85, 36, 85, 255}, {85, 36, 170, 255},
|
||||
{85, 36, 255, 255}, {85, 73, 0, 255}, {85, 73, 85, 255},
|
||||
{85, 73, 170, 255}, {85, 73, 255, 255}, {85, 109, 0, 255},
|
||||
{85, 109, 85, 255}, {85, 109, 170, 255}, {85, 109, 255, 255},
|
||||
{85, 146, 0, 255}, {85, 146, 85, 255}, {85, 146, 170, 255},
|
||||
{85, 146, 255, 255}, {85, 182, 0, 255}, {85, 182, 85, 255},
|
||||
{85, 182, 170, 255}, {85, 182, 255, 255}, {85, 219, 0, 255},
|
||||
{85, 219, 85, 255}, {85, 219, 170, 255}, {85, 219, 255, 255},
|
||||
{85, 255, 0, 255}, {85, 255, 85, 255}, {85, 255, 170, 255},
|
||||
{85, 255, 255, 255}, {170, 0, 0, 255}, {170, 0, 85, 255},
|
||||
{170, 0, 170, 255}, {170, 0, 255, 255}, {170, 36, 0, 255},
|
||||
{170, 36, 85, 255}, {170, 36, 170, 255}, {170, 36, 255, 255},
|
||||
{170, 73, 0, 255}, {170, 73, 85, 255}, {170, 73, 170, 255},
|
||||
{170, 73, 255, 255}, {170, 109, 0, 255}, {170, 109, 85, 255},
|
||||
{170, 109, 170, 255}, {170, 109, 255, 255}, {170, 146, 0, 255},
|
||||
{170, 146, 85, 255}, {170, 146, 170, 255}, {170, 146, 255, 255},
|
||||
{170, 182, 0, 255}, {170, 182, 85, 255}, {170, 182, 170, 255},
|
||||
{170, 182, 255, 255}, {170, 219, 0, 255}, {170, 219, 85, 255},
|
||||
{170, 219, 170, 255}, {170, 219, 255, 255}, {170, 255, 0, 255},
|
||||
{170, 255, 85, 255}, {170, 255, 170, 255}, {170, 255, 255, 255},
|
||||
{255, 0, 0, 255}, {255, 0, 85, 255}, {255, 0, 170, 255},
|
||||
{255, 0, 255, 255}, {255, 36, 0, 255}, {255, 36, 85, 255},
|
||||
{255, 36, 170, 255}, {255, 36, 255, 255}, {255, 73, 0, 255},
|
||||
{255, 73, 85, 255}, {255, 73, 170, 255}, {255, 73, 255, 255},
|
||||
{255, 109, 0, 255}, {255, 109, 85, 255}, {255, 109, 170, 255},
|
||||
{255, 109, 255, 255}, {255, 146, 0, 255}, {255, 146, 85, 255},
|
||||
{255, 146, 170, 255}, {255, 146, 255, 255}, {255, 182, 0, 255},
|
||||
{255, 182, 85, 255}, {255, 182, 170, 255}, {255, 182, 255, 255},
|
||||
{255, 219, 0, 255}, {255, 219, 85, 255}, {255, 219, 170, 255},
|
||||
{255, 219, 255, 255}, {255, 255, 0, 255}, {255, 255, 85, 255},
|
||||
{255, 255, 170, 255}, {255, 255, 255, 255}, {0, 0, 0, 255},
|
||||
{0, 0, 85, 255}, {0, 0, 170, 255}, {0, 0, 255, 255},
|
||||
{0, 36, 0, 255}, {0, 36, 85, 255}, {0, 36, 170, 255},
|
||||
{0, 36, 255, 255}, {0, 73, 0, 255}, {0, 73, 85, 255},
|
||||
{0, 73, 170, 255}, {0, 73, 255, 255}, {0, 109, 0, 255},
|
||||
{0, 109, 85, 255}, {0, 109, 170, 255}, {0, 109, 255, 255},
|
||||
{0, 146, 0, 255}, {0, 146, 85, 255}, {0, 146, 170, 255},
|
||||
{0, 146, 255, 255}, {0, 182, 0, 255}, {0, 182, 85, 255},
|
||||
{0, 182, 170, 255}, {0, 182, 255, 255}, {0, 219, 0, 255},
|
||||
{0, 219, 85, 255}, {0, 219, 170, 255}, {0, 219, 255, 255},
|
||||
{0, 255, 0, 255}, {0, 255, 85, 255}, {0, 255, 170, 255},
|
||||
{0, 255, 255, 255}, {85, 0, 0, 255}, {85, 0, 85, 255},
|
||||
{85, 0, 170, 255}, {85, 0, 255, 255}, {85, 36, 0, 255},
|
||||
{85, 36, 85, 255}, {85, 36, 170, 255}, {85, 36, 255, 255},
|
||||
{85, 73, 0, 255}, {85, 73, 85, 255}, {85, 73, 170, 255},
|
||||
{85, 73, 255, 255}, {85, 109, 0, 255}, {85, 109, 85, 255},
|
||||
{85, 109, 170, 255}, {85, 109, 255, 255}, {85, 146, 0, 255},
|
||||
{85, 146, 85, 255}, {85, 146, 170, 255}, {85, 146, 255, 255},
|
||||
{85, 182, 0, 255}, {85, 182, 85, 255}, {85, 182, 170, 255},
|
||||
{85, 182, 255, 255}, {85, 219, 0, 255}, {85, 219, 85, 255},
|
||||
{85, 219, 170, 255}, {85, 219, 255, 255}, {85, 255, 0, 255},
|
||||
{85, 255, 85, 255}, {85, 255, 170, 255}, {85, 255, 255, 255},
|
||||
{170, 0, 0, 255}, {170, 0, 85, 255}, {170, 0, 170, 255},
|
||||
{170, 0, 255, 255}, {170, 36, 0, 255}, {170, 36, 85, 255},
|
||||
{170, 36, 170, 255}, {170, 36, 255, 255}, {170, 73, 0, 255},
|
||||
{170, 73, 85, 255}, {170, 73, 170, 255}, {170, 73, 255, 255},
|
||||
{170, 109, 0, 255}, {170, 109, 85, 255}, {170, 109, 170, 255},
|
||||
{170, 109, 255, 255}, {170, 146, 0, 255}, {170, 146, 85, 255},
|
||||
{170, 146, 170, 255}, {170, 146, 255, 255}, {170, 182, 0, 255},
|
||||
{170, 182, 85, 255}, {170, 182, 170, 255}, {170, 182, 255, 255},
|
||||
{170, 219, 0, 255}, {170, 219, 85, 255}, {170, 219, 170, 255},
|
||||
{170, 219, 255, 255}, {170, 255, 0, 255}, {170, 255, 85, 255},
|
||||
{170, 255, 170, 255}, {170, 255, 255, 255}, {255, 0, 0, 255},
|
||||
{255, 0, 85, 255}, {255, 0, 170, 255}, {255, 0, 255, 255},
|
||||
{255, 36, 0, 255}, {255, 36, 85, 255}, {255, 36, 170, 255},
|
||||
{255, 36, 255, 255}, {255, 73, 0, 255}, {255, 73, 85, 255},
|
||||
{255, 73, 170, 255}, {255, 73, 255, 255}, {255, 109, 0, 255},
|
||||
{255, 109, 85, 255}, {255, 109, 170, 255}, {255, 109, 255, 255},
|
||||
{255, 146, 0, 255}, {255, 146, 85, 255}, {255, 146, 170, 255},
|
||||
{255, 146, 255, 255}, {255, 182, 0, 255}, {255, 182, 85, 255},
|
||||
{255, 182, 170, 255}, {255, 182, 255, 255}, {255, 219, 0, 255},
|
||||
{255, 219, 85, 255}, {255, 219, 170, 255}, {255, 219, 255, 255},
|
||||
{255, 255, 0, 255}, {255, 255, 85, 255}, {255, 255, 170, 255},
|
||||
{255, 255, 255, 255}};
|
||||
|
||||
static const int default_palette_size =
|
||||
(int)(sizeof(default_palette_colors) / sizeof(SDL_Color));
|
||||
|
||||
#endif
|
@ -1,26 +0,0 @@
|
||||
/* array structure interface version 3 declarations */
|
||||
|
||||
#if !defined(PG_ARRAYINTER_HEADER)
|
||||
#define PG_ARRAYINTER_HEADER
|
||||
|
||||
static const int PAI_CONTIGUOUS = 0x01;
|
||||
static const int PAI_FORTRAN = 0x02;
|
||||
static const int PAI_ALIGNED = 0x100;
|
||||
static const int PAI_NOTSWAPPED = 0x200;
|
||||
static const int PAI_WRITEABLE = 0x400;
|
||||
static const int PAI_ARR_HAS_DESCR = 0x800;
|
||||
|
||||
typedef struct {
|
||||
int two; /* contains the integer 2 -- simple sanity check */
|
||||
int nd; /* number of dimensions */
|
||||
char typekind; /* kind in array -- character code of typestr */
|
||||
int itemsize; /* size of each element */
|
||||
int flags; /* flags indicating how the data should be */
|
||||
/* interpreted */
|
||||
Py_intptr_t *shape; /* A length-nd array of shape information */
|
||||
Py_intptr_t *strides; /* A length-nd array of stride information */
|
||||
void *data; /* A pointer to the first element of the array */
|
||||
PyObject *descr; /* NULL or a data-description */
|
||||
} PyArrayInterface;
|
||||
|
||||
#endif
|
@ -1,7 +0,0 @@
|
||||
#ifndef PG_BUFPROXY_INTERNAL_H
|
||||
#define PG_BUFPROXY_INTERNAL_H
|
||||
|
||||
#include "include/pygame_bufferproxy.h"
|
||||
#define PYGAMEAPI_BUFPROXY_NUMSLOTS 4
|
||||
|
||||
#endif /* ~PG_BUFPROXY_INTERNAL_H */
|
@ -1,27 +0,0 @@
|
||||
/* Python 2.x/3.x compatibility tools (internal)
|
||||
*/
|
||||
#ifndef PGCOMPAT_INTERNAL_H
|
||||
#define PGCOMPAT_INTERNAL_H
|
||||
|
||||
#include "include/pgcompat.h"
|
||||
|
||||
/* Module init function returns new module instance. */
|
||||
#define MODINIT_DEFINE(mod_name) PyMODINIT_FUNC PyInit_##mod_name(void)
|
||||
|
||||
/* Defaults for unicode file path encoding */
|
||||
#if defined(MS_WIN32)
|
||||
#define UNICODE_DEF_FS_ERROR "replace"
|
||||
#else
|
||||
#define UNICODE_DEF_FS_ERROR "surrogateescape"
|
||||
#endif
|
||||
|
||||
#define RELATIVE_MODULE(m) ("." m)
|
||||
|
||||
#ifndef Py_TPFLAGS_HAVE_NEWBUFFER
|
||||
#define Py_TPFLAGS_HAVE_NEWBUFFER 0
|
||||
#endif
|
||||
|
||||
#define Slice_GET_INDICES_EX(slice, length, start, stop, step, slicelength) \
|
||||
PySlice_GetIndicesEx(slice, length, start, stop, step, slicelength)
|
||||
|
||||
#endif /* ~PGCOMPAT_INTERNAL_H */
|
@ -1,20 +0,0 @@
|
||||
#if !defined(PGOPENGL_H)
|
||||
#define PGOPENGL_H
|
||||
|
||||
/** This header includes definitions of Opengl functions as pointer types for
|
||||
** use with the SDL function SDL_GL_GetProcAddress.
|
||||
**/
|
||||
|
||||
#if defined(_WIN32)
|
||||
#define GL_APIENTRY __stdcall
|
||||
#else
|
||||
#define GL_APIENTRY
|
||||
#endif
|
||||
|
||||
typedef void(GL_APIENTRY *GL_glReadPixels_Func)(int, int, int, int,
|
||||
unsigned int, unsigned int,
|
||||
void *);
|
||||
|
||||
typedef void(GL_APIENTRY *GL_glViewport_Func)(int, int, unsigned int,
|
||||
unsigned int);
|
||||
#endif
|
@ -1,23 +0,0 @@
|
||||
/* platform/compiler adjustments (internal) */
|
||||
#ifndef PG_PLATFORM_INTERNAL_H
|
||||
#define PG_PLATFORM_INTERNAL_H
|
||||
|
||||
#include "include/pgplatform.h"
|
||||
|
||||
#ifndef MIN
|
||||
#define MIN(a, b) ((a) < (b) ? (a) : (b))
|
||||
#endif
|
||||
#ifndef MAX
|
||||
#define MAX(a, b) ((a) > (b) ? (a) : (b))
|
||||
#endif
|
||||
#ifndef ABS
|
||||
#define ABS(a) (((a) < 0) ? -(a) : (a))
|
||||
#endif
|
||||
|
||||
/* warnings */
|
||||
#define PG_STRINGIZE_HELPER(x) #x
|
||||
#define PG_STRINGIZE(x) PG_STRINGIZE_HELPER(x)
|
||||
#define PG_WARN(desc) \
|
||||
message(__FILE__ "(" PG_STRINGIZE(__LINE__) "): WARNING: " #desc)
|
||||
|
||||
#endif /* ~PG_PLATFORM_INTERNAL_H */
|
@ -1,32 +0,0 @@
|
||||
/*
|
||||
pygame - Python Game Library
|
||||
Copyright (C) 2000-2001 Pete Shinners
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
Pete Shinners
|
||||
pete@shinners.org
|
||||
*/
|
||||
|
||||
/* This will use PYGAMEAPI_DEFINE_SLOTS instead
|
||||
* of PYGAMEAPI_EXTERN_SLOTS for base modules.
|
||||
*/
|
||||
#ifndef PYGAME_INTERNAL_H
|
||||
#define PYGAME_INTERNAL_H
|
||||
|
||||
#define PYGAME_H
|
||||
#include "_pygame.h"
|
||||
|
||||
#endif /* ~PYGAME_INTERNAL_H */
|
@ -1,147 +0,0 @@
|
||||
/*
|
||||
pygame - Python Game Library
|
||||
Copyright (C) 2006, 2007 Rene Dudfield, Marcus von Appen
|
||||
|
||||
Originally put in the public domain by Sam Lantinga.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#ifndef SCRAP_H
|
||||
#define SCRAP_H
|
||||
|
||||
/* This is unconditionally defined in Python.h */
|
||||
#if defined(_POSIX_C_SOURCE)
|
||||
#undef _POSIX_C_SOURCE
|
||||
#endif
|
||||
|
||||
#include <Python.h>
|
||||
|
||||
/* Handle clipboard text and data in arbitrary formats */
|
||||
|
||||
/**
|
||||
* Predefined supported pygame scrap types.
|
||||
*/
|
||||
#define PYGAME_SCRAP_TEXT "text/plain"
|
||||
#define PYGAME_SCRAP_BMP "image/bmp"
|
||||
#define PYGAME_SCRAP_PPM "image/ppm"
|
||||
#define PYGAME_SCRAP_PBM "image/pbm"
|
||||
|
||||
/**
|
||||
* The supported scrap clipboard types.
|
||||
*
|
||||
* This is only relevant in a X11 environment, which supports mouse
|
||||
* selections as well. For Win32 and MacOS environments the default
|
||||
* clipboard is used, no matter what value is passed.
|
||||
*/
|
||||
typedef enum {
|
||||
SCRAP_CLIPBOARD,
|
||||
SCRAP_SELECTION /* only supported in X11 environments. */
|
||||
} ScrapClipType;
|
||||
|
||||
/**
|
||||
* Macro for initialization checks.
|
||||
*/
|
||||
#define PYGAME_SCRAP_INIT_CHECK() \
|
||||
if (!pygame_scrap_initialized()) \
|
||||
return (PyErr_SetString(pgExc_SDLError, "scrap system not initialized."), \
|
||||
NULL)
|
||||
|
||||
/**
|
||||
* \brief Checks, whether the pygame scrap module was initialized.
|
||||
*
|
||||
* \return 1 if the modules was initialized, 0 otherwise.
|
||||
*/
|
||||
extern int
|
||||
pygame_scrap_initialized(void);
|
||||
|
||||
/**
|
||||
* \brief Initializes the pygame scrap module internals. Call this before any
|
||||
* other method.
|
||||
*
|
||||
* \return 1 on successful initialization, 0 otherwise.
|
||||
*/
|
||||
extern int
|
||||
pygame_scrap_init(void);
|
||||
|
||||
/**
|
||||
* \brief Checks, whether the pygame window lost the clipboard focus or not.
|
||||
*
|
||||
* \return 1 if the window lost the focus, 0 otherwise.
|
||||
*/
|
||||
extern int
|
||||
pygame_scrap_lost(void);
|
||||
|
||||
/**
|
||||
* \brief Places content of a specific type into the clipboard.
|
||||
*
|
||||
* \note For X11 the following notes are important: The following types
|
||||
* are reserved for internal usage and thus will throw an error on
|
||||
* setting them: "TIMESTAMP", "TARGETS", "SDL_SELECTION".
|
||||
* Setting PYGAME_SCRAP_TEXT ("text/plain") will also automatically
|
||||
* set the X11 types "STRING" (XA_STRING), "TEXT" and "UTF8_STRING".
|
||||
*
|
||||
* For Win32 the following notes are important: Setting
|
||||
* PYGAME_SCRAP_TEXT ("text/plain") will also automatically set
|
||||
* the Win32 type "TEXT" (CF_TEXT).
|
||||
*
|
||||
* For QNX the following notes are important: Setting
|
||||
* PYGAME_SCRAP_TEXT ("text/plain") will also automatically set
|
||||
* the QNX type "TEXT" (Ph_CL_TEXT).
|
||||
*
|
||||
* \param type The type of the content.
|
||||
* \param srclen The length of the content.
|
||||
* \param src The NULL terminated content.
|
||||
* \return 1, if the content could be successfully pasted into the clipboard,
|
||||
* 0 otherwise.
|
||||
*/
|
||||
extern int
|
||||
pygame_scrap_put(char *type, Py_ssize_t srclen, char *src);
|
||||
|
||||
/**
|
||||
* \brief Gets the current content from the clipboard.
|
||||
*
|
||||
* \note The received content does not need to be the content previously
|
||||
* placed in the clipboard using pygame_put_scrap(). See the
|
||||
* pygame_put_scrap() notes for more details.
|
||||
*
|
||||
* \param type The type of the content to receive.
|
||||
* \param count The size of the returned content.
|
||||
* \return The content or NULL in case of an error or if no content of the
|
||||
* specified type was available.
|
||||
*/
|
||||
extern char *
|
||||
pygame_scrap_get(char *type, size_t *count);
|
||||
|
||||
/**
|
||||
* \brief Gets the currently available content types from the clipboard.
|
||||
*
|
||||
* \return The different available content types or NULL in case of an
|
||||
* error or if no content type is available.
|
||||
*/
|
||||
extern char **
|
||||
pygame_scrap_get_types(void);
|
||||
|
||||
/**
|
||||
* \brief Checks whether content for the specified scrap type is currently
|
||||
* available in the clipboard.
|
||||
*
|
||||
* \param type The type to check for.
|
||||
* \return 1, if there is content and 0 otherwise.
|
||||
*/
|
||||
extern int
|
||||
pygame_scrap_contains(char *type);
|
||||
|
||||
#endif /* SCRAP_H */
|
@ -1,84 +0,0 @@
|
||||
#define NO_PYGAME_C_API
|
||||
#include "_surface.h"
|
||||
#include "_blit_info.h"
|
||||
|
||||
#if !defined(PG_ENABLE_ARM_NEON) && defined(__aarch64__)
|
||||
// arm64 has neon optimisations enabled by default, even when fpu=neon is not
|
||||
// passed
|
||||
#define PG_ENABLE_ARM_NEON 1
|
||||
#endif
|
||||
|
||||
int
|
||||
pg_sse2_at_runtime_but_uncompiled();
|
||||
int
|
||||
pg_neon_at_runtime_but_uncompiled();
|
||||
int
|
||||
pg_avx2_at_runtime_but_uncompiled();
|
||||
|
||||
#if (defined(__SSE2__) || defined(PG_ENABLE_ARM_NEON))
|
||||
void
|
||||
alphablit_alpha_sse2_argb_surf_alpha(SDL_BlitInfo *info);
|
||||
void
|
||||
alphablit_alpha_sse2_argb_no_surf_alpha(SDL_BlitInfo *info);
|
||||
void
|
||||
alphablit_alpha_sse2_argb_no_surf_alpha_opaque_dst(SDL_BlitInfo *info);
|
||||
void
|
||||
blit_blend_rgba_mul_sse2(SDL_BlitInfo *info);
|
||||
void
|
||||
blit_blend_rgb_mul_sse2(SDL_BlitInfo *info);
|
||||
void
|
||||
blit_blend_rgba_add_sse2(SDL_BlitInfo *info);
|
||||
void
|
||||
blit_blend_rgb_add_sse2(SDL_BlitInfo *info);
|
||||
void
|
||||
blit_blend_rgba_sub_sse2(SDL_BlitInfo *info);
|
||||
void
|
||||
blit_blend_rgb_sub_sse2(SDL_BlitInfo *info);
|
||||
void
|
||||
blit_blend_rgba_max_sse2(SDL_BlitInfo *info);
|
||||
void
|
||||
blit_blend_rgb_max_sse2(SDL_BlitInfo *info);
|
||||
void
|
||||
blit_blend_rgba_min_sse2(SDL_BlitInfo *info);
|
||||
void
|
||||
blit_blend_rgb_min_sse2(SDL_BlitInfo *info);
|
||||
void
|
||||
blit_blend_premultiplied_sse2(SDL_BlitInfo *info);
|
||||
#endif /* (defined(__SSE2__) || defined(PG_ENABLE_ARM_NEON)) */
|
||||
|
||||
/* Deliberately putting these outside of the preprocessor guards as I want to
|
||||
move to a system of trusting the runtime checks to head to the right
|
||||
function and having a fallback function there if pygame is not compiled
|
||||
with the right stuff (this is the strategy used for AVX2 right now.
|
||||
Potentially I might want to shift both these into a slightly different
|
||||
file as they are not exactly blits (though v. similar) - or I could rename
|
||||
the SIMD trilogy of files to replace the word blit with something more
|
||||
generic like surface_ops*/
|
||||
|
||||
void
|
||||
premul_surf_color_by_alpha_non_simd(SDL_Surface *src, SDL_Surface *dst);
|
||||
void
|
||||
premul_surf_color_by_alpha_sse2(SDL_Surface *src, SDL_Surface *dst);
|
||||
|
||||
int
|
||||
pg_has_avx2();
|
||||
void
|
||||
blit_blend_rgba_mul_avx2(SDL_BlitInfo *info);
|
||||
void
|
||||
blit_blend_rgb_mul_avx2(SDL_BlitInfo *info);
|
||||
void
|
||||
blit_blend_rgba_add_avx2(SDL_BlitInfo *info);
|
||||
void
|
||||
blit_blend_rgb_add_avx2(SDL_BlitInfo *info);
|
||||
void
|
||||
blit_blend_rgba_sub_avx2(SDL_BlitInfo *info);
|
||||
void
|
||||
blit_blend_rgb_sub_avx2(SDL_BlitInfo *info);
|
||||
void
|
||||
blit_blend_rgba_max_avx2(SDL_BlitInfo *info);
|
||||
void
|
||||
blit_blend_rgb_max_avx2(SDL_BlitInfo *info);
|
||||
void
|
||||
blit_blend_rgba_min_avx2(SDL_BlitInfo *info);
|
||||
void
|
||||
blit_blend_rgb_min_avx2(SDL_BlitInfo *info);
|
@ -1,361 +0,0 @@
|
||||
/*
|
||||
pygame - Python Game Library
|
||||
Copyright (C) 2000-2001 Pete Shinners
|
||||
Copyright (C) 2007 Marcus von Appen
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
Pete Shinners
|
||||
pete@shinners.org
|
||||
*/
|
||||
|
||||
#ifndef SURFACE_H
|
||||
#define SURFACE_H
|
||||
|
||||
/* This is defined in SDL.h */
|
||||
#if defined(_POSIX_C_SOURCE)
|
||||
#undef _POSIX_C_SOURCE
|
||||
#endif
|
||||
|
||||
#include <SDL.h>
|
||||
#include "pygame.h"
|
||||
|
||||
/* Blend modes */
|
||||
#define PYGAME_BLEND_ADD 0x1
|
||||
#define PYGAME_BLEND_SUB 0x2
|
||||
#define PYGAME_BLEND_MULT 0x3
|
||||
#define PYGAME_BLEND_MIN 0x4
|
||||
#define PYGAME_BLEND_MAX 0x5
|
||||
|
||||
#define PYGAME_BLEND_RGB_ADD 0x1
|
||||
#define PYGAME_BLEND_RGB_SUB 0x2
|
||||
#define PYGAME_BLEND_RGB_MULT 0x3
|
||||
#define PYGAME_BLEND_RGB_MIN 0x4
|
||||
#define PYGAME_BLEND_RGB_MAX 0x5
|
||||
|
||||
#define PYGAME_BLEND_RGBA_ADD 0x6
|
||||
#define PYGAME_BLEND_RGBA_SUB 0x7
|
||||
#define PYGAME_BLEND_RGBA_MULT 0x8
|
||||
#define PYGAME_BLEND_RGBA_MIN 0x9
|
||||
#define PYGAME_BLEND_RGBA_MAX 0x10
|
||||
#define PYGAME_BLEND_PREMULTIPLIED 0x11
|
||||
#define PYGAME_BLEND_ALPHA_SDL2 0x12
|
||||
|
||||
#if SDL_BYTEORDER == SDL_LIL_ENDIAN
|
||||
#define GET_PIXEL_24(b) (b[0] + (b[1] << 8) + (b[2] << 16))
|
||||
#else
|
||||
#define GET_PIXEL_24(b) (b[2] + (b[1] << 8) + (b[0] << 16))
|
||||
#endif
|
||||
|
||||
#define GET_PIXEL(pxl, bpp, source) \
|
||||
switch (bpp) { \
|
||||
case 2: \
|
||||
pxl = *((Uint16 *)(source)); \
|
||||
break; \
|
||||
case 4: \
|
||||
pxl = *((Uint32 *)(source)); \
|
||||
break; \
|
||||
default: { \
|
||||
Uint8 *b = (Uint8 *)source; \
|
||||
pxl = GET_PIXEL_24(b); \
|
||||
} break; \
|
||||
}
|
||||
|
||||
#define GET_PIXELVALS(_sR, _sG, _sB, _sA, px, fmt, ppa) \
|
||||
SDL_GetRGBA(px, fmt, &(_sR), &(_sG), &(_sB), &(_sA)); \
|
||||
if (!ppa) { \
|
||||
_sA = 255; \
|
||||
}
|
||||
|
||||
#define GET_PIXELVALS_1(sr, sg, sb, sa, _src, _fmt) \
|
||||
sr = _fmt->palette->colors[*((Uint8 *)(_src))].r; \
|
||||
sg = _fmt->palette->colors[*((Uint8 *)(_src))].g; \
|
||||
sb = _fmt->palette->colors[*((Uint8 *)(_src))].b; \
|
||||
sa = 255;
|
||||
|
||||
/* For 1 byte palette pixels */
|
||||
#define SET_PIXELVAL(px, fmt, _dR, _dG, _dB, _dA) \
|
||||
*(px) = (Uint8)SDL_MapRGBA(fmt, _dR, _dG, _dB, _dA)
|
||||
|
||||
#if SDL_BYTEORDER == SDL_LIL_ENDIAN
|
||||
#define SET_OFFSETS_24(or, og, ob, fmt) \
|
||||
{ \
|
||||
or = (fmt->Rshift == 0 ? 0 : fmt->Rshift == 8 ? 1 : 2); \
|
||||
og = (fmt->Gshift == 0 ? 0 : fmt->Gshift == 8 ? 1 : 2); \
|
||||
ob = (fmt->Bshift == 0 ? 0 : fmt->Bshift == 8 ? 1 : 2); \
|
||||
}
|
||||
|
||||
#define SET_OFFSETS_32(or, og, ob, fmt) \
|
||||
{ \
|
||||
or = (fmt->Rshift == 0 ? 0 \
|
||||
: fmt->Rshift == 8 ? 1 \
|
||||
: fmt->Rshift == 16 ? 2 \
|
||||
: 3); \
|
||||
og = (fmt->Gshift == 0 ? 0 \
|
||||
: fmt->Gshift == 8 ? 1 \
|
||||
: fmt->Gshift == 16 ? 2 \
|
||||
: 3); \
|
||||
ob = (fmt->Bshift == 0 ? 0 \
|
||||
: fmt->Bshift == 8 ? 1 \
|
||||
: fmt->Bshift == 16 ? 2 \
|
||||
: 3); \
|
||||
}
|
||||
#else
|
||||
#define SET_OFFSETS_24(or, og, ob, fmt) \
|
||||
{ \
|
||||
or = (fmt->Rshift == 0 ? 2 : fmt->Rshift == 8 ? 1 : 0); \
|
||||
og = (fmt->Gshift == 0 ? 2 : fmt->Gshift == 8 ? 1 : 0); \
|
||||
ob = (fmt->Bshift == 0 ? 2 : fmt->Bshift == 8 ? 1 : 0); \
|
||||
}
|
||||
|
||||
#define SET_OFFSETS_32(or, og, ob, fmt) \
|
||||
{ \
|
||||
or = (fmt->Rshift == 0 ? 3 \
|
||||
: fmt->Rshift == 8 ? 2 \
|
||||
: fmt->Rshift == 16 ? 1 \
|
||||
: 0); \
|
||||
og = (fmt->Gshift == 0 ? 3 \
|
||||
: fmt->Gshift == 8 ? 2 \
|
||||
: fmt->Gshift == 16 ? 1 \
|
||||
: 0); \
|
||||
ob = (fmt->Bshift == 0 ? 3 \
|
||||
: fmt->Bshift == 8 ? 2 \
|
||||
: fmt->Bshift == 16 ? 1 \
|
||||
: 0); \
|
||||
}
|
||||
#endif
|
||||
|
||||
#define CREATE_PIXEL(buf, r, g, b, a, bp, ft) \
|
||||
switch (bp) { \
|
||||
case 2: \
|
||||
*((Uint16 *)(buf)) = ((r >> ft->Rloss) << ft->Rshift) | \
|
||||
((g >> ft->Gloss) << ft->Gshift) | \
|
||||
((b >> ft->Bloss) << ft->Bshift) | \
|
||||
((a >> ft->Aloss) << ft->Ashift); \
|
||||
break; \
|
||||
case 4: \
|
||||
*((Uint32 *)(buf)) = ((r >> ft->Rloss) << ft->Rshift) | \
|
||||
((g >> ft->Gloss) << ft->Gshift) | \
|
||||
((b >> ft->Bloss) << ft->Bshift) | \
|
||||
((a >> ft->Aloss) << ft->Ashift); \
|
||||
break; \
|
||||
}
|
||||
|
||||
/* Pretty good idea from Tom Duff :-). */
|
||||
#define LOOP_UNROLLED4(code, n, width) \
|
||||
n = (width + 3) / 4; \
|
||||
switch (width & 3) { \
|
||||
case 0: \
|
||||
do { \
|
||||
code; \
|
||||
case 3: \
|
||||
code; \
|
||||
case 2: \
|
||||
code; \
|
||||
case 1: \
|
||||
code; \
|
||||
} while (--n > 0); \
|
||||
}
|
||||
|
||||
/* Used in the srcbpp == dstbpp == 1 blend functions */
|
||||
#define REPEAT_3(code) \
|
||||
code; \
|
||||
code; \
|
||||
code;
|
||||
|
||||
#define REPEAT_4(code) \
|
||||
code; \
|
||||
code; \
|
||||
code; \
|
||||
code;
|
||||
|
||||
#define BLEND_ADD(tmp, sR, sG, sB, sA, dR, dG, dB, dA) \
|
||||
tmp = dR + sR; \
|
||||
dR = (tmp <= 255 ? tmp : 255); \
|
||||
tmp = dG + sG; \
|
||||
dG = (tmp <= 255 ? tmp : 255); \
|
||||
tmp = dB + sB; \
|
||||
dB = (tmp <= 255 ? tmp : 255);
|
||||
|
||||
#define BLEND_SUB(tmp, sR, sG, sB, sA, dR, dG, dB, dA) \
|
||||
tmp = dR - sR; \
|
||||
dR = (tmp >= 0 ? tmp : 0); \
|
||||
tmp = dG - sG; \
|
||||
dG = (tmp >= 0 ? tmp : 0); \
|
||||
tmp = dB - sB; \
|
||||
dB = (tmp >= 0 ? tmp : 0);
|
||||
|
||||
#define BLEND_MULT(sR, sG, sB, sA, dR, dG, dB, dA) \
|
||||
dR = (dR && sR) ? ((dR * sR) + 255) >> 8 : 0; \
|
||||
dG = (dG && sG) ? ((dG * sG) + 255) >> 8 : 0; \
|
||||
dB = (dB && sB) ? ((dB * sB) + 255) >> 8 : 0;
|
||||
|
||||
#define BLEND_MIN(sR, sG, sB, sA, dR, dG, dB, dA) \
|
||||
if (sR < dR) { \
|
||||
dR = sR; \
|
||||
} \
|
||||
if (sG < dG) { \
|
||||
dG = sG; \
|
||||
} \
|
||||
if (sB < dB) { \
|
||||
dB = sB; \
|
||||
}
|
||||
|
||||
#define BLEND_MAX(sR, sG, sB, sA, dR, dG, dB, dA) \
|
||||
if (sR > dR) { \
|
||||
dR = sR; \
|
||||
} \
|
||||
if (sG > dG) { \
|
||||
dG = sG; \
|
||||
} \
|
||||
if (sB > dB) { \
|
||||
dB = sB; \
|
||||
}
|
||||
|
||||
#define BLEND_RGBA_ADD(tmp, sR, sG, sB, sA, dR, dG, dB, dA) \
|
||||
tmp = dR + sR; \
|
||||
dR = (tmp <= 255 ? tmp : 255); \
|
||||
tmp = dG + sG; \
|
||||
dG = (tmp <= 255 ? tmp : 255); \
|
||||
tmp = dB + sB; \
|
||||
dB = (tmp <= 255 ? tmp : 255); \
|
||||
tmp = dA + sA; \
|
||||
dA = (tmp <= 255 ? tmp : 255);
|
||||
|
||||
#define BLEND_RGBA_SUB(tmp, sR, sG, sB, sA, dR, dG, dB, dA) \
|
||||
tmp = dR - sR; \
|
||||
dR = (tmp >= 0 ? tmp : 0); \
|
||||
tmp = dG - sG; \
|
||||
dG = (tmp >= 0 ? tmp : 0); \
|
||||
tmp = dB - sB; \
|
||||
dB = (tmp >= 0 ? tmp : 0); \
|
||||
tmp = dA - sA; \
|
||||
dA = (tmp >= 0 ? tmp : 0);
|
||||
|
||||
#define BLEND_RGBA_MULT(sR, sG, sB, sA, dR, dG, dB, dA) \
|
||||
dR = (dR && sR) ? ((dR * sR) + 255) >> 8 : 0; \
|
||||
dG = (dG && sG) ? ((dG * sG) + 255) >> 8 : 0; \
|
||||
dB = (dB && sB) ? ((dB * sB) + 255) >> 8 : 0; \
|
||||
dA = (dA && sA) ? ((dA * sA) + 255) >> 8 : 0;
|
||||
|
||||
#define BLEND_RGBA_MIN(sR, sG, sB, sA, dR, dG, dB, dA) \
|
||||
if (sR < dR) { \
|
||||
dR = sR; \
|
||||
} \
|
||||
if (sG < dG) { \
|
||||
dG = sG; \
|
||||
} \
|
||||
if (sB < dB) { \
|
||||
dB = sB; \
|
||||
} \
|
||||
if (sA < dA) { \
|
||||
dA = sA; \
|
||||
}
|
||||
|
||||
#define BLEND_RGBA_MAX(sR, sG, sB, sA, dR, dG, dB, dA) \
|
||||
if (sR > dR) { \
|
||||
dR = sR; \
|
||||
} \
|
||||
if (sG > dG) { \
|
||||
dG = sG; \
|
||||
} \
|
||||
if (sB > dB) { \
|
||||
dB = sB; \
|
||||
} \
|
||||
if (sA > dA) { \
|
||||
dA = sA; \
|
||||
}
|
||||
|
||||
#if 1
|
||||
/* Choose an alpha blend equation. If the sign is preserved on a right shift
|
||||
* then use a specialized, faster, equation. Otherwise a more general form,
|
||||
* where all additions are done before the shift, is needed.
|
||||
*/
|
||||
#if (-1 >> 1) < 0
|
||||
#define ALPHA_BLEND_COMP(sC, dC, sA) ((((sC - dC) * sA + sC) >> 8) + dC)
|
||||
#else
|
||||
#define ALPHA_BLEND_COMP(sC, dC, sA) (((dC << 8) + (sC - dC) * sA + sC) >> 8)
|
||||
#endif
|
||||
|
||||
#define ALPHA_BLEND(sR, sG, sB, sA, dR, dG, dB, dA) \
|
||||
do { \
|
||||
if (dA) { \
|
||||
dR = ALPHA_BLEND_COMP(sR, dR, sA); \
|
||||
dG = ALPHA_BLEND_COMP(sG, dG, sA); \
|
||||
dB = ALPHA_BLEND_COMP(sB, dB, sA); \
|
||||
dA = sA + dA - ((sA * dA) / 255); \
|
||||
} \
|
||||
else { \
|
||||
dR = sR; \
|
||||
dG = sG; \
|
||||
dB = sB; \
|
||||
dA = sA; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#define ALPHA_BLEND_PREMULTIPLIED_COMP(sC, dC, sA) \
|
||||
(sC + dC - ((dC + 1) * sA >> 8))
|
||||
|
||||
#define ALPHA_BLEND_PREMULTIPLIED(tmp, sR, sG, sB, sA, dR, dG, dB, dA) \
|
||||
do { \
|
||||
dR = ALPHA_BLEND_PREMULTIPLIED_COMP(sR, dR, sA); \
|
||||
dG = ALPHA_BLEND_PREMULTIPLIED_COMP(sG, dG, sA); \
|
||||
dB = ALPHA_BLEND_PREMULTIPLIED_COMP(sB, dB, sA); \
|
||||
dA = ALPHA_BLEND_PREMULTIPLIED_COMP(sA, dA, sA); \
|
||||
} while (0)
|
||||
#elif 0
|
||||
|
||||
#define ALPHA_BLEND(sR, sG, sB, sA, dR, dG, dB, dA) \
|
||||
do { \
|
||||
if (sA) { \
|
||||
if (dA && sA < 255) { \
|
||||
int dContrib = dA * (255 - sA) / 255; \
|
||||
dA = sA + dA - ((sA * dA) / 255); \
|
||||
dR = (dR * dContrib + sR * sA) / dA; \
|
||||
dG = (dG * dContrib + sG * sA) / dA; \
|
||||
dB = (dB * dContrib + sB * sA) / dA; \
|
||||
} \
|
||||
else { \
|
||||
dR = sR; \
|
||||
dG = sG; \
|
||||
dB = sB; \
|
||||
dA = sA; \
|
||||
} \
|
||||
} \
|
||||
} while (0)
|
||||
#endif
|
||||
|
||||
int
|
||||
surface_fill_blend(SDL_Surface *surface, SDL_Rect *rect, Uint32 color,
|
||||
int blendargs);
|
||||
|
||||
void
|
||||
surface_respect_clip_rect(SDL_Surface *surface, SDL_Rect *rect);
|
||||
|
||||
int
|
||||
pygame_AlphaBlit(SDL_Surface *src, SDL_Rect *srcrect, SDL_Surface *dst,
|
||||
SDL_Rect *dstrect, int the_args);
|
||||
|
||||
int
|
||||
pygame_Blit(SDL_Surface *src, SDL_Rect *srcrect, SDL_Surface *dst,
|
||||
SDL_Rect *dstrect, int the_args);
|
||||
|
||||
int
|
||||
premul_surf_color_by_alpha(SDL_Surface *src, SDL_Surface *dst);
|
||||
|
||||
int
|
||||
pg_warn_simd_at_runtime_but_uncompiled();
|
||||
|
||||
#endif /* SURFACE_H */
|
@ -1,472 +0,0 @@
|
||||
<#
|
||||
.Synopsis
|
||||
Activate a Python virtual environment for the current PowerShell session.
|
||||
|
||||
.Description
|
||||
Pushes the python executable for a virtual environment to the front of the
|
||||
$Env:PATH environment variable and sets the prompt to signify that you are
|
||||
in a Python virtual environment. Makes use of the command line switches as
|
||||
well as the `pyvenv.cfg` file values present in the virtual environment.
|
||||
|
||||
.Parameter VenvDir
|
||||
Path to the directory that contains the virtual environment to activate. The
|
||||
default value for this is the parent of the directory that the Activate.ps1
|
||||
script is located within.
|
||||
|
||||
.Parameter Prompt
|
||||
The prompt prefix to display when this virtual environment is activated. By
|
||||
default, this prompt is the name of the virtual environment folder (VenvDir)
|
||||
surrounded by parentheses and followed by a single space (ie. '(.venv) ').
|
||||
|
||||
.Example
|
||||
Activate.ps1
|
||||
Activates the Python virtual environment that contains the Activate.ps1 script.
|
||||
|
||||
.Example
|
||||
Activate.ps1 -Verbose
|
||||
Activates the Python virtual environment that contains the Activate.ps1 script,
|
||||
and shows extra information about the activation as it executes.
|
||||
|
||||
.Example
|
||||
Activate.ps1 -VenvDir C:\Users\MyUser\Common\.venv
|
||||
Activates the Python virtual environment located in the specified location.
|
||||
|
||||
.Example
|
||||
Activate.ps1 -Prompt "MyPython"
|
||||
Activates the Python virtual environment that contains the Activate.ps1 script,
|
||||
and prefixes the current prompt with the specified string (surrounded in
|
||||
parentheses) while the virtual environment is active.
|
||||
|
||||
.Notes
|
||||
On Windows, it may be required to enable this Activate.ps1 script by setting the
|
||||
execution policy for the user. You can do this by issuing the following PowerShell
|
||||
command:
|
||||
|
||||
PS C:\> Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
|
||||
|
||||
For more information on Execution Policies:
|
||||
https://go.microsoft.com/fwlink/?LinkID=135170
|
||||
|
||||
#>
|
||||
Param(
|
||||
[Parameter(Mandatory = $false)]
|
||||
[String]
|
||||
$VenvDir,
|
||||
[Parameter(Mandatory = $false)]
|
||||
[String]
|
||||
$Prompt
|
||||
)
|
||||
|
||||
<# Function declarations --------------------------------------------------- #>
|
||||
|
||||
<#
|
||||
.Synopsis
|
||||
Remove all shell session elements added by the Activate script, including the
|
||||
addition of the virtual environment's Python executable from the beginning of
|
||||
the PATH variable.
|
||||
|
||||
.Parameter NonDestructive
|
||||
If present, do not remove this function from the global namespace for the
|
||||
session.
|
||||
|
||||
#>
|
||||
function global:deactivate ([switch]$NonDestructive) {
|
||||
# Revert to original values
|
||||
|
||||
# The prior prompt:
|
||||
if (Test-Path -Path Function:_OLD_VIRTUAL_PROMPT) {
|
||||
Copy-Item -Path Function:_OLD_VIRTUAL_PROMPT -Destination Function:prompt
|
||||
Remove-Item -Path Function:_OLD_VIRTUAL_PROMPT
|
||||
}
|
||||
|
||||
# The prior PYTHONHOME:
|
||||
if (Test-Path -Path Env:_OLD_VIRTUAL_PYTHONHOME) {
|
||||
Copy-Item -Path Env:_OLD_VIRTUAL_PYTHONHOME -Destination Env:PYTHONHOME
|
||||
Remove-Item -Path Env:_OLD_VIRTUAL_PYTHONHOME
|
||||
}
|
||||
|
||||
# The prior PATH:
|
||||
if (Test-Path -Path Env:_OLD_VIRTUAL_PATH) {
|
||||
Copy-Item -Path Env:_OLD_VIRTUAL_PATH -Destination Env:PATH
|
||||
Remove-Item -Path Env:_OLD_VIRTUAL_PATH
|
||||
}
|
||||
|
||||
# Just remove the VIRTUAL_ENV altogether:
|
||||
if (Test-Path -Path Env:VIRTUAL_ENV) {
|
||||
Remove-Item -Path env:VIRTUAL_ENV
|
||||
}
|
||||
|
||||
# Just remove VIRTUAL_ENV_PROMPT altogether.
|
||||
if (Test-Path -Path Env:VIRTUAL_ENV_PROMPT) {
|
||||
Remove-Item -Path env:VIRTUAL_ENV_PROMPT
|
||||
}
|
||||
|
||||
# Just remove the _PYTHON_VENV_PROMPT_PREFIX altogether:
|
||||
if (Get-Variable -Name "_PYTHON_VENV_PROMPT_PREFIX" -ErrorAction SilentlyContinue) {
|
||||
Remove-Variable -Name _PYTHON_VENV_PROMPT_PREFIX -Scope Global -Force
|
||||
}
|
||||
|
||||
# Leave deactivate function in the global namespace if requested:
|
||||
if (-not $NonDestructive) {
|
||||
Remove-Item -Path function:deactivate
|
||||
}
|
||||
}
|
||||
|
||||
<#
|
||||
.Description
|
||||
Get-PyVenvConfig parses the values from the pyvenv.cfg file located in the
|
||||
given folder, and returns them in a map.
|
||||
|
||||
For each line in the pyvenv.cfg file, if that line can be parsed into exactly
|
||||
two strings separated by `=` (with any amount of whitespace surrounding the =)
|
||||
then it is considered a `key = value` line. The left hand string is the key,
|
||||
the right hand is the value.
|
||||
|
||||
If the value starts with a `'` or a `"` then the first and last character is
|
||||
stripped from the value before being captured.
|
||||
|
||||
.Parameter ConfigDir
|
||||
Path to the directory that contains the `pyvenv.cfg` file.
|
||||
#>
|
||||
function Get-PyVenvConfig(
|
||||
[String]
|
||||
$ConfigDir
|
||||
) {
|
||||
Write-Verbose "Given ConfigDir=$ConfigDir, obtain values in pyvenv.cfg"
|
||||
|
||||
# Ensure the file exists, and issue a warning if it doesn't (but still allow the function to continue).
|
||||
$pyvenvConfigPath = Join-Path -Resolve -Path $ConfigDir -ChildPath 'pyvenv.cfg' -ErrorAction Continue
|
||||
|
||||
# An empty map will be returned if no config file is found.
|
||||
$pyvenvConfig = @{ }
|
||||
|
||||
if ($pyvenvConfigPath) {
|
||||
|
||||
Write-Verbose "File exists, parse `key = value` lines"
|
||||
$pyvenvConfigContent = Get-Content -Path $pyvenvConfigPath
|
||||
|
||||
$pyvenvConfigContent | ForEach-Object {
|
||||
$keyval = $PSItem -split "\s*=\s*", 2
|
||||
if ($keyval[0] -and $keyval[1]) {
|
||||
$val = $keyval[1]
|
||||
|
||||
# Remove extraneous quotations around a string value.
|
||||
if ("'""".Contains($val.Substring(0, 1))) {
|
||||
$val = $val.Substring(1, $val.Length - 2)
|
||||
}
|
||||
|
||||
$pyvenvConfig[$keyval[0]] = $val
|
||||
Write-Verbose "Adding Key: '$($keyval[0])'='$val'"
|
||||
}
|
||||
}
|
||||
}
|
||||
return $pyvenvConfig
|
||||
}
|
||||
|
||||
|
||||
<# Begin Activate script --------------------------------------------------- #>
|
||||
|
||||
# Determine the containing directory of this script
|
||||
$VenvExecPath = Split-Path -Parent $MyInvocation.MyCommand.Definition
|
||||
$VenvExecDir = Get-Item -Path $VenvExecPath
|
||||
|
||||
Write-Verbose "Activation script is located in path: '$VenvExecPath'"
|
||||
Write-Verbose "VenvExecDir Fullname: '$($VenvExecDir.FullName)"
|
||||
Write-Verbose "VenvExecDir Name: '$($VenvExecDir.Name)"
|
||||
|
||||
# Set values required in priority: CmdLine, ConfigFile, Default
|
||||
# First, get the location of the virtual environment, it might not be
|
||||
# VenvExecDir if specified on the command line.
|
||||
if ($VenvDir) {
|
||||
Write-Verbose "VenvDir given as parameter, using '$VenvDir' to determine values"
|
||||
}
|
||||
else {
|
||||
Write-Verbose "VenvDir not given as a parameter, using parent directory name as VenvDir."
|
||||
$VenvDir = $VenvExecDir.Parent.FullName.TrimEnd("\\/")
|
||||
Write-Verbose "VenvDir=$VenvDir"
|
||||
}
|
||||
|
||||
# Next, read the `pyvenv.cfg` file to determine any required value such
|
||||
# as `prompt`.
|
||||
$pyvenvCfg = Get-PyVenvConfig -ConfigDir $VenvDir
|
||||
|
||||
# Next, set the prompt from the command line, or the config file, or
|
||||
# just use the name of the virtual environment folder.
|
||||
if ($Prompt) {
|
||||
Write-Verbose "Prompt specified as argument, using '$Prompt'"
|
||||
}
|
||||
else {
|
||||
Write-Verbose "Prompt not specified as argument to script, checking pyvenv.cfg value"
|
||||
if ($pyvenvCfg -and $pyvenvCfg['prompt']) {
|
||||
Write-Verbose " Setting based on value in pyvenv.cfg='$($pyvenvCfg['prompt'])'"
|
||||
$Prompt = $pyvenvCfg['prompt'];
|
||||
}
|
||||
else {
|
||||
Write-Verbose " Setting prompt based on parent's directory's name. (Is the directory name passed to venv module when creating the virtual environment)"
|
||||
Write-Verbose " Got leaf-name of $VenvDir='$(Split-Path -Path $venvDir -Leaf)'"
|
||||
$Prompt = Split-Path -Path $venvDir -Leaf
|
||||
}
|
||||
}
|
||||
|
||||
Write-Verbose "Prompt = '$Prompt'"
|
||||
Write-Verbose "VenvDir='$VenvDir'"
|
||||
|
||||
# Deactivate any currently active virtual environment, but leave the
|
||||
# deactivate function in place.
|
||||
deactivate -nondestructive
|
||||
|
||||
# Now set the environment variable VIRTUAL_ENV, used by many tools to determine
|
||||
# that there is an activated venv.
|
||||
$env:VIRTUAL_ENV = $VenvDir
|
||||
|
||||
if (-not $Env:VIRTUAL_ENV_DISABLE_PROMPT) {
|
||||
|
||||
Write-Verbose "Setting prompt to '$Prompt'"
|
||||
|
||||
# Set the prompt to include the env name
|
||||
# Make sure _OLD_VIRTUAL_PROMPT is global
|
||||
function global:_OLD_VIRTUAL_PROMPT { "" }
|
||||
Copy-Item -Path function:prompt -Destination function:_OLD_VIRTUAL_PROMPT
|
||||
New-Variable -Name _PYTHON_VENV_PROMPT_PREFIX -Description "Python virtual environment prompt prefix" -Scope Global -Option ReadOnly -Visibility Public -Value $Prompt
|
||||
|
||||
function global:prompt {
|
||||
Write-Host -NoNewline -ForegroundColor Green "($_PYTHON_VENV_PROMPT_PREFIX) "
|
||||
_OLD_VIRTUAL_PROMPT
|
||||
}
|
||||
$env:VIRTUAL_ENV_PROMPT = $Prompt
|
||||
}
|
||||
|
||||
# Clear PYTHONHOME
|
||||
if (Test-Path -Path Env:PYTHONHOME) {
|
||||
Copy-Item -Path Env:PYTHONHOME -Destination Env:_OLD_VIRTUAL_PYTHONHOME
|
||||
Remove-Item -Path Env:PYTHONHOME
|
||||
}
|
||||
|
||||
# Add the venv to the PATH
|
||||
Copy-Item -Path Env:PATH -Destination Env:_OLD_VIRTUAL_PATH
|
||||
$Env:PATH = "$VenvExecDir$([System.IO.Path]::PathSeparator)$Env:PATH"
|
||||
|
||||
# SIG # Begin signature block
|
||||
# MIIpigYJKoZIhvcNAQcCoIIpezCCKXcCAQExDzANBglghkgBZQMEAgEFADB5Bgor
|
||||
# BgEEAYI3AgEEoGswaTA0BgorBgEEAYI3AgEeMCYCAwEAAAQQH8w7YFlLCE63JNLG
|
||||
# KX7zUQIBAAIBAAIBAAIBAAIBADAxMA0GCWCGSAFlAwQCAQUABCBnL745ElCYk8vk
|
||||
# dBtMuQhLeWJ3ZG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lr4GXd2iyJV5sv/XU4ED866fznOnFWtZJvxKGOdqN0W7
|
||||
# 01pw7mIJ8+2aRqpow1ppPzju7VagRQ8fKmtj9Sg5N8Ja3+AehpjwM/PYzctan/1m
|
||||
# ytIK/HCw5k/MeGmPVBs/fqbN0DT4KGrJ7YMySdYZMs0U9V7Ak7PelZLgw8BkNi1Y
|
||||
# Rb9i+7/t9AaBlVYMy/6+gzdsnarnlSzV8/6Est8w4Ie7sBxx3Tpsokopb+oPF///
|
||||
# 2cA3jMNToO9YfsqvgpTEkWwjWanC2cd26K8ikw0uu0klmaxNvYpP459/QU3JMyFj
|
||||
# I4ReTxVXLZrQlzCDUUdLmLSeV1AugCOYOHM2RAv4r+3qxk0jBCfA8RRK+prLNjXE
|
||||
# af1QEbeRRNr0418MtnBdIzxHnW8yffWfHmtDNJoyPqggkRU3Mb8Myu8QPD3ZiCPj
|
||||
# F+HsKUntyCV64hr9BNLmkpbw+kUvGtC0/7sZF9Gyp/DKnnbQu8vSR+CaZQqVQxJo
|
||||
# UeI7m44utNTSSZCJ9JV7bnniwqztrP/r2PTAxkUywoCzif6R863qJ/uQA0QQjq8t
|
||||
# +aR822g6YVyJsLYQKbpEgshG2QwzGHun5HkvawJ8
|
||||
# SIG # End signature block
|
@ -1,69 +0,0 @@
|
||||
# This file must be used with "source bin/activate" *from bash*
|
||||
# you cannot run it directly
|
||||
|
||||
deactivate () {
|
||||
# reset old environment variables
|
||||
if [ -n "${_OLD_VIRTUAL_PATH:-}" ] ; then
|
||||
PATH="${_OLD_VIRTUAL_PATH:-}"
|
||||
export PATH
|
||||
unset _OLD_VIRTUAL_PATH
|
||||
fi
|
||||
if [ -n "${_OLD_VIRTUAL_PYTHONHOME:-}" ] ; then
|
||||
PYTHONHOME="${_OLD_VIRTUAL_PYTHONHOME:-}"
|
||||
export PYTHONHOME
|
||||
unset _OLD_VIRTUAL_PYTHONHOME
|
||||
fi
|
||||
|
||||
# This should detect bash and zsh, which have a hash command that must
|
||||
# be called to get it to forget past commands. Without forgetting
|
||||
# past commands the $PATH changes we made may not be respected
|
||||
if [ -n "${BASH:-}" -o -n "${ZSH_VERSION:-}" ] ; then
|
||||
hash -r 2> /dev/null
|
||||
fi
|
||||
|
||||
if [ -n "${_OLD_VIRTUAL_PS1:-}" ] ; then
|
||||
PS1="${_OLD_VIRTUAL_PS1:-}"
|
||||
export PS1
|
||||
unset _OLD_VIRTUAL_PS1
|
||||
fi
|
||||
|
||||
unset VIRTUAL_ENV
|
||||
unset VIRTUAL_ENV_PROMPT
|
||||
if [ ! "${1:-}" = "nondestructive" ] ; then
|
||||
# Self destruct!
|
||||
unset -f deactivate
|
||||
fi
|
||||
}
|
||||
|
||||
# unset irrelevant variables
|
||||
deactivate nondestructive
|
||||
|
||||
VIRTUAL_ENV="e:\Documents\Python Scripting\AI Snake\.venv"
|
||||
export VIRTUAL_ENV
|
||||
|
||||
_OLD_VIRTUAL_PATH="$PATH"
|
||||
PATH="$VIRTUAL_ENV/Scripts:$PATH"
|
||||
export PATH
|
||||
|
||||
# unset PYTHONHOME if set
|
||||
# this will fail if PYTHONHOME is set to the empty string (which is bad anyway)
|
||||
# could use `if (set -u; : $PYTHONHOME) ;` in bash
|
||||
if [ -n "${PYTHONHOME:-}" ] ; then
|
||||
_OLD_VIRTUAL_PYTHONHOME="${PYTHONHOME:-}"
|
||||
unset PYTHONHOME
|
||||
fi
|
||||
|
||||
if [ -z "${VIRTUAL_ENV_DISABLE_PROMPT:-}" ] ; then
|
||||
_OLD_VIRTUAL_PS1="${PS1:-}"
|
||||
PS1="(.venv) ${PS1:-}"
|
||||
export PS1
|
||||
VIRTUAL_ENV_PROMPT="(.venv) "
|
||||
export VIRTUAL_ENV_PROMPT
|
||||
fi
|
||||
|
||||
# This should detect bash and zsh, which have a hash command that must
|
||||
# be called to get it to forget past commands. Without forgetting
|
||||
# past commands the $PATH changes we made may not be respected
|
||||
if [ -n "${BASH:-}" -o -n "${ZSH_VERSION:-}" ] ; then
|
||||
hash -r 2> /dev/null
|
||||
fi
|
@ -1,34 +0,0 @@
|
||||
@echo off
|
||||
|
||||
rem This file is UTF-8 encoded, so we need to update the current code page while executing it
|
||||
for /f "tokens=2 delims=:." %%a in ('"%SystemRoot%\System32\chcp.com"') do (
|
||||
set _OLD_CODEPAGE=%%a
|
||||
)
|
||||
if defined _OLD_CODEPAGE (
|
||||
"%SystemRoot%\System32\chcp.com" 65001 > nul
|
||||
)
|
||||
|
||||
set VIRTUAL_ENV=e:\Documents\Python Scripting\AI Snake\.venv
|
||||
|
||||
if not defined PROMPT set PROMPT=$P$G
|
||||
|
||||
if defined _OLD_VIRTUAL_PROMPT set PROMPT=%_OLD_VIRTUAL_PROMPT%
|
||||
if defined _OLD_VIRTUAL_PYTHONHOME set PYTHONHOME=%_OLD_VIRTUAL_PYTHONHOME%
|
||||
|
||||
set _OLD_VIRTUAL_PROMPT=%PROMPT%
|
||||
set PROMPT=(.venv) %PROMPT%
|
||||
|
||||
if defined PYTHONHOME set _OLD_VIRTUAL_PYTHONHOME=%PYTHONHOME%
|
||||
set PYTHONHOME=
|
||||
|
||||
if defined _OLD_VIRTUAL_PATH set PATH=%_OLD_VIRTUAL_PATH%
|
||||
if not defined _OLD_VIRTUAL_PATH set _OLD_VIRTUAL_PATH=%PATH%
|
||||
|
||||
set PATH=%VIRTUAL_ENV%\Scripts;%PATH%
|
||||
set VIRTUAL_ENV_PROMPT=(.venv)
|
||||
|
||||
:END
|
||||
if defined _OLD_CODEPAGE (
|
||||
"%SystemRoot%\System32\chcp.com" %_OLD_CODEPAGE% > nul
|
||||
set _OLD_CODEPAGE=
|
||||
)
|
Binary file not shown.
Binary file not shown.
@ -1,22 +0,0 @@
|
||||
@echo off
|
||||
|
||||
if defined _OLD_VIRTUAL_PROMPT (
|
||||
set "PROMPT=%_OLD_VIRTUAL_PROMPT%"
|
||||
)
|
||||
set _OLD_VIRTUAL_PROMPT=
|
||||
|
||||
if defined _OLD_VIRTUAL_PYTHONHOME (
|
||||
set "PYTHONHOME=%_OLD_VIRTUAL_PYTHONHOME%"
|
||||
set _OLD_VIRTUAL_PYTHONHOME=
|
||||
)
|
||||
|
||||
if defined _OLD_VIRTUAL_PATH (
|
||||
set "PATH=%_OLD_VIRTUAL_PATH%"
|
||||
)
|
||||
|
||||
set _OLD_VIRTUAL_PATH=
|
||||
|
||||
set VIRTUAL_ENV=
|
||||
set VIRTUAL_ENV_PROMPT=
|
||||
|
||||
:END
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,5 +0,0 @@
|
||||
home = C:\Python311
|
||||
include-system-site-packages = false
|
||||
version = 3.11.0
|
||||
executable = C:\Python311\python.exe
|
||||
command = C:\Python311\python.exe -m venv e:\Documents\Python Scripting\AI Snake\.venv
|
Loading…
Reference in New Issue
Block a user