upp-components icon indicating copy to clipboard operation
upp-components copied to clipboard

Add SVG support to Terminal widget as a compile-time option.

Open ismail-yilmaz opened this issue 3 years ago • 2 comments

Given the increasing popularity of inline images support in virtual terminal emulators, and the usage of SVG in general, the SVG rendering support can be added to TerminalCtrl as a compile-time option, since U++ already provides the necessary and easy-to-use SVG rendering functions.

As for the required changes in the wire protocols: This option doesn't necessarily require any modification of supported/existing wire protocols (DECSIXEL/jexer/iterm2), since TerminalCtrl already uses a generic infrastructure to identify and decode images.

ismail-yilmaz avatar Jan 14 '21 10:01 ismail-yilmaz

A sort of proof of concept implemention, using the existing jexer protocol:

TerminalCtrl-inline-sgv-test (using jexer protocol)

Works just fine with images.

It uses Upp::RenderSVGImage to render the svg into a raster image that can be displayed as usual. (Currently requires only three more lines of code + 2 lines of code change to the renderer.)

Still, a simple yet fine-grained implementation seems to require at least a few options to the wire protocol (such as default bkg color, custom size, etc.).

@klamonte, would you be okay if I attempt to extend the jexer protocol a little bit to include SVG rendering? (a possible TerminalCtrl-variant?)

ismail-yilmaz avatar Jun 14 '21 20:06 ismail-yilmaz

@ismail-yilmaz I have no objection. Do you think SVG would make the most sense to be like PNG/JPG, where dimensions are picked up from the image data, or more like RGB where height/width are specified exactly?

ghost avatar Jan 01 '22 22:01 ghost