本文整理汇总了C++中CDDSImage::GetSize方法的典型用法代码示例。如果您正苦于以下问题:C++ CDDSImage::GetSize方法的具体用法?C++ CDDSImage::GetSize怎么用?C++ CDDSImage::GetSize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CDDSImage
的用法示例。
在下文中一共展示了CDDSImage::GetSize方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CompressToDDS
void CompressToDDS(SDL_Surface* image, unsigned int format, CDDSImage &out)
{
// Convert to ARGB
SDL_PixelFormat argbFormat;
memset(&argbFormat, 0, sizeof(SDL_PixelFormat));
argbFormat.BitsPerPixel = 32;
argbFormat.BytesPerPixel = 4;
#if SDL_BYTEORDER == SDL_LIL_ENDIAN
argbFormat.Amask = 0xff000000;
argbFormat.Ashift = 24;
argbFormat.Rmask = 0x00ff0000;
argbFormat.Rshift = 16;
argbFormat.Gmask = 0x0000ff00;
argbFormat.Gshift = 8;
argbFormat.Bmask = 0x000000ff;
argbFormat.Bshift = 0;
#else
argbFormat.Amask = 0x000000ff;
argbFormat.Ashift = 0;
argbFormat.Rmask = 0x0000ff00;
argbFormat.Rshift = 8;
argbFormat.Gmask = 0x00ff0000;
argbFormat.Gshift = 16;
argbFormat.Bmask = 0xff000000;
argbFormat.Bshift = 24;
#endif
SDL_Surface *argbImage = SDL_ConvertSurface(image, &argbFormat, 0);
double colorMSE, alphaMSE;
if (format == XB_FMT_DXT1)
CompressImage((squish::u8 *)argbImage->pixels, image->w, image->h, out.GetData(), squish::kDxt1, colorMSE, alphaMSE);
else if (format == XB_FMT_DXT5)
CompressImage((squish::u8 *)argbImage->pixels, image->w, image->h, out.GetData(), squish::kDxt5, colorMSE, alphaMSE);
// print some info about the resulting image
printf("Size: %dx%d %s in %u bytes. Quality: %5.2f\n", image->w, image->h, GetFormatString(format), out.GetSize(), colorMSE);
SDL_FreeSurface(argbImage);
}