:py:mod:`wolfhece.textpillow` ============================= .. py:module:: wolfhece.textpillow .. autoapi-nested-parse:: Author: HECE - University of Liege, Pierre Archambeau Date: 2024 Copyright (c) 2024 University of Liege. All rights reserved. This script and its content are protected by copyright law. Unauthorized copying or distribution of this file, via any medium, is strictly prohibited. Module Contents --------------- .. py:class:: Font_Priority Bases: :py:obj:`enum.Enum` .. autoapi-inheritance-diagram:: wolfhece.textpillow.Font_Priority :parts: 1 :private-bases: Generic enumeration. Derive from this class to define new enumerations. .. py:attribute:: WIDTH :value: 1 .. py:attribute:: HEIGHT :value: 2 .. py:attribute:: FONTSIZE :value: 3 .. py:class:: Relative_Position Bases: :py:obj:`enum.Enum` .. autoapi-inheritance-diagram:: wolfhece.textpillow.Relative_Position :parts: 1 :private-bases: Generic enumeration. Derive from this class to define new enumerations. .. py:attribute:: TOP_LEFT :value: 1 .. py:attribute:: TOP :value: 4 .. py:attribute:: TOP_RIGHT :value: 7 .. py:attribute:: LEFT :value: 2 .. py:attribute:: CENTER :value: 5 .. py:attribute:: RIGHT :value: 8 .. py:attribute:: BOTTOM_LEFT :value: 3 .. py:attribute:: BOTTOM :value: 6 .. py:attribute:: BOTTOM_RIGHT :value: 9 .. py:function:: load_font(fontname: str, fontsize: int = 10) .. py:class:: Text_Infos(priority=Font_Priority.WIDTH, orientationbase=(1, 0), fontname='arial.ttf', fontsize=10, colour=(0, 0, 0, 255), dimspix=(100, 100), dimsreal=(0, 0), relative_position=Relative_Position.CENTER) Properties of Text_Image Class .. py:method:: setsize_pixels(w, h) .. py:method:: setsize_real(wh=(0, 0), scales=(0, 0)) Evalue la taille en pixel sur base de la taille réelle :param wh (float, float): largeur et hauteur dans le système réel :param scales (tuple, optional): Facteur d'échelle selon x et y. Defaults to (0,0) Le facteur d'échelle est évalué comme le rapport entre la taille en pixel et la taille réelle. Exemple : 0.5 --> 2x plus petit en pixels qu'en réel. .. py:method:: findsize(text: str) Trouve la taille en pixel sur base du texte et de la taille de police en cours :param text: Texte à utiliser :type text: str .. py:method:: adapt_fontsize(text) .. py:method:: findscale(dx, dy, w, h) .. py:method:: setscale(sx=1, sy=1) .. py:method:: getcorners(xcenter, ycenter) .. py:method:: getminmax(xcenter, ycenter) .. py:class:: Text_Image(text: str, proptext: Text_Infos, language='en') .. py:property:: image :type: PIL.Image .. py:method:: create_image() .. py:method:: show_image() .. py:data:: myprop