Glk extension proposal: images in buffer windows

See https://eblong.com/zarf/tmp/glkimagetest/glkimgtest.html.

Remember that the interpreter (the glkapi layer, for Quixe) knows all image sizes. So glkote.js doesn’t have to handle ORIG. This has always been true; both glk_image_draw() and glk_image_draw_scaled() pass explicit image sizes to GlkOte.

So glkote.js only has to be updated for WIDTHRATIO, ASPECTRATIO, and the MaxWidth flag. I think all the interesting combinations are tested in the above page.

For the GlkOte JSON protocol, I am imagining these cases:

width:W, height:H    // the current usage

widthratio:R, height:H   // R is a float; 1.0 means 100% of the window width

width:W, heightratio:R   // R is a float; 1.0 means 1/1 aspect ratio

widthratio:R1, heightratio:R2

Include winmaxwidth:true to give the image a max-width of the window width. winmaxwidth:false is the alternative (overwide image gets clipped). If winmaxwidth is omitted, it defaults to true.

2 Likes