Mercurial > projects > qtd
comparison qt/core/QPoint.d @ 3:323efbe5c2f7
native wrap of QLine and QLineF, fixes in opEquals, updated QPainter to the use of native structs
author | eldar |
---|---|
date | Wed, 13 May 2009 17:34:40 +0000 |
parents | e78566595089 |
children |
comparison
equal
deleted
inserted
replaced
2:ee8e70aca95e | 3:323efbe5c2f7 |
---|---|
33 void x(int xpos) | 33 void x(int xpos) |
34 { xp = xpos; } | 34 { xp = xpos; } |
35 | 35 |
36 void y(int ypos) | 36 void y(int ypos) |
37 { yp = ypos; } | 37 { yp = ypos; } |
38 | 38 |
39 void setX(int xpos) // for convenience | |
40 { xp = xpos; } | |
41 | |
42 void setY(int ypos) // for convenience | |
43 { yp = ypos; } | |
44 | |
39 public final int manhattanLength() { | 45 public final int manhattanLength() { |
40 return qtd_QPoint_manhattanLength(this); | 46 return qtd_QPoint_manhattanLength(this); |
41 } | 47 } |
42 /* | 48 /* |
43 inline int &rx() | 49 inline int &rx() |
54 { xp-=p.xp; yp-=p.yp; return *this; } | 60 { xp-=p.xp; yp-=p.yp; return *this; } |
55 | 61 |
56 QPoint opMulAssign(qreal c) | 62 QPoint opMulAssign(qreal c) |
57 { xp = qRound(xp*c); yp = qRound(yp*c); return *this; } | 63 { xp = qRound(xp*c); yp = qRound(yp*c); return *this; } |
58 | 64 |
59 bool opEquals(ref QPoint p1, ref QPoint p2) | 65 bool opEquals(ref QPoint p) |
60 { return p1.xp == p2.xp && p1.yp == p2.yp; } | 66 { return xp == p.xp && yp == p.yp; } |
61 | 67 |
62 QPoint opAdd(ref QPoint p) | 68 QPoint opAdd(ref QPoint p) |
63 { return QPoint(this.xp+p.xp, this.yp+p.yp); } | 69 { return QPoint(this.xp+p.xp, this.yp+p.yp); } |
64 | 70 |
65 QPoint opSub(ref QPoint p) | 71 QPoint opSub(ref QPoint p) |
168 { xp-=p.xp; yp-=p.yp; return *this; } | 174 { xp-=p.xp; yp-=p.yp; return *this; } |
169 | 175 |
170 QPointF opMulAssign(qreal c) | 176 QPointF opMulAssign(qreal c) |
171 { xp*=c; yp*=c; return *this; } | 177 { xp*=c; yp*=c; return *this; } |
172 | 178 |
173 bool opEquals(ref QPointF p1, ref QPointF p2) | 179 bool opEquals(ref QPointF p) |
174 { return qFuzzyCompare(p1.xp, p2.xp) && qFuzzyCompare(p1.yp, p2.yp); } | 180 { return qFuzzyCompare(xp, p.xp) && qFuzzyCompare(yp, p.yp); } |
175 | 181 |
176 QPointF opAdd(ref QPointF p) | 182 QPointF opAdd(ref QPointF p) |
177 { return QPointF(this.xp+p.xp, this.yp+p.yp); } | 183 { return QPointF(this.xp+p.xp, this.yp+p.yp); } |
178 | 184 |
179 QPointF opSub(ref QPointF p) | 185 QPointF opSub(ref QPointF p) |