xlang v4.0 Release
程序设计语言基础库文档
载入中...
搜索中...
未找到
QMatrix.xcsm
浏览该文件的文档.
1//xlang Source, Name:QMatrix.xcsm
2//Date: Mon Oct 23:07:48 2018
3package Qt{
4 @SuppressWarnings public class QMatrix : QCore{
5 public QMatrix(double m11, double m12, double m21, double m22,
6 double dx, double dy )
7 {
8 double [] param = new double[]{m11, m12, m21, m22, dx, dy};
9 nativehandle = QtXnl.createPObject(QType.qtMatrix, param);
10 }
11
12 public QMatrix(){
13 nativehandle = QtXnl.createNObject(QType.qtMatrix, 0);
14 }
15 public QMatrix(double [] param){
16 nativehandle = QtXnl.createPObject(QType.qtMatrix, param);
17 }
18 public QMatrix(QMatrix m){
19 double [] param = m.getValues();
20 nativehandle = QtXnl.createPObject(QType.qtMatrix, param);
21 }
22
23 public QMatrix(long h){
24 nativehandle = h;
25 }
26
27 public double [] getValues(){
28 double [] param = new double[6];
29 QtXnl.int_get_valuep(nativehandle, Constant.QMATRIX_GET_VALUES, param);
30 return param;
31 }
32
33 public QPoint mapPoint(@NotNilptr QPoint p){
34 long v = QtXnl.object_get_long_int(nativehandle, Constant.MATRIXMAPPOINT, p.x, p.y);
35 return new QPoint((int)(v >> 32) & 0xffffffff, (int)v & 0xffffffff);
36 }
37 public void mapPoints(@NotNilptr float [] p){
38 for (int i = 0; i < p.length; i += 2){
39 long v = QtXnl.object_get_long_int(nativehandle, Constant.MATRIXMAPPOINT, p[0 + i], p[1 + i]);
40 p[0 + i] = (int)(v >> 32) & 0xffffffff;
41 p[1 + i] = (int)v & 0xffffffff;
42 }
43 }
44 public QRect mapRect(@NotNilptr QRect r){
45 long lt = QtXnl.object_get_long_int(nativehandle, Constant.MATRIXMAPPOINT, r.left, r.top);
46 long rb = QtXnl.object_get_long_int(nativehandle, Constant.MATRIXMAPPOINT, r.right, r.bottom);
47 long lb = QtXnl.object_get_long_int(nativehandle, Constant.MATRIXMAPPOINT, r.left, r.bottom);
48 long rt = QtXnl.object_get_long_int(nativehandle, Constant.MATRIXMAPPOINT, r.right, r.top);
49
50 int x1 = (int)(lt >> 32) & 0xffffffff,
51 x2 = (int)(rb >> 32) & 0xffffffff,
52 x3 = (int)(lb >> 32) & 0xffffffff,
53 x4 = (int)(rt >> 32) & 0xffffffff;
54
55 int y1 = (int)lt & 0xffffffff,
56 y2 = (int)rb & 0xffffffff,
57 y3 = (int)lb & 0xffffffff,
58 y4 = (int)rt & 0xffffffff;
59
60 return new QRect(
61 Math.min(x1,Math.min(x2,Math.min(x3,x4))), Math.min(y1,Math.min(y2,Math.min(y3,y4))),
62 Math.max(x1,Math.max(x2,Math.max(x3,x4))), Math.max(y1,Math.max(y2,Math.max(y3,y4)))
63 );
64 }
65
66 public QMatrix translate(double x, double y){
67 return new QMatrix(QtXnl.long_double2(nativehandle, Constant.MATRIXTRANSLATE, x, y));
68 }
69
70 public QMatrix scale(double sx, double sy){
71 return new QMatrix(QtXnl.long_double2(nativehandle, Constant.MATRIXSCALE, sx, sy));
72 }
73
74 public QMatrix shear(double sh, double sv){
75 return new QMatrix(QtXnl.long_double2(nativehandle, Constant.MATRIXSHEAR, sh, sv));
76 }
77
78 public QMatrix rotate(double a){
79 return new QMatrix(QtXnl.long_double2(nativehandle, Constant.MATRIXROTATE, a, 0));
80 }
81 public QMatrix rotate(double a, double cx, double cy){
82 translate(cx, cy);
83 QMatrix q = new QMatrix(QtXnl.long_double2(nativehandle, Constant.MATRIXROTATE, a, 0));
84 translate(-cx, -cy);
85 return q;
86 }
87
88 public QMatrix operator *(@NotNilptr QMatrix m){
89 return new QMatrix(QtXnl.object_get_long_int(nativehandle, Constant.MATRIXMUL, m.nativehandle, 0));
90 }
91
92 public void recycle(){
93 if (nativehandle != 0){
94 QtXnl.widget_slot(nativehandle, Constant.MATRIXDTOR);
95 nativehandle = 0;
96 }
97 }
98
99 public void finalize(){
100 if (nativehandle != 0){
101 QtXnl.widget_slot(nativehandle, Constant.MATRIXDTOR);
102 }
103 }
104 };
105};
Math类
static final int min(int, int)
static final int max(int, int)
QMatrix(QMatrix m)
Definition QMatrix.xcsm:18
QMatrix(long h)
Definition QMatrix.xcsm:23
QMatrix(double [] param)
Definition QMatrix.xcsm:15
QRect mapRect(@NotNilptr QRect r)
Definition QMatrix.xcsm:44
QMatrix translate(double x, double y)
Definition QMatrix.xcsm:66
void finalize()
Definition QMatrix.xcsm:99
QMatrix rotate(double a)
Definition QMatrix.xcsm:78
QMatrix shear(double sh, double sv)
Definition QMatrix.xcsm:74
QPoint mapPoint(@NotNilptr QPoint p)
Definition QMatrix.xcsm:33
double [] getValues()
Definition QMatrix.xcsm:27
QMatrix scale(double sx, double sy)
Definition QMatrix.xcsm:70
QMatrix operator *(@NotNilptr QMatrix m)
Definition QMatrix.xcsm:88
void recycle()
Definition QMatrix.xcsm:92
void mapPoints(@NotNilptr float [] p)
Definition QMatrix.xcsm:37
QMatrix rotate(double a, double cx, double cy)
Definition QMatrix.xcsm:81