I don't see this here (on the wx Buttons in the mathtext_wx.py example,
at least). What are you using to display this bitmap? It may be a
premultiplied/nonpremultiplied alpha problem. Are you using the code I
attached, or setting the red channel to the text image as well?
Mike
On 04/29/2010 12:19 PM, Cédrick FAURY wrote:
Thank you for your answer, Mike.
It works fine, but I don't understand why there is grey points around
the letters ... (see attached image)

Cédrick
Le 29/04/2010 15:17, Michael Droettboom a écrit :
There
is
no direct way, but since you can get a numpy array of the text bitmap,
you can do whatever modifications you want to it. For example, the
following is a modification of the mathtext_to_wxbitmap function in
mathtext_wx that takes an rgb tuple as an argument:
def mathtext_to_wxbitmap(s, rgb):
ftimage, depth = mathtext_parser.parse(s, 150)
x = ftimage.as_array()
# Create an RGBA array for the destination, w x h x 4
rgba = np.zeros((x.shape[0], x.shape[1], 4), dtype=np.uint8)
# set the RGB components to the constant value passed in
rgba[:,:,0:3] = rgb
# set the A component to the shape of the text
rgba[:,:,3] = x
return wx.BitmapFromBufferRGBA(
ftimage.get_width(), ftimage.get_height(),
rgba.tostring())
Mike
On 04/29/2010 02:28 AM, Cédrick FAURY wrote:
Hello,
Is it possible to get colored bitmaps (instead of black ones) with the
MathTextParser when it is used as shown in the mathtext_wx.py example
??
Thanks by advance for your help.
Best regards,
Cédrick FAURY
------------------------------------------------------------------------------
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users
|
------------------------------------------------------------------------------
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users