void PLPGMDecoder::readData ( PLBmpBase * pBmp, PLDataSource * pDataSrc ) { int Width = m_PGMHeader.ImageWidth; int Height = m_PGMHeader.ImageHeight; PLBYTE * pDest; PLBYTE ** pLineArray = pBmp->GetLineArray(); int y; if (m_PGMHeader.ImageType == PGM_P2) { skipPgmASCIISeparators(pDataSrc); m_UseLastByte = true; } for (y=0; y < Height; y++) { pDest = pLineArray[y]; if (m_PGMHeader.ImageType==PGM_P5) // P5 expandByteLine (pDest, m_PGMHeader.MaxGrayValue, Width, pDataSrc); else // P2 expandASCIILine (pDest, m_PGMHeader.MaxGrayValue, Width, pDataSrc); } }
void PLPPMDecoder::readData(PLBmpBase *pBmp, PLDataSource *pDataSrc) { int Width = m_PPMHead.ImageWidth; int Height = m_PPMHead.ImageHeight; PLPixel32 ** pLineArray = pBmp->GetLineArray32(); if (m_PPMHead.ImageType == PPM_P3) { skipPpmASCIISeparators(pDataSrc); m_UseLastByte = true; } for (int y=0; y < Height; y++) { PLPixel32 *pDest = pLineArray[y]; if (m_PPMHead.ImageType==PPM_P6) // P6 expandByteLine (pDest, m_PPMHead.MaxSampleValue, Width, pDataSrc); else // P3 expandASCIILine (pDest, m_PPMHead.MaxSampleValue, Width, pDataSrc); } }