Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Can someone explain to me what FB in the Context does?

it's... an array of pixels? does that imply all apps must draw themselves?



Sounds like it's a framebuffer, and yes the apps draw themselves.

Looking at the source code of the cursor app [0], we can see it draws the mouse cursor and skips the rest. The transparent console app [1] is doing something more complicated which I haven't tried to fully understand, but which definitely involves massaging pixels and even temporarily saves pixel data in ctx.store.b1 and ctx.store.b2 so it looks like some kind of double buffering.

  [0]: https://github.com/Ruddle/Fomos/blob/cba0460af59e63f46c7646f8a2f29d574ff0d722/app_cursor/src/main.rs#L75
  [1]: https://github.com/Ruddle/Fomos/blob/cba0460af59e63f46c7646f8a2f29d574ff0d722/app_console/src/main.rs#L384


> The transparent console app [1] is doing something more complicated which I haven't tried to fully understand, (..)

If apps draw themselves, and transparency is involved, this could need:

a) Save background which is overwritten ("damage areas" is a modern description, I think?).

b) Alpha blending - calculating a weighed average between background & what you're overwriting it with.

c) And maybe some kind of text-buffer -> bitmap conversion (if not done ahead of time).

Enough pixel massaging right there.


Does this mean that apps that don't want/need to be visual are still burdened with it?


or ask other apps to draw for them.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: