void Bitmap::readScanLines(std::istream &sourceStream){
		for (int row = 0; row < height; ++row)
		{
			ScanLine scanLine;
			
			for (int column = 0; column < width; ++column)
			{
				scanLine.push_back(RGBColor::read(sourceStream));
			}
			
			scanLines.push_back(scanLine);
		}
	}
Пример #2
0
void Bitmap::readRawData(std::istream& sourceStream)
{
	int numberOfScanLines = 0;
	while (numberOfScanLines < mHeight)
	{
		ScanLine curScanLine;
		int lineByteCount = 0;
		while (lineByteCount < mWidth)
		{
			curScanLine.push_back(Color::read(sourceStream));
			lineByteCount++; //do checking instead of this for the padding cases
		}
		//check for padding
		for (int i = 0; i < getNumberOfPadBytes(); i++) sourceStream.get();
		mScanLineCollection.push_back(curScanLine);
		numberOfScanLines++;
	}
}
Пример #3
0
void Bitmap::read(std::istream& sourceStream)
{
    myScanLines.clear();
    
    for (int row = 0; row < myHeight; ++row)
    {
        ScanLine scanLine;

        for (int column = 0; column < myWidth; ++column)
        {
            scanLine.push_back(Color::read(sourceStream));
        }

        // Read pad bytes
        for (int pad = 0; pad < myNumberOfPadBytes; ++pad)
        {
            Binary::Byte::read(sourceStream);
        }

        myScanLines.push_back(scanLine);
    }
}