Image Generator Classes¶
This module is a compilation of Image Generation Classes.
- class AssetGenerator[source]¶
The Abstract Base Class for Image Generation tasks.
- Parameters
asset_path (str) – The path to the assets folder.
- static get_font()[source]¶
Shrinks the font size until the text fits in bbox.
- Parameters
font (
PIL.ImageFont.ImageFont
) – The font to be used.txt (str) – The text to be written.
bbox (List[int]) – The bounding box to be used.
- Returns
The font object.
- Return type
- imprint_text()[source]¶
Pastes Center aligned, font corrected text on the canvas.
- Parameters
canvas (
PIL.ImageDraw.Draw()
) – The canvas to be used.txt (str) – The text to be written.
start_pos (Tuple[int, int]) – The starting position of the text.
bbox (Tuple[int, int, int, int]) – The bounding box to be used.
fontsize (int) – The font size to be used.
- class BadgeGenerator[source]¶
Badgestrip Image Generation Class
- class BoardGenerator[source]¶
The Board Generator for Wackamole minigame.
- get()[source]¶
Returns a Board image with a random tile replaced with a pokechip.
- Parameters
level (Optional[int]) – The level of the board., default is 0.
- Returns
The board image and the board name.
- Return type
Tuple[str,
PIL.Image.Image
]
- get_board()[source]¶
Returns a Wackamole board of given difficulty level.
- Parameters
level (Optional[int]) – The level of the board., default is 0.
- Returns
The board image and the board name.
- Return type
Tuple[str,
PIL.Image.Image
]
- class GladitorMatchHandler[source]¶
Gladiator Match handler class
- get()[source]¶
Handles a duel match between Gladiators. Returns an image and damages dealt by each gladiator per round.
- Parameters
gladiators (List[
Gladiator
]) – The list of gladiators.- Returns
The image and the damages dealt.
- Return type
Tuple[
PIL.Image.Image
, int, int]
- class LeaderBoardGenerator[source]¶
Leaderboard Image Generation Class
- async get()[source]¶
Returns the leaderboard image.
- Parameters
ctx (
bot.PokeGambler
) – The PokeGambler client object.data (Dict) – The data to be used to generate the leaderboard.
- Returns
The leaderboard image.
- Return type
- async get_rankcard()[source]¶
Generates a Rank Card for a user.
- Parameters
ctx (
bot.PokeGambler
) – The PokeGambler client object.data (Dict) – The data to be used to generate the rank card.
heading (bool) – Whether or not to include the rank card heading.
- Returns
The rank card image.
- Return type
- class ProfileCardGenerator[source]¶
ProfileCard Image Generation Class
- get()[source]¶
Returns the profile card for a user.
- Parameters
name (str) – The user’s name.
avatar (
PIL.Image.Image
) – The user’s avatar.balance (str) – The user’s current balance.
num_played (str) – The number of matches the user has played.
num_won (str) – The number of matches the user has won.
badges (Optional[List[
PIL.Image.Image
]]) – The badges the user has earned.blacklisted (bool) – Whether or not the user is blacklisted.
background (
PIL.Image.Image
) – The user’s background image.
- Returns
The profile card
- Return type