ex12bit(3alleg4)


NAME

   ex12bit - How to fake a 12-bit truecolor mode on an 8-bit card. Allegro
   game programming library.

SYNOPSIS

   #include <allegro.h>

   Example ex12bit

DESCRIPTION

   This program sets up a 12-bit mode on any 8-bit card, by setting  up  a
   256-colour  palette  that  will  fool  the  eye into grouping two 8-bit
   pixels into one 12-bit pixel. In  order  to  do  this,  you  make  your
   256-colour  palette  with  all  the  combinations  of  blue  and green,
   assuming green ranges from 0-15 and  blue  from  0-14.  This  takes  up
   16x15=240  colours.  This  leaves  16 colours to use as red (red ranges
   from 0-15).  Then you put your green/blue in one pixel, and your red in
   the  pixel  next  to it. The eye gets fooled into thinking it's all one
   pixel.

   The example starts setting a normal 256 color  mode,  and  construct  a
   special  palette for it. But then comes the trick: you need to write to
   a set of two adjacent pixels to form a single 12 bit dot. Two eight bit
   pixels is the same as one 16 bit pixel, so after setting the video mode
   you need to hack  the  screen  bitmap  about,  halving  the  width  and
   changing  it to use the 16 bit drawing code. Then, once you have packed
   a color into the correct format (using the makecol12() function below),
   any  of  the  normal Allegro drawing functions can be used with this 12
   bit display!

   Things to note:

   The horizontal width is halved, so you get  resolutions  like  320x480,
   400x600, and 512x768.

   Because  each dot is spread over two actual pixels, the display will be
   darker than in a normal video mode.

   Any bitmap data will obviously need converting to the  correct  12  bit
   format: regular 15 or 16 bit images won't display correctly...

   Although  this  works like a truecolor mode, it is actually using a 256
   color palette, so palette fades are still possible!

   This code only works in linear screen modes (don't try Mode-X).

SEE ALSO

   BITMAP(3alleg4),         END_OF_MAIN(3alleg4),         MATRIX(3alleg4),
   PALETTE(3alleg4),         RGB(3alleg4),         allegro_error(3alleg4),
   allegro_init(3alleg4), allegro_message(3alleg4), apply_matrix(3alleg4),
   blit(3alleg4),          circle(3alleg4),         clear_bitmap(3alleg4),
   clear_keybuf(3alleg4), clear_to_color(3alleg4), create_bitmap(3alleg4),
   create_bitmap_ex(3alleg4),                     destroy_bitmap(3alleg4),
   ellipsefill(3alleg4),        fade_out(3alleg4),        fixcos(3alleg4),
   fixed(3alleg4),    fixsin(3alleg4),   fixtoi(3alleg4),   font(3alleg4),
   get_rotation_matrix(3alleg4),                        getpixel(3alleg4),
   install_keyboard(3alleg4),     itofix(3alleg4),    keypressed(3alleg4),
   line(3alleg4),         makecol(3alleg4),          masked_blit(3alleg4),
   putpixel(3alleg4),       screen(3alleg4),       set_clip_rect(3alleg4),
   set_color(3alleg4),    set_gfx_mode(3alleg4),     set_palette(3alleg4),
   text_height(3alleg4),     text_length(3alleg4),    textout_ex(3alleg4),
   textprintf_ex(3alleg4)





Opportunity


Personal Opportunity - Free software gives you access to billions of dollars of software at no cost. Use this software for your business, personal use or to develop a profitable skill. Access to source code provides access to a level of capabilities/information that companies protect though copyrights. Open source is a core component of the Internet and it is available to you. Leverage the billions of dollars in resources and capabilities to build a career, establish a business or change the world. The potential is endless for those who understand the opportunity.

Business Opportunity - Goldman Sachs, IBM and countless large corporations are leveraging open source to reduce costs, develop products and increase their bottom lines. Learn what these companies know about open source and how open source can give you the advantage.





Free Software


Free Software provides computer programs and capabilities at no cost but more importantly, it provides the freedom to run, edit, contribute to, and share the software. The importance of free software is a matter of access, not price. Software at no cost is a benefit but ownership rights to the software and source code is far more significant.


Free Office Software - The Libre Office suite provides top desktop productivity tools for free. This includes, a word processor, spreadsheet, presentation engine, drawing and flowcharting, database and math applications. Libre Office is available for Linux or Windows.





Free Books


The Free Books Library is a collection of thousands of the most popular public domain books in an online readable format. The collection includes great classical literature and more recent works where the U.S. copyright has expired. These books are yours to read and use without restrictions.


Source Code - Want to change a program or know how it works? Open Source provides the source code for its programs so that anyone can use, modify or learn how to write those programs themselves. Visit the GNU source code repositories to download the source.





Education


Study at Harvard, Stanford or MIT - Open edX provides free online courses from Harvard, MIT, Columbia, UC Berkeley and other top Universities. Hundreds of courses for almost all major subjects and course levels. Open edx also offers some paid courses and selected certifications.


Linux Manual Pages - A man or manual page is a form of software documentation found on Linux/Unix operating systems. Topics covered include computer programs (including library and system calls), formal standards and conventions, and even abstract concepts.