xlang v4.0 Release
程序设计语言基础库文档
载入中...
搜索中...
未找到
QBrush.xcsm
浏览该文件的文档.
1//xlang Source, Name:qt5/widgets/QBrush.xcsm
2//Date: Thu Apr 18:46:27 2019
3package Qt{
4 @SuppressWarnings public class QBrush : QNative{
5
8 public enum Style{
9 NoBrush ,
10 SolidPattern ,
11 Dense1Pattern ,
12 Dense2Pattern ,
13 Dense3Pattern ,
14 Dense4Pattern ,
15 Dense5Pattern ,
16 Dense6Pattern ,
17 Dense7Pattern ,
18 HorPattern ,
19 VerPattern ,
20 CrossPattern ,
21 BDiagPattern ,
22 FDiagPattern ,
23 DiagCrossPattern ,
24 LinearGradientPattern ,
25 RadialGradientPattern ,
26 ConicalGradientPattern ,
27 TexturePattern = 24
28 };
29
30 public enum Spread{
33 RepeatSpread
34 };
35
36 public static class Gradient{
37 public long gradhandle = 0;
38
39 int nstyle = Style.LinearGradientPattern;
40
41 public Gradient(int style){
42 nstyle = style;
43 }
44
45 public bool create(@NotNilptr double [] data){
46 if (gradhandle != 0){
47 return false;
48 }
49
50 switch(nstyle){
51 case Style.LinearGradientPattern:
52 gradhandle = QtXnl.createPObject(QType.qtLineGradient, data);
53 break;
54 case Style.RadialGradientPattern:
55 {
56 switch(data.length){
57 case 3:
58 gradhandle = QtXnl.createPObject(QType.qtRadialGradient3, data);
59 break;
60 case 5:
61 gradhandle = QtXnl.createPObject(QType.qtRadialGradient5, data);
62 break;
63 case 6:
64 gradhandle = QtXnl.createPObject(QType.qtRadialGradient6, data);
65 break;
66 }
67 }
68 break;
69 case Style.ConicalGradientPattern:
70 gradhandle = QtXnl.createPObject(QType.qtConicalGradient, data);
71 break;
72 }
73 return gradhandle != 0;
74 }
75
76 public void setColorAt(double pos, int color){
77 QtXnl.widget_set_v2int_double_value(gradhandle, Constant.SETCOLORAT, color, pos, 0);
78 }
79
80 public void setSpread(int spread){
81 QtXnl.widget_set_vint_value(gradhandle, Constant.SETSPREAD, spread);
82 }
83
84 public void finalize(){
85 if (gradhandle != 0){
86 QtXnl.widget_slot(gradhandle, Constant.DELLOCGRADIENT);
87 }
88 }
89 };
90
91 public static class QLinearGradient : Gradient{
92 public QLinearGradient(double x,double y,double ex,double ey) throws IllegalArgumentException{
93 super(Style.LinearGradientPattern);
94 double [] _params = {x, y, ex, ey};
95 if (create(_params) == false){
96 throw new IllegalArgumentException("can not create QLinearGradient");
97 }
98 }
99
100 };
101
102 public static class QRadialGradient : Gradient{
103 public QRadialGradient(double x,double y,double r) throws IllegalArgumentException{
104 super(Style.RadialGradientPattern);
105 double [] _params = {x, y, r};
106 if (create(_params) == false){
107 throw new IllegalArgumentException("can not create QRadialGradient");
108 }
109 }
110
111 public QRadialGradient(double x,double y,double r,double fx,double fy) throws IllegalArgumentException{
112 super(Style.RadialGradientPattern);
113 double [] _params = {x, y, r, fx, fy};
114 if (create(_params) == false){
115 throw new IllegalArgumentException("can not create QRadialGradient");
116 }
117 }
118
119 public QRadialGradient(double x,double y,double r,double fx,double fy, double fr) throws IllegalArgumentException{
120 super(Style.RadialGradientPattern);
121 double [] _params = {x, y, r, fx, fy, fr};
122 if (create(_params) == false){
123 throw new IllegalArgumentException("can not create QRadialGradient");
124 }
125 }
126 };
127
128 public static class QConicalGradient : Gradient{
129 public QConicalGradient(double cx,double cy,double s) throws IllegalArgumentException{
130 super(Style.ConicalGradientPattern);
131 double [] _params = {cx, cy, s};
132 if (create(_params) == false){
133 throw new IllegalArgumentException("can not create QConicalGradient");
134 }
135 }
136 };
137
138 public QBrush() throws IllegalArgumentException{//构造
139 nativehandle = QtXnl.createNObject(QType.qtBrush, 0);
140 if (nativehandle == 0){
141 throw new IllegalArgumentException("can not create QBrush");
142 }
143 }
144
145 public QBrush(@NotNilptr Gradient grad) throws IllegalArgumentException{
146 nativehandle = QtXnl.createNObject(QType.qtBrush, grad.gradhandle);
147 if (nativehandle == 0){
148 throw new IllegalArgumentException("can not create QBrush");
149 }
150 }
151
152 public QBrush(@NotNilptr QImage img) throws IllegalArgumentException{
153 nativehandle = QtXnl.createNObject(QType.qtImgBrush, img.himage);
154 if (nativehandle == 0){
155 throw new IllegalArgumentException("can not create QBrush");
156 }
157 }
158
159 public void finalize(){
160 if (nativehandle != 0){
161 QtXnl.widget_slot(nativehandle, Constant.DELLOCBRUSH);
162 }
163 }
164
165
166 };
167};
bool create(@NotNilptr double [] data)
Definition QBrush.xcsm:45
void setColorAt(double pos, int color)
Definition QBrush.xcsm:76
Gradient(int style)
Definition QBrush.xcsm:41
void setSpread(int spread)
Definition QBrush.xcsm:80
QConicalGradient(double cx,double cy,double s)
Definition QBrush.xcsm:129
QLinearGradient(double x,double y,double ex,double ey)
Definition QBrush.xcsm:92
QRadialGradient(double x,double y,double r)
Definition QBrush.xcsm:103
QRadialGradient(double x,double y,double r,double fx,double fy, double fr)
Definition QBrush.xcsm:119
QRadialGradient(double x,double y,double r,double fx,double fy)
Definition QBrush.xcsm:111
QBrush(@NotNilptr Gradient grad)
Definition QBrush.xcsm:145
void finalize()
Definition QBrush.xcsm:159
QBrush(@NotNilptr QImage img)
Definition QBrush.xcsm:152