images in a text buffer window

So, using Flexible Windows, I recognize that one can set up a “text buffer” or “graphical” window and that the very first word of “text buffer” is “text.” And yet I’m going to plow ahead and ask: can one display figures in a text buffer window? I notice that when you focus on a different window and use “display”, the image still shows up in the main window.

I guess what’s not clear to me is whether there really is a fundamental difference between the main window and the other windows which explains why one can produce inline images along with text in the main window, or whether that is something that can be worked around with Glulx.

It can be worked around. All text buffer windows have the same capabilities.

The low-level (I6) VM_Picture function is written to always send the image to the main window, but it should be easy to write a modified version.

Thanks. Would I be correct to surmise that this is the bit of I6 code that I’d want to pursue modifying?

@c [ VM_Picture resource_ID; if (glk_gestalt(gestalt_Graphics, 0)) { glk_image_draw(gg_mainwin, resource_ID, imagealign_InlineCenter, 0); } else { print "[Picture number ", resource_ID, " here.]^"; } ];

Right. Replace the global “gg_mainwin” with however Flexible Window stores the I6 reference value for your chosen text buffer window. I don’t remember offhand how it handles its data structures.

glk_image_draw( win.(+ ref number +), resource_ID, imagealign_InlineCenter, 0);

If “win” is a function argument.

Thanks! I got this to work. For posterity, this was what I had to change (using Flexible Windows)…

[code]To jf-display (F - figure name) in (win - a g-window):
(- DisplayFigureAlt({win}, ResourceIDsOfFigures–>{F}, {phrase options}); -).

Include (-
[
DisplayFigureAlt win resource_ID;
print “^”; VM_PictureAlt(win, resource_ID); print “^”;
];
-)

Include (-
[
VM_PictureAlt win resource_ID;
if (glk_gestalt(gestalt_Graphics, 0)) {
glk_image_draw( win.(+ ref number +), resource_ID, imagealign_InlineCenter, 0);
} else {
print "[Picture number “, resource_ID, " here.]^”;
}
];
-)
[/code]