本文整理汇总了C++中Texture::Clear方法的典型用法代码示例。如果您正苦于以下问题:C++ Texture::Clear方法的具体用法?C++ Texture::Clear怎么用?C++ Texture::Clear使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Texture
的用法示例。
在下文中一共展示了Texture::Clear方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: img
void ESSUB_LoadPNG (const std::string& aPath, Texture** aTexture)
{
assert(aTexture);
wchar_t buffer[1024];
MultiByteToWideChar(CP_UTF8, 0, aPath.c_str(), -1, buffer, 512);
Texture* output = 0;
Bitmap img(buffer, false);
if(img.GetWidth())
{
output = ESVideo::CreateTexture(img.GetWidth(), img.GetHeight(), true);
output->Clear(0);
BitmapData BMData;
BMData.Width = std::min(output->GetWidth(), img.GetWidth());
BMData.Height = std::min(output->GetHeight(), img.GetHeight());
BMData.Stride = output->GetWidth() * 4;
BMData.PixelFormat = PixelFormat32bppARGB;
BMData.Scan0 = output->Map();
BMData.Reserved = 0;
Rect area(0, 0, img.GetWidth(), img.GetHeight());
img.LockBits(&area, ImageLockModeRead | ImageLockModeUserInputBuf, PixelFormat32bppARGB, &BMData);
img.UnlockBits(&BMData);
output->Unmap();
}
*aTexture = output;
}
示例2:
Texture* GetTexture ()
{
Texture* output = 0;
if(Valid)
{
output = ESVideo::CreateTexture(Width, Height, true);
output->Clear(0);
uint32_t copyWidth = std::min(Width, output->GetWidth());
uint32_t copyHeight = std::min(Height, output->GetHeight());
uint32_t* texPixels = output->Map();
for(int i = 0; i != copyHeight; i ++)
{
uint32_t* dest = texPixels + (output->GetPitch() * i);
uint8_t* source = RowPointers[i];
for(int j = 0; j != copyWidth; j ++)
{
uint32_t a = (InfoPtr->color_type == PNG_COLOR_TYPE_RGB_ALPHA) ? *source++ : 0xFF;
uint32_t r = *source ++;
uint32_t g = *source ++;
uint32_t b = *source ++;
*dest++ = output->ConvertPixel(r, g, b, a);
}
}
output->Unmap();
}
return output;
}