Luc,

I use this function in SrcEdit. http://srcedit.brainsware.org
It has been proven working for me, but i can't ensure you a BUG-less function. 
:)

> I wrote earlier:
> 
> > Given a color index or RGB color value, how can I find the
> > inverted color I would get if I used an API like WinInvertPixel
> > on a pixel of the said color?

Hope you could do with this one:

IndexedColorType invertIndexedColor(IndexedColorType col){
        UInt32 supportedDepth = 0;
    if(gRomVersion >= version35){
            RGBColorType rgb;
            // check for real black
            if(col>0xe5) col = 0xff;
            WinIndexToRGB(col,&rgb);
            // convert RGBColorType
            rgb.index = 255 - rgb.index;
            rgb.r = 255 - rgb.r;
            rgb.g = 255 - rgb.g;
            rgb.b = 255 - rgb.b;
        return WinRGBToIndex(&rgb);
    }
    else{
        
ScrDisplayMode(scrDisplayModeGetSupportedDepths,NULL,NULL,&supportedDepth,NULL);
        return(IndexedColorType)supportedDepth - col;
    }
}

> I tried shifting the color index by half the number of available colors but 
> that does not exactly correspond to the inverted color (ex. 255/black becomes 
> 127 or ... brownish green).
> 
> So, how do APIs like WinInvertPixel do that? Ben would know...
> 
> 
> Luc Le Blanc 

Sincerely

/John
/John

-- 
For information on using the ACCESS Developer Forums, or to unsubscribe, please 
see http://www.access-company.com/developers/forums/

Reply via email to