MuseScore  3.4
Music composition and notation
pattern.h
Go to the documentation of this file.
1 //=============================================================================
2 // MusE Reader
3 // Music Score Reader
4 //
5 // Copyright (C) 2010 Werner Schweer
6 //
7 // This program is free software; you can redistribute it and/or modify
8 // it under the terms of the GNU General Public License version 2.
9 //
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
14 //
15 // You should have received a copy of the GNU General Public License
16 // along with this program; if not, write to the Free Software
17 // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18 //=============================================================================
19 
20 #ifndef __PATTERN_H__
21 #define __PATTERN_H__
22 
23 #include "libmscore/score.h"
24 
25 namespace Ms {
26 
27 enum class SymId;
28 class Sym;
29 
30 //---------------------------------------------------------
31 // Pattern
32 // _n % sizeof(int) is zero, patterns are 32bit padded
33 //---------------------------------------------------------
34 
35 class Pattern {
36  protected:
37  QImage _image;
39  QPoint _base;
41  float **model;
42  int rows;
43  int cols;
44 
45  public:
46  Pattern();
47  ~Pattern();
48  Pattern(Score *s, SymId id, double spatium);
49  Pattern(Score *s, QString name);
50  Pattern(QImage*, int, int, int, int);
51 
52  double match(const Pattern*) const;
53  double match(const QImage* , int , int ) const;
54  double match(const QImage* img, int col, int row, double bg_parm) const;
55 
56  void dump() const;
57  const QImage* image() const { return &_image; }
58  int w() const { return cols; /*_image.width();*/ }
59  int h() const { return rows; /*_image.height();*/ }
60  bool dot(int x, int y) const;
61  SymId id() const { return _id; }
62  void setId(SymId val) { _id = val; }
63  const QPoint& base() const { return _base; }
64  void setBase(const QPoint& v) { _base = v; }
65  };
66 }
67 
68 #endif
69 
SymId id() const
Definition: pattern.h:61
Definition of Score class.
void setId(SymId val)
Definition: pattern.h:62
Definition: pattern.h:35
SymId
Definition: sym.h:30
bool dot(int x, int y) const
Definition: pattern.cpp:250
Definition: score.h:391
QImage _image
Definition: pattern.h:37
float ** model
Definition: pattern.h:41
int w() const
Definition: pattern.h:58
double match(const Pattern *) const
Definition: pattern.cpp:54
Definition: aeolus.cpp:26
const QImage * image() const
Definition: pattern.h:57
const QPoint & base() const
Definition: pattern.h:63
SymId _id
Definition: pattern.h:38
void dump() const
Definition: pattern.cpp:234
int rows
Definition: pattern.h:42
int h() const
Definition: pattern.h:59
~Pattern()
Definition: pattern.cpp:36
QPoint _base
Definition: pattern.h:39
Score * _score
Definition: pattern.h:40
void setBase(const QPoint &v)
Definition: pattern.h:64
int cols
Definition: pattern.h:43
Pattern()
Definition: pattern.cpp:32