News : The level of daily SPAM has reached insane proportions, all registrations are now manual. I ask you to send me an e-mail (john (at) murga (dot) org), to confirm that you want me to create an account for you.


Post Reply  Post Thread 
murgaLua color/image
Author Message
mikshaw
Senior Member
****


Posts: 522
Group: Registered
Joined: Apr 2007
Status: Offline
Reputation: 5
Post: #1
RE: murgaLua color/image

I'm guessing you are using Fluid and converting it to Lua. Honestly I don't know a thing about using Fluid, and the code that comes from it looks unusual to me. One thing, for example, is the excessive use of "object" as a variable name. In my view this serves only to make things confusing and potentially broken, but then as I said I don't understand what it's doing. But I'll try to help in a way I can.

It took me a long time to get to understanding color in Fltk/murgaLua as well as I do now, and there are still some parts that give me trouble. If you are looking to apply a color to a widget according to the Fltk color index (in this case 179...a sort of dark sky blue?), you only need to specify the index:

Code:
object:color(179)


I'll assume image_intel2GenCorei5 refers to the image array. I've worked with embedded image arrays for pixmaps only...haven't figured out how to do anything other than that. Pixmaps are particularly easy to embed because they are just text files themselves. What I've found is easiest is to use one of the image loading functions to load an external image at runtime, applying that data to a variable which can then be manipulated in murgaLua. For example:

Code:
-- load the external file image.png
png_img=fltk:Fl_PNG_Image("image.png")
-- make a box on which to display the image
png_box=fltk:Fl_Box(30,20,100,100)
-- apply image data to the box
png_box:image(png_img)

Here's another simpler way to do that, but might limit what you can do with the data after it's loaded, since it doesn't assign the image data to a named variable:

Code:
png_box=fltk:Fl_Box(30,20,100,100)
png_box:image(fltk:Fl_PNG_Image("image.png"))


I assume if it's compiled from a script which uses external images, you'll need to keep the images with the program. The compiler, as far as I understand it, simply combines the script and a murgaLua executable into a single compressed file.

11-10-2011 06:15 AM
Find all posts by this user Quote this message in a reply
Post Reply  Post Thread 

Messages In This Thread
murgaLua color/image - luaCoder - 11-10-2011, 04:17 AM
RE: murgaLua color/image - mikshaw - 11-10-2011 06:15 AM
RE: murgaLua color/image - luaCoder - 11-10-2011, 01:11 PM
RE: murgaLua color/image - mikshaw - 11-10-2011, 04:17 PM
RE: murgaLua color/image - jpjacobs - 11-10-2011, 06:54 PM
RE: murgaLua color/image - luaCoder - 11-11-2011, 08:07 AM

View a Printable Version
Send this Thread to a Friend
Subscribe to this Thread | Add Thread to Favorites

Forum Jump: