Well... in pure tcl-space it would look something like this:
Code: Select all
#The actual image data, I'm lazy just using ... for this example
set imageData {.................}
set myImage [image create photo imgobj -data $imageData
..
.c.img config -image imgobj
Most likely, you'd rather include the image data as a separate file, in C-space. One fairly common way of doing this, is to include it as a header-file, that simply defines a string (constant) with the image data. This kind of packing would usually require some very careful coding, as you'd have to watch out for quotes (") and escapes (\) to get a valid content. You'd probably be best off using a tool for this, though some more advanced IDE's provide means of loading a .text object using an external data source during compilation.
Once the variable/constant has been declared, you'll have to tie it into tcl-space using the Tcl_LinkVar fuction (remember to pass the TCL_LINK_READ_ONLY flag if using a string constant). It would then be accessible in the tcl interpreter, using the name you've assigned it with the Tcl_LinkVar function, and fully usable with image create -data $myvar
This article might be of interrest as how you could embed the actual image data into a separate objectfile (.o), suitable for linking, when working with gcc without fancy IDE's:
http://www.linuxjournal.com/content/emb ... rsion-5967