本文整理汇总了C++中CImage::GetBitsPtr方法的典型用法代码示例。如果您正苦于以下问题:C++ CImage::GetBitsPtr方法的具体用法?C++ CImage::GetBitsPtr怎么用?C++ CImage::GetBitsPtr使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CImage
的用法示例。
在下文中一共展示了CImage::GetBitsPtr方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CodeToFile
void CDevILCodec::CodeToFile(const nstring & filename, const CImage &image)
{
ILuint imageid;
CDevILFormats informat;
informat.SetExFormat(image.GetPixelFormat());
// Generate the main image name to use.
ilGenImages(1, &imageid);
// Bind this image name.
ilBindImage(imageid);
ilTexImage(image.GetWidth(), image.GetHeight(), image.GetDepth(), informat.GetInternalChannels(),
informat.GetFormat(), IL_UNSIGNED_BYTE, image.GetBitsPtr());
ilSaveImage(filename.c_str());
ilDeleteImages(1, &imageid);
ILenum Error = 0;
if((Error = ilGetError()) != NULL)
{
nstring str("CDevILCodec::CodeToFile: ");
str.append(iluErrorString(Error));
throw NOVA_EXP(str.c_str(), BAD_OPERATION);
}
}
示例2: CodeToBuffer
void CDevILCodec::CodeToBuffer(CMemoryBuffer & out, const CImage &image,
ESaveFormats ext)
{
ILuint imageid;
CDevILFormats informat;
informat.SetExFormat(image.GetPixelFormat());
// Generate the main image name to use.
ilGenImages(1, &imageid);
// Bind this image name.
ilBindImage(imageid);
ilTexImage(image.GetWidth(), image.GetHeight(), image.GetDepth(), informat.GetInternalChannels(),
informat.GetFormat(), IL_UNSIGNED_BYTE, image.GetBitsPtr());
ILenum type = 0;
switch(ext)
{
case SF_BMP:
type = IL_BMP;
break;
case SF_ICO:
type = IL_ICO;
break;
case SF_JPG:
type = IL_JPG;
break;
case SF_PCX:
type = IL_PCX;
break;
case SF_PIC:
type = IL_PIC;
break;
case SF_PNG:
type = IL_PNG;
break;
case SF_TGA:
type = IL_TGA;
break;
case SF_TIF:
type = IL_TIF;
break;
case SF_GIF:
type = IL_GIF;
break;
case SF_DDS:
type = IL_DDS;
break;
case SF_PIX:
type = IL_PIX;
break;
case SF_HDR:
type = IL_HDR;
break;
default:
return;
}
out.AllocBuffer(image.GetSize()+0xff);
ilSaveL(type, out.GetBegin(), out.GetBufferSize());
ilDeleteImages(1, &imageid);
ILenum Error = 0;
if((Error = ilGetError()) != NULL)
{
nstring str("CDevILCodec::CodeToStream: ");
str.append(iluErrorString(Error));
throw NOVA_EXP(str.c_str(), BAD_OPERATION);
}
}