Writing text to a pixmap

BlitzMax Forums/BlitzMax Programming/Writing text to a pixmap

*(Posted 2008) [#1]
Is it possible to write text to a pixmap, from what I can see the commands only allow pixels to be read and written to.


Brucey(Posted 2008) [#2]
Perhaps you can use one of those RenderToTexture functions to draw to an image...
(assuming you can retrieve the image back to a pixmap later).


Otherwise, there's no built-in support to do it.
You could write your own, or use a third-party imaging module which might do what you need.


*(Posted 2008) [#3]
bugger was hoping for something built in to do it :s, will have a look at the render to texture functions to see if there is anything I can do there.


tonyg(Posted 2008) [#4]
..or back to drawimage,drawtext,grabpixmap if it can be done in the available cycles.


skn3(Posted 2008) [#5]
Could you not write a lil routine to copy the characters of the font to memory buffers, and then do mem copies into the pixmap?


GfK(Posted 2008) [#6]
Draw Pixmap to backbuffer
Draw text to backbuffer
Grab pixmap

??

Not fast enough for doing it on-the-fly. Depends what you're trying to do.


*(Posted 2008) [#7]
the reason I was asking was because I wanted to use it in Minib3d, this doesnt always work.

With images that are larger than the screen you cannot write text to it so that method fails.


Derron(Posted 2008) [#8]
If your texture is larger than the screen: (eg 2048x2048)

Just split it into parts fitting your screen... then do what GfK said (but displaced so the part you want to alter is drawn on the screen)

Afterwards just paste the pixmaps into the textures pixmap.

Remember: this is in no way a thing for realtime displayment.

PS: don't forget to displace the text too (-x and -y so the already drawn parts of the text will be "out of sight" too).


bye MB


*(Posted 2008) [#9]
I will look for another way of doing it


tonyg(Posted 2008) [#10]
If you were using a bitmap font which used images, couldn't you use the pixmaps associated with them during loadimage and the pixmap.paste command?
Might even be possible with the existing imagefont system.
<edit> Have a look at imagefont as you can cast the pixels data to a pixmap for the loaded font which could then be pasted into your target pixmap.
<edit2> Very quick and nasty code just to see if it's possible...