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