Message-ID: <335BAF42.4010@mcs.nl> Date: Mon, 21 Apr 1997 20:17:38 +0200 From: Peter Zijlstra Reply-To: peter AT mcs DOT nl Organization: Zembla MIME-Version: 1.0 To: Alessandro Moure CC: DJGPP mailing list 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> Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Precedence: bulk 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