Murga-Projects Forums
can we create images from text? - Printable Version

+- Murga-Projects Forums (
+-- Forum: Project Forums (/forumdisplay.php?fid=1)
+--- Forum: MurgaLua - General (/forumdisplay.php?fid=2)
+--- Thread: can we create images from text? (/showthread.php?tid=143)

can we create images from text? - mikshaw - 07-30-2007 11:07 AM

I keep looking at Erco's FLTK Cheat Page for inspiration, and try to convert some of this C++ stuff to MurgaLua. Lately I've been looking at this one example, wondering if it's possible for us:
I'm not so much interested in the draggable part as in the fact that he is defining a pixmap within his code. Is this possible in murgaLua? I've done a few tests, but so far have only gotten either an error (no Fl_Pixmap) or simply no image, but I'm wondering if maybe I'm just not using it right. I assume a pixmap and XBM/XPM are not terribly different, but I could be wrong of course.

I'm having trouble figuring if "static Fl_Pixmap G_cat(cat_xpm)" is pretty much the same as "G_cat=fltk:Fl_Pixmap(cat_xpm)", or if I need to do some table parsing, or if this just isn't going to work.

I think it would be awesome if we could define pixmaps like need for external image files.

RE: can we create images from text? - mikshaw - 07-30-2007 12:41 PM

After playing with it for a while, I realized that the text can be used as an external file without needing a binary image editor to create the image, so that was pretty cool in itself. I still think it would be great to be able to use a text string within a script to create a pixmap, but if that isn't possible I'll be satisfied with what I have now. Even without that ability, it would still be possible to create the file from script at runtime as a tempfile, which accomplishes the same thing.

RE: can we create images from text? - mikshaw - 07-30-2007 01:16 PM

Oh, ok =o)

I guess you can dynamically write an xpm file to os.tmpname() and then use that file as an image with Fl_XPM_Image(), so it's all good =o)

RE: can we create images from text? - JohnMurga - 07-30-2007 05:18 PM

This one of the things I wanted to look at for 0.6 ... BTW 0.5.5 will be out today.

A tiny problem emerged with the mac build :-(


RE: can we create images from text? - mikshaw - 07-31-2007 03:57 AM

This one of the things I wanted to look at for 0.6

It seems as though it would require Fl_Pixmap (not supported in MurgaLua 0.5) in order to use pixmap data directly. Fl_Bitmap works this way too, although I have very little idea what type of data Fl_Bitmap wants...the best I was able to do was make a mess of black and white pixels.

RE: can we create images from text? - mikshaw - 08-02-2007 12:55 AM

To continue....

What is the "bitmap data array" needed for Fl_Bitmap?
I've been throwing stuff into the mix for days (well, 2 days, and not full days, mind you...far from it), and all I get from Fl_Bitmap is an image that doesn't look like an image. I've tried X Pixmap data, X Bitmap data (2 varieties, neither of which I could understand to begin with), and the only thing I found online was relating to gdk, which I couldn't understand either.

I'm thinking about just creating an array of 1s and 0s (or spaces) to lay out an ascii-type image, but it seems like a whole lot of work for something that is just a guess.

Maybe it's time I started looking into the drawing functions, but it still seems too complicated when I already have many other more basic things to learn about FLTK.