File indexing completed on 2024-04-21 04:32:12
0001 /* 0002 * Copyright (C) 2012-2015 by Stephen Allewell 0003 * steve.allewell@gmail.com 0004 * 0005 * This program is free software; you can redistribute it and/or modify 0006 * it under the terms of the GNU General Public License as published by 0007 * the Free Software Foundation; either version 2 of the License, or 0008 * (at your option) any later version. 0009 */ 0010 0011 #ifndef Pattern_H 0012 #define Pattern_H 0013 0014 #include "DocumentPalette.h" 0015 #include "StitchData.h" 0016 0017 class Document; 0018 0019 class Pattern 0020 { 0021 public: 0022 explicit Pattern(Document *document = nullptr); 0023 0024 void clear(); 0025 0026 Document *document(); 0027 DocumentPalette &palette(); 0028 StitchData &stitches(); 0029 0030 Pattern *cut(const QRect &area, int colorMask, const QList<Stitch::Type> &stitchMask, bool excludeBackstitches, bool excludeKnots); 0031 Pattern *copy(const QRect &area, int colorMask, const QList<Stitch::Type> &stitchMask, bool excludeBackstitches, bool excludeKnots); 0032 void paste(Pattern *pattern, const QPoint &cell, bool merge); 0033 0034 friend QDataStream &operator<<(QDataStream &stream, const Pattern &pattern); 0035 friend QDataStream &operator>>(QDataStream &stream, Pattern &pattern); 0036 0037 private: 0038 static const int version = 100; 0039 0040 void constructPalette(Pattern *pattern); 0041 0042 Document *m_document; 0043 DocumentPalette m_documentPalette; 0044 StitchData m_stitchData; 0045 }; 0046 0047 QDataStream &operator<<(QDataStream &, const Pattern &); 0048 QDataStream &operator>>(QDataStream &, Pattern &); 0049 0050 #endif // Pattern_H