Bubblespeech
The Bubblespeech feature in Drawlib allows you to create irregular bubble-shaped speech graphics, often used in illustrations.
It’s implemented within the dsart
module as part of the Smart Art functions, offering advanced shape drawing capabilities.
Here’s an example of using Bubblespeech in Drawlib:
1from drawlib.apis import *
2
3config(width=100, height=50)
4dsart.bubblespeech(
5 xy=(30, 10),
6 width=50,
7 height=30,
8 tail_edge="left",
9 tail_start_ratio=0.2,
10 tail_vertex_xy=(10, 25),
11 tail_end_ratio=0.6,
12 style=ShapeStyle(lwidth=0, fcolor=Colors.Blue),
13 text="Hello Drawlib!",
14 textstyle=ShapeTextStyle(size=32, color=Colors.White),
15)
16save()
This function call draws a bubble speech shape with a tail starting from the right edge, beginning at 30% from the bottom, extending to 70% along its path.
In the example above, the options for drawing Bubblespeech are specified. The key parameters include:
xy: Coordinates specifying the position of the bottom-left corner.
tail_edge: Specifies the edge from which the tail extends (
left
,right
,bottom
,top
).tail_from_ratio: Determines where the tail starts along the specified edge (0.0 to 1.0).
tail_vertex_xy: Specifies the exact vertex location of the tail.
tail_to_ratio: Specifies where the tail ends along its path (must be greater than tail_from_ratio).
Please refer the below picture for understanding the parameters.
Ellipse like bubblespeech is not supported yet.