xlang v4.0 Release
程序设计语言基础库文档
载入中...
搜索中...
未找到
QImage.xcsm
浏览该文件的文档.
1//xlang Source, Name:QImage.xcsm
2//Date: Mon Oct 21:48:01 2018
3package Qt{
4 @SuppressWarnings public class QImage{
5 public long himage;
6 public QImage(long h){
7 himage = h;
8 }
9 public static const int
10 Format_Invalid = 0,
11 Format_Mono = 1,
12 Format_MonoLSB = 2,
13 Format_Indexed8 = 3,
14 Format_RGB32 = 4,
15 Format_ARGB32 = 5,
16 Format_ARGB32_Premultiplied = 6,
17 Format_RGB16 = 7,
18 Format_ARGB8565_Premultiplied = 8,
19 Format_RGB666 = 9,
20 Format_ARGB6666_Premultiplied = 10,
21 Format_RGB555 = 11,
22 Format_ARGB8555_Premultiplied = 12,
23 Format_RGB888 = 13,
24 Format_RGB444 = 14,
25 Format_ARGB4444_Premultiplied = 15,
26 Format_RGBX8888 = 16,
27 Format_RGBA8888 = 17,
28 Format_RGBA8888_Premultiplied = 18,
29 Format_BGR30 = 19,
30 Format_A2BGR30_Premultiplied = 20,
31 Format_RGB30 = 21,
32 Format_A2RGB30_Premultiplied = 22,
33 Format_Alpha8 = 23,
34 Format_Grayscale8 = 24,
35 NImageFormats = 25;
36
37 public QImage(){
38
39 }
40
41 public QImage(String file, String format) throws IllegalArgumentException{
42 himage = QtXnl.long_string2(0, Constant.IMGLOAD, file, format);
43 if (himage == 0){
44 throw new IllegalArgumentException("can not load file:" + file);
45 }
46 }
47
48 public QImage(byte [] data, String format) throws IllegalArgumentException{
49 himage = QtXnl.long_object_string(0, Constant.IMGLOAD, data, format);
50 if (himage == 0){
51 throw new IllegalArgumentException("can not load from data");
52 }
53 }
54
55 public QImage(int width, int height, int format) throws IllegalArgumentException{
56 long wh = width;
57 wh <<= 32;
58
59 himage = QtXnl.long_intlong2(0, Constant.IMGLOAD, wh | height, format);
60
61 if (himage == 0){
62 throw new IllegalArgumentException("can not load from data");
63 }
64 }
65
66 public QImage(byte [] data, int width, int height, int format) throws IllegalArgumentException{
67 long wh = width;
68 wh <<= 32;
69
70 himage = QtXnl.pointer_intlong2(data, Constant.IMGLOAD, wh | height, format);
71
72 if (himage == 0){
73 throw new IllegalArgumentException("can not load from data");
74 }
75
76 }
77
78 public void finalize(){
79 if (himage != 0){
80 QtXnl.widget_slot(himage, Constant.DELETEIMAGE);
81 }
82 }
83
84 public bool saveToFile(String filename, String format, int quality){
85 return QtXnl.long_long_string2(himage, Constant.QIMGSAVE, quality, filename, format) != 0;
86 }
87
88 public bool saveToFile(String filename, String format){
89 return QtXnl.long_long_string2(himage, Constant.QIMGSAVE, -1, filename, format) != 0;
90 }
91
92 public int width(){
93 return QtXnl.widget_get_int_value(himage, Constant.IMGWIDTH);
94 }
95
96 public int height(){
97 return QtXnl.widget_get_int_value(himage, Constant.IMGHEIGHT);
98 }
99
100 public int format(){
101 return QtXnl.widget_get_int_value(himage, Constant.IMGFORMAT);
102 }
103
104 public byte[] getdata(){
105 return (byte[])QtXnl.object_get_handle(himage, Constant.IMGGETDATA, 0);
106 }
107
108 public int[] getPixels(){
109 return (int[])QtXnl.object_get_handle(himage, Constant.IMGGETDATA, 1);
110 }
111 };
112};
byte [] getdata()
Definition QImage.xcsm:104
QImage(long h)
Definition QImage.xcsm:6
bool saveToFile(String filename, String format, int quality)
Definition QImage.xcsm:84
QImage(byte [] data, int width, int height, int format)
Definition QImage.xcsm:66
void finalize()
Definition QImage.xcsm:78
int width()
Definition QImage.xcsm:92
int [] getPixels()
Definition QImage.xcsm:108
int height()
Definition QImage.xcsm:96
QImage(String file, String format)
Definition QImage.xcsm:41
QImage(int width, int height, int format)
Definition QImage.xcsm:55
QImage(byte [] data, String format)
Definition QImage.xcsm:48
bool saveToFile(String filename, String format)
Definition QImage.xcsm:88
int format()
Definition QImage.xcsm:100
字符串类