mirror of
https://github.com/Faraphel/Atlas-Install.git
synced 2025-07-05 12:18:21 +02:00
fixed the ImageLayer Operation that was not pasting the image of top of the other correctly
This commit is contained in:
parent
6831b18c0a
commit
093319eece
7 changed files with 17 additions and 20 deletions
|
@ -2,7 +2,7 @@
|
|||
"operation": {
|
||||
"img-generate": {
|
||||
"layers": [
|
||||
{"type": "color", "color": [0, 0, 0]},
|
||||
{"type": "color", "color": [0, 0, 0, 0]},
|
||||
{"type": "image", "image_path": "files/Boot/Strap/bootscreen-base.png"},
|
||||
{"type": "text", "x": 0.01, "y": 0.00, "text": "Mario Kart Wii - Faraphel", "font_size": 0.04, "color": [100, 100, 100], "font_path": "files/Boot/Strap/CenturyGothicBold.ttf"},
|
||||
{"type": "text", "x": 0.10, "y": 0.06, "text": "Elke track heeft een score tussen 1 en 5 sterren", "font_size": 0.045, "color": [255, 180, 0], "font_path": "files/Boot/Strap/CenturyGothicBold.ttf"},
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
"operation": {
|
||||
"img-generate": {
|
||||
"layers": [
|
||||
{"type": "color", "color": [0, 0, 0]},
|
||||
{"type": "color", "color": [0, 0, 0, 0]},
|
||||
{"type": "image", "image_path": "files/Boot/Strap/bootscreen-base.png"},
|
||||
{"type": "text", "x": 0.01, "y": 0.00, "text": "Mario Kart Wii - Faraphel", "font_size": 0.04, "color": [100, 100, 100], "font_path": "files/Boot/Strap/CenturyGothicBold.ttf"},
|
||||
{"type": "text", "x": 0.10, "y": 0.06, "text": "Every track has a score between 1 and 5 stars", "font_size": 0.045, "color": [255, 180, 0], "font_path": "files/Boot/Strap/CenturyGothicBold.ttf"},
|
||||
|
@ -14,8 +14,8 @@
|
|||
{"type": "text", "x": 0.45, "y": 0.25, "text": "\"Boost\" mean that you will be constantly\nbe accelerating on this track", "font_size": 0.045, "color": [255, 180, 0], "font_path": "files/Boot/Strap/CenturyGothicBold.ttf"},
|
||||
{"type": "text", "x": 0.45, "y": 0.40, "text": "The track's author is credited while\nthe track presentation", "font_size": 0.045, "color": [255, 180, 0], "font_path": "files/Boot/Strap/CenturyGothicBold.ttf"},
|
||||
{"type": "text", "x": 0.45, "y": 0.67, "text": "The original track's game if shown\nwith the prefix", "font_size": 0.045, "color": [255, 180, 0], "font_path": "files/Boot/Strap/CenturyGothicBold.ttf"},
|
||||
{"type": "text", "x": 0.02, "y": 0.88, "text": "All score are not always correct, you can contribute to", "font_size": 0.04, "color": [128, 128, 128], "font_path": "files/Boot/Strap/CenturyGothicBold.ttf"},
|
||||
{"type": "text", "x": 0.02, "y": 0.93, "text": "the mod by giving your opinion on the discord : https://discord.gg/C66cfHBb7S", "font_size": 0.04, "color": [128, 128, 128], "font_path": "files/Boot/Strap/CenturyGothicBold.ttf"}
|
||||
{"type": "text", "x": 0.02, "y": 0.88, "text": "All score are not always correct, you can contribute to the mod", "font_size": 0.04, "color": [128, 128, 128], "font_path": "files/Boot/Strap/CenturyGothicBold.ttf"},
|
||||
{"type": "text", "x": 0.02, "y": 0.93, "text": "by giving your opinion on the discord : https://discord.gg/C66cfHBb7S", "font_size": 0.04, "color": [128, 128, 128], "font_path": "files/Boot/Strap/CenturyGothicBold.ttf"}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
"operation": {
|
||||
"img-generate": {
|
||||
"layers": [
|
||||
{"type": "color", "color": [0, 0, 0]},
|
||||
{"type": "color", "color": [0, 0, 0, 0]},
|
||||
{"type": "image", "image_path": "files/Boot/Strap/bootscreen-base.png"},
|
||||
{"type": "text", "x": 0.01, "y": 0.00, "text": "Mario Kart Wii - Faraphel", "font_size": 0.04, "color": [100, 100, 100], "font_path": "files/Boot/Strap/CenturyGothicBold.ttf"},
|
||||
{"type": "text", "x": 0.10, "y": 0.06, "text": "Cada pista tiene una puntuación entre 1 y 5 estrellas", "font_size": 0.045, "color": [255, 180, 0], "font_path": "files/Boot/Strap/CenturyGothicBold.ttf"},
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
"operation": {
|
||||
"img-generate": {
|
||||
"layers": [
|
||||
{"type": "color", "color": [0, 0, 0]},
|
||||
{"type": "color", "color": [0, 0, 0, 0]},
|
||||
{"type": "image", "image_path": "files/Boot/Strap/bootscreen-base.png"},
|
||||
{"type": "text", "x": 0.01, "y": 0.00, "text": "Mario Kart Wii - Faraphel", "font_size": 0.04, "color": [100, 100, 100], "font_path": "files/Boot/Strap/CenturyGothicBold.ttf"},
|
||||
{"type": "text", "x": 0.10, "y": 0.06, "text": "Chaque course possède une note allant de 1 à 5 étoiles", "font_size": 0.045, "color": [255, 180, 0], "font_path": "files/Boot/Strap/CenturyGothicBold.ttf"},
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
"operation": {
|
||||
"img-generate": {
|
||||
"layers": [
|
||||
{"type": "color", "color": [0, 0, 0]},
|
||||
{"type": "color", "color": [0, 0, 0, 0]},
|
||||
{"type": "image", "image_path": "files/Boot/Strap/bootscreen-base.png"},
|
||||
{"type": "text", "x": 0.01, "y": 0.00, "text": "Mario Kart Wii - Faraphel", "font_size": 0.04, "color": [100, 100, 100], "font_path": "files/Boot/Strap/CenturyGothicBold.ttf"},
|
||||
{"type": "text", "x": 0.10, "y": 0.06, "text": "Jeder track hat eine Punktzahl zwischen 1 und 5 sternen", "font_size": 0.045, "color": [255, 180, 0], "font_path": "files/Boot/Strap/CenturyGothicBold.ttf"},
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
"operation": {
|
||||
"img-generate": {
|
||||
"layers": [
|
||||
{"type": "color", "color": [0, 0, 0]},
|
||||
{"type": "color", "color": [0, 0, 0, 0]},
|
||||
{"type": "image", "image_path": "files/Boot/Strap/bootscreen-base.png"},
|
||||
{"type": "text", "x": 0.01, "y": 0.00, "text": "Mario Kart Wii - Faraphel", "font_size": 0.04, "color": [100, 100, 100], "font_path": "files/Boot/Strap/CenturyGothicBold.ttf"},
|
||||
{"type": "text", "x": 0.10, "y": 0.06, "text": "Ogni traccia ha un punteggio compreso tra 1 e 5 stelle", "font_size": 0.045, "color": [255, 180, 0], "font_path": "files/Boot/Strap/CenturyGothicBold.ttf"},
|
||||
|
|
|
@ -40,7 +40,7 @@ class PatchOperation:
|
|||
self.layers: list["Layer"] = [self.Layer(layer) for layer in layers]
|
||||
|
||||
def patch(self, patch: "Patch", file_name: str, file_content: IO) -> (str, IO):
|
||||
image = Image.open(file_content)
|
||||
image = Image.open(file_content).convert("RGBA")
|
||||
|
||||
for layer in self.layers:
|
||||
image = layer.patch_image(patch, image)
|
||||
|
@ -127,7 +127,7 @@ class PatchOperation:
|
|||
|
||||
def patch_image(self, patch: "Patch", image: Image.Image):
|
||||
draw = ImageDraw.Draw(image)
|
||||
draw.rectangle(self.get_bbox(image), self.color)
|
||||
draw.rectangle(self.get_bbox(image), fill=self.color)
|
||||
|
||||
return image
|
||||
|
||||
|
@ -151,18 +151,15 @@ class PatchOperation:
|
|||
if not layer_image_path.is_relative_to(patch.path):
|
||||
raise PathOutsidePatch(layer_image_path, patch.path)
|
||||
|
||||
layer_image = Image.open(
|
||||
layer_image_path.resolve()
|
||||
).resize(
|
||||
self.get_bbox_size(image)
|
||||
).convert(
|
||||
"RGBA"
|
||||
)
|
||||
# load the image that will be pasted
|
||||
layer_image = Image.open(layer_image_path.resolve()) \
|
||||
.resize(self.get_bbox_size(image)) \
|
||||
.convert("RGBA")
|
||||
|
||||
image.paste(
|
||||
# paste onto the final image the layer with transparency support
|
||||
image.alpha_composite(
|
||||
layer_image,
|
||||
box=self.get_bbox(image),
|
||||
mask=layer_image
|
||||
dest=self.get_bbox(image)[:2],
|
||||
)
|
||||
|
||||
return image
|
||||
|
|
Loading…
Reference in a new issue