/*************************************************************************** * Copyright (C) 2008 by Oliver Groß * * z.o.gross@gmx.de * * * * 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 LIBQCROSS_CMONOPICTURE_H #define LIBQCROSS_CMONOPICTURE_H #include #include #include class QImage; namespace libqcross { class CNonogram { public: typedef QVector NumbersVector; CNonogram(); CNonogram(QSize size); ~CNonogram(); void loadFromImage(QImage & image); void resize(QSize size); QString name() const { return m_Name; } void setName(QString value) { m_Name = value; } quint16 timeout() const { return m_Timeout; } void setTimeout(quint16 value) { m_Timeout = value; } int width() const { return m_Size.width(); } int height() const { return m_Size.height(); } bool pixel(int x, int y) const { return m_Data[x][y]; } void setPixel(int x, int y, bool value); NumbersVector & rowNumbers(int index) const { return m_RowNumbers[index]; } NumbersVector & columnNumbers(int index) const { return m_ColumnNumbers[index]; } int maximumNumberCount() const { return m_MaximumNumberCount; } quint32 blackPixels() const { return m_BlackPixels; } void updateNumbers(); void fill(bool value); bool isValid() const { return m_Data; } protected: QSize m_Size; bool ** m_Data; QString m_Name; quint16 m_Timeout; NumbersVector * m_RowNumbers; NumbersVector * m_ColumnNumbers; quint32 m_BlackPixels; int m_MaximumNumberCount; void cleanup(); void init(); }; } #endif