public bool GetNextPixel(ref int x, ref int y, ref Color color)
{
x = OffsetX + _pixelCounter % Width;
y = OffsetY + _pixelCounter / Width;
while (_bytePosition < _data.Length)
{
if (0 == _data[_bytePosition])
{
//swap color
_currColor = _currColor == Color.White ? Color.Black : Color.White;
++_bytePosition;
continue;
}
if (_counter < _data[_bytePosition])
{
color = _currColor;
++_counter;
++_pixelCounter;
return true;
}
else
{
//swap color
_currColor = _currColor == Color.White ? Color.Black : Color.White;
//move byte position
++_bytePosition;
//reset counter
_counter = 0;
}
}
return false;
}
}