fsleyes_widgets.utils.textbitmap
¶
This module provides a single function, textBitmap()
, which renders
some text off-screen using matplotlib
, and returns it as an RGBA bitmap.
-
fsleyes_widgets.utils.textbitmap.
textBitmap
(text, width, height, fontSize, fgColour, bgColour, alpha=1.0)¶ Draw some text using
matplotlib
.The rendered text is returned as a RGBA bitmap within a
numpy.uint8
array of size \(w \times h \times 4\), with the top-left pixel located at index[0, 0, :]
.- Parameters
text – Text to render.
width – Width in pixels.
height – Height in pixels.
fontSize – Font size in points.
fgColour – Foreground (text) colour - can be any colour specification that is accepted by
matplotlib
.bgColour – Background colour - can be any colour specification that is accepted by
matplotlib
..alpha – Text transparency, in the range
[0.0 - 1.0]
.