Пример #1
0
 def text(self, content, pos, font_size=15, color=0xFFFFFF):
     import taichi as ti
     # TODO: refactor Canvas::text
     font_size = float(font_size)
     pos = ti.core_vec(*pos)
     r, g, b = hex_to_rgb(color)
     color = ti.core_vec(r, g, b, 1)
     self.canvas.text(content, pos, font_size, color)
Пример #2
0
    def text(self, content, pos, font_size=15, color=0xFFFFFF):
        """Draw texts on canvas.

        Args:
            content (str): The text to be drawn on canvas.
            pos (List[Number]): The position where the text is to be put.
            font_size (Number, optional): The font size of the text.
            color (int, optional): The color of the text. Default is 0xFFFFFF.

        """

        # TODO: refactor Canvas::text
        font_size = float(font_size)
        pos = ti.core_vec(*pos)
        r, g, b = hex_to_rgb(color)
        color = ti.core_vec(r, g, b, 1)
        self.canvas.text(content, pos, font_size, color)