Skip to content

Commit 64c267d

Browse files
getting warm again
1 parent 606f194 commit 64c267d

File tree

1 file changed

+93
-46
lines changed

1 file changed

+93
-46
lines changed

spec/vt-good-image-protocol.tex

Lines changed: 93 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
\documentclass{article}
1+
% vim:cc=80:cole=0
2+
\documentclass[a4paper]{article}
3+
%\documentclass[a4paper, 20pt]{extreport}
24
\usepackage[utf8]{inputenc}
35
\usepackage[english]{babel}
46

@@ -18,7 +20,7 @@
1820

1921
\usepackage{draftwatermark}
2022
\SetWatermarkText{Draft}
21-
\SetWatermarkScale{8}
23+
\SetWatermarkScale{4}
2224

2325
\usepackage[english]{babel}
2426

@@ -55,37 +57,65 @@ \section{Motivation} % {{{
5557

5658
For many decades Sixel and ReGIS have been the only image protocols for terminal emulators.
5759
While both are ancient and not even widely implemented, newer generations of people are used
58-
to seeing images and even emojis everywhere.
60+
to seeing images and even emoji everywhere.
5961
Those people may eventually touch a virtual terminal emulator and expect to be it no different
60-
than what they are used to in other software systems.
61-
62-
There is growing interest in both of these fields, and thus, many virtual terminal emulator
63-
developers, 30 to 40 years later, have started implementing their own proprietary protocols
64-
for displaying images as Sixel was simply not state of the art anymore.
65-
66-
While this is positive, it also leads to fragmentation in the ecosystem because application
67-
developers do not know what to support in case they intend to display images.
68-
This specification attempts to unify all those image protocols - not as a superset, but rather
69-
as a largest common denominator, with implementation adaptability on both ends - terminal and
70-
application side.
71-
62+
than what they are used to from other software systems.
63+
\todo{What about Tektronix?}
64+
65+
There is a growing interest in displaying images in todays
66+
virtual terminal emulators.
67+
68+
Since these protocols are were not designed with todays needs in mind,
69+
virtual terminal emulaor developers have started implementing their own
70+
proprietary protocols for displaying images as Sixel and related
71+
were simply not state of the art anymore.
72+
73+
While this is positive, it also leads to fragmentation in the ecosystem
74+
because application developers do not know what to support in case they intend
75+
to display images in their client applications.
76+
77+
There is also recently a late resurrection of the Sixel bitmap protocol
78+
to be implemented by some terminal emulators and library developers,
79+
however, none of them is 100\% conforming to how Sixel used to work 40 years ago,
80+
as there is no easy way to access the hardware they were implemented on
81+
and also xterm does not implement every aspect of Sixel.
82+
83+
This specification attempts to unify all those image protocols and addresses
84+
some of the issues, not as a superset, but rather as a largest common denominator,
85+
with implementation adaptability in mind.
86+
% }}}
87+
\section{Terminology} % {{{
88+
\begin{itemize}
89+
\item \textbf{screen cell}; a rectanglular area of the screen that can contain a character with
90+
its graphics rendition or an image fragment
91+
\item \textbf{image fragment}; a rectanglular tile of an image that perfectly fits into a screen cell
92+
\item \textbf{image storage pool}; a backing store for images received for future operations
93+
\end{itemize}
94+
\todo{more terminology to add?}
7295
% }}}
7396
\section{Prior art and current state} % {{{
7497

7598
Prior art of image protocols for terminals are as follows:
7699

100+
\subsection{Tektronix}
101+
102+
\begin{itemize}
103+
\item First appeared in 1970s
104+
\item Tektronix 4010 series was a family of text-and-graphics computer terminals based on storage-tube technology created by Tektronix.
105+
\end{itemize}
106+
77107
\subsection{DEC ReGIS graphics}
78108

79109
\begin{itemize}
80-
\item First appeared in 1981
110+
\item First appeared in VT125, in July 1981
81111
\item vector graphics based
82112
\item implemented by: xterm
83113
\end{itemize}
84114

85115
\subsection{Sixel graphics}
86116

87117
\begin{itemize}
88-
\item Sixel grpahics first appeared in VT330/VT340 specifications that seems to be published in 1988.
118+
\item Sixel grpahics first appeared in LA50 dot-matrix printers (1983) and short after in the VT240 in Oktober 1983.
89119
\item It is pixel based and positions the graphics cursor in a way it is most optimal for dot printers,
90120
that could print 6 pixels in height per line.
91121
\item Specialized image format optimized for 6-pin printers.
@@ -107,11 +137,13 @@ \subsection{iTerm2 image protocol}
107137

108138
\subsection{Terminology image protocol}
109139

140+
Terminology's image protocol is rather a media transport protocol as it
141+
can also be used to render animations, including videos.
142+
110143
\begin{itemize}
111-
\item First appeared in ... \todo{When did Terminology's image protocol first appear?}
112-
\item Very hard to find anything out about the underlying transmission protocol.
113-
\item Seems to be file based.
114-
\item No specification available.
144+
\item First appeared in June, 2012.
145+
\item Uses VT sequences inspired by Xterm's sequence extensions.
146+
\item Specification is in the source code repository's \texttt{README.md} file.
115147
\end{itemize}
116148

117149
\subsection{Kitty image protocol}
@@ -194,17 +226,18 @@ \section{Future Compatibility and Stability} % {{{
194226
% }}}
195227
\section{Terminal Emulator Requirements} % {{{
196228

197-
This is the list of resource requirements that must be guaranteed by the virtual terminal emulator.
229+
This is the list of resource requirements that must be guaranteed
230+
by the virtual terminal emulator.
198231

199232
\begin{enumerate}
200233
\item at least 32 images displayable concurrently
201-
\item at least 4 MB per image uncompressed
234+
(given enough grid cells are available)
235+
\item at least 4 MB per image uncompressed (RGBA8888)
202236
\item at least 128 MB per storage pool (\(4 * 32\))
203237
\end{enumerate}
204238

205239
Upper limits must be present for security reasons but can be varying by implementation.
206240

207-
\todo{Have the ability to query resource limits?}
208241
\todo{What should happen when the number of images an application wants
209242
to display is higher than the limit?}
210243

@@ -216,6 +249,7 @@ \section{Performance Considerations} % {{{
216249
% }}}
217250
\section{Security Considerations} % {{{
218251

252+
\todo{Here be dragons.}
219253
\begin{itemize}
220254
\item image upload spamming
221255
\item huge image Uploads
@@ -233,16 +267,16 @@ \subsection{Upload Image}
233267
\subsubsection*{Parameters}
234268

235269
\begin{tabular}{|l|l|l|}
236-
\hline
237-
\textbf{parameter name} & \textbf{default} & \textbf{description} \\
238-
\hline
239-
\textbf{name} & & a unique identifier for the uploaded image \\
240-
\textbf{format} & RGBA & a value that determines the image format. \\
241-
& & See section \ref{sec:supported-image-formtats} for available image formats \\
242-
\textbf{width} & & optional pixel width of the given image (only required for RGB/RGBA format) \\
243-
\textbf{height} & & optional pixel height of the given image (only required for RGB/RGBA format) \\
244-
\textbf{data} & & image data in the given input format \\
245-
\hline
270+
\hline
271+
\textbf{parameter name} & \textbf{default} & \textbf{description} \\
272+
\hline
273+
\textbf{name} & & a unique identifier for the uploaded image \\
274+
\textbf{format} & RGBA & a value that determines the image format. \\
275+
& & See section \ref{sec:supported-image-formtats} for available image formats \\
276+
\textbf{width} & & optional pixel width of the given image (only required for RGB/RGBA format) \\
277+
\textbf{height} & & optional pixel height of the given image (only required for RGB/RGBA format) \\
278+
\textbf{data} & & image data in the given input format \\
279+
\hline
246280
\end{tabular}
247281

248282
\subsubsection{Idempotency}
@@ -261,18 +295,23 @@ \subsubsection{Storage Management}
261295

262296
If the image is larger than the allowed storage size, the upload will fail.
263297

264-
Evicted images that were still held in screen cells may display a unicode object replacement
265-
codepoint (U+FFFC) or an empty cell.
298+
Evicted images that were still held in screen cells may display a
299+
unicode object replacement codepoint (U+FFFC) or an empty cell.
300+
\todo{Can this even happen? Due to ref-counting it should not.}
266301

267-
Displaying an image results in incrementing the reference counter by the number of screen cells
268-
that are holding fragments of the image.
302+
Displaying an image results in incrementing the reference counter
303+
by the number of screen cells that are holding fragments of the image.
269304

270-
Clearing a screen cell holding an image fragment (e.g. by overwriting or deleting its contents)
271-
will decrement the image reference counter.
305+
Clearing a screen cell holding an image fragment (e.g. by overwriting
306+
or deleting its contents) will decrement the image reference counter.
272307

273308
When no screen cell is holding a reference to the image,
274309
the corresponding reference counter should be either 1 (if uploaded in a separate step)
275310
or 0 (if uploaded within the render instruction).
311+
% ^^^ does this make sense to be mentioned here?
312+
% a named image upload initializes the blob ref count to 1 (for the named reference)
313+
% whereas the blob also has a refcount of 1 when oneshotting,
314+
% because the one reference comes from the image-display action.
276315

277316
Releasing the image by its name will remove the name-to-image association, and thus,
278317
decrement its reference counter.
@@ -635,17 +674,25 @@ \subsection{Feature Detection}
635674
\DA's response code for detecting support for an implementation of this specification is \code{11}.
636675

637676
% }}}
638-
\section{Support Image Formats} % {{{
677+
\section{Supported Image Formats} % {{{
639678

640679
\label{sec:supported-image-formtats}
641680

642681
\begin{tabular}{c | c | l}
643682
File Format & Identifier & Description \\ \hline
644-
RGB & 1 & raw RGB data with each color component being of size 1 byte. \\
645-
RGBA & 2 & raw RGBA data, just like RGB, but with an alpha channel. \\
646-
PNG & 3 & PNG file format \\
683+
RGB & 1 & raw RGB data with each color component being of size 1 byte. \\
684+
RGBA & 2 & raw RGBA data, just like RGB, but with an alpha channel. \\
685+
PNG & 3 & PNG file format \\
647686
\end{tabular}
648687

688+
% }}}
689+
\section{Future Modifications} % {{{
690+
691+
Possible future modifications could (but do not have to) cover:
692+
693+
\begin{itemize}
694+
\item Query, set and reset resource limits.
695+
\end{itemize}
649696
% }}}
650697
\section{References} % {{{
651698

@@ -659,8 +706,7 @@ \section{References} % {{{
659706
\item \label{ref:image-kitty}Kitty's image protocol, \url{https://sw.kovidgoyal.net/kitty/graphics-protocol.html}
660707
\end{enumerate}
661708
% }}}
662-
663-
\section{Editorial Notes}
709+
\section{Editorial Notes} % {{{
664710

665711
\begin{itemize}
666712
\item Maybe use tables instead of lists for parameter listings?
@@ -671,6 +717,7 @@ \section{Editorial Notes}
671717
a pixel perfect rendering is attempted (resize-policy set to NoResize,
672718
screen-cols=\$COLUMNS). But what is row count?
673719
\end{itemize}
720+
% }}}
674721

675722
\listoftodos
676723

0 commit comments

Comments
 (0)