21
21
//-------------------------------------------------------------------------------------
23
#ifndef __LOMSE__BASIC_H__
24
#define __LOMSE__BASIC_H__
23
#ifndef __LOMSE_BASIC_H__
24
#define __LOMSE_BASIC_H__
32
32
#define textdomain(Domain)
33
33
#define bindtextdomain(Package, Directory)
35
//----------------------------------------------------------------------------------
39
// members are public to simplify.
43
42
FloatPoint() : x(0.0f), y(0.0f) { }
55
54
FloatPoint& operator-=(const FloatPoint& pt) { x -= pt.x; y -= pt.y; return *this; }
57
//----------------------------------------------------------------------------------
64
FloatSize() : width(0.0f), height(0.0f) {}
65
FloatSize(float w, float h) : width(w), height(h) {}
67
// no copy ctor or assignment operator - the defaults are ok
69
bool operator==(const FloatSize& sz) const { return width == sz.width && height == sz.height; }
70
bool operator!=(const FloatSize& sz) const { return width != sz.width || height != sz.height; }
72
FloatSize operator+(const FloatSize& sz) const { return FloatSize(width + sz.width, height + sz.height); }
73
FloatSize operator-(const FloatSize& sz) const { return FloatSize(width - sz.width, height - sz.height); }
74
FloatSize operator/(float i) const { return FloatSize(width / i, height / i); }
75
FloatSize operator*(float i) const { return FloatSize(width * i, height * i); }
77
FloatSize& operator+=(const FloatSize& sz) { width += sz.width; height += sz.height; return *this; }
78
FloatSize& operator-=(const FloatSize& sz) { width -= sz.width; height -= sz.height; return *this; }
79
FloatSize& operator/=(const float i) { width /= i; height /= i; return *this; }
80
FloatSize& operator*=(const float i) { width *= i; height *= i; return *this; }
59
84
typedef float Tenths; //relative unit: one tenth of staff interline space
60
85
typedef FloatPoint TPoint; //point, in Tenths
86
typedef FloatSize TSize; //size, in Tenths
87
typedef float LUnits; //absolute unit (logical unit): one cent of mm
88
typedef FloatPoint UPoint; //point, in LUnits
89
typedef FloatSize USize; //size, in LUnits
61
90
typedef unsigned short int16u;
63
92
//------------------------------------------------------------------------------
80
base_scale = 1 << base_shift,
81
base_mask = base_scale - 1
84
111
rgba16() : r(0), g(0), b(0), a(base_mask) {}
92
119
rgba16(const rgba16& c, unsigned a_) :
93
120
r(c.r), g(c.g), b(c.b), a(int16u(a_)) {}
122
bool operator == (rgba16 color)
124
return r == color.r && g == color.g && b == color.b && a == color.a ;
95
127
bool operator != (rgba16 color)
97
129
return r != color.r || g != color.g || b != color.b || a != color.a ;
111
143
static rgba16 no_color() { return rgba16(0,0,0,0); }
118
148
} //namespace lomse
120
#endif // __LOMSE__BASIC_H__
150
#endif // __LOMSE_BASIC_H__