Merge branch 'dr_game/gen_img' into dr_game/rust_render
This commit is contained in:
commit
cc5a07904d
@ -80,7 +80,7 @@
|
||||
|
||||
# for images
|
||||
# not for pypy >= 3.10
|
||||
pillow >= 9.5.0; (platform_python_implementation == "PyPy" and python_version < "3.10") or platform_python_implementation == "CPython"
|
||||
pillow >= 10.0.0; (platform_python_implementation == "PyPy" and python_version < "3.10") or platform_python_implementation == "CPython"
|
||||
|
||||
# for sys info
|
||||
psutil >= 5.9.5
|
||||
|
@ -78,7 +78,7 @@
|
||||
|
||||
# for images
|
||||
# not for pypy >= 3.10
|
||||
pillow >= 9.5.0; (platform_python_implementation == "PyPy" and python_version < "3.10") or platform_python_implementation == "CPython"
|
||||
pillow >= 10.0.0; (platform_python_implementation == "PyPy" and python_version < "3.10") or platform_python_implementation == "CPython"
|
||||
|
||||
# for sys info
|
||||
psutil >= 5.9.5
|
||||
|
@ -9,7 +9,7 @@ import sys
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
#: The release version
|
||||
version = '2.0.8'
|
||||
version = '2.0.9'
|
||||
__version__ = version
|
||||
|
||||
MIN_PYTHON_VERSION = 3, 8
|
||||
|
@ -23,7 +23,7 @@ the application's responsibility to keep track of the regions returned by the
|
||||
|
||||
.. versionadded:: 1.1
|
||||
"""
|
||||
from typing import TYPE_CHECKING, Tuple
|
||||
from typing import TYPE_CHECKING, Tuple, Optional
|
||||
|
||||
import pyglet
|
||||
|
||||
@ -40,13 +40,13 @@ class AllocatorException(Exception):
|
||||
class _Strip:
|
||||
__slots__ = 'x', 'y', 'max_height', 'y2'
|
||||
|
||||
def __init__(self, y: int, max_height: int):
|
||||
def __init__(self, y: int, max_height: int) -> None:
|
||||
self.x = 0
|
||||
self.y = y
|
||||
self.max_height = max_height
|
||||
self.y2 = y
|
||||
|
||||
def add(self, width: int, height: int):
|
||||
def add(self, width: int, height: int) -> Tuple[int, int]:
|
||||
assert width > 0 and height > 0
|
||||
assert height <= self.max_height
|
||||
|
||||
@ -55,7 +55,7 @@ class _Strip:
|
||||
self.y2 = max(self.y + height, self.y2)
|
||||
return x, y
|
||||
|
||||
def compact(self):
|
||||
def compact(self) -> None:
|
||||
self.max_height = self.y2 - self.y
|
||||
|
||||
|
||||
@ -71,7 +71,7 @@ class Allocator:
|
||||
"""
|
||||
__slots__ = 'width', 'height', 'strips', 'used_area'
|
||||
|
||||
def __init__(self, width: int, height: int):
|
||||
def __init__(self, width: int, height: int) -> None:
|
||||
"""Create an `Allocator` of the given size.
|
||||
|
||||
:Parameters:
|
||||
@ -139,13 +139,13 @@ class Allocator:
|
||||
if not self.strips:
|
||||
return 0.0
|
||||
possible_area = self.strips[-1].y2 * self.width
|
||||
return 1.0 - self.used_area / float(possible_area)
|
||||
return 1.0 - self.used_area / possible_area
|
||||
|
||||
|
||||
class TextureAtlas:
|
||||
"""Collection of images within a texture."""
|
||||
|
||||
def __init__(self, width: int = 2048, height: int = 2048):
|
||||
def __init__(self, width: int=2048, height: int=2048) -> None:
|
||||
"""Create a texture atlas of the given size.
|
||||
|
||||
:Parameters:
|
||||
@ -194,7 +194,7 @@ class TextureBin:
|
||||
ones as necessary to accommodate images added to the bin.
|
||||
"""
|
||||
|
||||
def __init__(self, texture_width: int = 2048, texture_height: int = 2048):
|
||||
def __init__(self, texture_width: int = 2048, texture_height: int = 2048) -> None:
|
||||
"""Create a texture bin for holding atlases of the given size.
|
||||
|
||||
:Parameters:
|
||||
@ -252,7 +252,7 @@ class TextureArrayBin:
|
||||
ones as necessary as the depth is exceeded.
|
||||
"""
|
||||
|
||||
def __init__(self, texture_width=2048, texture_height=2048, max_depth=None):
|
||||
def __init__(self, texture_width: int=2048, texture_height: int=2048, max_depth: Optional[int]=None) -> None:
|
||||
max_texture_size = pyglet.image.get_max_texture_size()
|
||||
self.max_depth = max_depth or pyglet.image.get_max_array_texture_layers()
|
||||
self.texture_width = min(texture_width, max_texture_size)
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
# for images
|
||||
# not for pypy >= 3.10
|
||||
pillow >= 9.5.0; (platform_python_implementation == "PyPy" and python_version < "3.10") or platform_python_implementation == "CPython"
|
||||
pillow >= 10.0.0; (platform_python_implementation == "PyPy" and python_version < "3.10") or platform_python_implementation == "CPython"
|
||||
|
||||
# for sys info
|
||||
psutil >= 5.9.5
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
# for images
|
||||
# not for pypy >= 3.10
|
||||
pillow >= 9.5.0; (platform_python_implementation == "PyPy" and python_version < "3.10") or platform_python_implementation == "CPython"
|
||||
pillow >= 10.0.0; (platform_python_implementation == "PyPy" and python_version < "3.10") or platform_python_implementation == "CPython"
|
||||
|
||||
# for sys info
|
||||
psutil >= 5.9.5
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
# for images
|
||||
# not for pypy >= 3.10
|
||||
pillow >= 9.5.0; (platform_python_implementation == "PyPy" and python_version < "3.10") or platform_python_implementation == "CPython"
|
||||
pillow >= 10.0.0; (platform_python_implementation == "PyPy" and python_version < "3.10") or platform_python_implementation == "CPython"
|
||||
|
||||
# for sys info
|
||||
psutil >= 5.9.5
|
||||
|
Loading…
Reference in New Issue
Block a user