Add imgtype_shift() and imgtype_line_size().

This commit is contained in:
David Capello 2010-10-10 21:17:59 -03:00
parent 27fe8f2ffe
commit 5b93db64ba

View File

@ -100,10 +100,20 @@ void image_resize(const Image* src, Image* dst, ResizeMethod method, const Palet
int image_count_diff(const Image* i1, const Image* i2);
bool image_shrink_rect(Image *image, int *x1, int *y1, int *x2, int *y2, int refpixel);
inline int imgtype_shift(int imgtype)
{
return ((imgtype == IMAGE_RGB)? 2:
(imgtype == IMAGE_GRAYSCALE)? 1: 0);
}
inline int image_shift(const Image* image)
{
return ((image->imgtype == IMAGE_RGB)? 2:
(image->imgtype == IMAGE_GRAYSCALE)? 1: 0);
return imgtype_shift(image->imgtype);
}
inline int imgtype_line_size(int imgtype, int width)
{
return (width << imgtype_shift(imgtype));
}
inline int image_line_size(const Image* image, int width)