delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/09/03/15:52:02

From: "Jose Agustin Vericat" <frodobolson AT redestb DOT es>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: 16bpp PutPixel
Date: 1 Sep 1997 23:30:54 GMT
Organization: Unisource Espana NEWS SERVER
Lines: 26
Message-ID: <01bcb72a$bda13760$LocalHost@jose>
References: <19970816190400 DOT PAA15010 AT ladder02 DOT news DOT aol DOT com>
NNTP-Posting-Host: ppp77.80.redestb.es
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

You only need to rotate the colors, using this function:

int makecol16 (int r, int g, int b)
{
   return (((r>>3) << r_shift) |
             ((g>>2) << g_shift) |
             ((b>>3) << b_shift));

The r_shift, g_shift and b_shift are the position of these colors in the
packed 16 bits color mode. Usually they are 0 for b_shift, 5 for green and
11 for red, but if you want to be sure, use the values given by the VESA
driver.

Hope that this helps!

Jose Agustin Vericat a.k.a. frodobolson

> Hi,
> 
> I'm having trouble getting a putpixel function to work in VESA2 16bpp
> modes. My program uses 24bpp internal rendering, and so I would
appreciate
> if someone could post a 24->16bpp converter. Thanks in advance.
> 
> Gingko
> 

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019