summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--autistdraw.c27
1 files changed, 23 insertions, 4 deletions
diff --git a/autistdraw.c b/autistdraw.c
index 8e85285..31d8c0b 100644
--- a/autistdraw.c
+++ b/autistdraw.c
@@ -757,17 +757,36 @@ export_irc (app_context_t *app)
size_t x, y, w, h;
find_data_bounding_rect (app, &x, &y, &w, &h);
+ // This is tricky and needs to be tested with major IRC clients. Currently
+ // works with: weechat 1.0, xchat 2.8.8, freenode's qwebirc.
+
+ // We cannot use the same non-space character for transparent and opaque
+ // pixels because many clients don't understand the transparent 99 colour
+ // that is needed for the foreground of transparent pixels. Therefore it
+ // is not possible to display correctly using non-monospace fonts.
+
for (size_t row = 0; row < h; row++)
{
- int color = MIRC_NONE;
+ // qwebirc is retarded and in some cases it reduces spaces, misaligning
+ // the picture. Appending two spaces after the attribute reset and
+ // rendering opaque pixels as something different from a space seems
+ // to prevent that behaviour.
+ int color = MIRC_TRANSPARENT;
+ fprintf (fp, "\x0f ");
+
for (size_t column = 0; column < w; column++)
{
int new_color = color_to_mirc
(BITMAP_PIXEL (app, x + column, y + row));
if (color != new_color)
- fprintf (fp, "\x03%02d,%02d", new_color, new_color);
- color = new_color;
- fputc ('_', fp);
+ {
+ color = new_color;
+ if (color == MIRC_TRANSPARENT)
+ fprintf (fp, "\x0f");
+ else
+ fprintf (fp, "\x03%02d,%02d", color, color);
+ }
+ fputc ("# "[color == MIRC_TRANSPARENT], fp);
}
fputc ('\n', fp);
}