Re: [AD] getpixel conflict with alpha blended sprites |
[ Thread Index |
Date Index
| More lists.liballeg.org/allegro-developers Archives
]
> I thought reading alpha was a typical way of using getpixel().
> And it is already trivial to check if you are reading outside
> the bitmap, by comparing with BITMAP->cl, BITMAP->cr,
> BITMAP->ct, BITMAP->cb.
Perhaps another function could be added,
"set_getpixel_use_alpha_channel(bool)" or something, so that it wouldn't
break existing programs but if the user wanted to, they could ask it to mask
out the alpha channel?
Yes, the bounds check can be done with the bitmap struct members - the
problem then becomes either:
(1) you call getpixel anyway, but then the bounds checking code is done
twice
(2) you use a switch statement to find out which _getpixel function to use
depending on the bitmap color depth
in performance critical code, neither of these are ideal solutions, so
perhaps a new vtable entry for a "_getpixel" function for the bitmap which
would just return the pixel without bounds checking could be added?