Implement maxsize parameter for all relevant Doll subclasses

This commit is contained in:
LoafyLemon 2024-12-15 16:33:12 +00:00
parent 1183676c2b
commit a219f9784f
3 changed files with 9 additions and 9 deletions

View File

@ -36,12 +36,12 @@ init python:
return layers return layers
@functools.cache @functools.cache
def build_image(self, hash, matrix=None): def build_image(self, hash, matrix=None, maxsize=(1010, 1200)):
if matrix is None: if matrix is None:
matrix = self.matrix matrix = self.matrix
processors = { processors = {
"default": lambda file: Transform(Image(file), matrixcolor=matrix), "default": lambda file: Transform(file, matrixcolor=matrix, maxsize=maxsize),
} }
layers = self.get_layers(hash) layers = self.get_layers(hash)

View File

@ -113,13 +113,13 @@ init python:
return layers return layers
@functools.cache @functools.cache
def build_image(self, hash, subpath="", matrix=None): def build_image(self, hash, subpath="", matrix=None, maxsize=(1010, 1200)):
if matrix is None: if matrix is None:
matrix = self.char.body.matrix matrix = self.char.body.matrix
processors = { processors = {
"skin": lambda file: Transform(file, matrixcolor=matrix), "skin": lambda file: Transform(file, matrixcolor=matrix, maxsize=maxsize),
"default": lambda file: Image(file), "default": lambda file: Transform(file, maxsize=maxsize),
} }
layers = self.get_layers(hash, subpath) layers = self.get_layers(hash, subpath)

View File

@ -75,7 +75,7 @@ init python:
return layers return layers
@functools.cache @functools.cache
def build_image(self, hash, subpath="", matrix=None): def build_image(self, hash, subpath="", matrix=None, maxsize=(1010, 1200)):
layers = self.get_layers(hash, subpath) layers = self.get_layers(hash, subpath)
eyemask = next((layers.pop(k, None) for k in layers if "eyemask" in k), [None])[0] eyemask = next((layers.pop(k, None) for k in layers if "eyemask" in k), [None])[0]
@ -83,9 +83,9 @@ init python:
matrix = self.char.body.matrix matrix = self.char.body.matrix
processors = { processors = {
"skin": lambda file: Transform(file, matrixcolor=matrix), "skin": lambda file: Transform(file, maxsize=maxsize, matrixcolor=matrix),
"pupils": lambda file: AlphaMask(file, eyemask), "pupils": lambda file: Transform(AlphaMask(file, eyemask), maxsize=maxsize),
"default": lambda file: Image(file), "default": lambda file: Transform(file, maxsize=maxsize),
} }
sprites = [] sprites = []