can we create images from text?
|
Author |
Message |
mikshaw
Senior Member
   
Posts: 522
Group: Registered
Joined: Apr 2007
Status:
Offline
Reputation: 5
|
can we create images from text?
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:
http://seriss.com/people/erco/fltk/#DraggableBoxes
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 this...no need for external image files.
|
|
07-30-2007 11:07 AM |
|
 |
mikshaw
Senior Member
   
Posts: 522
Group: Registered
Joined: Apr 2007
Status:
Offline
Reputation: 5
|
RE: can we create images from text?
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.
|
|
07-30-2007 12:41 PM |
|
 |
mikshaw
Senior Member
   
Posts: 522
Group: Registered
Joined: Apr 2007
Status:
Offline
Reputation: 5
|
RE: can we create images from text?
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 post was last modified: 07-30-2007 02:34 PM by mikshaw.
|
|
07-30-2007 01:16 PM |
|
 |
JohnMurga
Administrator
      
Posts: 381
Group: Administrators
Joined: Apr 2007
Status:
Offline
Reputation: 2
|
RE: can we create images from text?
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 :-(
Cheers
JohnM
|
|
07-30-2007 05:18 PM |
|
 |
mikshaw
Senior Member
   
Posts: 522
Group: Registered
Joined: Apr 2007
Status:
Offline
Reputation: 5
|
RE: can we create images from text?
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.
|
|
07-31-2007 03:57 AM |
|
 |
mikshaw
Senior Member
   
Posts: 522
Group: Registered
Joined: Apr 2007
Status:
Offline
Reputation: 5
|
RE: can we create images from text?
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.
This post was last modified: 08-02-2007 12:56 AM by mikshaw.
|
|
08-02-2007 12:55 AM |
|
 |