mirror of
https://github.com/ChuckBuilds/LEDMatrix.git
synced 2026-04-11 13:23:00 +00:00
oversized MLB and NCAA Baseball logos, adjusted layout so they should be more clear. Disabled NCAA Baseball in config since my teams are out of tournament
This commit is contained in:
@@ -572,26 +572,45 @@ class MiLBLiveManager(BaseMiLBManager):
|
||||
width = self.display_manager.matrix.width
|
||||
height = self.display_manager.matrix.height
|
||||
image = Image.new('RGB', (width, height), color=(0, 0, 0))
|
||||
draw = ImageDraw.Draw(image)
|
||||
|
||||
# Make logos 150% of display dimensions to allow them to extend off screen
|
||||
max_width = int(width * 1.5)
|
||||
max_height = int(height * 1.5)
|
||||
|
||||
# Set logo size
|
||||
new_logo_height = 32
|
||||
logo_size = (new_logo_height, new_logo_height) # Increase size
|
||||
logo_y_offset = 0# Center vertically
|
||||
|
||||
# Load and place team logos (same as base method)
|
||||
# Load and place team logos
|
||||
away_logo = self._get_team_logo(game_data['away_team'])
|
||||
home_logo = self._get_team_logo(game_data['home_team'])
|
||||
|
||||
if away_logo and home_logo:
|
||||
away_logo = away_logo.resize(logo_size, Image.Resampling.LANCZOS)
|
||||
home_logo = home_logo.resize(logo_size, Image.Resampling.LANCZOS)
|
||||
away_x = 2
|
||||
away_y = logo_y_offset # Apply offset
|
||||
home_x = width - home_logo.width - 2# home_logo.width should be 24 now
|
||||
home_y = logo_y_offset # Apply offset
|
||||
image.paste(away_logo, (away_x, away_y), away_logo)
|
||||
image.paste(home_logo, (home_x, home_y), home_logo)
|
||||
# Resize maintaining aspect ratio
|
||||
away_logo.thumbnail((max_width, max_height), Image.Resampling.LANCZOS)
|
||||
home_logo.thumbnail((max_width, max_height), Image.Resampling.LANCZOS)
|
||||
|
||||
# Create a single overlay for both logos
|
||||
overlay = Image.new('RGBA', (width, height), (0, 0, 0, 0))
|
||||
|
||||
# Calculate vertical center line for alignment
|
||||
center_y = height // 2
|
||||
|
||||
# Draw home team logo (far right, extending beyond screen)
|
||||
home_x = width - home_logo.width + 2
|
||||
home_y = center_y - (home_logo.height // 2)
|
||||
|
||||
# Paste the home logo onto the overlay
|
||||
overlay.paste(home_logo, (home_x, home_y), home_logo)
|
||||
|
||||
# Draw away team logo (far left, extending beyond screen)
|
||||
away_x = -2
|
||||
away_y = center_y - (away_logo.height // 2)
|
||||
|
||||
overlay.paste(away_logo, (away_x, away_y), away_logo)
|
||||
|
||||
# Composite the overlay with the main image
|
||||
image = image.convert('RGBA')
|
||||
image = Image.alpha_composite(image, overlay)
|
||||
image = image.convert('RGB')
|
||||
|
||||
draw = ImageDraw.Draw(image)
|
||||
|
||||
# --- Live Game Specific Elements ---
|
||||
|
||||
@@ -604,7 +623,7 @@ class MiLBLiveManager(BaseMiLBManager):
|
||||
inning_bbox = draw.textbbox((0, 0), inning_text, font=self.display_manager.font)
|
||||
inning_width = inning_bbox[2] - inning_bbox[0]
|
||||
inning_x = (width - inning_width) // 2
|
||||
inning_y = 0 # Position near top center
|
||||
inning_y = 1 # Position near top center
|
||||
# draw.text((inning_x, inning_y), inning_text, fill=(255, 255, 255), font=self.display_manager.font)
|
||||
self._draw_text_with_outline(draw, inning_text, (inning_x, inning_y), self.display_manager.font)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user