Introducing PALE (Picture & Animation Library for Emacs)

I have been trying to push the limits of #Emacs to do real-time graphics since I started working on Emacs Reader (~1 year).

Emacs Reader has to do a lot of hacks to be efficient in performance, and in doing so we encountered memory leaks of horrible kinds (in Emacs itself), GC overloading of strings and other issues.

Finally over the last month or so, I decided to build a graphics library called PALE for Emacs which will leverage dynamic modules for efficiency. And here's the result, the animation below is hardware-accelerated, i.e the textures are rendered on GPU and then displayed on Emacs.

There are jitters here and there, but I still have a lot of room for optimization (I think!). The library will provide an API similar to svg.el, on top of that I will provide a C API so that dynamic module packages like Reader can directly provide image data from C and use it.

Right now it lives inside Emacs Reader's git, but it will eventually be separated:

https://codeberg.org/divyaranjan/emacs-reader/src/branch/partial-rendering/pale

Okay another serious breakthrough. After declaring PALE yesterday I stupidly wondered if I can hook this to ffmpeg to decode a video in realtime and play it.

Bloody hell it worked. #Emacs is actually rendering a full video in your ordinary text buffer, no xwidgets nothing.

I cannot still believe my eyes.

I fixed a whole chunk of flickering and now it is 30FPS smooth!

@lens_r I've seen this a couple other places, but I just don't understand why it hasn't generated more excitement.

@tusharhero @divyaranjan

@jameshowell @lens_r @divyaranjan Are you talking about Bad Apple? Or PALE? Or the emacs-reader demos we have been sharing?

@tusharhero I was referring to my surprise that the video-in-text-buffer stuff hasn't made more buzz.

But I am also on record admiring emacs-reader, where my noting the lack of attention was, I hope, implicit.

@lens_r @divyaranjan

@jameshowell @tusharhero @divyaranjan maybe someone from #orgmode #emacs would get a kick out of directly embedding gifs/videos into educational documents, or even displaying manim animations written in an org babel block 👀
@lens_r @jameshowell @divyaranjan I was thinking an Emacs client for GNU Octave
@tusharhero @jameshowell @divyaranjan I just played with octave and I would absolutely love an Emacs client for it
@jameshowell @lens_r @tusharhero Maybe because it feels too good to be true? :)