help-grub
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Grub2 Graphics In OS


From: Tristan ross
Subject: Grub2 Graphics In OS
Date: Thu, 15 Dec 2016 11:29:11 -0800

   Hey, I've got my os to boot with grub2 and it goes into graphics mode.
   I'm trying to set the rgb color of pixels but I just get blue when I
   run my function to generate an rgb color.

   Code is at [1]https://github.com/SpaceboyRoss01/ronix

   Â

   Code to generate color:

   unsigned int graphics_color(int r,int g,int b) {
   Â Â Â  unsigned int color = ((r*1000)+(g*100)+(b*10));
   Â Â Â  switch(graphics_mbi->framebuffer_type) {
   Â Â Â Â Â Â Â  case MULTIBOOT_FRAMEBUFFER_TYPE_RGB:
   Â Â Â Â Â Â Â Â Â Â Â  color = ((r <<
   graphics_mbi->framebuffer_red_mask_size) - r) <<
   graphics_mbi->framebuffer_red_field_position;
   Â Â Â Â Â Â Â Â Â Â Â  color += ((g <<
   graphics_mbi->framebuffer_green_mask_size) - g) <<
   graphics_mbi->framebuffer_green_field_position;
   Â Â Â Â Â Â Â Â Â Â Â  color += ((b <<
   graphics_mbi->framebuffer_blue_mask_size) - b) <<
   graphics_mbi->framebuffer_blue_field_position;
   Â Â Â Â Â Â Â Â Â Â Â  break;
   Â Â Â Â Â Â Â  case MULTIBOOT_FRAMEBUFFER_TYPE_EGA_TEXT:
   Â Â  Â Â Â Â Â Â Â Â  color = '\\' | ((r*1000)+(g*100)+(b*10));
   Â Â  Â Â Â Â Â Â Â Â  break;
   Â Â Â  }
   Â Â Â  #ifdef DEBUG
   Â Â Â  debugf("RGB(%d,%d,%d) = %d\n",r,g,b,color);
   Â Â Â  #endif
   Â Â Â  return color;
   }
   Â
   I'm running graphics_color(255,255,255) which returns -50200321
   How do I fix this so it returns 16777215
   I used the grub2 multiboot documentation.

References

   1. https://github.com/SpaceboyRoss01/ronix


reply via email to

[Prev in Thread] Current Thread [Next in Thread]