Coder Social home page Coder Social logo

sixel mode ? about term-mode7 HOT 10 OPEN

stuaxo avatar stuaxo commented on September 6, 2024
sixel mode ?

from term-mode7.

Comments (10)

NoiseByNorthwest avatar NoiseByNorthwest commented on September 6, 2024

Yes I agree :)
But I dont know if I will make changes to this demo, and if so I probably will not break compatibility with common terminals.

from term-mode7.

saitoha avatar saitoha commented on September 6, 2024

patch: https://gist.github.com/saitoha/6622d20a4e4e49fd7d2beaf2bfdb4930
demo: https://youtu.be/YyRxkPMIBXk

Requesting Primary DA(https://www.vt100.net/docs/vt510-rm/DA1) to the terminal is most common way for testing sixel mode availability.

from term-mode7.

stuaxo avatar stuaxo commented on September 6, 2024

Awesome, it looks better than I imagined :)

There seems to be some slight colour banding effect on the demo (watch the youtube video especially the line where these purple bits are) - are they meant to be there?

image

from term-mode7.

saitoha avatar saitoha commented on September 6, 2024

try:

diff --git a/main.c b/main.c
index 12c7890..98010a9 100644
--- a/main.c
+++ b/main.c
@@ -169,7 +169,7 @@ int main()
     size_t current_map = 0;
 
     size_t color_count = maps[current_map].default_color_count;
-    size_t mipmap_count = 5;
+    size_t mipmap_count = 1;
     texture_t * texture = texture_create(
         maps[current_map].file_name,
         color_count,

from term-mode7.

saitoha avatar saitoha commented on September 6, 2024

Sorry, additionary some stupid bugs are found.

diff --git a/main.c b/main.c
index 12c7890..7ffd3d2 100644
--- a/main.c
+++ b/main.c
@@ -16,6 +16,8 @@
 static const size_t pixbuf_width = 640;
 static const size_t pixbuf_height = 360;
 unsigned char pixbuf[pixbuf_width * pixbuf_height];
+static const size_t default_mipmap_count_sixel = 1;
+static const size_t default_mipmap_count_character = 5;
 #endif /* HAVE_SIXEL */
 
 static void terminate_ncurses(void);
@@ -125,9 +127,9 @@ output_sixel(uint8_t colors[][4])
     if (SIXEL_FAILED(status))
         goto end;
     for (i = 0; i < 256; ++i) {
-       palette[i * 3 + 0] = colors[i * 4][0];
-       palette[i * 3 + 1] = colors[i * 4][1];
-       palette[i * 3 + 2] = colors[i * 4][2];
+       palette[i * 3 + 0] = colors[i][0];
+       palette[i * 3 + 1] = colors[i][1];
+       palette[i * 3 + 2] = colors[i][2];
     }
     sixel_dither_set_palette(dither, (unsigned char *)palette);
     if (SIXEL_FAILED(status))
@@ -169,7 +171,11 @@ int main()
     size_t current_map = 0;
 
     size_t color_count = maps[current_map].default_color_count;
-    size_t mipmap_count = 5;
+#if HAVE_SIXEL
+    size_t mipmap_count = default_mipmap_count_sixel;
+#else
+    size_t mipmap_count = default_mipmap_count_character;
+#endif /* HAVE_SIXEL */
     texture_t * texture = texture_create(
         maps[current_map].file_name,
         color_count,
@@ -357,7 +363,12 @@ int main()
                     }
 
                     color_count = maps[current_map].default_color_count;
-                    mipmap_count = 5;
+                    mipmap_count = default_mipmap_count_character;
+#if HAVE_SIXEL
+                    if (current_renderer == 3) { /* sixel */
+                        mipmap_count = default_mipmap_count_sixel;
+                    }
+#endif /* HAVE_SIXEL */
                 }
 
                 texture_destroy(texture);

from term-mode7.

saitoha avatar saitoha commented on September 6, 2024

updated.
patch: https://gist.github.com/saitoha/6622d20a4e4e49fd7d2beaf2bfdb4930
demo: https://youtu.be/snHtdvcMK0s

from term-mode7.

NoiseByNorthwest avatar NoiseByNorthwest commented on September 6, 2024

@saitoha thanks, I'm going to try it

from term-mode7.

NoiseByNorthwest avatar NoiseByNorthwest commented on September 6, 2024

@saitoha I've added your patch on sixel_support branch (see #2 ) with small additional patches to fix the build.
But what I get when I run it is a black screen... Until I switch to another renderer. What are the full requirements to make sixel working ?

from term-mode7.

stuaxo avatar stuaxo commented on September 6, 2024

@saitoha looks really good, those kind of bugs are all too easy in graphics.

from term-mode7.

saitoha avatar saitoha commented on September 6, 2024

@NoiseByNorthwest I'm guessing your terminal doesn't support sixel or isn't enabled sixel feature.
See:
https://github.com/saitoha/libsixel#terminal-requirements

from term-mode7.

Related Issues (1)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.