delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/04/21/15:31:09

Message-ID: <335BAF42.4010@mcs.nl>
Date: Mon, 21 Apr 1997 20:17:38 +0200
From: Peter Zijlstra <peter AT mcs DOT nl>
Reply-To: peter AT mcs DOT nl
Organization: Zembla
MIME-Version: 1.0
To: Alessandro Moure <moure AT sercomtel DOT com DOT br>
CC: DJGPP mailing list <djgpp AT delorie DOT com>
Subject: Re: 32k color mode.
References: <3356522F DOT 485D AT pop DOT sercomtel DOT com DOT br> <335889E3 DOT 7A2D AT mcs DOT nl> <335917B6 DOT 2678 AT pop DOT sercomtel DOT com DOT br>

Alessandro Moure wrote:
> 
>         The best thing in working with a customizable color palette, in my
> point of view, come from the fact that if you change the colorīs setting
> in the palette, you will see this new color in the video without having
> to replot the image.
>         If you have pixels with GrSetColor(20,255,0,0), for example, and want
> to change the color of only these pixels, you only have to change the
> setting of color 20, ie, GrSetColor(20,0,255,0).
>         When in 256 colors mode we can use GrSetColor, but what can we do when
> working with 32k colors mode?

Just the thing you didnīt wanted to do, REPLOT THE IMAGE, or at least
those 
pixels you actually wanted to change.

>         One other question: Is there a function to read the color of the pixel
> that is under the mouse cursor?

Donīt know any lib-functions - other than my own - that do that, but
writing 
one would not be that difficult. Get the mouse.x and mouse.y then:

inline unsigned short get_screen_colour( unsigned int arg_x, unsigned
int arg_y) {

	extern unsigned short screen[];	/* screen bitmap/virtual page */

	return screen[ mouse.y * screen.width + mouse.x];
}

this should do the trick. Now your return value is the 5:5:5 RGB value -
or for that matter any other weigthing your V.card likes - that you put 
in there.

Hope this all makes some sense :)

greetinx and some happy coding,

Peter


- Raw text -


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