diff --git a/blog/content/edition-3/posts/03-screen-output/index.md b/blog/content/edition-3/posts/03-screen-output/index.md index db38a1b2..6f961418 100644 --- a/blog/content/edition-3/posts/03-screen-output/index.md +++ b/blog/content/edition-3/posts/03-screen-output/index.md @@ -34,7 +34,7 @@ The complete source code for this post can be found in the [`post-3.3`][post bra -## Recap +## Bitmap Images In the [previous post], we learned how to make our minimal kernel bootable. Using the [`BootInfo`] provided by the bootloader, we were able to access a special memory region called the _[framebuffer]_, which controls the screen output. @@ -59,10 +59,29 @@ fn kernel_main(boot_info: &'static mut BootInfo) -> ! { ``` The reason that the above code affects the screen output is because the graphics card interprets the framebuffer memory as a [bitmap] image. -A bitmap describes an image through a predefined number of bits per pixel. -TODO +A bitmap describes an image through a predefined number of bytes per pixel. +The pixels are laid out line by line, typically starting at the top. [bitmap]: https://en.wikipedia.org/wiki/Bitmap +[RGB]: https://en.wikipedia.org/wiki/Rgb + +For example, the pixels of an image with width 10 and height 3 would be typically stored in this order: + + + + + +
0123456789
10111213141516171819
20212223242526272829
+ +So top left pixel is stored at offset 0 in the bitmap array. +The pixel on its right is at offset `pixel_size`. +The first pixel of the next line starts at offset `line_length * pixel_size`. + +### Padding + +Depending on the hardware and GPU firmware, it is often more efficient + +### Color formats ---