I'm trying to understand what the ftview demo gblender_lookup_channel
function does. It's not obvious to me, there aren't any comments or
documentation, there is nothing in the mailing list archive, and I did
spend some time tracing it to try to make sense of it. The key =
(GBlenderChanKey)blender->keys + idx; line in particular is confusing to
me because it's casting between two unrelated structs. But in general I
don't know what this function is trying to do, or what it means by keys,
channels and indexes. Any help would be useful. I understand the
concepts of color and alpha blending fine, so it's not a newbie kind of
problem.
GBLENDER_APIDEF( unsigned char* )
gblender_lookup_channel( GBlender blender,
int background,
int foreground )
{
int idx, idx0;
unsigned short backfore = (unsigned short)((foreground << 8) |
background);
GBlenderChanKey key;
idx0 = ( background + foreground*17 ) % (GBLENDER_KEY_COUNT);
idx = idx0;
do
{
key = (GBlenderChanKey)blender->keys + idx;
if ( key->index < 0 )
goto NewNode;
if ( key->backfore == backfore )
goto Exit;
idx = (idx+1) & (GBLENDER_KEY_COUNT-1);
}
while ( idx != idx0 );
NewNode:
key->backfore = backfore;
key->index = (signed short)( idx * GBLENDER_SHADE_COUNT );
gblender_reset_channel_key( blender, key );
Exit:
return (unsigned char*)blender->cells + key->index;
}
_______________________________________________
Freetype mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/freetype