/*************************************************************************** * Copyright (C) 2012 Stefan Bühler * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ #ifndef LIBQNONO_NONOGRAMMARKER_H #define LIBQNONO_NONOGRAMMARKER_H #include namespace libqnono { class NonogramMarker { public: enum Mark { NONE = 0, MARKED = 1, CROSSED = 2 }; NonogramMarker(); NonogramMarker(QSize size); NonogramMarker(const NonogramMarker& other); ~NonogramMarker(); NonogramMarker& operator=(const NonogramMarker& other); bool operator==(const NonogramMarker& other) const; Mark pixel(int x, int y) const { return m_data[y*m_size.width()+x]; } Mark & pixel(int x, int y) { return m_data[y*m_size.width()+x]; } void setPixel(int x, int y, Mark value) { m_data[y*m_size.width()+x] = value; } QSize size() const { return m_size; } bool readFromStream(QDataStream & stream); void writeToStream(QDataStream & stream) const; private: QSize m_size; Mark *m_data; }; QDataStream & operator<<(QDataStream & stream, const NonogramMarker & marker); QDataStream & operator>>(QDataStream & stream, NonogramMarker & marker); } #endif // LIBQNONO_NONOGRAMMARKER_H