Mail Archives: djgpp/1997/04/21/15:31:09
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 -