added completly new version for haslach 2025

This commit is contained in:
fotobox
2025-03-17 03:47:13 +01:00
parent 152832515c
commit 769ab91da8
2333 changed files with 409208 additions and 341 deletions

View File

@@ -0,0 +1,345 @@
# 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
"""Pygame is a set of Python modules designed for writing games.
It is written on top of the excellent SDL library. This allows you
to create fully featured games and multimedia programs in the python
language. The package is highly portable, with games running on
Windows, MacOS, OS X, BeOS, FreeBSD, IRIX, and Linux."""
import sys
import os
# Choose Windows display driver
if os.name == "nt":
pygame_dir = os.path.split(__file__)[0]
# pypy does not find the dlls, so we add package folder to PATH.
os.environ["PATH"] = os.environ["PATH"] + ";" + pygame_dir
# windows store python does not find the dlls, so we run this
if sys.version_info > (3, 8):
os.add_dll_directory(pygame_dir) # only available in 3.8+
# cleanup namespace
del pygame_dir
# when running under X11, always set the SDL window WM_CLASS to make the
# window managers correctly match the pygame window.
elif "DISPLAY" in os.environ and "SDL_VIDEO_X11_WMCLASS" not in os.environ:
os.environ["SDL_VIDEO_X11_WMCLASS"] = os.path.basename(sys.argv[0])
def _attribute_undefined(name):
raise RuntimeError(f"{name} is not available")
class MissingModule:
_NOT_IMPLEMENTED_ = True
def __init__(self, name, urgent=0):
self.name = name
exc_type, exc_msg = sys.exc_info()[:2]
self.info = str(exc_msg)
self.reason = f"{exc_type.__name__}: {self.info}"
self.urgent = urgent
if urgent:
self.warn()
def __getattr__(self, var):
if not self.urgent:
self.warn()
self.urgent = 1
missing_msg = f"{self.name} module not available ({self.reason})"
raise NotImplementedError(missing_msg)
def __bool__(self):
return False
def warn(self):
msg_type = "import" if self.urgent else "use"
message = f"{msg_type} {self.name}: {self.info}\n({self.reason})"
try:
import warnings
level = 4 if self.urgent else 3
warnings.warn(message, RuntimeWarning, level)
except ImportError:
print(message)
# we need to import like this, each at a time. the cleanest way to import
# our modules is with the import command (not the __import__ function)
# isort: skip_file
# first, the "required" modules
from pygame.base import * # pylint: disable=wildcard-import; lgtm[py/polluting-import]
from pygame.constants import * # now has __all__ pylint: disable=wildcard-import; lgtm[py/polluting-import]
from pygame.version import * # pylint: disable=wildcard-import; lgtm[py/polluting-import]
from pygame.rect import Rect
from pygame.rwobject import encode_string, encode_file_path
import pygame.surflock
import pygame.color
Color = pygame.color.Color
import pygame.bufferproxy
BufferProxy = pygame.bufferproxy.BufferProxy
import pygame.math
Vector2 = pygame.math.Vector2
Vector3 = pygame.math.Vector3
__version__ = ver
# next, the "standard" modules
# we still allow them to be missing for stripped down pygame distributions
if get_sdl_version() < (2, 0, 0):
# cdrom only available for SDL 1.2.X
try:
import pygame.cdrom
except (ImportError, OSError):
cdrom = MissingModule("cdrom", urgent=1)
try:
import pygame.display
except (ImportError, OSError):
display = MissingModule("display", urgent=1)
try:
import pygame.draw
except (ImportError, OSError):
draw = MissingModule("draw", urgent=1)
try:
import pygame.event
except (ImportError, OSError):
event = MissingModule("event", urgent=1)
try:
import pygame.image
except (ImportError, OSError):
image = MissingModule("image", urgent=1)
try:
import pygame.joystick
except (ImportError, OSError):
joystick = MissingModule("joystick", urgent=1)
try:
import pygame.key
except (ImportError, OSError):
key = MissingModule("key", urgent=1)
try:
import pygame.mouse
except (ImportError, OSError):
mouse = MissingModule("mouse", urgent=1)
try:
import pygame.cursors
from pygame.cursors import Cursor
except (ImportError, OSError):
cursors = MissingModule("cursors", urgent=1)
def Cursor(*args): # pylint: disable=unused-argument
_attribute_undefined("pygame.Cursor")
try:
import pygame.sprite
except (ImportError, OSError):
sprite = MissingModule("sprite", urgent=1)
try:
import pygame.threads
except (ImportError, OSError):
threads = MissingModule("threads", urgent=1)
try:
import pygame.pixelcopy
except (ImportError, OSError):
pixelcopy = MissingModule("pixelcopy", urgent=1)
try:
from pygame.surface import Surface, SurfaceType
except (ImportError, OSError):
def Surface(size, flags, depth, masks): # pylint: disable=unused-argument
_attribute_undefined("pygame.Surface")
SurfaceType = Surface
try:
import pygame.mask
from pygame.mask import Mask
except (ImportError, OSError):
mask = MissingModule("mask", urgent=0)
def Mask(size, fill): # pylint: disable=unused-argument
_attribute_undefined("pygame.Mask")
try:
from pygame.pixelarray import PixelArray
except (ImportError, OSError):
def PixelArray(surface): # pylint: disable=unused-argument
_attribute_undefined("pygame.PixelArray")
try:
from pygame.overlay import Overlay
except (ImportError, OSError):
def Overlay(format, size): # pylint: disable=unused-argument
_attribute_undefined("pygame.Overlay")
try:
import pygame.time
except (ImportError, OSError):
time = MissingModule("time", urgent=1)
try:
import pygame.transform
except (ImportError, OSError):
transform = MissingModule("transform", urgent=1)
# lastly, the "optional" pygame modules
if "PYGAME_FREETYPE" in os.environ:
try:
import pygame.ftfont as font
sys.modules["pygame.font"] = font
except (ImportError, OSError):
pass
try:
import pygame.font
import pygame.sysfont
pygame.font.SysFont = pygame.sysfont.SysFont
pygame.font.get_fonts = pygame.sysfont.get_fonts
pygame.font.match_font = pygame.sysfont.match_font
except (ImportError, OSError):
font = MissingModule("font", urgent=0)
# try and load pygame.mixer_music before mixer, for py2app...
try:
import pygame.mixer_music
# del pygame.mixer_music
# print("NOTE2: failed importing pygame.mixer_music in lib/__init__.py")
except (ImportError, OSError):
pass
try:
import pygame.mixer
except (ImportError, OSError):
mixer = MissingModule("mixer", urgent=0)
try:
import pygame.scrap
except (ImportError, OSError):
scrap = MissingModule("scrap", urgent=0)
try:
import pygame.surfarray
except (ImportError, OSError):
surfarray = MissingModule("surfarray", urgent=0)
try:
import pygame.sndarray
except (ImportError, OSError):
sndarray = MissingModule("sndarray", urgent=0)
try:
import pygame.fastevent
except (ImportError, OSError):
fastevent = MissingModule("fastevent", urgent=0)
# there's also a couple "internal" modules not needed
# by users, but putting them here helps "dependency finder"
# programs get everything they need (like py2exe)
try:
import pygame.imageext
del pygame.imageext
except (ImportError, OSError):
pass
# this internal module needs to be included for dependency
# finders, but can't be deleted, as some tests need it
try:
import pygame.pkgdata
except (ImportError, OSError):
pass
def packager_imports():
"""some additional imports that py2app/py2exe will want to see"""
import atexit
import numpy
import OpenGL.GL
import pygame.macosx
import pygame.colordict
# make Rects pickleable
import copyreg
def __rect_constructor(x, y, w, h):
return Rect(x, y, w, h)
def __rect_reduce(r):
assert isinstance(r, Rect)
return __rect_constructor, (r.x, r.y, r.w, r.h)
copyreg.pickle(Rect, __rect_reduce, __rect_constructor)
# make Colors pickleable
def __color_constructor(r, g, b, a):
return Color(r, g, b, a)
def __color_reduce(c):
assert isinstance(c, Color)
return __color_constructor, (c.r, c.g, c.b, c.a)
copyreg.pickle(Color, __color_reduce, __color_constructor)
# Thanks for supporting pygame. Without support now, there won't be pygame later.
if "PYGAME_HIDE_SUPPORT_PROMPT" not in os.environ:
print(
"pygame {} (SDL {}.{}.{}, Python {}.{}.{})".format( # pylint: disable=consider-using-f-string
ver, *get_sdl_version() + sys.version_info[0:3]
)
)
print("Hello from the pygame community. https://www.pygame.org/contribute.html")
# cleanup namespace
del pygame, os, sys, MissingModule, copyreg, packager_imports

View File

@@ -0,0 +1,632 @@
# buildconfig/stubs/gen_stubs.py
# A script to auto-generate locals.pyi, constants.pyi and __init__.pyi typestubs
# IMPORTANT NOTE: Do not edit this file by hand!
from typing import Tuple, NoReturn
def Overlay(format: int, size: Tuple[int, int]) -> NoReturn: ...
from pygame import (
display as display,
draw as draw,
event as event,
font as font,
image as image,
key as key,
mixer as mixer,
mouse as mouse,
time as time,
cursors as cursors,
joystick as joystick,
math as math,
mask as mask,
pixelcopy as pixelcopy,
sndarray as sndarray,
sprite as sprite,
surfarray as surfarray,
transform as transform,
fastevent as fastevent,
scrap as scrap,
threads as threads,
version as version,
base as base,
bufferproxy as bufferproxy,
color as color,
colordict as colordict,
mixer_music as mixer_music,
pixelarray as pixelarray,
rect as rect,
rwobject as rwobject,
surface as surface,
surflock as surflock,
sysfont as sysfont,
)
from .rect import Rect as Rect
from .surface import Surface as Surface, SurfaceType as SurfaceType
from .color import Color as Color
from .pixelarray import PixelArray as PixelArray
from .math import Vector2 as Vector2, Vector3 as Vector3
from .cursors import Cursor as Cursor
from .bufferproxy import BufferProxy as BufferProxy
from .mask import Mask as Mask
from .base import (
BufferError as BufferError,
HAVE_NEWBUF as HAVE_NEWBUF,
error as error,
get_array_interface as get_array_interface,
get_error as get_error,
get_init as get_init,
get_sdl_byteorder as get_sdl_byteorder,
get_sdl_version as get_sdl_version,
init as init,
quit as quit,
register_quit as register_quit,
set_error as set_error,
)
from .rwobject import (
encode_file_path as encode_file_path,
encode_string as encode_string,
)
from .version import SDL as SDL, rev as rev, ver as ver, vernum as vernum
from .constants import (
ACTIVEEVENT as ACTIVEEVENT,
ANYFORMAT as ANYFORMAT,
APPACTIVE as APPACTIVE,
APPINPUTFOCUS as APPINPUTFOCUS,
APPMOUSEFOCUS as APPMOUSEFOCUS,
APP_DIDENTERBACKGROUND as APP_DIDENTERBACKGROUND,
APP_DIDENTERFOREGROUND as APP_DIDENTERFOREGROUND,
APP_LOWMEMORY as APP_LOWMEMORY,
APP_TERMINATING as APP_TERMINATING,
APP_WILLENTERBACKGROUND as APP_WILLENTERBACKGROUND,
APP_WILLENTERFOREGROUND as APP_WILLENTERFOREGROUND,
ASYNCBLIT as ASYNCBLIT,
AUDIODEVICEADDED as AUDIODEVICEADDED,
AUDIODEVICEREMOVED as AUDIODEVICEREMOVED,
AUDIO_ALLOW_ANY_CHANGE as AUDIO_ALLOW_ANY_CHANGE,
AUDIO_ALLOW_CHANNELS_CHANGE as AUDIO_ALLOW_CHANNELS_CHANGE,
AUDIO_ALLOW_FORMAT_CHANGE as AUDIO_ALLOW_FORMAT_CHANGE,
AUDIO_ALLOW_FREQUENCY_CHANGE as AUDIO_ALLOW_FREQUENCY_CHANGE,
AUDIO_S16 as AUDIO_S16,
AUDIO_S16LSB as AUDIO_S16LSB,
AUDIO_S16MSB as AUDIO_S16MSB,
AUDIO_S16SYS as AUDIO_S16SYS,
AUDIO_S8 as AUDIO_S8,
AUDIO_U16 as AUDIO_U16,
AUDIO_U16LSB as AUDIO_U16LSB,
AUDIO_U16MSB as AUDIO_U16MSB,
AUDIO_U16SYS as AUDIO_U16SYS,
AUDIO_U8 as AUDIO_U8,
BIG_ENDIAN as BIG_ENDIAN,
BLENDMODE_ADD as BLENDMODE_ADD,
BLENDMODE_BLEND as BLENDMODE_BLEND,
BLENDMODE_MOD as BLENDMODE_MOD,
BLENDMODE_NONE as BLENDMODE_NONE,
BLEND_ADD as BLEND_ADD,
BLEND_ALPHA_SDL2 as BLEND_ALPHA_SDL2,
BLEND_MAX as BLEND_MAX,
BLEND_MIN as BLEND_MIN,
BLEND_MULT as BLEND_MULT,
BLEND_PREMULTIPLIED as BLEND_PREMULTIPLIED,
BLEND_RGBA_ADD as BLEND_RGBA_ADD,
BLEND_RGBA_MAX as BLEND_RGBA_MAX,
BLEND_RGBA_MIN as BLEND_RGBA_MIN,
BLEND_RGBA_MULT as BLEND_RGBA_MULT,
BLEND_RGBA_SUB as BLEND_RGBA_SUB,
BLEND_RGB_ADD as BLEND_RGB_ADD,
BLEND_RGB_MAX as BLEND_RGB_MAX,
BLEND_RGB_MIN as BLEND_RGB_MIN,
BLEND_RGB_MULT as BLEND_RGB_MULT,
BLEND_RGB_SUB as BLEND_RGB_SUB,
BLEND_SUB as BLEND_SUB,
BUTTON_LEFT as BUTTON_LEFT,
BUTTON_MIDDLE as BUTTON_MIDDLE,
BUTTON_RIGHT as BUTTON_RIGHT,
BUTTON_WHEELDOWN as BUTTON_WHEELDOWN,
BUTTON_WHEELUP as BUTTON_WHEELUP,
BUTTON_X1 as BUTTON_X1,
BUTTON_X2 as BUTTON_X2,
CLIPBOARDUPDATE as CLIPBOARDUPDATE,
CONTROLLERAXISMOTION as CONTROLLERAXISMOTION,
CONTROLLERBUTTONDOWN as CONTROLLERBUTTONDOWN,
CONTROLLERBUTTONUP as CONTROLLERBUTTONUP,
CONTROLLERDEVICEADDED as CONTROLLERDEVICEADDED,
CONTROLLERDEVICEREMAPPED as CONTROLLERDEVICEREMAPPED,
CONTROLLERDEVICEREMOVED as CONTROLLERDEVICEREMOVED,
CONTROLLERSENSORUPDATE as CONTROLLERSENSORUPDATE,
CONTROLLERTOUCHPADDOWN as CONTROLLERTOUCHPADDOWN,
CONTROLLERTOUCHPADMOTION as CONTROLLERTOUCHPADMOTION,
CONTROLLERTOUCHPADUP as CONTROLLERTOUCHPADUP,
CONTROLLER_AXIS_INVALID as CONTROLLER_AXIS_INVALID,
CONTROLLER_AXIS_LEFTX as CONTROLLER_AXIS_LEFTX,
CONTROLLER_AXIS_LEFTY as CONTROLLER_AXIS_LEFTY,
CONTROLLER_AXIS_MAX as CONTROLLER_AXIS_MAX,
CONTROLLER_AXIS_RIGHTX as CONTROLLER_AXIS_RIGHTX,
CONTROLLER_AXIS_RIGHTY as CONTROLLER_AXIS_RIGHTY,
CONTROLLER_AXIS_TRIGGERLEFT as CONTROLLER_AXIS_TRIGGERLEFT,
CONTROLLER_AXIS_TRIGGERRIGHT as CONTROLLER_AXIS_TRIGGERRIGHT,
CONTROLLER_BUTTON_A as CONTROLLER_BUTTON_A,
CONTROLLER_BUTTON_B as CONTROLLER_BUTTON_B,
CONTROLLER_BUTTON_BACK as CONTROLLER_BUTTON_BACK,
CONTROLLER_BUTTON_DPAD_DOWN as CONTROLLER_BUTTON_DPAD_DOWN,
CONTROLLER_BUTTON_DPAD_LEFT as CONTROLLER_BUTTON_DPAD_LEFT,
CONTROLLER_BUTTON_DPAD_RIGHT as CONTROLLER_BUTTON_DPAD_RIGHT,
CONTROLLER_BUTTON_DPAD_UP as CONTROLLER_BUTTON_DPAD_UP,
CONTROLLER_BUTTON_GUIDE as CONTROLLER_BUTTON_GUIDE,
CONTROLLER_BUTTON_INVALID as CONTROLLER_BUTTON_INVALID,
CONTROLLER_BUTTON_LEFTSHOULDER as CONTROLLER_BUTTON_LEFTSHOULDER,
CONTROLLER_BUTTON_LEFTSTICK as CONTROLLER_BUTTON_LEFTSTICK,
CONTROLLER_BUTTON_MAX as CONTROLLER_BUTTON_MAX,
CONTROLLER_BUTTON_RIGHTSHOULDER as CONTROLLER_BUTTON_RIGHTSHOULDER,
CONTROLLER_BUTTON_RIGHTSTICK as CONTROLLER_BUTTON_RIGHTSTICK,
CONTROLLER_BUTTON_START as CONTROLLER_BUTTON_START,
CONTROLLER_BUTTON_X as CONTROLLER_BUTTON_X,
CONTROLLER_BUTTON_Y as CONTROLLER_BUTTON_Y,
DOUBLEBUF as DOUBLEBUF,
DROPBEGIN as DROPBEGIN,
DROPCOMPLETE as DROPCOMPLETE,
DROPFILE as DROPFILE,
DROPTEXT as DROPTEXT,
FINGERDOWN as FINGERDOWN,
FINGERMOTION as FINGERMOTION,
FINGERUP as FINGERUP,
FULLSCREEN as FULLSCREEN,
GL_ACCELERATED_VISUAL as GL_ACCELERATED_VISUAL,
GL_ACCUM_ALPHA_SIZE as GL_ACCUM_ALPHA_SIZE,
GL_ACCUM_BLUE_SIZE as GL_ACCUM_BLUE_SIZE,
GL_ACCUM_GREEN_SIZE as GL_ACCUM_GREEN_SIZE,
GL_ACCUM_RED_SIZE as GL_ACCUM_RED_SIZE,
GL_ALPHA_SIZE as GL_ALPHA_SIZE,
GL_BLUE_SIZE as GL_BLUE_SIZE,
GL_BUFFER_SIZE as GL_BUFFER_SIZE,
GL_CONTEXT_DEBUG_FLAG as GL_CONTEXT_DEBUG_FLAG,
GL_CONTEXT_FLAGS as GL_CONTEXT_FLAGS,
GL_CONTEXT_FORWARD_COMPATIBLE_FLAG as GL_CONTEXT_FORWARD_COMPATIBLE_FLAG,
GL_CONTEXT_MAJOR_VERSION as GL_CONTEXT_MAJOR_VERSION,
GL_CONTEXT_MINOR_VERSION as GL_CONTEXT_MINOR_VERSION,
GL_CONTEXT_PROFILE_COMPATIBILITY as GL_CONTEXT_PROFILE_COMPATIBILITY,
GL_CONTEXT_PROFILE_CORE as GL_CONTEXT_PROFILE_CORE,
GL_CONTEXT_PROFILE_ES as GL_CONTEXT_PROFILE_ES,
GL_CONTEXT_PROFILE_MASK as GL_CONTEXT_PROFILE_MASK,
GL_CONTEXT_RELEASE_BEHAVIOR as GL_CONTEXT_RELEASE_BEHAVIOR,
GL_CONTEXT_RELEASE_BEHAVIOR_FLUSH as GL_CONTEXT_RELEASE_BEHAVIOR_FLUSH,
GL_CONTEXT_RELEASE_BEHAVIOR_NONE as GL_CONTEXT_RELEASE_BEHAVIOR_NONE,
GL_CONTEXT_RESET_ISOLATION_FLAG as GL_CONTEXT_RESET_ISOLATION_FLAG,
GL_CONTEXT_ROBUST_ACCESS_FLAG as GL_CONTEXT_ROBUST_ACCESS_FLAG,
GL_DEPTH_SIZE as GL_DEPTH_SIZE,
GL_DOUBLEBUFFER as GL_DOUBLEBUFFER,
GL_FRAMEBUFFER_SRGB_CAPABLE as GL_FRAMEBUFFER_SRGB_CAPABLE,
GL_GREEN_SIZE as GL_GREEN_SIZE,
GL_MULTISAMPLEBUFFERS as GL_MULTISAMPLEBUFFERS,
GL_MULTISAMPLESAMPLES as GL_MULTISAMPLESAMPLES,
GL_RED_SIZE as GL_RED_SIZE,
GL_SHARE_WITH_CURRENT_CONTEXT as GL_SHARE_WITH_CURRENT_CONTEXT,
GL_STENCIL_SIZE as GL_STENCIL_SIZE,
GL_STEREO as GL_STEREO,
GL_SWAP_CONTROL as GL_SWAP_CONTROL,
HAT_CENTERED as HAT_CENTERED,
HAT_DOWN as HAT_DOWN,
HAT_LEFT as HAT_LEFT,
HAT_LEFTDOWN as HAT_LEFTDOWN,
HAT_LEFTUP as HAT_LEFTUP,
HAT_RIGHT as HAT_RIGHT,
HAT_RIGHTDOWN as HAT_RIGHTDOWN,
HAT_RIGHTUP as HAT_RIGHTUP,
HAT_UP as HAT_UP,
HIDDEN as HIDDEN,
HWACCEL as HWACCEL,
HWPALETTE as HWPALETTE,
HWSURFACE as HWSURFACE,
JOYAXISMOTION as JOYAXISMOTION,
JOYBALLMOTION as JOYBALLMOTION,
JOYBUTTONDOWN as JOYBUTTONDOWN,
JOYBUTTONUP as JOYBUTTONUP,
JOYDEVICEADDED as JOYDEVICEADDED,
JOYDEVICEREMOVED as JOYDEVICEREMOVED,
JOYHATMOTION as JOYHATMOTION,
KEYDOWN as KEYDOWN,
KEYMAPCHANGED as KEYMAPCHANGED,
KEYUP as KEYUP,
KMOD_ALT as KMOD_ALT,
KMOD_CAPS as KMOD_CAPS,
KMOD_CTRL as KMOD_CTRL,
KMOD_GUI as KMOD_GUI,
KMOD_LALT as KMOD_LALT,
KMOD_LCTRL as KMOD_LCTRL,
KMOD_LGUI as KMOD_LGUI,
KMOD_LMETA as KMOD_LMETA,
KMOD_LSHIFT as KMOD_LSHIFT,
KMOD_META as KMOD_META,
KMOD_MODE as KMOD_MODE,
KMOD_NONE as KMOD_NONE,
KMOD_NUM as KMOD_NUM,
KMOD_RALT as KMOD_RALT,
KMOD_RCTRL as KMOD_RCTRL,
KMOD_RGUI as KMOD_RGUI,
KMOD_RMETA as KMOD_RMETA,
KMOD_RSHIFT as KMOD_RSHIFT,
KMOD_SHIFT as KMOD_SHIFT,
KSCAN_0 as KSCAN_0,
KSCAN_1 as KSCAN_1,
KSCAN_2 as KSCAN_2,
KSCAN_3 as KSCAN_3,
KSCAN_4 as KSCAN_4,
KSCAN_5 as KSCAN_5,
KSCAN_6 as KSCAN_6,
KSCAN_7 as KSCAN_7,
KSCAN_8 as KSCAN_8,
KSCAN_9 as KSCAN_9,
KSCAN_A as KSCAN_A,
KSCAN_AC_BACK as KSCAN_AC_BACK,
KSCAN_APOSTROPHE as KSCAN_APOSTROPHE,
KSCAN_B as KSCAN_B,
KSCAN_BACKSLASH as KSCAN_BACKSLASH,
KSCAN_BACKSPACE as KSCAN_BACKSPACE,
KSCAN_BREAK as KSCAN_BREAK,
KSCAN_C as KSCAN_C,
KSCAN_CAPSLOCK as KSCAN_CAPSLOCK,
KSCAN_CLEAR as KSCAN_CLEAR,
KSCAN_COMMA as KSCAN_COMMA,
KSCAN_CURRENCYSUBUNIT as KSCAN_CURRENCYSUBUNIT,
KSCAN_CURRENCYUNIT as KSCAN_CURRENCYUNIT,
KSCAN_D as KSCAN_D,
KSCAN_DELETE as KSCAN_DELETE,
KSCAN_DOWN as KSCAN_DOWN,
KSCAN_E as KSCAN_E,
KSCAN_END as KSCAN_END,
KSCAN_EQUALS as KSCAN_EQUALS,
KSCAN_ESCAPE as KSCAN_ESCAPE,
KSCAN_EURO as KSCAN_EURO,
KSCAN_F as KSCAN_F,
KSCAN_F1 as KSCAN_F1,
KSCAN_F10 as KSCAN_F10,
KSCAN_F11 as KSCAN_F11,
KSCAN_F12 as KSCAN_F12,
KSCAN_F13 as KSCAN_F13,
KSCAN_F14 as KSCAN_F14,
KSCAN_F15 as KSCAN_F15,
KSCAN_F2 as KSCAN_F2,
KSCAN_F3 as KSCAN_F3,
KSCAN_F4 as KSCAN_F4,
KSCAN_F5 as KSCAN_F5,
KSCAN_F6 as KSCAN_F6,
KSCAN_F7 as KSCAN_F7,
KSCAN_F8 as KSCAN_F8,
KSCAN_F9 as KSCAN_F9,
KSCAN_G as KSCAN_G,
KSCAN_GRAVE as KSCAN_GRAVE,
KSCAN_H as KSCAN_H,
KSCAN_HELP as KSCAN_HELP,
KSCAN_HOME as KSCAN_HOME,
KSCAN_I as KSCAN_I,
KSCAN_INSERT as KSCAN_INSERT,
KSCAN_INTERNATIONAL1 as KSCAN_INTERNATIONAL1,
KSCAN_INTERNATIONAL2 as KSCAN_INTERNATIONAL2,
KSCAN_INTERNATIONAL3 as KSCAN_INTERNATIONAL3,
KSCAN_INTERNATIONAL4 as KSCAN_INTERNATIONAL4,
KSCAN_INTERNATIONAL5 as KSCAN_INTERNATIONAL5,
KSCAN_INTERNATIONAL6 as KSCAN_INTERNATIONAL6,
KSCAN_INTERNATIONAL7 as KSCAN_INTERNATIONAL7,
KSCAN_INTERNATIONAL8 as KSCAN_INTERNATIONAL8,
KSCAN_INTERNATIONAL9 as KSCAN_INTERNATIONAL9,
KSCAN_J as KSCAN_J,
KSCAN_K as KSCAN_K,
KSCAN_KP0 as KSCAN_KP0,
KSCAN_KP1 as KSCAN_KP1,
KSCAN_KP2 as KSCAN_KP2,
KSCAN_KP3 as KSCAN_KP3,
KSCAN_KP4 as KSCAN_KP4,
KSCAN_KP5 as KSCAN_KP5,
KSCAN_KP6 as KSCAN_KP6,
KSCAN_KP7 as KSCAN_KP7,
KSCAN_KP8 as KSCAN_KP8,
KSCAN_KP9 as KSCAN_KP9,
KSCAN_KP_0 as KSCAN_KP_0,
KSCAN_KP_1 as KSCAN_KP_1,
KSCAN_KP_2 as KSCAN_KP_2,
KSCAN_KP_3 as KSCAN_KP_3,
KSCAN_KP_4 as KSCAN_KP_4,
KSCAN_KP_5 as KSCAN_KP_5,
KSCAN_KP_6 as KSCAN_KP_6,
KSCAN_KP_7 as KSCAN_KP_7,
KSCAN_KP_8 as KSCAN_KP_8,
KSCAN_KP_9 as KSCAN_KP_9,
KSCAN_KP_DIVIDE as KSCAN_KP_DIVIDE,
KSCAN_KP_ENTER as KSCAN_KP_ENTER,
KSCAN_KP_EQUALS as KSCAN_KP_EQUALS,
KSCAN_KP_MINUS as KSCAN_KP_MINUS,
KSCAN_KP_MULTIPLY as KSCAN_KP_MULTIPLY,
KSCAN_KP_PERIOD as KSCAN_KP_PERIOD,
KSCAN_KP_PLUS as KSCAN_KP_PLUS,
KSCAN_L as KSCAN_L,
KSCAN_LALT as KSCAN_LALT,
KSCAN_LANG1 as KSCAN_LANG1,
KSCAN_LANG2 as KSCAN_LANG2,
KSCAN_LANG3 as KSCAN_LANG3,
KSCAN_LANG4 as KSCAN_LANG4,
KSCAN_LANG5 as KSCAN_LANG5,
KSCAN_LANG6 as KSCAN_LANG6,
KSCAN_LANG7 as KSCAN_LANG7,
KSCAN_LANG8 as KSCAN_LANG8,
KSCAN_LANG9 as KSCAN_LANG9,
KSCAN_LCTRL as KSCAN_LCTRL,
KSCAN_LEFT as KSCAN_LEFT,
KSCAN_LEFTBRACKET as KSCAN_LEFTBRACKET,
KSCAN_LGUI as KSCAN_LGUI,
KSCAN_LMETA as KSCAN_LMETA,
KSCAN_LSHIFT as KSCAN_LSHIFT,
KSCAN_LSUPER as KSCAN_LSUPER,
KSCAN_M as KSCAN_M,
KSCAN_MENU as KSCAN_MENU,
KSCAN_MINUS as KSCAN_MINUS,
KSCAN_MODE as KSCAN_MODE,
KSCAN_N as KSCAN_N,
KSCAN_NONUSBACKSLASH as KSCAN_NONUSBACKSLASH,
KSCAN_NONUSHASH as KSCAN_NONUSHASH,
KSCAN_NUMLOCK as KSCAN_NUMLOCK,
KSCAN_NUMLOCKCLEAR as KSCAN_NUMLOCKCLEAR,
KSCAN_O as KSCAN_O,
KSCAN_P as KSCAN_P,
KSCAN_PAGEDOWN as KSCAN_PAGEDOWN,
KSCAN_PAGEUP as KSCAN_PAGEUP,
KSCAN_PAUSE as KSCAN_PAUSE,
KSCAN_PERIOD as KSCAN_PERIOD,
KSCAN_POWER as KSCAN_POWER,
KSCAN_PRINT as KSCAN_PRINT,
KSCAN_PRINTSCREEN as KSCAN_PRINTSCREEN,
KSCAN_Q as KSCAN_Q,
KSCAN_R as KSCAN_R,
KSCAN_RALT as KSCAN_RALT,
KSCAN_RCTRL as KSCAN_RCTRL,
KSCAN_RETURN as KSCAN_RETURN,
KSCAN_RGUI as KSCAN_RGUI,
KSCAN_RIGHT as KSCAN_RIGHT,
KSCAN_RIGHTBRACKET as KSCAN_RIGHTBRACKET,
KSCAN_RMETA as KSCAN_RMETA,
KSCAN_RSHIFT as KSCAN_RSHIFT,
KSCAN_RSUPER as KSCAN_RSUPER,
KSCAN_S as KSCAN_S,
KSCAN_SCROLLLOCK as KSCAN_SCROLLLOCK,
KSCAN_SCROLLOCK as KSCAN_SCROLLOCK,
KSCAN_SEMICOLON as KSCAN_SEMICOLON,
KSCAN_SLASH as KSCAN_SLASH,
KSCAN_SPACE as KSCAN_SPACE,
KSCAN_SYSREQ as KSCAN_SYSREQ,
KSCAN_T as KSCAN_T,
KSCAN_TAB as KSCAN_TAB,
KSCAN_U as KSCAN_U,
KSCAN_UNKNOWN as KSCAN_UNKNOWN,
KSCAN_UP as KSCAN_UP,
KSCAN_V as KSCAN_V,
KSCAN_W as KSCAN_W,
KSCAN_X as KSCAN_X,
KSCAN_Y as KSCAN_Y,
KSCAN_Z as KSCAN_Z,
K_0 as K_0,
K_1 as K_1,
K_2 as K_2,
K_3 as K_3,
K_4 as K_4,
K_5 as K_5,
K_6 as K_6,
K_7 as K_7,
K_8 as K_8,
K_9 as K_9,
K_AC_BACK as K_AC_BACK,
K_AMPERSAND as K_AMPERSAND,
K_ASTERISK as K_ASTERISK,
K_AT as K_AT,
K_BACKQUOTE as K_BACKQUOTE,
K_BACKSLASH as K_BACKSLASH,
K_BACKSPACE as K_BACKSPACE,
K_BREAK as K_BREAK,
K_CAPSLOCK as K_CAPSLOCK,
K_CARET as K_CARET,
K_CLEAR as K_CLEAR,
K_COLON as K_COLON,
K_COMMA as K_COMMA,
K_CURRENCYSUBUNIT as K_CURRENCYSUBUNIT,
K_CURRENCYUNIT as K_CURRENCYUNIT,
K_DELETE as K_DELETE,
K_DOLLAR as K_DOLLAR,
K_DOWN as K_DOWN,
K_END as K_END,
K_EQUALS as K_EQUALS,
K_ESCAPE as K_ESCAPE,
K_EURO as K_EURO,
K_EXCLAIM as K_EXCLAIM,
K_F1 as K_F1,
K_F10 as K_F10,
K_F11 as K_F11,
K_F12 as K_F12,
K_F13 as K_F13,
K_F14 as K_F14,
K_F15 as K_F15,
K_F2 as K_F2,
K_F3 as K_F3,
K_F4 as K_F4,
K_F5 as K_F5,
K_F6 as K_F6,
K_F7 as K_F7,
K_F8 as K_F8,
K_F9 as K_F9,
K_GREATER as K_GREATER,
K_HASH as K_HASH,
K_HELP as K_HELP,
K_HOME as K_HOME,
K_INSERT as K_INSERT,
K_KP0 as K_KP0,
K_KP1 as K_KP1,
K_KP2 as K_KP2,
K_KP3 as K_KP3,
K_KP4 as K_KP4,
K_KP5 as K_KP5,
K_KP6 as K_KP6,
K_KP7 as K_KP7,
K_KP8 as K_KP8,
K_KP9 as K_KP9,
K_KP_0 as K_KP_0,
K_KP_1 as K_KP_1,
K_KP_2 as K_KP_2,
K_KP_3 as K_KP_3,
K_KP_4 as K_KP_4,
K_KP_5 as K_KP_5,
K_KP_6 as K_KP_6,
K_KP_7 as K_KP_7,
K_KP_8 as K_KP_8,
K_KP_9 as K_KP_9,
K_KP_DIVIDE as K_KP_DIVIDE,
K_KP_ENTER as K_KP_ENTER,
K_KP_EQUALS as K_KP_EQUALS,
K_KP_MINUS as K_KP_MINUS,
K_KP_MULTIPLY as K_KP_MULTIPLY,
K_KP_PERIOD as K_KP_PERIOD,
K_KP_PLUS as K_KP_PLUS,
K_LALT as K_LALT,
K_LCTRL as K_LCTRL,
K_LEFT as K_LEFT,
K_LEFTBRACKET as K_LEFTBRACKET,
K_LEFTPAREN as K_LEFTPAREN,
K_LESS as K_LESS,
K_LGUI as K_LGUI,
K_LMETA as K_LMETA,
K_LSHIFT as K_LSHIFT,
K_LSUPER as K_LSUPER,
K_MENU as K_MENU,
K_MINUS as K_MINUS,
K_MODE as K_MODE,
K_NUMLOCK as K_NUMLOCK,
K_NUMLOCKCLEAR as K_NUMLOCKCLEAR,
K_PAGEDOWN as K_PAGEDOWN,
K_PAGEUP as K_PAGEUP,
K_PAUSE as K_PAUSE,
K_PERCENT as K_PERCENT,
K_PERIOD as K_PERIOD,
K_PLUS as K_PLUS,
K_POWER as K_POWER,
K_PRINT as K_PRINT,
K_PRINTSCREEN as K_PRINTSCREEN,
K_QUESTION as K_QUESTION,
K_QUOTE as K_QUOTE,
K_QUOTEDBL as K_QUOTEDBL,
K_RALT as K_RALT,
K_RCTRL as K_RCTRL,
K_RETURN as K_RETURN,
K_RGUI as K_RGUI,
K_RIGHT as K_RIGHT,
K_RIGHTBRACKET as K_RIGHTBRACKET,
K_RIGHTPAREN as K_RIGHTPAREN,
K_RMETA as K_RMETA,
K_RSHIFT as K_RSHIFT,
K_RSUPER as K_RSUPER,
K_SCROLLLOCK as K_SCROLLLOCK,
K_SCROLLOCK as K_SCROLLOCK,
K_SEMICOLON as K_SEMICOLON,
K_SLASH as K_SLASH,
K_SPACE as K_SPACE,
K_SYSREQ as K_SYSREQ,
K_TAB as K_TAB,
K_UNDERSCORE as K_UNDERSCORE,
K_UNKNOWN as K_UNKNOWN,
K_UP as K_UP,
K_a as K_a,
K_b as K_b,
K_c as K_c,
K_d as K_d,
K_e as K_e,
K_f as K_f,
K_g as K_g,
K_h as K_h,
K_i as K_i,
K_j as K_j,
K_k as K_k,
K_l as K_l,
K_m as K_m,
K_n as K_n,
K_o as K_o,
K_p as K_p,
K_q as K_q,
K_r as K_r,
K_s as K_s,
K_t as K_t,
K_u as K_u,
K_v as K_v,
K_w as K_w,
K_x as K_x,
K_y as K_y,
K_z as K_z,
LIL_ENDIAN as LIL_ENDIAN,
LOCALECHANGED as LOCALECHANGED,
MIDIIN as MIDIIN,
MIDIOUT as MIDIOUT,
MOUSEBUTTONDOWN as MOUSEBUTTONDOWN,
MOUSEBUTTONUP as MOUSEBUTTONUP,
MOUSEMOTION as MOUSEMOTION,
MOUSEWHEEL as MOUSEWHEEL,
MULTIGESTURE as MULTIGESTURE,
NOEVENT as NOEVENT,
NOFRAME as NOFRAME,
NUMEVENTS as NUMEVENTS,
OPENGL as OPENGL,
OPENGLBLIT as OPENGLBLIT,
PREALLOC as PREALLOC,
QUIT as QUIT,
RENDER_DEVICE_RESET as RENDER_DEVICE_RESET,
RENDER_TARGETS_RESET as RENDER_TARGETS_RESET,
RESIZABLE as RESIZABLE,
RLEACCEL as RLEACCEL,
RLEACCELOK as RLEACCELOK,
SCALED as SCALED,
SCRAP_BMP as SCRAP_BMP,
SCRAP_CLIPBOARD as SCRAP_CLIPBOARD,
SCRAP_PBM as SCRAP_PBM,
SCRAP_PPM as SCRAP_PPM,
SCRAP_SELECTION as SCRAP_SELECTION,
SCRAP_TEXT as SCRAP_TEXT,
SHOWN as SHOWN,
SRCALPHA as SRCALPHA,
SRCCOLORKEY as SRCCOLORKEY,
SWSURFACE as SWSURFACE,
SYSTEM_CURSOR_ARROW as SYSTEM_CURSOR_ARROW,
SYSTEM_CURSOR_CROSSHAIR as SYSTEM_CURSOR_CROSSHAIR,
SYSTEM_CURSOR_HAND as SYSTEM_CURSOR_HAND,
SYSTEM_CURSOR_IBEAM as SYSTEM_CURSOR_IBEAM,
SYSTEM_CURSOR_NO as SYSTEM_CURSOR_NO,
SYSTEM_CURSOR_SIZEALL as SYSTEM_CURSOR_SIZEALL,
SYSTEM_CURSOR_SIZENESW as SYSTEM_CURSOR_SIZENESW,
SYSTEM_CURSOR_SIZENS as SYSTEM_CURSOR_SIZENS,
SYSTEM_CURSOR_SIZENWSE as SYSTEM_CURSOR_SIZENWSE,
SYSTEM_CURSOR_SIZEWE as SYSTEM_CURSOR_SIZEWE,
SYSTEM_CURSOR_WAIT as SYSTEM_CURSOR_WAIT,
SYSTEM_CURSOR_WAITARROW as SYSTEM_CURSOR_WAITARROW,
SYSWMEVENT as SYSWMEVENT,
TEXTEDITING as TEXTEDITING,
TEXTINPUT as TEXTINPUT,
TIMER_RESOLUTION as TIMER_RESOLUTION,
USEREVENT as USEREVENT,
USEREVENT_DROPFILE as USEREVENT_DROPFILE,
VIDEOEXPOSE as VIDEOEXPOSE,
VIDEORESIZE as VIDEORESIZE,
WINDOWCLOSE as WINDOWCLOSE,
WINDOWDISPLAYCHANGED as WINDOWDISPLAYCHANGED,
WINDOWENTER as WINDOWENTER,
WINDOWEXPOSED as WINDOWEXPOSED,
WINDOWFOCUSGAINED as WINDOWFOCUSGAINED,
WINDOWFOCUSLOST as WINDOWFOCUSLOST,
WINDOWHIDDEN as WINDOWHIDDEN,
WINDOWHITTEST as WINDOWHITTEST,
WINDOWICCPROFCHANGED as WINDOWICCPROFCHANGED,
WINDOWLEAVE as WINDOWLEAVE,
WINDOWMAXIMIZED as WINDOWMAXIMIZED,
WINDOWMINIMIZED as WINDOWMINIMIZED,
WINDOWMOVED as WINDOWMOVED,
WINDOWRESIZED as WINDOWRESIZED,
WINDOWRESTORED as WINDOWRESTORED,
WINDOWSHOWN as WINDOWSHOWN,
WINDOWSIZECHANGED as WINDOWSIZECHANGED,
WINDOWTAKEFOCUS as WINDOWTAKEFOCUS,
)

View File

@@ -0,0 +1,5 @@
import os
def get_hook_dirs():
return [os.path.dirname(__file__)]

View File

@@ -0,0 +1,45 @@
"""
binaries hook for pygame seems to be required for pygame 2.0 Windows.
Otherwise some essential DLLs will not be transferred to the exe.
And also put hooks for datas, resources that pygame uses, to work
correctly with pyinstaller
"""
import os
import platform
from pygame import __file__ as pygame_main_file
# Get pygame's folder
pygame_folder = os.path.dirname(os.path.abspath(pygame_main_file))
# datas is the variable that pyinstaller looks for while processing hooks
datas = []
# A helper to append the relative path of a resource to hook variable - datas
def _append_to_datas(file_path):
res_path = os.path.join(pygame_folder, file_path)
if os.path.exists(res_path):
datas.append((res_path, "pygame"))
# First append the font file, then based on the OS, append pygame icon file
_append_to_datas("freesansbold.ttf")
if platform.system() == "Darwin":
_append_to_datas("pygame_icon_mac.bmp")
else:
_append_to_datas("pygame_icon.bmp")
if platform.system() == "Windows":
from PyInstaller.utils.hooks import collect_dynamic_libs
pre_binaries = collect_dynamic_libs("pygame")
binaries = []
for b in pre_binaries:
binary, location = b
# settles all the DLLs into the top level folder, which prevents duplication
# with the DLLs already being put there.
binaries.append((binary, "."))

View File

@@ -0,0 +1,208 @@
"""pygame.camera backend that uses OpenCV.
Uses the cv2 module opencv for python.
See https://pypi.org/project/opencv-python/ for wheels version.
python3 -m pip install opencv-python --user
"""
import numpy
import cv2
import time
import pygame
def list_cameras():
""" """
index = 0
device_idx = []
failed = 0
# Sometimes there are gaps between the device index.
# We keep trying max_gaps times.
max_gaps = 3
while failed < max_gaps:
vcap = cv2.VideoCapture(index)
if not vcap.read()[0]:
failed += 1
else:
device_idx.append(index)
vcap.release()
index += 1
return device_idx
def list_cameras_darwin():
import subprocess
from xml.etree import ElementTree
# pylint: disable=consider-using-with
flout, _ = subprocess.Popen(
"system_profiler -xml SPCameraDataType",
shell=True,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
).communicate()
last_text = None
cameras = []
for node in ElementTree.fromstring(flout).iterfind("./array/dict/array/dict/*"):
if last_text == "_name":
cameras.append(node.text)
last_text = node.text
return cameras
class Camera:
def __init__(self, device=0, size=(640, 480), mode="RGB", api_preference=None):
"""
api_preference - cv2.CAP_DSHOW cv2.CAP_V4L2 cv2.CAP_MSMF and others
# See https://docs.opencv.org/3.4/d4/d15/group__videoio__flags__base.html
"""
self._device_index = device
self._size = size
self.api_preference = api_preference
if api_preference is not None:
if sys.platform == "win32":
# seems more compatible on windows?
self.api_preference = cv2.CAP_DSHOW
if mode == "RGB":
self._fmt = cv2.COLOR_BGR2RGB
elif mode == "YUV":
self._fmt = cv2.COLOR_BGR2YUV
elif mode == "HSV":
self._fmt = cv2.COLOR_BGR2HSV
else:
raise ValueError("Not a supported mode")
self._open = False
# all of this could have been done in the constructor, but creating
# the VideoCapture is very time consuming, so it makes more sense in the
# actual start() method
def start(self):
if self._open:
return
self._cam = cv2.VideoCapture(self._device_index, self.api_preference)
if not self._cam.isOpened():
raise ValueError("Could not open camera.")
self._cam.set(cv2.CAP_PROP_FRAME_WIDTH, self._size[0])
self._cam.set(cv2.CAP_PROP_FRAME_HEIGHT, self._size[1])
w = self._cam.get(cv2.CAP_PROP_FRAME_WIDTH)
h = self._cam.get(cv2.CAP_PROP_FRAME_HEIGHT)
self._size = (int(w), int(h))
self._flipx = False
self._flipy = False
self._brightness = 1
self._frametime = 1 / self._cam.get(cv2.CAP_PROP_FPS)
self._last_frame_time = 0
self._open = True
def stop(self):
if self._open:
self._cam.release()
self._cam = None
self._open = False
def _check_open(self):
if not self._open:
raise pygame.error("Camera must be started")
def get_size(self):
self._check_open()
return self._size
def set_controls(self, hflip=None, vflip=None, brightness=None):
self._check_open()
if hflip is not None:
self._flipx = bool(hflip)
if vflip is not None:
self._flipy = bool(vflip)
if brightness is not None:
self._cam.set(cv2.CAP_PROP_BRIGHTNESS, brightness)
return self.get_controls()
def get_controls(self):
self._check_open()
return (self._flipx, self._flipy, self._cam.get(cv2.CAP_PROP_BRIGHTNESS))
def query_image(self):
self._check_open()
current_time = time.time()
if current_time - self._last_frame_time > self._frametime:
return True
return False
def get_image(self, dest_surf=None):
self._check_open()
self._last_frame_time = time.time()
_, image = self._cam.read()
image = cv2.cvtColor(image, self._fmt)
flip_code = None
if self._flipx:
if self._flipy:
flip_code = -1
else:
flip_code = 1
elif self._flipy:
flip_code = 0
if flip_code is not None:
image = cv2.flip(image, flip_code)
image = numpy.fliplr(image)
image = numpy.rot90(image)
surf = pygame.surfarray.make_surface(image)
if dest_surf:
dest_surf.blit(surf, (0, 0))
return dest_surf
return surf
def get_raw(self):
self._check_open()
self._last_frame_time = time.time()
_, image = self._cam.read()
return image.tobytes()
class CameraMac(Camera):
def __init__(self, device=0, size=(640, 480), mode="RGB", api_preference=None):
if isinstance(device, int):
_dev = device
elif isinstance(device, str):
_dev = list_cameras_darwin().index(device)
else:
raise TypeError(
"OpenCV-Mac backend can take device indices or names, ints or strings, not ",
str(type(device)),
)
super().__init__(_dev, size, mode, api_preference)

View File

@@ -0,0 +1,117 @@
"""pygame.camera.Camera implementation using the videocapture module for windows.
http://videocapture.sourceforge.net/
Binary windows wheels:
https://www.lfd.uci.edu/~gohlke/pythonlibs/#videocapture
"""
import pygame
def list_cameras():
"""Always only lists one camera.
Functionality not supported in videocapture module.
"""
return [0]
# this just cycles through all the cameras trying to open them
# cameras = []
# for x in range(256):
# try:
# c = Camera(x)
# except:
# break
# cameras.append(x)
# return cameras
def init():
global vidcap
try:
import vidcap as vc
except ImportError:
from VideoCapture import vidcap as vc
vidcap = vc
def quit():
global vidcap
vidcap = None
class Camera:
# pylint: disable=unused-argument
def __init__(self, device=0, size=(640, 480), mode="RGB", show_video_window=0):
"""device: VideoCapture enumerates the available video capture devices
on your system. If you have more than one device, specify
the desired one here. The device number starts from 0.
show_video_window: 0 ... do not display a video window (the default)
1 ... display a video window
Mainly used for debugging, since the video window
can not be closed or moved around.
"""
self.dev = vidcap.new_Dev(device, show_video_window)
width, height = size
self.dev.setresolution(width, height)
def display_capture_filter_properties(self):
"""Displays a dialog containing the property page of the capture filter.
For VfW drivers you may find the option to select the resolution most
likely here.
"""
self.dev.displaycapturefilterproperties()
def display_capture_pin_properties(self):
"""Displays a dialog containing the property page of the capture pin.
For WDM drivers you may find the option to select the resolution most
likely here.
"""
self.dev.displaycapturepinproperties()
def set_resolution(self, width, height):
"""Sets the capture resolution. (without dialog)"""
self.dev.setresolution(width, height)
def get_buffer(self):
"""Returns a string containing the raw pixel data."""
return self.dev.getbuffer()
def start(self):
"""Not implemented."""
def set_controls(self, **kwargs):
"""Not implemented."""
def stop(self):
"""Not implemented."""
def get_image(self, dest_surf=None):
""" """
return self.get_surface(dest_surf)
def get_surface(self, dest_surf=None):
"""Returns a pygame Surface."""
abuffer, width, height = self.get_buffer()
if not abuffer:
return None
surf = pygame.image.frombuffer(abuffer, (width, height), "BGR")
surf = pygame.transform.flip(surf, 0, 1)
# if there is a destination surface given, we blit onto that.
if dest_surf:
dest_surf.blit(surf, (0, 0))
else:
dest_surf = surf
return dest_surf
if __name__ == "__main__":
import pygame.examples.camera
pygame.camera.Camera = Camera
pygame.camera.list_cameras = list_cameras
pygame.examples.camera.main()

View File

@@ -0,0 +1,40 @@
from os import PathLike
from typing import IO, Callable, Sequence, Tuple, Union
from typing_extensions import Literal as Literal
from typing_extensions import Protocol
from pygame.color import Color
from pygame.math import Vector2
from pygame.rect import Rect
# For functions that take a file name
AnyPath = Union[str, bytes, PathLike[str], PathLike[bytes]]
# Most pygame functions that take a file argument should be able to handle
# a FileArg type
FileArg = Union[AnyPath, IO[bytes], IO[str]]
Coordinate = Union[Tuple[float, float], Sequence[float], Vector2]
# This typehint is used when a function would return an RGBA tuble
RGBAOutput = Tuple[int, int, int, int]
ColorValue = Union[Color, int, str, Tuple[int, int, int], RGBAOutput, Sequence[int]]
from typing import Union
def my_function(my_var: Union[int, float, complex]) -> None:
print(my_var)
_CanBeRect = Union[
Rect,
Tuple[Union[float, int], Union[float, int], Union[float, int], Union[float, int]],
Tuple[Coordinate, Coordinate],
Sequence[Union[float, int]],
Sequence[Coordinate],
]
class _HasRectAttribute(Protocol):
# An object that has a rect attribute that is either a rect, or a function
# that returns a rect confirms to the rect protocol
rect: Union[RectValue, Callable[[], RectValue]]
RectValue = Union[_CanBeRect, _HasRectAttribute]

View File

@@ -0,0 +1,3 @@
from .sdl2 import * # pylint: disable=wildcard-import; lgtm[py/polluting-import]
from .audio import * # pylint: disable=wildcard-import; lgtm[py/polluting-import]
from .video import * # pylint: disable=wildcard-import; lgtm[py/polluting-import]

View File

@@ -0,0 +1,3 @@
from pygame._sdl2.audio import *
from pygame._sdl2.sdl2 import *
from pygame._sdl2.video import *

View File

@@ -0,0 +1,54 @@
from typing import Callable, List
AUDIO_U8: int
AUDIO_S8: int
AUDIO_U16LSB: int
AUDIO_S16LSB: int
AUDIO_U16MSB: int
AUDIO_S16MSB: int
AUDIO_U16: int
AUDIO_S16: int
AUDIO_S32LSB: int
AUDIO_S32MSB: int
AUDIO_S32: int
AUDIO_F32LSB: int
AUDIO_F32MSB: int
AUDIO_F32: int
AUDIO_ALLOW_FREQUENCY_CHANGE: int
AUDIO_ALLOW_FORMAT_CHANGE: int
AUDIO_ALLOW_CHANNELS_CHANGE: int
AUDIO_ALLOW_ANY_CHANGE: int
def get_audio_device_names(iscapture: bool = False) -> List[str]: ...
class AudioDevice:
def __init__(
self,
devicename: str,
iscapture: bool,
frequency: int,
audioformat: int,
numchannels: int,
chunksize: int,
allowed_changes: int,
callback: Callable[[AudioDevice, memoryview], None],
) -> None: ...
@property
def iscapture(self) -> bool: ...
@property
def deviceid(self) -> int: ...
@property
def devicename(self) -> str: ...
@property
def callback(self) -> Callable[[AudioDevice, memoryview], None]: ...
@property
def frequency(self) -> int: ...
@property
def audioformat(self) -> int: ...
@property
def numchannels(self) -> int: ...
@property
def chunksize(self) -> int: ...
def pause(self, pause_on: int) -> None: ...
def close(self) -> None: ...

View File

@@ -0,0 +1,35 @@
from typing import Dict, Mapping, Optional
from pygame.joystick import JoystickType
def init() -> None: ...
def get_init() -> bool: ...
def quit() -> None: ...
def set_eventstate(state: bool) -> None: ...
def get_eventstate() -> bool: ...
def update() -> None: ...
def get_count() -> int: ...
def is_controller(index: int) -> bool: ...
def name_forindex(index: int) -> Optional[str]: ...
class Controller:
def __init__(self, index: int) -> None: ...
@property
def name(self) -> str: ...
@property
def id(self) -> int: ...
def init(self) -> None: ...
def get_init(self) -> bool: ...
def quit(self) -> None: ...
@staticmethod
def from_joystick(joy: JoystickType) -> Controller: ...
def attached(self) -> bool: ...
def as_joystick(self) -> JoystickType: ...
def get_axis(self, axis: int) -> int: ...
def get_button(self, button: int) -> bool: ...
def get_mapping(self) -> Dict[str, str]: ...
def set_mapping(self, mapping: Mapping[str, str]) -> int: ...
def rumble(
self, low_frequency: float, high_frequency: float, duration: int
) -> bool: ...
def stop_rumble(self) -> None: ...

View File

@@ -0,0 +1,16 @@
from typing import Optional
INIT_TIMER: int
INIT_AUDIO: int
INIT_VIDEO: int
INIT_JOYSTICK: int
INIT_HAPTIC: int
INIT_GAMECONTROLLER: int
INIT_EVENTS: int
INIT_NOPARACHUTE: int
INIT_EVERYTHING: int
class error(RuntimeError):
def __init__(self, message: Optional[str] = None) -> None: ...
def init_subsystem(flags: int) -> None: ...

View File

@@ -0,0 +1,6 @@
from typing import Dict, Union
def get_num_devices() -> int: ...
def get_device(index: int) -> int: ...
def get_num_fingers(device_id: int) -> int: ...
def get_finger(touchid: int, index: int) -> Dict[str, Union[int, float]]: ...

View File

@@ -0,0 +1,159 @@
from typing import Any, Generator, Iterable, Optional, Tuple, Union
from pygame.rect import Rect
from pygame.surface import Surface
from .._common import RectValue, Literal, ColorValue
WINDOWPOS_UNDEFINED: int
WINDOWPOS_CENTERED: int
MESSAGEBOX_ERROR: int
MESSAGEBOX_WARNING: int
MESSAGEBOX_INFORMATION: int
class RendererDriverInfo:
name: str
flags: int
num_texture_formats: int
max_texture_width: int
max_texture_height: int
def get_drivers() -> Generator[RendererDriverInfo, None, None]: ...
def get_grabbed_window() -> Optional[Window]: ...
def messagebox(
title: str,
message: str,
window: Optional[Window] = None,
info: bool = False,
warn: bool = False,
error: bool = False,
buttons: Tuple[str, ...] = ("OK",),
return_button: int = 0,
escape_button: int = 0,
) -> int: ...
class Window:
DEFAULT_SIZE: Tuple[Literal[640], Literal[480]]
def __init__(
self,
title: str = "pygame",
size: Iterable[int] = (640, 480),
position: Optional[Iterable[int]] = None,
fullscreen: bool = False,
fullscreen_desktop: bool = False,
**kwargs: bool
) -> None: ...
@classmethod
def from_display_module(cls) -> Window: ...
@classmethod
def from_window(cls, other: int) -> Window: ...
grab: bool
relative_mouse: bool
def set_windowed(self) -> None: ...
def set_fullscreen(self, desktop: bool = False) -> None: ...
title: str
def destroy(self) -> None: ...
def hide(self) -> None: ...
def show(self) -> None: ...
def focus(self, input_only: bool = False) -> None: ...
def restore(self) -> None: ...
def maximize(self) -> None: ...
def minimize(self) -> None: ...
resizable: bool
borderless: bool
def set_icon(self, surface: Surface) -> None: ...
id: int
size: Iterable[int]
position: Union[int, Iterable[int]]
opacity: float
display_index: int
def set_modal_for(self, Window) -> None: ...
class Texture:
def __init__(
self,
renderer: Renderer,
size: Iterable[int],
static: bool = False,
streaming: bool = False,
target: bool = False,
) -> None: ...
@staticmethod
def from_surface(renderer: Renderer, surface: Surface) -> Texture: ...
renderer: Renderer
width: int
height: int
alpha: int
blend_mode: int
color: ColorValue
def get_rect(self, **kwargs: Any) -> Rect: ...
def draw(
self,
srcrect: Optional[RectValue] = None,
dstrect: Optional[RectValue] = None,
angle: int = 0,
origin: Optional[Iterable[int]] = None,
flip_x: bool = False,
flip_y: bool = False,
) -> None: ...
def update(self, surface: Surface, area: Optional[RectValue] = None) -> None: ...
class Image:
def __init__(
self,
textureOrImage: Union[Texture, Image],
srcrect: Optional[RectValue] = None,
) -> None: ...
def get_rect(self, **kwargs: Any) -> Rect: ...
def draw(
self, srcrect: Optional[RectValue] = None, dstrect: Optional[RectValue] = None
) -> None: ...
angle: float
origin: Optional[Iterable[float]]
flip_x: bool
flip_y: bool
color: ColorValue
alpha: float
blend_mode: int
texture: Texture
srcrect: Rect
class Renderer:
def __init__(
self,
window: Window,
index: int = -1,
accelerated: int = -1,
vsync: bool = False,
target_texture: bool = False,
) -> None: ...
@classmethod
def from_window(cls, window: Window) -> Renderer: ...
draw_blend_mode: int
draw_color: ColorValue
def clear(self) -> None: ...
def present(self) -> None: ...
def get_viewport(self) -> Rect: ...
def set_viewport(self, area: Optional[RectValue]) -> None: ...
logical_size: Iterable[int]
scale: Iterable[float]
target: Optional[Texture]
def blit(
self,
source: Union[Texture, Image],
dest: Optional[RectValue] = None,
area: Optional[RectValue] = None,
special_flags: int = 0,
) -> Rect: ...
def draw_line(self, p1: Iterable[int], p2: Iterable[int]) -> None: ...
def draw_point(self, point: Iterable[int]) -> None: ...
def draw_rect(self, rect: RectValue) -> None: ...
def fill_rect(self, rect: RectValue) -> None: ...
def to_surface(
self, surface: Optional[Surface] = None, area: Optional[RectValue] = None
) -> Surface: ...
@staticmethod
def compose_custom_blend_mode(
color_mode: Tuple[int, int, int], alpha_mode: Tuple[int, int, int]
) -> int: ...

View File

@@ -0,0 +1,19 @@
from typing import Any, Tuple, Callable
class error(RuntimeError): ...
class BufferError(Exception): ...
# Always defined
HAVE_NEWBUF: int = 1
def init() -> Tuple[int, int]: ...
def quit() -> None: ...
def get_init() -> bool: ...
def get_error() -> str: ...
def set_error(error_msg: str) -> None: ...
def get_sdl_version(linked: bool = True) -> Tuple[int, int, int]: ...
def get_sdl_byteorder() -> int: ...
def register_quit(callable: Callable[[], Any]) -> None: ...
# undocumented part of pygame API, kept here to make stubtest happy
def get_array_interface(arg: Any) -> dict: ...

View File

@@ -0,0 +1,15 @@
from typing import Any, Dict, overload
class BufferProxy:
parent: Any
length: int
raw: bytes
# possibly going to be deprecated/removed soon, in which case these
# typestubs must be removed too
__array_interface__: Dict[str, Any]
__array_struct__: Any
@overload
def __init__(self) -> None: ...
@overload
def __init__(self, parent: Any) -> None: ...
def write(self, buffer: bytes, offset: int = 0) -> None: ...

View File

@@ -0,0 +1,211 @@
import os
import platform
import sys
import warnings
from abc import ABC, abstractmethod
from pygame import error
_is_init = False
class AbstractCamera(ABC):
# set_controls and get_controls are not a part of the AbstractCamera ABC,
# because implementations of the same can vary across different Camera
# types
@abstractmethod
def __init__(self, *args, **kwargs):
""" """
@abstractmethod
def start(self):
""" """
@abstractmethod
def stop(self):
""" """
@abstractmethod
def get_size(self):
""" """
@abstractmethod
def query_image(self):
""" """
@abstractmethod
def get_image(self, dest_surf=None):
""" """
@abstractmethod
def get_raw(self):
""" """
def _pre_init_placeholder():
if not _is_init:
raise error("pygame.camera is not initialized")
# camera was init, and yet functions are not monkey patched. This should
# not happen
raise NotImplementedError()
def _pre_init_placeholder_varargs(*_, **__):
_pre_init_placeholder()
class _PreInitPlaceholderCamera(AbstractCamera):
__init__ = _pre_init_placeholder_varargs
start = _pre_init_placeholder_varargs
stop = _pre_init_placeholder_varargs
get_controls = _pre_init_placeholder_varargs
set_controls = _pre_init_placeholder_varargs
get_size = _pre_init_placeholder_varargs
query_image = _pre_init_placeholder_varargs
get_image = _pre_init_placeholder_varargs
get_raw = _pre_init_placeholder_varargs
list_cameras = _pre_init_placeholder
Camera = _PreInitPlaceholderCamera
def _colorspace_not_available(*args):
raise RuntimeError("pygame is not built with colorspace support")
try:
from pygame import _camera
colorspace = _camera.colorspace
except ImportError:
# Should not happen in most cases
colorspace = _colorspace_not_available
def _setup_backend(backend):
global list_cameras, Camera
if backend == "opencv-mac":
from pygame import _camera_opencv
list_cameras = _camera_opencv.list_cameras_darwin
Camera = _camera_opencv.CameraMac
elif backend == "opencv":
from pygame import _camera_opencv
list_cameras = _camera_opencv.list_cameras
Camera = _camera_opencv.Camera
elif backend in ("_camera (msmf)", "_camera (v4l2)"):
from pygame import _camera
list_cameras = _camera.list_cameras
Camera = _camera.Camera
elif backend == "videocapture":
from pygame import _camera_vidcapture
warnings.warn(
"The VideoCapture backend is not recommended and may be removed."
"For Python3 and Windows 8+, there is now a native Windows "
"backend built into pygame.",
DeprecationWarning,
stacklevel=2,
)
_camera_vidcapture.init()
list_cameras = _camera_vidcapture.list_cameras
Camera = _camera_vidcapture.Camera
else:
raise ValueError("unrecognized backend name")
def get_backends():
possible_backends = []
if sys.platform == "win32" and int(platform.win32_ver()[0].split(".")[0]) >= 8:
try:
# If cv2 is installed, prefer that on windows.
import cv2
possible_backends.append("OpenCV")
except ImportError:
possible_backends.append("_camera (MSMF)")
if "linux" in sys.platform:
possible_backends.append("_camera (V4L2)")
if "darwin" in sys.platform:
possible_backends.append("OpenCV-Mac")
if "OpenCV" not in possible_backends:
possible_backends.append("OpenCV")
if sys.platform == "win32":
possible_backends.append("VideoCapture")
# see if we have any user specified defaults in environments.
camera_env = os.environ.get("PYGAME_CAMERA", "").lower()
if camera_env == "opencv": # prioritize opencv
if "OpenCV" in possible_backends:
possible_backends.remove("OpenCV")
possible_backends = ["OpenCV"] + possible_backends
if camera_env in ("vidcapture", "videocapture"): # prioritize vidcapture
if "VideoCapture" in possible_backends:
possible_backends.remove("VideoCapture")
possible_backends = ["VideoCapture"] + possible_backends
return possible_backends
def init(backend=None):
global _is_init
# select the camera module to import here.
backends = [b.lower() for b in get_backends()]
if not backends:
raise error("No camera backends are supported on your platform!")
backend = backends[0] if backend is None else backend.lower()
if backend not in backends:
warnings.warn(
"We don't think this is a supported backend on this system, "
"but we'll try it...",
Warning,
stacklevel=2,
)
try:
_setup_backend(backend)
except ImportError:
emsg = f"Backend '{backend}' is not supported on your platform!"
if backend in ("opencv", "opencv-mac", "videocapture"):
dep = "vidcap" if backend == "videocapture" else "OpenCV"
emsg += (
f" Make sure you have '{dep}' installed to be able to use this backend"
)
raise error(emsg)
_is_init = True
def quit():
global _is_init, Camera, list_cameras
# reset to their respective pre-init placeholders
list_cameras = _pre_init_placeholder
Camera = _PreInitPlaceholderCamera
_is_init = False
if __name__ == "__main__":
# try and use this camera stuff with the pygame camera example.
import pygame.examples.camera
# pygame.camera.Camera = Camera
# pygame.camera.list_cameras = list_cameras
pygame.examples.camera.main()

View File

@@ -0,0 +1,49 @@
from abc import ABC, abstractmethod
from typing import List, Optional, Sequence, Tuple, Union
from pygame.surface import Surface
def get_backends() -> List[str]: ...
def init(backend: Optional[str] = None) -> None: ...
def quit() -> None: ...
def list_cameras() -> List[str]: ...
class AbstractCamera(ABC):
@abstractmethod
def __init__(self, *args, **kwargs) -> None: ...
@abstractmethod
def start(self) -> None: ...
@abstractmethod
def stop(self) -> None: ...
@abstractmethod
def get_size(self) -> Tuple[int, int]: ...
@abstractmethod
def query_image(self) -> bool: ...
@abstractmethod
def get_image(self, dest_surf: Optional[Surface] = None) -> Surface: ...
@abstractmethod
def get_raw(self) -> bytes: ...
# set_controls and get_controls are not a part of the AbstractCamera ABC,
# because implementations of the same can vary across different Camera
# types
class Camera(AbstractCamera):
def __init__(
self,
device: Union[str, int] = 0,
size: Union[Tuple[int, int], Sequence[int]] = (640, 480),
format: str = "RGB",
) -> None: ...
def start(self) -> None: ...
def stop(self) -> None: ...
def get_controls(self) -> Tuple[bool, bool, int]: ...
def set_controls(
self,
hflip: bool = ...,
vflip: bool = ...,
brightness: int = ...,
) -> Tuple[bool, bool, int]: ...
def get_size(self) -> Tuple[int, int]: ...
def query_image(self) -> bool: ...
def get_image(self, surface: Optional[Surface] = None) -> Surface: ...
def get_raw(self) -> bytes: ...

View File

@@ -0,0 +1,56 @@
import sys
from typing import Any, Dict, Iterator, Tuple, overload
from ._common import ColorValue
if sys.version_info >= (3, 9):
from collections.abc import Collection
else:
from typing import Collection
THECOLORS: Dict[str, Tuple[int, int, int, int]]
# Color confirms to the Collection ABC, since it also confirms to
# Sized, Iterable and Container ABCs
class Color(Collection[int]):
r: int
g: int
b: int
a: int
cmy: Tuple[float, float, float]
hsva: Tuple[float, float, float, float]
hsla: Tuple[float, float, float, float]
i1i2i3: Tuple[float, float, float]
__hash__: None # type: ignore
__array_struct__: Any
@overload
def __init__(self, r: int, g: int, b: int, a: int = 255) -> None: ...
@overload
def __init__(self, rgbvalue: ColorValue) -> None: ...
@overload
def __getitem__(self, i: int) -> int: ...
@overload
def __getitem__(self, s: slice) -> Tuple[int]: ...
def __setitem__(self, key: int, value: int) -> None: ...
def __iter__(self) -> Iterator[int]: ...
def __add__(self, other: Color) -> Color: ...
def __sub__(self, other: Color) -> Color: ...
def __mul__(self, other: Color) -> Color: ...
def __floordiv__(self, other: Color) -> Color: ...
def __mod__(self, other: Color) -> Color: ...
def __int__(self) -> int: ...
def __float__(self) -> float: ...
def __len__(self) -> int: ...
def __index__(self) -> int: ...
def __invert__(self) -> Color: ...
def __contains__(self, other: int) -> bool: ... # type: ignore[override]
def normalize(self) -> Tuple[float, float, float, float]: ...
def correct_gamma(self, gamma: float) -> Color: ...
def set_length(self, length: int) -> None: ...
def lerp(self, color: ColorValue, amount: float) -> Color: ...
def premul_alpha(self) -> Color: ...
@overload
def update(self, r: int, g: int, b: int, a: int = 255) -> None: ...
@overload
def update(self, rgbvalue: ColorValue) -> None: ...
def grayscale(self) -> Color: ...

View File

@@ -0,0 +1,692 @@
# pygame - Python Game Library
# Copyright (C) 2000-2003 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
""" A dictionary of RGBA tuples indexed by color names.
See https://www.pygame.org/docs/ref/color_list.html for sample swatches.
"""
THECOLORS = {
"aliceblue": (240, 248, 255, 255),
"antiquewhite": (250, 235, 215, 255),
"antiquewhite1": (255, 239, 219, 255),
"antiquewhite2": (238, 223, 204, 255),
"antiquewhite3": (205, 192, 176, 255),
"antiquewhite4": (139, 131, 120, 255),
"aqua": (0, 255, 255, 255),
"aquamarine": (127, 255, 212, 255),
"aquamarine1": (127, 255, 212, 255),
"aquamarine2": (118, 238, 198, 255),
"aquamarine3": (102, 205, 170, 255),
"aquamarine4": (69, 139, 116, 255),
"azure": (240, 255, 255, 255),
"azure1": (240, 255, 255, 255),
"azure3": (193, 205, 205, 255),
"azure2": (224, 238, 238, 255),
"azure4": (131, 139, 139, 255),
"beige": (245, 245, 220, 255),
"bisque": (255, 228, 196, 255),
"bisque1": (255, 228, 196, 255),
"bisque2": (238, 213, 183, 255),
"bisque3": (205, 183, 158, 255),
"bisque4": (139, 125, 107, 255),
"black": (0, 0, 0, 255),
"blanchedalmond": (255, 235, 205, 255),
"blue": (0, 0, 255, 255),
"blue1": (0, 0, 255, 255),
"blue2": (0, 0, 238, 255),
"blue3": (0, 0, 205, 255),
"blue4": (0, 0, 139, 255),
"blueviolet": (138, 43, 226, 255),
"brown": (165, 42, 42, 255),
"brown1": (255, 64, 64, 255),
"brown2": (238, 59, 59, 255),
"brown3": (205, 51, 51, 255),
"brown4": (139, 35, 35, 255),
"burlywood": (222, 184, 135, 255),
"burlywood1": (255, 211, 155, 255),
"burlywood2": (238, 197, 145, 255),
"burlywood3": (205, 170, 125, 255),
"burlywood4": (139, 115, 85, 255),
"cadetblue": (95, 158, 160, 255),
"cadetblue1": (152, 245, 255, 255),
"cadetblue2": (142, 229, 238, 255),
"cadetblue3": (122, 197, 205, 255),
"cadetblue4": (83, 134, 139, 255),
"chartreuse": (127, 255, 0, 255),
"chartreuse1": (127, 255, 0, 255),
"chartreuse2": (118, 238, 0, 255),
"chartreuse3": (102, 205, 0, 255),
"chartreuse4": (69, 139, 0, 255),
"chocolate": (210, 105, 30, 255),
"chocolate1": (255, 127, 36, 255),
"chocolate2": (238, 118, 33, 255),
"chocolate3": (205, 102, 29, 255),
"chocolate4": (139, 69, 19, 255),
"coral": (255, 127, 80, 255),
"coral1": (255, 114, 86, 255),
"coral2": (238, 106, 80, 255),
"coral3": (205, 91, 69, 255),
"coral4": (139, 62, 47, 255),
"cornflowerblue": (100, 149, 237, 255),
"cornsilk": (255, 248, 220, 255),
"cornsilk1": (255, 248, 220, 255),
"cornsilk2": (238, 232, 205, 255),
"cornsilk3": (205, 200, 177, 255),
"cornsilk4": (139, 136, 120, 255),
"crimson": (220, 20, 60, 255),
"cyan": (0, 255, 255, 255),
"cyan1": (0, 255, 255, 255),
"cyan2": (0, 238, 238, 255),
"cyan3": (0, 205, 205, 255),
"cyan4": (0, 139, 139, 255),
"darkblue": (0, 0, 139, 255),
"darkcyan": (0, 139, 139, 255),
"darkgoldenrod": (184, 134, 11, 255),
"darkgoldenrod1": (255, 185, 15, 255),
"darkgoldenrod2": (238, 173, 14, 255),
"darkgoldenrod3": (205, 149, 12, 255),
"darkgoldenrod4": (139, 101, 8, 255),
"darkgray": (169, 169, 169, 255),
"darkgreen": (0, 100, 0, 255),
"darkgrey": (169, 169, 169, 255),
"darkkhaki": (189, 183, 107, 255),
"darkmagenta": (139, 0, 139, 255),
"darkolivegreen": (85, 107, 47, 255),
"darkolivegreen1": (202, 255, 112, 255),
"darkolivegreen2": (188, 238, 104, 255),
"darkolivegreen3": (162, 205, 90, 255),
"darkolivegreen4": (110, 139, 61, 255),
"darkorange": (255, 140, 0, 255),
"darkorange1": (255, 127, 0, 255),
"darkorange2": (238, 118, 0, 255),
"darkorange3": (205, 102, 0, 255),
"darkorange4": (139, 69, 0, 255),
"darkorchid": (153, 50, 204, 255),
"darkorchid1": (191, 62, 255, 255),
"darkorchid2": (178, 58, 238, 255),
"darkorchid3": (154, 50, 205, 255),
"darkorchid4": (104, 34, 139, 255),
"darkred": (139, 0, 0, 255),
"darksalmon": (233, 150, 122, 255),
"darkseagreen": (143, 188, 143, 255),
"darkseagreen1": (193, 255, 193, 255),
"darkseagreen2": (180, 238, 180, 255),
"darkseagreen3": (155, 205, 155, 255),
"darkseagreen4": (105, 139, 105, 255),
"darkslateblue": (72, 61, 139, 255),
"darkslategray": (47, 79, 79, 255),
"darkslategray1": (151, 255, 255, 255),
"darkslategray2": (141, 238, 238, 255),
"darkslategray3": (121, 205, 205, 255),
"darkslategray4": (82, 139, 139, 255),
"darkslategrey": (47, 79, 79, 255),
"darkturquoise": (0, 206, 209, 255),
"darkviolet": (148, 0, 211, 255),
"deeppink": (255, 20, 147, 255),
"deeppink1": (255, 20, 147, 255),
"deeppink2": (238, 18, 137, 255),
"deeppink3": (205, 16, 118, 255),
"deeppink4": (139, 10, 80, 255),
"deepskyblue": (0, 191, 255, 255),
"deepskyblue1": (0, 191, 255, 255),
"deepskyblue2": (0, 178, 238, 255),
"deepskyblue3": (0, 154, 205, 255),
"deepskyblue4": (0, 104, 139, 255),
"dimgray": (105, 105, 105, 255),
"dimgrey": (105, 105, 105, 255),
"dodgerblue": (30, 144, 255, 255),
"dodgerblue1": (30, 144, 255, 255),
"dodgerblue2": (28, 134, 238, 255),
"dodgerblue3": (24, 116, 205, 255),
"dodgerblue4": (16, 78, 139, 255),
"firebrick": (178, 34, 34, 255),
"firebrick1": (255, 48, 48, 255),
"firebrick2": (238, 44, 44, 255),
"firebrick3": (205, 38, 38, 255),
"firebrick4": (139, 26, 26, 255),
"floralwhite": (255, 250, 240, 255),
"forestgreen": (34, 139, 34, 255),
"fuchsia": (255, 0, 255, 255),
"gainsboro": (220, 220, 220, 255),
"ghostwhite": (248, 248, 255, 255),
"gold": (255, 215, 0, 255),
"gold1": (255, 215, 0, 255),
"gold2": (238, 201, 0, 255),
"gold3": (205, 173, 0, 255),
"gold4": (139, 117, 0, 255),
"goldenrod": (218, 165, 32, 255),
"goldenrod1": (255, 193, 37, 255),
"goldenrod2": (238, 180, 34, 255),
"goldenrod3": (205, 155, 29, 255),
"goldenrod4": (139, 105, 20, 255),
"gray": (190, 190, 190, 255),
"gray0": (0, 0, 0, 255),
"gray1": (3, 3, 3, 255),
"gray2": (5, 5, 5, 255),
"gray3": (8, 8, 8, 255),
"gray4": (10, 10, 10, 255),
"gray5": (13, 13, 13, 255),
"gray6": (15, 15, 15, 255),
"gray7": (18, 18, 18, 255),
"gray8": (20, 20, 20, 255),
"gray9": (23, 23, 23, 255),
"gray10": (26, 26, 26, 255),
"gray11": (28, 28, 28, 255),
"gray12": (31, 31, 31, 255),
"gray13": (33, 33, 33, 255),
"gray14": (36, 36, 36, 255),
"gray15": (38, 38, 38, 255),
"gray16": (41, 41, 41, 255),
"gray17": (43, 43, 43, 255),
"gray18": (46, 46, 46, 255),
"gray19": (48, 48, 48, 255),
"gray20": (51, 51, 51, 255),
"gray21": (54, 54, 54, 255),
"gray22": (56, 56, 56, 255),
"gray23": (59, 59, 59, 255),
"gray24": (61, 61, 61, 255),
"gray25": (64, 64, 64, 255),
"gray26": (66, 66, 66, 255),
"gray27": (69, 69, 69, 255),
"gray28": (71, 71, 71, 255),
"gray29": (74, 74, 74, 255),
"gray30": (77, 77, 77, 255),
"gray31": (79, 79, 79, 255),
"gray32": (82, 82, 82, 255),
"gray33": (84, 84, 84, 255),
"gray34": (87, 87, 87, 255),
"gray35": (89, 89, 89, 255),
"gray36": (92, 92, 92, 255),
"gray37": (94, 94, 94, 255),
"gray38": (97, 97, 97, 255),
"gray39": (99, 99, 99, 255),
"gray40": (102, 102, 102, 255),
"gray41": (105, 105, 105, 255),
"gray42": (107, 107, 107, 255),
"gray43": (110, 110, 110, 255),
"gray44": (112, 112, 112, 255),
"gray45": (115, 115, 115, 255),
"gray46": (117, 117, 117, 255),
"gray47": (120, 120, 120, 255),
"gray48": (122, 122, 122, 255),
"gray49": (125, 125, 125, 255),
"gray50": (127, 127, 127, 255),
"gray51": (130, 130, 130, 255),
"gray52": (133, 133, 133, 255),
"gray53": (135, 135, 135, 255),
"gray54": (138, 138, 138, 255),
"gray55": (140, 140, 140, 255),
"gray56": (143, 143, 143, 255),
"gray57": (145, 145, 145, 255),
"gray58": (148, 148, 148, 255),
"gray59": (150, 150, 150, 255),
"gray60": (153, 153, 153, 255),
"gray61": (156, 156, 156, 255),
"gray62": (158, 158, 158, 255),
"gray63": (161, 161, 161, 255),
"gray64": (163, 163, 163, 255),
"gray65": (166, 166, 166, 255),
"gray66": (168, 168, 168, 255),
"gray67": (171, 171, 171, 255),
"gray68": (173, 173, 173, 255),
"gray69": (176, 176, 176, 255),
"gray70": (179, 179, 179, 255),
"gray71": (181, 181, 181, 255),
"gray72": (184, 184, 184, 255),
"gray73": (186, 186, 186, 255),
"gray74": (189, 189, 189, 255),
"gray75": (191, 191, 191, 255),
"gray76": (194, 194, 194, 255),
"gray77": (196, 196, 196, 255),
"gray78": (199, 199, 199, 255),
"gray79": (201, 201, 201, 255),
"gray80": (204, 204, 204, 255),
"gray81": (207, 207, 207, 255),
"gray82": (209, 209, 209, 255),
"gray83": (212, 212, 212, 255),
"gray84": (214, 214, 214, 255),
"gray85": (217, 217, 217, 255),
"gray86": (219, 219, 219, 255),
"gray87": (222, 222, 222, 255),
"gray88": (224, 224, 224, 255),
"gray89": (227, 227, 227, 255),
"gray90": (229, 229, 229, 255),
"gray91": (232, 232, 232, 255),
"gray92": (235, 235, 235, 255),
"gray93": (237, 237, 237, 255),
"gray94": (240, 240, 240, 255),
"gray95": (242, 242, 242, 255),
"gray96": (245, 245, 245, 255),
"gray97": (247, 247, 247, 255),
"gray98": (250, 250, 250, 255),
"gray99": (252, 252, 252, 255),
"gray100": (255, 255, 255, 255),
"green": (0, 255, 0, 255),
"green1": (0, 255, 0, 255),
"green2": (0, 238, 0, 255),
"green3": (0, 205, 0, 255),
"green4": (0, 139, 0, 255),
"greenyellow": (173, 255, 47, 255),
"grey": (190, 190, 190, 255),
"grey0": (0, 0, 0, 255),
"grey1": (3, 3, 3, 255),
"grey2": (5, 5, 5, 255),
"grey3": (8, 8, 8, 255),
"grey4": (10, 10, 10, 255),
"grey5": (13, 13, 13, 255),
"grey6": (15, 15, 15, 255),
"grey7": (18, 18, 18, 255),
"grey8": (20, 20, 20, 255),
"grey9": (23, 23, 23, 255),
"grey10": (26, 26, 26, 255),
"grey11": (28, 28, 28, 255),
"grey12": (31, 31, 31, 255),
"grey13": (33, 33, 33, 255),
"grey14": (36, 36, 36, 255),
"grey15": (38, 38, 38, 255),
"grey16": (41, 41, 41, 255),
"grey17": (43, 43, 43, 255),
"grey18": (46, 46, 46, 255),
"grey19": (48, 48, 48, 255),
"grey20": (51, 51, 51, 255),
"grey21": (54, 54, 54, 255),
"grey22": (56, 56, 56, 255),
"grey23": (59, 59, 59, 255),
"grey24": (61, 61, 61, 255),
"grey25": (64, 64, 64, 255),
"grey26": (66, 66, 66, 255),
"grey27": (69, 69, 69, 255),
"grey28": (71, 71, 71, 255),
"grey29": (74, 74, 74, 255),
"grey30": (77, 77, 77, 255),
"grey31": (79, 79, 79, 255),
"grey32": (82, 82, 82, 255),
"grey33": (84, 84, 84, 255),
"grey34": (87, 87, 87, 255),
"grey35": (89, 89, 89, 255),
"grey36": (92, 92, 92, 255),
"grey37": (94, 94, 94, 255),
"grey38": (97, 97, 97, 255),
"grey39": (99, 99, 99, 255),
"grey40": (102, 102, 102, 255),
"grey41": (105, 105, 105, 255),
"grey42": (107, 107, 107, 255),
"grey43": (110, 110, 110, 255),
"grey44": (112, 112, 112, 255),
"grey45": (115, 115, 115, 255),
"grey46": (117, 117, 117, 255),
"grey47": (120, 120, 120, 255),
"grey48": (122, 122, 122, 255),
"grey49": (125, 125, 125, 255),
"grey50": (127, 127, 127, 255),
"grey51": (130, 130, 130, 255),
"grey52": (133, 133, 133, 255),
"grey53": (135, 135, 135, 255),
"grey54": (138, 138, 138, 255),
"grey55": (140, 140, 140, 255),
"grey56": (143, 143, 143, 255),
"grey57": (145, 145, 145, 255),
"grey58": (148, 148, 148, 255),
"grey59": (150, 150, 150, 255),
"grey60": (153, 153, 153, 255),
"grey61": (156, 156, 156, 255),
"grey62": (158, 158, 158, 255),
"grey63": (161, 161, 161, 255),
"grey64": (163, 163, 163, 255),
"grey65": (166, 166, 166, 255),
"grey66": (168, 168, 168, 255),
"grey67": (171, 171, 171, 255),
"grey68": (173, 173, 173, 255),
"grey69": (176, 176, 176, 255),
"grey70": (179, 179, 179, 255),
"grey71": (181, 181, 181, 255),
"grey72": (184, 184, 184, 255),
"grey73": (186, 186, 186, 255),
"grey74": (189, 189, 189, 255),
"grey75": (191, 191, 191, 255),
"grey76": (194, 194, 194, 255),
"grey77": (196, 196, 196, 255),
"grey78": (199, 199, 199, 255),
"grey79": (201, 201, 201, 255),
"grey80": (204, 204, 204, 255),
"grey81": (207, 207, 207, 255),
"grey82": (209, 209, 209, 255),
"grey83": (212, 212, 212, 255),
"grey84": (214, 214, 214, 255),
"grey85": (217, 217, 217, 255),
"grey86": (219, 219, 219, 255),
"grey87": (222, 222, 222, 255),
"grey88": (224, 224, 224, 255),
"grey89": (227, 227, 227, 255),
"grey90": (229, 229, 229, 255),
"grey91": (232, 232, 232, 255),
"grey92": (235, 235, 235, 255),
"grey93": (237, 237, 237, 255),
"grey94": (240, 240, 240, 255),
"grey95": (242, 242, 242, 255),
"grey96": (245, 245, 245, 255),
"grey97": (247, 247, 247, 255),
"grey98": (250, 250, 250, 255),
"grey99": (252, 252, 252, 255),
"grey100": (255, 255, 255, 255),
"honeydew": (240, 255, 240, 255),
"honeydew1": (240, 255, 240, 255),
"honeydew2": (224, 238, 224, 255),
"honeydew3": (193, 205, 193, 255),
"honeydew4": (131, 139, 131, 255),
"hotpink": (255, 105, 180, 255),
"hotpink1": (255, 110, 180, 255),
"hotpink2": (238, 106, 167, 255),
"hotpink3": (205, 96, 144, 255),
"hotpink4": (139, 58, 98, 255),
"indianred": (205, 92, 92, 255),
"indianred1": (255, 106, 106, 255),
"indianred2": (238, 99, 99, 255),
"indianred3": (205, 85, 85, 255),
"indianred4": (139, 58, 58, 255),
"indigo": (75, 0, 130, 255),
"ivory": (255, 255, 240, 255),
"ivory1": (255, 255, 240, 255),
"ivory2": (238, 238, 224, 255),
"ivory3": (205, 205, 193, 255),
"ivory4": (139, 139, 131, 255),
"khaki": (240, 230, 140, 255),
"khaki1": (255, 246, 143, 255),
"khaki2": (238, 230, 133, 255),
"khaki3": (205, 198, 115, 255),
"khaki4": (139, 134, 78, 255),
"lavender": (230, 230, 250, 255),
"lavenderblush": (255, 240, 245, 255),
"lavenderblush1": (255, 240, 245, 255),
"lavenderblush2": (238, 224, 229, 255),
"lavenderblush3": (205, 193, 197, 255),
"lavenderblush4": (139, 131, 134, 255),
"lawngreen": (124, 252, 0, 255),
"lemonchiffon": (255, 250, 205, 255),
"lemonchiffon1": (255, 250, 205, 255),
"lemonchiffon2": (238, 233, 191, 255),
"lemonchiffon3": (205, 201, 165, 255),
"lemonchiffon4": (139, 137, 112, 255),
"lightblue": (173, 216, 230, 255),
"lightblue1": (191, 239, 255, 255),
"lightblue2": (178, 223, 238, 255),
"lightblue3": (154, 192, 205, 255),
"lightblue4": (104, 131, 139, 255),
"lightcoral": (240, 128, 128, 255),
"lightcyan": (224, 255, 255, 255),
"lightcyan1": (224, 255, 255, 255),
"lightcyan2": (209, 238, 238, 255),
"lightcyan3": (180, 205, 205, 255),
"lightcyan4": (122, 139, 139, 255),
"lightgoldenrod": (238, 221, 130, 255),
"lightgoldenrod1": (255, 236, 139, 255),
"lightgoldenrod2": (238, 220, 130, 255),
"lightgoldenrod3": (205, 190, 112, 255),
"lightgoldenrod4": (139, 129, 76, 255),
"lightgoldenrodyellow": (250, 250, 210, 255),
"lightgray": (211, 211, 211, 255),
"lightgreen": (144, 238, 144, 255),
"lightgrey": (211, 211, 211, 255),
"lightpink": (255, 182, 193, 255),
"lightpink1": (255, 174, 185, 255),
"lightpink2": (238, 162, 173, 255),
"lightpink3": (205, 140, 149, 255),
"lightpink4": (139, 95, 101, 255),
"lightsalmon": (255, 160, 122, 255),
"lightsalmon1": (255, 160, 122, 255),
"lightsalmon2": (238, 149, 114, 255),
"lightsalmon3": (205, 129, 98, 255),
"lightsalmon4": (139, 87, 66, 255),
"lightseagreen": (32, 178, 170, 255),
"lightskyblue": (135, 206, 250, 255),
"lightskyblue1": (176, 226, 255, 255),
"lightskyblue2": (164, 211, 238, 255),
"lightskyblue3": (141, 182, 205, 255),
"lightskyblue4": (96, 123, 139, 255),
"lightslateblue": (132, 112, 255, 255),
"lightslategray": (119, 136, 153, 255),
"lightslategrey": (119, 136, 153, 255),
"lightsteelblue": (176, 196, 222, 255),
"lightsteelblue1": (202, 225, 255, 255),
"lightsteelblue2": (188, 210, 238, 255),
"lightsteelblue3": (162, 181, 205, 255),
"lightsteelblue4": (110, 123, 139, 255),
"lightyellow": (255, 255, 224, 255),
"lightyellow1": (255, 255, 224, 255),
"lightyellow2": (238, 238, 209, 255),
"lightyellow3": (205, 205, 180, 255),
"lightyellow4": (139, 139, 122, 255),
"linen": (250, 240, 230, 255),
"lime": (0, 255, 0, 255),
"limegreen": (50, 205, 50, 255),
"magenta": (255, 0, 255, 255),
"magenta1": (255, 0, 255, 255),
"magenta2": (238, 0, 238, 255),
"magenta3": (205, 0, 205, 255),
"magenta4": (139, 0, 139, 255),
"maroon": (176, 48, 96, 255),
"maroon1": (255, 52, 179, 255),
"maroon2": (238, 48, 167, 255),
"maroon3": (205, 41, 144, 255),
"maroon4": (139, 28, 98, 255),
"mediumaquamarine": (102, 205, 170, 255),
"mediumblue": (0, 0, 205, 255),
"mediumorchid": (186, 85, 211, 255),
"mediumorchid1": (224, 102, 255, 255),
"mediumorchid2": (209, 95, 238, 255),
"mediumorchid3": (180, 82, 205, 255),
"mediumorchid4": (122, 55, 139, 255),
"mediumpurple": (147, 112, 219, 255),
"mediumpurple1": (171, 130, 255, 255),
"mediumpurple2": (159, 121, 238, 255),
"mediumpurple3": (137, 104, 205, 255),
"mediumpurple4": (93, 71, 139, 255),
"mediumseagreen": (60, 179, 113, 255),
"mediumslateblue": (123, 104, 238, 255),
"mediumspringgreen": (0, 250, 154, 255),
"mediumturquoise": (72, 209, 204, 255),
"mediumvioletred": (199, 21, 133, 255),
"midnightblue": (25, 25, 112, 255),
"mintcream": (245, 255, 250, 255),
"mistyrose": (255, 228, 225, 255),
"mistyrose1": (255, 228, 225, 255),
"mistyrose2": (238, 213, 210, 255),
"mistyrose3": (205, 183, 181, 255),
"mistyrose4": (139, 125, 123, 255),
"moccasin": (255, 228, 181, 255),
"navajowhite": (255, 222, 173, 255),
"navajowhite1": (255, 222, 173, 255),
"navajowhite2": (238, 207, 161, 255),
"navajowhite3": (205, 179, 139, 255),
"navajowhite4": (139, 121, 94, 255),
"navy": (0, 0, 128, 255),
"navyblue": (0, 0, 128, 255),
"oldlace": (253, 245, 230, 255),
"olive": (128, 128, 0, 255),
"olivedrab": (107, 142, 35, 255),
"olivedrab1": (192, 255, 62, 255),
"olivedrab2": (179, 238, 58, 255),
"olivedrab3": (154, 205, 50, 255),
"olivedrab4": (105, 139, 34, 255),
"orange": (255, 165, 0, 255),
"orange1": (255, 165, 0, 255),
"orange2": (238, 154, 0, 255),
"orange3": (205, 133, 0, 255),
"orange4": (139, 90, 0, 255),
"orangered": (255, 69, 0, 255),
"orangered1": (255, 69, 0, 255),
"orangered2": (238, 64, 0, 255),
"orangered3": (205, 55, 0, 255),
"orangered4": (139, 37, 0, 255),
"orchid": (218, 112, 214, 255),
"orchid1": (255, 131, 250, 255),
"orchid2": (238, 122, 233, 255),
"orchid3": (205, 105, 201, 255),
"orchid4": (139, 71, 137, 255),
"palegreen": (152, 251, 152, 255),
"palegreen1": (154, 255, 154, 255),
"palegreen2": (144, 238, 144, 255),
"palegreen3": (124, 205, 124, 255),
"palegreen4": (84, 139, 84, 255),
"palegoldenrod": (238, 232, 170, 255),
"paleturquoise": (175, 238, 238, 255),
"paleturquoise1": (187, 255, 255, 255),
"paleturquoise2": (174, 238, 238, 255),
"paleturquoise3": (150, 205, 205, 255),
"paleturquoise4": (102, 139, 139, 255),
"palevioletred": (219, 112, 147, 255),
"palevioletred1": (255, 130, 171, 255),
"palevioletred2": (238, 121, 159, 255),
"palevioletred3": (205, 104, 137, 255),
"palevioletred4": (139, 71, 93, 255),
"papayawhip": (255, 239, 213, 255),
"peachpuff": (255, 218, 185, 255),
"peachpuff1": (255, 218, 185, 255),
"peachpuff2": (238, 203, 173, 255),
"peachpuff3": (205, 175, 149, 255),
"peachpuff4": (139, 119, 101, 255),
"peru": (205, 133, 63, 255),
"pink": (255, 192, 203, 255),
"pink1": (255, 181, 197, 255),
"pink2": (238, 169, 184, 255),
"pink3": (205, 145, 158, 255),
"pink4": (139, 99, 108, 255),
"plum": (221, 160, 221, 255),
"plum1": (255, 187, 255, 255),
"plum2": (238, 174, 238, 255),
"plum3": (205, 150, 205, 255),
"plum4": (139, 102, 139, 255),
"powderblue": (176, 224, 230, 255),
"purple": (160, 32, 240, 255),
"purple1": (155, 48, 255, 255),
"purple2": (145, 44, 238, 255),
"purple3": (125, 38, 205, 255),
"purple4": (85, 26, 139, 255),
"red": (255, 0, 0, 255),
"red1": (255, 0, 0, 255),
"red2": (238, 0, 0, 255),
"red3": (205, 0, 0, 255),
"red4": (139, 0, 0, 255),
"rosybrown": (188, 143, 143, 255),
"rosybrown1": (255, 193, 193, 255),
"rosybrown2": (238, 180, 180, 255),
"rosybrown3": (205, 155, 155, 255),
"rosybrown4": (139, 105, 105, 255),
"royalblue": (65, 105, 225, 255),
"royalblue1": (72, 118, 255, 255),
"royalblue2": (67, 110, 238, 255),
"royalblue3": (58, 95, 205, 255),
"royalblue4": (39, 64, 139, 255),
"salmon": (250, 128, 114, 255),
"salmon1": (255, 140, 105, 255),
"salmon2": (238, 130, 98, 255),
"salmon3": (205, 112, 84, 255),
"salmon4": (139, 76, 57, 255),
"saddlebrown": (139, 69, 19, 255),
"sandybrown": (244, 164, 96, 255),
"seagreen": (46, 139, 87, 255),
"seagreen1": (84, 255, 159, 255),
"seagreen2": (78, 238, 148, 255),
"seagreen3": (67, 205, 128, 255),
"seagreen4": (46, 139, 87, 255),
"seashell": (255, 245, 238, 255),
"seashell1": (255, 245, 238, 255),
"seashell2": (238, 229, 222, 255),
"seashell3": (205, 197, 191, 255),
"seashell4": (139, 134, 130, 255),
"sienna": (160, 82, 45, 255),
"sienna1": (255, 130, 71, 255),
"sienna2": (238, 121, 66, 255),
"sienna3": (205, 104, 57, 255),
"sienna4": (139, 71, 38, 255),
"silver": (192, 192, 192, 255),
"skyblue": (135, 206, 235, 255),
"skyblue1": (135, 206, 255, 255),
"skyblue2": (126, 192, 238, 255),
"skyblue3": (108, 166, 205, 255),
"skyblue4": (74, 112, 139, 255),
"slateblue": (106, 90, 205, 255),
"slateblue1": (131, 111, 255, 255),
"slateblue2": (122, 103, 238, 255),
"slateblue3": (105, 89, 205, 255),
"slateblue4": (71, 60, 139, 255),
"slategray": (112, 128, 144, 255),
"slategray1": (198, 226, 255, 255),
"slategray2": (185, 211, 238, 255),
"slategray3": (159, 182, 205, 255),
"slategray4": (108, 123, 139, 255),
"slategrey": (112, 128, 144, 255),
"snow": (255, 250, 250, 255),
"snow1": (255, 250, 250, 255),
"snow2": (238, 233, 233, 255),
"snow3": (205, 201, 201, 255),
"snow4": (139, 137, 137, 255),
"springgreen": (0, 255, 127, 255),
"springgreen1": (0, 255, 127, 255),
"springgreen2": (0, 238, 118, 255),
"springgreen3": (0, 205, 102, 255),
"springgreen4": (0, 139, 69, 255),
"steelblue": (70, 130, 180, 255),
"steelblue1": (99, 184, 255, 255),
"steelblue2": (92, 172, 238, 255),
"steelblue3": (79, 148, 205, 255),
"steelblue4": (54, 100, 139, 255),
"tan": (210, 180, 140, 255),
"tan1": (255, 165, 79, 255),
"tan2": (238, 154, 73, 255),
"tan3": (205, 133, 63, 255),
"tan4": (139, 90, 43, 255),
"teal": (0, 128, 128, 255),
"thistle": (216, 191, 216, 255),
"thistle1": (255, 225, 255, 255),
"thistle2": (238, 210, 238, 255),
"thistle3": (205, 181, 205, 255),
"thistle4": (139, 123, 139, 255),
"tomato": (255, 99, 71, 255),
"tomato1": (255, 99, 71, 255),
"tomato2": (238, 92, 66, 255),
"tomato3": (205, 79, 57, 255),
"tomato4": (139, 54, 38, 255),
"turquoise": (64, 224, 208, 255),
"turquoise1": (0, 245, 255, 255),
"turquoise2": (0, 229, 238, 255),
"turquoise3": (0, 197, 205, 255),
"turquoise4": (0, 134, 139, 255),
"violet": (238, 130, 238, 255),
"violetred": (208, 32, 144, 255),
"violetred1": (255, 62, 150, 255),
"violetred2": (238, 58, 140, 255),
"violetred3": (205, 50, 120, 255),
"violetred4": (139, 34, 82, 255),
"wheat": (245, 222, 179, 255),
"wheat1": (255, 231, 186, 255),
"wheat2": (238, 216, 174, 255),
"wheat3": (205, 186, 150, 255),
"wheat4": (139, 126, 102, 255),
"white": (255, 255, 255, 255),
"whitesmoke": (245, 245, 245, 255),
"yellow": (255, 255, 0, 255),
"yellow1": (255, 255, 0, 255),
"yellow2": (238, 238, 0, 255),
"yellow3": (205, 205, 0, 255),
"yellow4": (139, 139, 0, 255),
"yellowgreen": (154, 205, 50, 255),
}

View File

@@ -0,0 +1,560 @@
# buildconfig/stubs/gen_stubs.py
# A script to auto-generate locals.pyi, constants.pyi and __init__.pyi typestubs
# IMPORTANT NOTE: Do not edit this file by hand!
ACTIVEEVENT: int
ANYFORMAT: int
APPACTIVE: int
APPINPUTFOCUS: int
APPMOUSEFOCUS: int
APP_DIDENTERBACKGROUND: int
APP_DIDENTERFOREGROUND: int
APP_LOWMEMORY: int
APP_TERMINATING: int
APP_WILLENTERBACKGROUND: int
APP_WILLENTERFOREGROUND: int
ASYNCBLIT: int
AUDIODEVICEADDED: int
AUDIODEVICEREMOVED: int
AUDIO_ALLOW_ANY_CHANGE: int
AUDIO_ALLOW_CHANNELS_CHANGE: int
AUDIO_ALLOW_FORMAT_CHANGE: int
AUDIO_ALLOW_FREQUENCY_CHANGE: int
AUDIO_S16: int
AUDIO_S16LSB: int
AUDIO_S16MSB: int
AUDIO_S16SYS: int
AUDIO_S8: int
AUDIO_U16: int
AUDIO_U16LSB: int
AUDIO_U16MSB: int
AUDIO_U16SYS: int
AUDIO_U8: int
BIG_ENDIAN: int
BLENDMODE_ADD: int
BLENDMODE_BLEND: int
BLENDMODE_MOD: int
BLENDMODE_NONE: int
BLEND_ADD: int
BLEND_ALPHA_SDL2: int
BLEND_MAX: int
BLEND_MIN: int
BLEND_MULT: int
BLEND_PREMULTIPLIED: int
BLEND_RGBA_ADD: int
BLEND_RGBA_MAX: int
BLEND_RGBA_MIN: int
BLEND_RGBA_MULT: int
BLEND_RGBA_SUB: int
BLEND_RGB_ADD: int
BLEND_RGB_MAX: int
BLEND_RGB_MIN: int
BLEND_RGB_MULT: int
BLEND_RGB_SUB: int
BLEND_SUB: int
BUTTON_LEFT: int
BUTTON_MIDDLE: int
BUTTON_RIGHT: int
BUTTON_WHEELDOWN: int
BUTTON_WHEELUP: int
BUTTON_X1: int
BUTTON_X2: int
CLIPBOARDUPDATE: int
CONTROLLERAXISMOTION: int
CONTROLLERBUTTONDOWN: int
CONTROLLERBUTTONUP: int
CONTROLLERDEVICEADDED: int
CONTROLLERDEVICEREMAPPED: int
CONTROLLERDEVICEREMOVED: int
CONTROLLERSENSORUPDATE: int
CONTROLLERTOUCHPADDOWN: int
CONTROLLERTOUCHPADMOTION: int
CONTROLLERTOUCHPADUP: int
CONTROLLER_AXIS_INVALID: int
CONTROLLER_AXIS_LEFTX: int
CONTROLLER_AXIS_LEFTY: int
CONTROLLER_AXIS_MAX: int
CONTROLLER_AXIS_RIGHTX: int
CONTROLLER_AXIS_RIGHTY: int
CONTROLLER_AXIS_TRIGGERLEFT: int
CONTROLLER_AXIS_TRIGGERRIGHT: int
CONTROLLER_BUTTON_A: int
CONTROLLER_BUTTON_B: int
CONTROLLER_BUTTON_BACK: int
CONTROLLER_BUTTON_DPAD_DOWN: int
CONTROLLER_BUTTON_DPAD_LEFT: int
CONTROLLER_BUTTON_DPAD_RIGHT: int
CONTROLLER_BUTTON_DPAD_UP: int
CONTROLLER_BUTTON_GUIDE: int
CONTROLLER_BUTTON_INVALID: int
CONTROLLER_BUTTON_LEFTSHOULDER: int
CONTROLLER_BUTTON_LEFTSTICK: int
CONTROLLER_BUTTON_MAX: int
CONTROLLER_BUTTON_RIGHTSHOULDER: int
CONTROLLER_BUTTON_RIGHTSTICK: int
CONTROLLER_BUTTON_START: int
CONTROLLER_BUTTON_X: int
CONTROLLER_BUTTON_Y: int
DOUBLEBUF: int
DROPBEGIN: int
DROPCOMPLETE: int
DROPFILE: int
DROPTEXT: int
FINGERDOWN: int
FINGERMOTION: int
FINGERUP: int
FULLSCREEN: int
GL_ACCELERATED_VISUAL: int
GL_ACCUM_ALPHA_SIZE: int
GL_ACCUM_BLUE_SIZE: int
GL_ACCUM_GREEN_SIZE: int
GL_ACCUM_RED_SIZE: int
GL_ALPHA_SIZE: int
GL_BLUE_SIZE: int
GL_BUFFER_SIZE: int
GL_CONTEXT_DEBUG_FLAG: int
GL_CONTEXT_FLAGS: int
GL_CONTEXT_FORWARD_COMPATIBLE_FLAG: int
GL_CONTEXT_MAJOR_VERSION: int
GL_CONTEXT_MINOR_VERSION: int
GL_CONTEXT_PROFILE_COMPATIBILITY: int
GL_CONTEXT_PROFILE_CORE: int
GL_CONTEXT_PROFILE_ES: int
GL_CONTEXT_PROFILE_MASK: int
GL_CONTEXT_RELEASE_BEHAVIOR: int
GL_CONTEXT_RELEASE_BEHAVIOR_FLUSH: int
GL_CONTEXT_RELEASE_BEHAVIOR_NONE: int
GL_CONTEXT_RESET_ISOLATION_FLAG: int
GL_CONTEXT_ROBUST_ACCESS_FLAG: int
GL_DEPTH_SIZE: int
GL_DOUBLEBUFFER: int
GL_FRAMEBUFFER_SRGB_CAPABLE: int
GL_GREEN_SIZE: int
GL_MULTISAMPLEBUFFERS: int
GL_MULTISAMPLESAMPLES: int
GL_RED_SIZE: int
GL_SHARE_WITH_CURRENT_CONTEXT: int
GL_STENCIL_SIZE: int
GL_STEREO: int
GL_SWAP_CONTROL: int
HAT_CENTERED: int
HAT_DOWN: int
HAT_LEFT: int
HAT_LEFTDOWN: int
HAT_LEFTUP: int
HAT_RIGHT: int
HAT_RIGHTDOWN: int
HAT_RIGHTUP: int
HAT_UP: int
HIDDEN: int
HWACCEL: int
HWPALETTE: int
HWSURFACE: int
JOYAXISMOTION: int
JOYBALLMOTION: int
JOYBUTTONDOWN: int
JOYBUTTONUP: int
JOYDEVICEADDED: int
JOYDEVICEREMOVED: int
JOYHATMOTION: int
KEYDOWN: int
KEYMAPCHANGED: int
KEYUP: int
KMOD_ALT: int
KMOD_CAPS: int
KMOD_CTRL: int
KMOD_GUI: int
KMOD_LALT: int
KMOD_LCTRL: int
KMOD_LGUI: int
KMOD_LMETA: int
KMOD_LSHIFT: int
KMOD_META: int
KMOD_MODE: int
KMOD_NONE: int
KMOD_NUM: int
KMOD_RALT: int
KMOD_RCTRL: int
KMOD_RGUI: int
KMOD_RMETA: int
KMOD_RSHIFT: int
KMOD_SHIFT: int
KSCAN_0: int
KSCAN_1: int
KSCAN_2: int
KSCAN_3: int
KSCAN_4: int
KSCAN_5: int
KSCAN_6: int
KSCAN_7: int
KSCAN_8: int
KSCAN_9: int
KSCAN_A: int
KSCAN_AC_BACK: int
KSCAN_APOSTROPHE: int
KSCAN_B: int
KSCAN_BACKSLASH: int
KSCAN_BACKSPACE: int
KSCAN_BREAK: int
KSCAN_C: int
KSCAN_CAPSLOCK: int
KSCAN_CLEAR: int
KSCAN_COMMA: int
KSCAN_CURRENCYSUBUNIT: int
KSCAN_CURRENCYUNIT: int
KSCAN_D: int
KSCAN_DELETE: int
KSCAN_DOWN: int
KSCAN_E: int
KSCAN_END: int
KSCAN_EQUALS: int
KSCAN_ESCAPE: int
KSCAN_EURO: int
KSCAN_F: int
KSCAN_F1: int
KSCAN_F10: int
KSCAN_F11: int
KSCAN_F12: int
KSCAN_F13: int
KSCAN_F14: int
KSCAN_F15: int
KSCAN_F2: int
KSCAN_F3: int
KSCAN_F4: int
KSCAN_F5: int
KSCAN_F6: int
KSCAN_F7: int
KSCAN_F8: int
KSCAN_F9: int
KSCAN_G: int
KSCAN_GRAVE: int
KSCAN_H: int
KSCAN_HELP: int
KSCAN_HOME: int
KSCAN_I: int
KSCAN_INSERT: int
KSCAN_INTERNATIONAL1: int
KSCAN_INTERNATIONAL2: int
KSCAN_INTERNATIONAL3: int
KSCAN_INTERNATIONAL4: int
KSCAN_INTERNATIONAL5: int
KSCAN_INTERNATIONAL6: int
KSCAN_INTERNATIONAL7: int
KSCAN_INTERNATIONAL8: int
KSCAN_INTERNATIONAL9: int
KSCAN_J: int
KSCAN_K: int
KSCAN_KP0: int
KSCAN_KP1: int
KSCAN_KP2: int
KSCAN_KP3: int
KSCAN_KP4: int
KSCAN_KP5: int
KSCAN_KP6: int
KSCAN_KP7: int
KSCAN_KP8: int
KSCAN_KP9: int
KSCAN_KP_0: int
KSCAN_KP_1: int
KSCAN_KP_2: int
KSCAN_KP_3: int
KSCAN_KP_4: int
KSCAN_KP_5: int
KSCAN_KP_6: int
KSCAN_KP_7: int
KSCAN_KP_8: int
KSCAN_KP_9: int
KSCAN_KP_DIVIDE: int
KSCAN_KP_ENTER: int
KSCAN_KP_EQUALS: int
KSCAN_KP_MINUS: int
KSCAN_KP_MULTIPLY: int
KSCAN_KP_PERIOD: int
KSCAN_KP_PLUS: int
KSCAN_L: int
KSCAN_LALT: int
KSCAN_LANG1: int
KSCAN_LANG2: int
KSCAN_LANG3: int
KSCAN_LANG4: int
KSCAN_LANG5: int
KSCAN_LANG6: int
KSCAN_LANG7: int
KSCAN_LANG8: int
KSCAN_LANG9: int
KSCAN_LCTRL: int
KSCAN_LEFT: int
KSCAN_LEFTBRACKET: int
KSCAN_LGUI: int
KSCAN_LMETA: int
KSCAN_LSHIFT: int
KSCAN_LSUPER: int
KSCAN_M: int
KSCAN_MENU: int
KSCAN_MINUS: int
KSCAN_MODE: int
KSCAN_N: int
KSCAN_NONUSBACKSLASH: int
KSCAN_NONUSHASH: int
KSCAN_NUMLOCK: int
KSCAN_NUMLOCKCLEAR: int
KSCAN_O: int
KSCAN_P: int
KSCAN_PAGEDOWN: int
KSCAN_PAGEUP: int
KSCAN_PAUSE: int
KSCAN_PERIOD: int
KSCAN_POWER: int
KSCAN_PRINT: int
KSCAN_PRINTSCREEN: int
KSCAN_Q: int
KSCAN_R: int
KSCAN_RALT: int
KSCAN_RCTRL: int
KSCAN_RETURN: int
KSCAN_RGUI: int
KSCAN_RIGHT: int
KSCAN_RIGHTBRACKET: int
KSCAN_RMETA: int
KSCAN_RSHIFT: int
KSCAN_RSUPER: int
KSCAN_S: int
KSCAN_SCROLLLOCK: int
KSCAN_SCROLLOCK: int
KSCAN_SEMICOLON: int
KSCAN_SLASH: int
KSCAN_SPACE: int
KSCAN_SYSREQ: int
KSCAN_T: int
KSCAN_TAB: int
KSCAN_U: int
KSCAN_UNKNOWN: int
KSCAN_UP: int
KSCAN_V: int
KSCAN_W: int
KSCAN_X: int
KSCAN_Y: int
KSCAN_Z: int
K_0: int
K_1: int
K_2: int
K_3: int
K_4: int
K_5: int
K_6: int
K_7: int
K_8: int
K_9: int
K_AC_BACK: int
K_AMPERSAND: int
K_ASTERISK: int
K_AT: int
K_BACKQUOTE: int
K_BACKSLASH: int
K_BACKSPACE: int
K_BREAK: int
K_CAPSLOCK: int
K_CARET: int
K_CLEAR: int
K_COLON: int
K_COMMA: int
K_CURRENCYSUBUNIT: int
K_CURRENCYUNIT: int
K_DELETE: int
K_DOLLAR: int
K_DOWN: int
K_END: int
K_EQUALS: int
K_ESCAPE: int
K_EURO: int
K_EXCLAIM: int
K_F1: int
K_F10: int
K_F11: int
K_F12: int
K_F13: int
K_F14: int
K_F15: int
K_F2: int
K_F3: int
K_F4: int
K_F5: int
K_F6: int
K_F7: int
K_F8: int
K_F9: int
K_GREATER: int
K_HASH: int
K_HELP: int
K_HOME: int
K_INSERT: int
K_KP0: int
K_KP1: int
K_KP2: int
K_KP3: int
K_KP4: int
K_KP5: int
K_KP6: int
K_KP7: int
K_KP8: int
K_KP9: int
K_KP_0: int
K_KP_1: int
K_KP_2: int
K_KP_3: int
K_KP_4: int
K_KP_5: int
K_KP_6: int
K_KP_7: int
K_KP_8: int
K_KP_9: int
K_KP_DIVIDE: int
K_KP_ENTER: int
K_KP_EQUALS: int
K_KP_MINUS: int
K_KP_MULTIPLY: int
K_KP_PERIOD: int
K_KP_PLUS: int
K_LALT: int
K_LCTRL: int
K_LEFT: int
K_LEFTBRACKET: int
K_LEFTPAREN: int
K_LESS: int
K_LGUI: int
K_LMETA: int
K_LSHIFT: int
K_LSUPER: int
K_MENU: int
K_MINUS: int
K_MODE: int
K_NUMLOCK: int
K_NUMLOCKCLEAR: int
K_PAGEDOWN: int
K_PAGEUP: int
K_PAUSE: int
K_PERCENT: int
K_PERIOD: int
K_PLUS: int
K_POWER: int
K_PRINT: int
K_PRINTSCREEN: int
K_QUESTION: int
K_QUOTE: int
K_QUOTEDBL: int
K_RALT: int
K_RCTRL: int
K_RETURN: int
K_RGUI: int
K_RIGHT: int
K_RIGHTBRACKET: int
K_RIGHTPAREN: int
K_RMETA: int
K_RSHIFT: int
K_RSUPER: int
K_SCROLLLOCK: int
K_SCROLLOCK: int
K_SEMICOLON: int
K_SLASH: int
K_SPACE: int
K_SYSREQ: int
K_TAB: int
K_UNDERSCORE: int
K_UNKNOWN: int
K_UP: int
K_a: int
K_b: int
K_c: int
K_d: int
K_e: int
K_f: int
K_g: int
K_h: int
K_i: int
K_j: int
K_k: int
K_l: int
K_m: int
K_n: int
K_o: int
K_p: int
K_q: int
K_r: int
K_s: int
K_t: int
K_u: int
K_v: int
K_w: int
K_x: int
K_y: int
K_z: int
LIL_ENDIAN: int
LOCALECHANGED: int
MIDIIN: int
MIDIOUT: int
MOUSEBUTTONDOWN: int
MOUSEBUTTONUP: int
MOUSEMOTION: int
MOUSEWHEEL: int
MULTIGESTURE: int
NOEVENT: int
NOFRAME: int
NUMEVENTS: int
OPENGL: int
OPENGLBLIT: int
PREALLOC: int
QUIT: int
RENDER_DEVICE_RESET: int
RENDER_TARGETS_RESET: int
RESIZABLE: int
RLEACCEL: int
RLEACCELOK: int
SCALED: int
SCRAP_BMP: str
SCRAP_CLIPBOARD: int
SCRAP_PBM: str
SCRAP_PPM: str
SCRAP_SELECTION: int
SCRAP_TEXT: str
SHOWN: int
SRCALPHA: int
SRCCOLORKEY: int
SWSURFACE: int
SYSTEM_CURSOR_ARROW: int
SYSTEM_CURSOR_CROSSHAIR: int
SYSTEM_CURSOR_HAND: int
SYSTEM_CURSOR_IBEAM: int
SYSTEM_CURSOR_NO: int
SYSTEM_CURSOR_SIZEALL: int
SYSTEM_CURSOR_SIZENESW: int
SYSTEM_CURSOR_SIZENS: int
SYSTEM_CURSOR_SIZENWSE: int
SYSTEM_CURSOR_SIZEWE: int
SYSTEM_CURSOR_WAIT: int
SYSTEM_CURSOR_WAITARROW: int
SYSWMEVENT: int
TEXTEDITING: int
TEXTINPUT: int
TIMER_RESOLUTION: int
USEREVENT: int
USEREVENT_DROPFILE: int
VIDEOEXPOSE: int
VIDEORESIZE: int
WINDOWCLOSE: int
WINDOWDISPLAYCHANGED: int
WINDOWENTER: int
WINDOWEXPOSED: int
WINDOWFOCUSGAINED: int
WINDOWFOCUSLOST: int
WINDOWHIDDEN: int
WINDOWHITTEST: int
WINDOWICCPROFCHANGED: int
WINDOWLEAVE: int
WINDOWMAXIMIZED: int
WINDOWMINIMIZED: int
WINDOWMOVED: int
WINDOWRESIZED: int
WINDOWRESTORED: int
WINDOWSHOWN: int
WINDOWSIZECHANGED: int
WINDOWTAKEFOCUS: int

View File

@@ -0,0 +1,844 @@
# pygame - Python Game Library
# Copyright (C) 2000-2003 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
"""Set of cursor resources available for use. These cursors come
in a sequence of values that are needed as the arguments for
pygame.mouse.set_cursor(). To dereference the sequence in place
and create the cursor in one step, call like this:
pygame.mouse.set_cursor(*pygame.cursors.arrow).
Here is a list of available cursors:
arrow, diamond, ball, broken_x, tri_left, tri_right
There is also a sample string cursor named 'thickarrow_strings'.
The compile() function can convert these string cursors into cursor byte data that can be used to
create Cursor objects.
Alternately, you can also create Cursor objects using surfaces or cursors constants,
such as pygame.SYSTEM_CURSOR_ARROW.
"""
import pygame
_cursor_id_table = {
pygame.SYSTEM_CURSOR_ARROW: "SYSTEM_CURSOR_ARROW",
pygame.SYSTEM_CURSOR_IBEAM: "SYSTEM_CURSOR_IBEAM",
pygame.SYSTEM_CURSOR_WAIT: "SYSTEM_CURSOR_WAIT",
pygame.SYSTEM_CURSOR_CROSSHAIR: "SYSTEM_CURSOR_CROSSHAIR",
pygame.SYSTEM_CURSOR_WAITARROW: "SYSTEM_CURSOR_WAITARROW",
pygame.SYSTEM_CURSOR_SIZENWSE: "SYSTEM_CURSOR_SIZENWSE",
pygame.SYSTEM_CURSOR_SIZENESW: "SYSTEM_CURSOR_SIZENESW",
pygame.SYSTEM_CURSOR_SIZEWE: "SYSTEM_CURSOR_SIZEWE",
pygame.SYSTEM_CURSOR_SIZENS: "SYSTEM_CURSOR_SIZENS",
pygame.SYSTEM_CURSOR_SIZEALL: "SYSTEM_CURSOR_SIZEALL",
pygame.SYSTEM_CURSOR_NO: "SYSTEM_CURSOR_NO",
pygame.SYSTEM_CURSOR_HAND: "SYSTEM_CURSOR_HAND",
}
class Cursor:
def __init__(self, *args):
"""Cursor(size, hotspot, xormasks, andmasks) -> Cursor
Cursor(hotspot, Surface) -> Cursor
Cursor(constant) -> Cursor
Cursor(Cursor) -> copies the Cursor object passed as an argument
Cursor() -> Cursor
pygame object for representing cursors
You can initialize a cursor from a system cursor or use the
constructor on an existing Cursor object, which will copy it.
Providing a Surface instance will render the cursor displayed
as that Surface when used.
These Surfaces may use other colors than black and white."""
if len(args) == 0:
self.type = "system"
self.data = (pygame.SYSTEM_CURSOR_ARROW,)
elif len(args) == 1 and args[0] in _cursor_id_table:
self.type = "system"
self.data = (args[0],)
elif len(args) == 1 and isinstance(args[0], Cursor):
self.type = args[0].type
self.data = args[0].data
elif (
len(args) == 2 and len(args[0]) == 2 and isinstance(args[1], pygame.Surface)
):
self.type = "color"
self.data = tuple(args)
elif len(args) == 4 and len(args[0]) == 2 and len(args[1]) == 2:
self.type = "bitmap"
# pylint: disable=consider-using-generator
# See https://github.com/pygame/pygame/pull/2509 for analysis
self.data = tuple(tuple(arg) for arg in args)
else:
raise TypeError("Arguments must match a cursor specification")
def __len__(self):
return len(self.data)
def __iter__(self):
return iter(self.data)
def __getitem__(self, index):
return self.data[index]
def __eq__(self, other):
return isinstance(other, Cursor) and self.data == other.data
def __ne__(self, other):
return not self.__eq__(other)
def __copy__(self):
"""Clone the current Cursor object.
You can do the same thing by doing Cursor(Cursor)."""
return self.__class__(self)
copy = __copy__
def __hash__(self):
return hash(tuple([self.type] + list(self.data)))
def __repr__(self):
if self.type == "system":
id_string = _cursor_id_table.get(self.data[0], "constant lookup error")
return f"<Cursor(type: system, constant: {id_string})>"
if self.type == "bitmap":
size = f"size: {self.data[0]}"
hotspot = f"hotspot: {self.data[1]}"
return f"<Cursor(type: bitmap, {size}, {hotspot})>"
if self.type == "color":
hotspot = f"hotspot: {self.data[0]}"
surf = repr(self.data[1])
return f"<Cursor(type: color, {hotspot}, surf: {surf})>"
raise TypeError("Invalid Cursor")
# Python side of the set_cursor function: C side in mouse.c
def set_cursor(*args):
"""set_cursor(pygame.cursors.Cursor OR args for a pygame.cursors.Cursor) -> None
set the mouse cursor to a new cursor"""
cursor = Cursor(*args)
pygame.mouse._set_cursor(**{cursor.type: cursor.data})
pygame.mouse.set_cursor = set_cursor
del set_cursor # cleanup namespace
# Python side of the get_cursor function: C side in mouse.c
def get_cursor():
"""get_cursor() -> pygame.cursors.Cursor
get the current mouse cursor"""
return Cursor(*pygame.mouse._get_cursor())
pygame.mouse.get_cursor = get_cursor
del get_cursor # cleanup namespace
arrow = Cursor(
(16, 16),
(0, 0),
(
0x00,
0x00,
0x40,
0x00,
0x60,
0x00,
0x70,
0x00,
0x78,
0x00,
0x7C,
0x00,
0x7E,
0x00,
0x7F,
0x00,
0x7F,
0x80,
0x7C,
0x00,
0x6C,
0x00,
0x46,
0x00,
0x06,
0x00,
0x03,
0x00,
0x03,
0x00,
0x00,
0x00,
),
(
0x40,
0x00,
0xE0,
0x00,
0xF0,
0x00,
0xF8,
0x00,
0xFC,
0x00,
0xFE,
0x00,
0xFF,
0x00,
0xFF,
0x80,
0xFF,
0xC0,
0xFF,
0x80,
0xFE,
0x00,
0xEF,
0x00,
0x4F,
0x00,
0x07,
0x80,
0x07,
0x80,
0x03,
0x00,
),
)
diamond = Cursor(
(16, 16),
(7, 7),
(
0,
0,
1,
0,
3,
128,
7,
192,
14,
224,
28,
112,
56,
56,
112,
28,
56,
56,
28,
112,
14,
224,
7,
192,
3,
128,
1,
0,
0,
0,
0,
0,
),
(
1,
0,
3,
128,
7,
192,
15,
224,
31,
240,
62,
248,
124,
124,
248,
62,
124,
124,
62,
248,
31,
240,
15,
224,
7,
192,
3,
128,
1,
0,
0,
0,
),
)
ball = Cursor(
(16, 16),
(7, 7),
(
0,
0,
3,
192,
15,
240,
24,
248,
51,
252,
55,
252,
127,
254,
127,
254,
127,
254,
127,
254,
63,
252,
63,
252,
31,
248,
15,
240,
3,
192,
0,
0,
),
(
3,
192,
15,
240,
31,
248,
63,
252,
127,
254,
127,
254,
255,
255,
255,
255,
255,
255,
255,
255,
127,
254,
127,
254,
63,
252,
31,
248,
15,
240,
3,
192,
),
)
broken_x = Cursor(
(16, 16),
(7, 7),
(
0,
0,
96,
6,
112,
14,
56,
28,
28,
56,
12,
48,
0,
0,
0,
0,
0,
0,
0,
0,
12,
48,
28,
56,
56,
28,
112,
14,
96,
6,
0,
0,
),
(
224,
7,
240,
15,
248,
31,
124,
62,
62,
124,
30,
120,
14,
112,
0,
0,
0,
0,
14,
112,
30,
120,
62,
124,
124,
62,
248,
31,
240,
15,
224,
7,
),
)
tri_left = Cursor(
(16, 16),
(1, 1),
(
0,
0,
96,
0,
120,
0,
62,
0,
63,
128,
31,
224,
31,
248,
15,
254,
15,
254,
7,
128,
7,
128,
3,
128,
3,
128,
1,
128,
1,
128,
0,
0,
),
(
224,
0,
248,
0,
254,
0,
127,
128,
127,
224,
63,
248,
63,
254,
31,
255,
31,
255,
15,
254,
15,
192,
7,
192,
7,
192,
3,
192,
3,
192,
1,
128,
),
)
tri_right = Cursor(
(16, 16),
(14, 1),
(
0,
0,
0,
6,
0,
30,
0,
124,
1,
252,
7,
248,
31,
248,
127,
240,
127,
240,
1,
224,
1,
224,
1,
192,
1,
192,
1,
128,
1,
128,
0,
0,
),
(
0,
7,
0,
31,
0,
127,
1,
254,
7,
254,
31,
252,
127,
252,
255,
248,
255,
248,
127,
240,
3,
240,
3,
224,
3,
224,
3,
192,
3,
192,
1,
128,
),
)
# Here is an example string resource cursor. To use this:
# curs, mask = pygame.cursors.compile_cursor(pygame.cursors.thickarrow_strings, 'X', '.')
# pygame.mouse.set_cursor((24, 24), (0, 0), curs, mask)
# Be warned, though, that cursors created from compiled strings do not support colors.
# sized 24x24
thickarrow_strings = (
"XX ",
"XXX ",
"XXXX ",
"XX.XX ",
"XX..XX ",
"XX...XX ",
"XX....XX ",
"XX.....XX ",
"XX......XX ",
"XX.......XX ",
"XX........XX ",
"XX........XXX ",
"XX......XXXXX ",
"XX.XXX..XX ",
"XXXX XX..XX ",
"XX XX..XX ",
" XX..XX ",
" XX..XX ",
" XX..XX ",
" XXXX ",
" XX ",
" ",
" ",
" ",
)
# sized 24x16
sizer_x_strings = (
" X X ",
" XX XX ",
" X.X X.X ",
" X..X X..X ",
" X...XXXXXXXX...X ",
"X................X ",
" X...XXXXXXXX...X ",
" X..X X..X ",
" X.X X.X ",
" XX XX ",
" X X ",
" ",
" ",
" ",
" ",
" ",
)
# sized 16x24
sizer_y_strings = (
" X ",
" X.X ",
" X...X ",
" X.....X ",
" X.......X ",
"XXXXX.XXXXX ",
" X.X ",
" X.X ",
" X.X ",
" X.X ",
" X.X ",
" X.X ",
" X.X ",
"XXXXX.XXXXX ",
" X.......X ",
" X.....X ",
" X...X ",
" X.X ",
" X ",
" ",
" ",
" ",
" ",
" ",
)
# sized 24x16
sizer_xy_strings = (
"XXXXXXXX ",
"X.....X ",
"X....X ",
"X...X ",
"X..X.X ",
"X.X X.X ",
"XX X.X X ",
"X X.X XX ",
" X.XX.X ",
" X...X ",
" X...X ",
" X....X ",
" X.....X ",
" XXXXXXXX ",
" ",
" ",
)
# sized 8x16
textmarker_strings = (
"ooo ooo ",
" o ",
" o ",
" o ",
" o ",
" o ",
" o ",
" o ",
" o ",
" o ",
" o ",
"ooo ooo ",
" ",
" ",
" ",
" ",
)
def compile(strings, black="X", white=".", xor="o"):
"""pygame.cursors.compile(strings, black, white, xor) -> data, mask
compile cursor strings into cursor data
This takes a set of strings with equal length and computes
the binary data for that cursor. The string widths must be
divisible by 8.
The black and white arguments are single letter strings that
tells which characters will represent black pixels, and which
characters represent white pixels. All other characters are
considered clear.
Some systems allow you to set a special toggle color for the
system color, this is also called the xor color. If the system
does not support xor cursors, that color will simply be black.
This returns a tuple containing the cursor data and cursor mask
data. Both these arguments are used when setting a cursor with
pygame.mouse.set_cursor().
"""
# first check for consistent lengths
size = len(strings[0]), len(strings)
if size[0] % 8 or size[1] % 8:
raise ValueError(f"cursor string sizes must be divisible by 8 {size}")
for s in strings[1:]:
if len(s) != size[0]:
raise ValueError("Cursor strings are inconsistent lengths")
# create the data arrays.
# this could stand a little optimizing
maskdata = []
filldata = []
maskitem = fillitem = 0
step = 8
for s in strings:
for c in s:
maskitem = maskitem << 1
fillitem = fillitem << 1
step = step - 1
if c == black:
maskitem = maskitem | 1
fillitem = fillitem | 1
elif c == white:
maskitem = maskitem | 1
elif c == xor:
fillitem = fillitem | 1
if not step:
maskdata.append(maskitem)
filldata.append(fillitem)
maskitem = fillitem = 0
step = 8
return tuple(filldata), tuple(maskdata)
def load_xbm(curs, mask):
"""pygame.cursors.load_xbm(cursorfile, maskfile) -> cursor_args
reads a pair of XBM files into set_cursor arguments
Arguments can either be filenames or filelike objects
with the readlines method. Not largely tested, but
should work with typical XBM files.
"""
def bitswap(num):
val = 0
for x in range(8):
b = num & (1 << x) != 0
val = val << 1 | b
return val
if hasattr(curs, "readlines"):
curs = curs.readlines()
else:
with open(curs, encoding="ascii") as cursor_f:
curs = cursor_f.readlines()
if hasattr(mask, "readlines"):
mask = mask.readlines()
else:
with open(mask, encoding="ascii") as mask_f:
mask = mask_f.readlines()
# avoid comments
for i, line in enumerate(curs):
if line.startswith("#define"):
curs = curs[i:]
break
for i, line in enumerate(mask):
if line.startswith("#define"):
mask = mask[i:]
break
# load width,height
width = int(curs[0].split()[-1])
height = int(curs[1].split()[-1])
# load hotspot position
if curs[2].startswith("#define"):
hotx = int(curs[2].split()[-1])
hoty = int(curs[3].split()[-1])
else:
hotx = hoty = 0
info = width, height, hotx, hoty
possible_starts = ("static char", "static unsigned char")
for i, line in enumerate(curs):
if line.startswith(possible_starts):
break
data = " ".join(curs[i + 1 :]).replace("};", "").replace(",", " ")
cursdata = []
for x in data.split():
cursdata.append(bitswap(int(x, 16)))
cursdata = tuple(cursdata)
for i, line in enumerate(mask):
if line.startswith(possible_starts):
break
data = " ".join(mask[i + 1 :]).replace("};", "").replace(",", " ")
maskdata = []
for x in data.split():
maskdata.append(bitswap(int(x, 16)))
maskdata = tuple(maskdata)
return info[:2], info[2:], cursdata, maskdata

View File

@@ -0,0 +1,91 @@
from typing import Any, Iterator, Sequence, Tuple, Union, overload
from pygame.surface import Surface
from ._common import FileArg, Literal
_Small_string = Tuple[
str, str, str, str, str, str, str, str, str, str, str, str, str, str, str, str
]
_Big_string = Tuple[
str,
str,
str,
str,
str,
str,
str,
str,
str,
str,
str,
str,
str,
str,
str,
str,
str,
str,
str,
str,
str,
str,
str,
str,
]
arrow: Cursor
diamond: Cursor
broken_x: Cursor
tri_left: Cursor
tri_right: Cursor
ball: Cursor
thickarrow_strings: _Big_string
sizer_x_strings: _Small_string
sizer_y_strings: _Big_string
sizer_xy_strings: _Small_string
textmarker_strings: _Small_string
def compile(
strings: Sequence[str],
black: str = "X",
white: str = ".",
xor: str = "o",
) -> Tuple[Tuple[int, ...], Tuple[int, ...]]: ...
def load_xbm(
curs: FileArg, mask: FileArg
) -> Tuple[Tuple[int, int], Tuple[int, int], Tuple[int, ...], Tuple[int, ...]]: ...
class Cursor:
@overload
def __init__(self, constant: int = ...) -> None: ...
@overload
def __init__(self, cursor: Cursor) -> None: ...
@overload
def __init__(
self,
size: Union[Tuple[int, int], Sequence[int]],
hotspot: Union[Tuple[int, int], Sequence[int]],
xormasks: Sequence[int],
andmasks: Sequence[int],
) -> None: ...
@overload
def __init__(
self,
hotspot: Union[Tuple[int, int], Sequence[int]],
surface: Surface,
) -> None: ...
def __iter__(self) -> Iterator[Any]: ...
def __len__(self) -> int: ...
def __copy__(self) -> Cursor: ...
def __hash__(self) -> int: ...
def __getitem__(
self, index: int
) -> Union[int, Tuple[int, int], Sequence[int], Surface]: ...
copy = __copy__
type: Literal["system", "color", "bitmap"]
data: Union[
Tuple[int],
Tuple[Tuple[int, int], Tuple[int, int], Tuple[int, ...], Tuple[int, ...]],
Tuple[Union[Tuple[int, int], Sequence[int]], Surface],
]

View File

@@ -0,0 +1,77 @@
from typing import Union, Tuple, List, Optional, Dict, Sequence, overload
from pygame.surface import Surface
from pygame.constants import FULLSCREEN
from ._common import Coordinate, RectValue, ColorValue, RGBAOutput
class _VidInfo:
hw: int
wm: int
video_mem: int
bitsize: int
bytesize: int
masks: RGBAOutput
shifts: RGBAOutput
losses: RGBAOutput
blit_hw: int
blit_hw_CC: int
blit_hw_A: int
blit_sw: int
blit_sw_CC: int
blit_sw_A: int
current_h: int
current_w: int
def init() -> None: ...
def quit() -> None: ...
def get_init() -> bool: ...
def set_mode(
size: Coordinate = (0, 0),
flags: int = 0,
depth: int = 0,
display: int = 0,
vsync: int = 0,
) -> Surface: ...
def get_surface() -> Surface: ...
def flip() -> None: ...
@overload
def update(
rectangle: Optional[Union[RectValue, Sequence[Optional[RectValue]]]] = None
) -> None: ...
@overload
def update(x: int, y: int, w: int, h: int) -> None: ...
@overload
def update(xy: Coordinate, wh: Coordinate) -> None: ...
def get_driver() -> str: ...
def Info() -> _VidInfo: ...
def get_wm_info() -> Dict[str, int]: ...
def list_modes(
depth: int = 0,
flags: int = FULLSCREEN,
display: int = 0,
) -> List[Tuple[int, int]]: ...
def mode_ok(
size: Union[Sequence[int], Tuple[int, int]],
flags: int = 0,
depth: int = 0,
display: int = 0,
) -> int: ...
def gl_get_attribute(flag: int) -> int: ...
def gl_set_attribute(flag: int, value: int) -> None: ...
def get_active() -> bool: ...
def iconify() -> bool: ...
def toggle_fullscreen() -> int: ...
def set_gamma(red: float, green: float = ..., blue: float = ...) -> int: ...
def set_gamma_ramp(
red: Sequence[int], green: Sequence[int], blue: Sequence[int]
) -> int: ...
def set_icon(surface: Surface) -> None: ...
def set_caption(title: str, icontitle: Optional[str] = None) -> None: ...
def get_caption() -> Tuple[str, str]: ...
def set_palette(palette: Sequence[ColorValue]) -> None: ...
def get_num_displays() -> int: ...
def get_window_size() -> Tuple[int, int]: ...
def get_allow_screensaver() -> bool: ...
def set_allow_screensaver(value: bool = True) -> None: ...
def get_desktop_sizes() -> List[Tuple[int, int]]: ...
def is_fullscreen() -> bool: ...

View File

@@ -0,0 +1,37 @@
# python -m pygame.docs
import os
import webbrowser
from urllib.parse import quote, urlunparse
def _iterpath(path):
path, last = os.path.split(path)
if last:
yield from _iterpath(path)
yield last
# for test suite to confirm pygame built with local docs
def has_local_docs():
pkg_dir = os.path.dirname(os.path.abspath(__file__))
main_page = os.path.join(pkg_dir, "generated", "index.html")
return os.path.exists(main_page)
def open_docs():
pkg_dir = os.path.dirname(os.path.abspath(__file__))
main_page = os.path.join(pkg_dir, "generated", "index.html")
if os.path.exists(main_page):
url_path = quote("/".join(_iterpath(main_page)))
drive, rest = os.path.splitdrive(__file__)
if drive:
url_path = f"{drive}/{url_path}"
url = urlunparse(("file", "", url_path, "", "", ""))
else:
url = "https://www.pygame.org/docs/"
webbrowser.open(url)
if __name__ == "__main__":
open_docs()

View File

@@ -0,0 +1,504 @@
GNU LESSER GENERAL PUBLIC LICENSE
Version 2.1, February 1999
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
[This is the first released version of the Lesser GPL. It also counts
as the successor of the GNU Library Public License, version 2, hence
the version number 2.1.]
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
Licenses are intended to guarantee your freedom to share and change
free software--to make sure the software is free for all its users.
This license, the Lesser General Public License, applies to some
specially designated software packages--typically libraries--of the
Free Software Foundation and other authors who decide to use it. You
can use it too, but we suggest you first think carefully about whether
this license or the ordinary General Public License is the better
strategy to use in any particular case, based on the explanations below.
When we speak of free software, we are referring to freedom of use,
not price. Our General Public Licenses are designed to make sure that
you have the freedom to distribute copies of free software (and charge
for this service if you wish); that you receive source code or can get
it if you want it; that you can change the software and use pieces of
it in new free programs; and that you are informed that you can do
these things.
To protect your rights, we need to make restrictions that forbid
distributors to deny you these rights or to ask you to surrender these
rights. These restrictions translate to certain responsibilities for
you if you distribute copies of the library or if you modify it.
For example, if you distribute copies of the library, whether gratis
or for a fee, you must give the recipients all the rights that we gave
you. You must make sure that they, too, receive or can get the source
code. If you link other code with the library, you must provide
complete object files to the recipients, so that they can relink them
with the library after making changes to the library and recompiling
it. And you must show them these terms so they know their rights.
We protect your rights with a two-step method: (1) we copyright the
library, and (2) we offer you this license, which gives you legal
permission to copy, distribute and/or modify the library.
To protect each distributor, we want to make it very clear that
there is no warranty for the free library. Also, if the library is
modified by someone else and passed on, the recipients should know
that what they have is not the original version, so that the original
author's reputation will not be affected by problems that might be
introduced by others.
Finally, software patents pose a constant threat to the existence of
any free program. We wish to make sure that a company cannot
effectively restrict the users of a free program by obtaining a
restrictive license from a patent holder. Therefore, we insist that
any patent license obtained for a version of the library must be
consistent with the full freedom of use specified in this license.
Most GNU software, including some libraries, is covered by the
ordinary GNU General Public License. This license, the GNU Lesser
General Public License, applies to certain designated libraries, and
is quite different from the ordinary General Public License. We use
this license for certain libraries in order to permit linking those
libraries into non-free programs.
When a program is linked with a library, whether statically or using
a shared library, the combination of the two is legally speaking a
combined work, a derivative of the original library. The ordinary
General Public License therefore permits such linking only if the
entire combination fits its criteria of freedom. The Lesser General
Public License permits more lax criteria for linking other code with
the library.
We call this license the "Lesser" General Public License because it
does Less to protect the user's freedom than the ordinary General
Public License. It also provides other free software developers Less
of an advantage over competing non-free programs. These disadvantages
are the reason we use the ordinary General Public License for many
libraries. However, the Lesser license provides advantages in certain
special circumstances.
For example, on rare occasions, there may be a special need to
encourage the widest possible use of a certain library, so that it becomes
a de-facto standard. To achieve this, non-free programs must be
allowed to use the library. A more frequent case is that a free
library does the same job as widely used non-free libraries. In this
case, there is little to gain by limiting the free library to free
software only, so we use the Lesser General Public License.
In other cases, permission to use a particular library in non-free
programs enables a greater number of people to use a large body of
free software. For example, permission to use the GNU C Library in
non-free programs enables many more people to use the whole GNU
operating system, as well as its variant, the GNU/Linux operating
system.
Although the Lesser General Public License is Less protective of the
users' freedom, it does ensure that the user of a program that is
linked with the Library has the freedom and the wherewithal to run
that program using a modified version of the Library.
The precise terms and conditions for copying, distribution and
modification follow. Pay close attention to the difference between a
"work based on the library" and a "work that uses the library". The
former contains code derived from the library, whereas the latter must
be combined with the library in order to run.
GNU LESSER GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License Agreement applies to any software library or other
program which contains a notice placed by the copyright holder or
other authorized party saying it may be distributed under the terms of
this Lesser General Public License (also called "this License").
Each licensee is addressed as "you".
A "library" means a collection of software functions and/or data
prepared so as to be conveniently linked with application programs
(which use some of those functions and data) to form executables.
The "Library", below, refers to any such software library or work
which has been distributed under these terms. A "work based on the
Library" means either the Library or any derivative work under
copyright law: that is to say, a work containing the Library or a
portion of it, either verbatim or with modifications and/or translated
straightforwardly into another language. (Hereinafter, translation is
included without limitation in the term "modification".)
"Source code" for a work means the preferred form of the work for
making modifications to it. For a library, complete source code means
all the source code for all modules it contains, plus any associated
interface definition files, plus the scripts used to control compilation
and installation of the library.
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running a program using the Library is not restricted, and output from
such a program is covered only if its contents constitute a work based
on the Library (independent of the use of the Library in a tool for
writing it). Whether that is true depends on what the Library does
and what the program that uses the Library does.
1. You may copy and distribute verbatim copies of the Library's
complete source code as you receive it, in any medium, provided that
you conspicuously and appropriately publish on each copy an
appropriate copyright notice and disclaimer of warranty; keep intact
all the notices that refer to this License and to the absence of any
warranty; and distribute a copy of this License along with the
Library.
You may charge a fee for the physical act of transferring a copy,
and you may at your option offer warranty protection in exchange for a
fee.
2. You may modify your copy or copies of the Library or any portion
of it, thus forming a work based on the Library, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) The modified work must itself be a software library.
b) You must cause the files modified to carry prominent notices
stating that you changed the files and the date of any change.
c) You must cause the whole of the work to be licensed at no
charge to all third parties under the terms of this License.
d) If a facility in the modified Library refers to a function or a
table of data to be supplied by an application program that uses
the facility, other than as an argument passed when the facility
is invoked, then you must make a good faith effort to ensure that,
in the event an application does not supply such function or
table, the facility still operates, and performs whatever part of
its purpose remains meaningful.
(For example, a function in a library to compute square roots has
a purpose that is entirely well-defined independent of the
application. Therefore, Subsection 2d requires that any
application-supplied function or table used by this function must
be optional: if the application does not supply it, the square
root function must still compute square roots.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Library,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Library, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote
it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Library.
In addition, mere aggregation of another work not based on the Library
with the Library (or with a work based on the Library) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may opt to apply the terms of the ordinary GNU General Public
License instead of this License to a given copy of the Library. To do
this, you must alter all the notices that refer to this License, so
that they refer to the ordinary GNU General Public License, version 2,
instead of to this License. (If a newer version than version 2 of the
ordinary GNU General Public License has appeared, then you can specify
that version instead if you wish.) Do not make any other change in
these notices.
Once this change is made in a given copy, it is irreversible for
that copy, so the ordinary GNU General Public License applies to all
subsequent copies and derivative works made from that copy.
This option is useful when you wish to copy part of the code of
the Library into a program that is not a library.
4. You may copy and distribute the Library (or a portion or
derivative of it, under Section 2) in object code or executable form
under the terms of Sections 1 and 2 above provided that you accompany
it with the complete corresponding machine-readable source code, which
must be distributed under the terms of Sections 1 and 2 above on a
medium customarily used for software interchange.
If distribution of object code is made by offering access to copy
from a designated place, then offering equivalent access to copy the
source code from the same place satisfies the requirement to
distribute the source code, even though third parties are not
compelled to copy the source along with the object code.
5. A program that contains no derivative of any portion of the
Library, but is designed to work with the Library by being compiled or
linked with it, is called a "work that uses the Library". Such a
work, in isolation, is not a derivative work of the Library, and
therefore falls outside the scope of this License.
However, linking a "work that uses the Library" with the Library
creates an executable that is a derivative of the Library (because it
contains portions of the Library), rather than a "work that uses the
library". The executable is therefore covered by this License.
Section 6 states terms for distribution of such executables.
When a "work that uses the Library" uses material from a header file
that is part of the Library, the object code for the work may be a
derivative work of the Library even though the source code is not.
Whether this is true is especially significant if the work can be
linked without the Library, or if the work is itself a library. The
threshold for this to be true is not precisely defined by law.
If such an object file uses only numerical parameters, data
structure layouts and accessors, and small macros and small inline
functions (ten lines or less in length), then the use of the object
file is unrestricted, regardless of whether it is legally a derivative
work. (Executables containing this object code plus portions of the
Library will still fall under Section 6.)
Otherwise, if the work is a derivative of the Library, you may
distribute the object code for the work under the terms of Section 6.
Any executables containing that work also fall under Section 6,
whether or not they are linked directly with the Library itself.
6. As an exception to the Sections above, you may also combine or
link a "work that uses the Library" with the Library to produce a
work containing portions of the Library, and distribute that work
under terms of your choice, provided that the terms permit
modification of the work for the customer's own use and reverse
engineering for debugging such modifications.
You must give prominent notice with each copy of the work that the
Library is used in it and that the Library and its use are covered by
this License. You must supply a copy of this License. If the work
during execution displays copyright notices, you must include the
copyright notice for the Library among them, as well as a reference
directing the user to the copy of this License. Also, you must do one
of these things:
a) Accompany the work with the complete corresponding
machine-readable source code for the Library including whatever
changes were used in the work (which must be distributed under
Sections 1 and 2 above); and, if the work is an executable linked
with the Library, with the complete machine-readable "work that
uses the Library", as object code and/or source code, so that the
user can modify the Library and then relink to produce a modified
executable containing the modified Library. (It is understood
that the user who changes the contents of definitions files in the
Library will not necessarily be able to recompile the application
to use the modified definitions.)
b) Use a suitable shared library mechanism for linking with the
Library. A suitable mechanism is one that (1) uses at run time a
copy of the library already present on the user's computer system,
rather than copying library functions into the executable, and (2)
will operate properly with a modified version of the library, if
the user installs one, as long as the modified version is
interface-compatible with the version that the work was made with.
c) Accompany the work with a written offer, valid for at
least three years, to give the same user the materials
specified in Subsection 6a, above, for a charge no more
than the cost of performing this distribution.
d) If distribution of the work is made by offering access to copy
from a designated place, offer equivalent access to copy the above
specified materials from the same place.
e) Verify that the user has already received a copy of these
materials or that you have already sent this user a copy.
For an executable, the required form of the "work that uses the
Library" must include any data and utility programs needed for
reproducing the executable from it. However, as a special exception,
the materials to be distributed need not include anything that is
normally distributed (in either source or binary form) with the major
components (compiler, kernel, and so on) of the operating system on
which the executable runs, unless that component itself accompanies
the executable.
It may happen that this requirement contradicts the license
restrictions of other proprietary libraries that do not normally
accompany the operating system. Such a contradiction means you cannot
use both them and the Library together in an executable that you
distribute.
7. You may place library facilities that are a work based on the
Library side-by-side in a single library together with other library
facilities not covered by this License, and distribute such a combined
library, provided that the separate distribution of the work based on
the Library and of the other library facilities is otherwise
permitted, and provided that you do these two things:
a) Accompany the combined library with a copy of the same work
based on the Library, uncombined with any other library
facilities. This must be distributed under the terms of the
Sections above.
b) Give prominent notice with the combined library of the fact
that part of it is a work based on the Library, and explaining
where to find the accompanying uncombined form of the same work.
8. You may not copy, modify, sublicense, link with, or distribute
the Library except as expressly provided under this License. Any
attempt otherwise to copy, modify, sublicense, link with, or
distribute the Library is void, and will automatically terminate your
rights under this License. However, parties who have received copies,
or rights, from you under this License will not have their licenses
terminated so long as such parties remain in full compliance.
9. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Library or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Library (or any work based on the
Library), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Library or works based on it.
10. Each time you redistribute the Library (or any work based on the
Library), the recipient automatically receives a license from the
original licensor to copy, distribute, link with or modify the Library
subject to these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties with
this License.
11. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Library at all. For example, if a patent
license would not permit royalty-free redistribution of the Library by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Library.
If any portion of this section is held invalid or unenforceable under any
particular circumstance, the balance of the section is intended to apply,
and the section as a whole is intended to apply in other circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
12. If the distribution and/or use of the Library is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Library under this License may add
an explicit geographical distribution limitation excluding those countries,
so that distribution is permitted only in or among countries not thus
excluded. In such case, this License incorporates the limitation as if
written in the body of this License.
13. The Free Software Foundation may publish revised and/or new
versions of the Lesser General Public License from time to time.
Such new versions will be similar in spirit to the present version,
but may differ in detail to address new problems or concerns.
Each version is given a distinguishing version number. If the Library
specifies a version number of this License which applies to it and
"any later version", you have the option of following the terms and
conditions either of that version or of any later version published by
the Free Software Foundation. If the Library does not specify a
license version number, you may choose any version ever published by
the Free Software Foundation.
14. If you wish to incorporate parts of the Library into other free
programs whose distribution conditions are incompatible with these,
write to the author to ask for permission. For software which is
copyrighted by the Free Software Foundation, write to the Free
Software Foundation; we sometimes make exceptions for this. Our
decision will be guided by the two goals of preserving the free status
of all derivatives of our free software and of promoting the sharing
and reuse of software generally.
NO WARRANTY
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Libraries
If you develop a new library, and you want it to be of the greatest
possible use to the public, we recommend making it free software that
everyone can redistribute and change. You can do so by permitting
redistribution under these terms (or, alternatively, under the terms of the
ordinary General Public License).
To apply these terms, attach the following notices to the library. It is
safest to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least the
"copyright" line and a pointer to where the full notice is found.
<one line to give the library's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Also add information on how to contact you by electronic and paper mail.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the library, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the
library `Frob' (a library for tweaking knobs) written by James Random Hacker.
<signature of Ty Coon>, 1 April 1990
Ty Coon, President of Vice
That's all there is to it!

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 70 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 70 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 70 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 70 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 75 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 75 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

Some files were not shown because too many files have changed in this diff Show More