本文整理汇总了C++中CCodecBuffer::WriteBlockRGBA方法的典型用法代码示例。如果您正苦于以下问题:C++ CCodecBuffer::WriteBlockRGBA方法的具体用法?C++ CCodecBuffer::WriteBlockRGBA怎么用?C++ CCodecBuffer::WriteBlockRGBA使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCodecBuffer
的用法示例。
在下文中一共展示了CCodecBuffer::WriteBlockRGBA方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: assert
CodecError CCodec_DXT5::Decompress(CCodecBuffer& bufferIn, CCodecBuffer& bufferOut, Codec_Feedback_Proc pFeedbackProc, CMP_DWORD_PTR pUser1, CMP_DWORD_PTR pUser2)
{
assert(bufferIn.GetWidth() == bufferOut.GetWidth());
assert(bufferIn.GetHeight() == bufferOut.GetHeight());
if(bufferIn.GetWidth() != bufferOut.GetWidth() || bufferIn.GetHeight() != bufferOut.GetHeight())
return CE_Unknown;
const CMP_DWORD dwBlocksX = ((bufferIn.GetWidth() + 3) >> 2);
const CMP_DWORD dwBlocksY = ((bufferIn.GetHeight() + 3) >> 2);
const CMP_DWORD dwBlocksXY = dwBlocksX*dwBlocksY;
bool bUseFixed = (!bufferOut.IsFloat() && bufferOut.GetChannelDepth() == 8 && !m_bUseFloat);
for(CMP_DWORD j = 0; j < dwBlocksY; j++)
{
for(CMP_DWORD i = 0; i < dwBlocksX; i++)
{
CMP_DWORD compressedBlock[4];
bufferIn.ReadBlock(i*4, j*4, compressedBlock, 4);
if(bUseFixed)
{
CMP_BYTE destBlock[BLOCK_SIZE_4X4X4];
DecompressRGBABlock(destBlock, compressedBlock);
bufferOut.WriteBlockRGBA(i*4, j*4, 4, 4, destBlock);
}
else
{
float destBlock[BLOCK_SIZE_4X4X4];
DecompressRGBABlock(destBlock, compressedBlock);
bufferOut.WriteBlockRGBA(i*4, j*4, 4, 4, destBlock);
}
}
if (pFeedbackProc)
{
float fProgress = 100.f * (j * dwBlocksX) / dwBlocksXY;
if (pFeedbackProc(fProgress, pUser1, pUser2))
{
return CE_Aborted;
}
}
}
return CE_OK;
}
示例2:
void CCodec_DXT5_xRBG::WriteBlock(CCodecBuffer& buffer, CMP_DWORD x, CMP_DWORD y, CMP_BYTE block[BLOCK_SIZE_4X4X4])
{
CMP_BYTE dwTempBlock[BLOCK_SIZE_4X4X4];
for(CMP_DWORD i = 0; i < BLOCK_SIZE_4X4; i++)
((DWORD*)dwTempBlock)[i] = SWIZZLE_xRBG_RGBA(((DWORD*)block)[i]);
buffer.WriteBlockRGBA(x, y, 4, 4, dwTempBlock);
}
示例3: Decompress
CodecError CCodec_ATC_RGBA_Interpolated::Decompress(CCodecBuffer& bufferIn, CCodecBuffer& bufferOut, Codec_Feedback_Proc pFeedbackProc, CMP_DWORD_PTR pUser1, CMP_DWORD_PTR pUser2)
{
assert(bufferIn.GetWidth() == bufferOut.GetWidth());
assert(bufferIn.GetHeight() == bufferOut.GetHeight());
if(bufferIn.GetWidth() != bufferOut.GetWidth() || bufferIn.GetHeight() != bufferOut.GetHeight())
return CE_Unknown;
const CMP_DWORD dwBlocksX = ((bufferIn.GetWidth() + 3) >> 2);
const CMP_DWORD dwBlocksY = ((bufferIn.GetHeight() + 3) >> 2);
const CMP_DWORD dwBlocksXY = dwBlocksX*dwBlocksY;
CMP_DWORD compressedBlock[4];
CMP_BYTE destBlock[BLOCK_SIZE_4X4X4];
for(CMP_DWORD j = 0; j < dwBlocksY; j++)
{
for(CMP_DWORD i = 0; i < dwBlocksX; i++)
{
bufferIn.ReadBlock(i*4, j*4, compressedBlock, 4);
DecompressRGBABlock_InterpolatedAlpha(destBlock, compressedBlock);
bufferOut.WriteBlockRGBA(i*4, j*4, 4, 4, destBlock);
}
if (pFeedbackProc)
{
float fProgress = 100.f * (j * dwBlocksX) / dwBlocksXY;
if (pFeedbackProc(fProgress, pUser1, pUser2))
{
return CE_Aborted;
}
}
}
return CE_OK;
}
示例4: Decompress
CodecError CCodec_GT::Decompress(CCodecBuffer& bufferIn, CCodecBuffer& bufferOut, Codec_Feedback_Proc pFeedbackProc, DWORD_PTR pUser1, DWORD_PTR pUser2)
{
assert(bufferIn.GetWidth() == bufferOut.GetWidth());
assert(bufferIn.GetHeight() == bufferOut.GetHeight());
CodecError err = InitializeGTLibrary();
if (err != CE_OK) return err;
if(bufferIn.GetWidth() != bufferOut.GetWidth() || bufferIn.GetHeight() != bufferOut.GetHeight())
return CE_Unknown;
const CMP_DWORD dwBlocksX = ((bufferIn.GetWidth() + 3) >> 2);
const CMP_DWORD dwBlocksY = ((bufferIn.GetHeight() + 3) >> 2);
const CMP_DWORD dwBlocksXY = dwBlocksX*dwBlocksY;
for(CMP_DWORD j = 0; j < dwBlocksY; j++)
{
for(CMP_DWORD i = 0; i < dwBlocksX; i++)
{
union FBLOCKS
{
BYTE decodedBlock[16][4];
BYTE destBlock[BLOCK_SIZE_4X4X4];
} DecData;
union BBLOCKS
{
CMP_DWORD compressedBlock[4];
BYTE out[16];
BYTE in[16];
} CompData;
CMP_BYTE destBlock[BLOCK_SIZE_4X4X4];
bufferIn.ReadBlock(i*4, j*4, CompData.compressedBlock, 4);
// Encode to the appropriate location in the compressed image
m_decoder->DecompressBlock(DecData.decodedBlock,CompData.in);
// Create the block for decoding
int srcIndex = 0;
for(int row=0; row < BLOCK_SIZE_4; row++)
{
for(int col=0; col<BLOCK_SIZE_4; col++)
{
destBlock[srcIndex] = (CMP_BYTE)DecData.decodedBlock[row*BLOCK_SIZE_4+col][BC_COMP_RED];
destBlock[srcIndex+1] = (CMP_BYTE)DecData.decodedBlock[row*BLOCK_SIZE_4+col][BC_COMP_GREEN];
destBlock[srcIndex+2] = (CMP_BYTE)DecData.decodedBlock[row*BLOCK_SIZE_4+col][BC_COMP_BLUE];
destBlock[srcIndex+3] = (CMP_BYTE)DecData.decodedBlock[row*BLOCK_SIZE_4+col][BC_COMP_ALPHA];
srcIndex+=4;
}
}
bufferOut.WriteBlockRGBA(i*4, j*4, 4, 4, destBlock);
}
if (pFeedbackProc)
{
float fProgress = 100.f * (j * dwBlocksX) / dwBlocksXY;
if (pFeedbackProc(fProgress, pUser1, pUser2))
{
#ifdef GT_COMPDEBUGGER
g_CompClient.disconnect();
#endif
return CE_Aborted;
}
}
}
return CE_OK;
}