07-24-2007 03:08 AM
07-24-2007 07:14 AM
07-27-2007 03:16 AM - edited 07-27-2007 03:16 AM
Good spot, Martin. As such a routine is likely to be handling tens or hundreds of thousands of pixels at a time, I would tend to use a logically equivalent but more efficient byte swapping approach, for both (
) functions:
long RGBtoBGR (long patt) {
char tmp;
union {long word; char byte [4];} u;
u.word = patt;
tmp = u.byte [0];
u.byte [0] = u.byte [2];
u.byte [2] = tmp;
return u.word;
}
JR
Message Edited by jr_2005 on 07-27-2007 09:16 AM