Murga-Projects Forums

Full Version: can we create images from text?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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.
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.
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)
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 :-(


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.

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.
Reference URL's