@@ -11,12 +11,65 @@ mod ffi {
11
11
unsafe extern "C++" {
12
12
include ! ( "cxx-qt-lib/qimage.h" ) ;
13
13
type QImage = super :: QImage ;
14
+ include ! ( "cxx-qt-lib/qsize.h" ) ;
15
+ type QSize = crate :: QSize ;
16
+ include ! ( "cxx-qt-lib/qrect.h" ) ;
17
+ type QRect = crate :: QRect ;
18
+ include ! ( "cxx-qt-lib/qcolor.h" ) ;
19
+ type QColor = crate :: QColor ;
14
20
15
21
/// Whether the QImage is null.
16
22
///
17
23
/// This means that the QImage has all parameters set to zero and no allocated data.
18
24
#[ rust_name = "is_null" ]
19
25
fn isNull ( self : & QImage ) -> bool ;
26
+
27
+ /// Returns true if all the colors in the image are shades of gray
28
+ #[ rust_name = "all_gray" ]
29
+ fn allGray ( self : & QImage ) -> bool ;
30
+
31
+ /// For 32-bit images, this function is equivalent to allGray().
32
+ /// For color indexed images, this function returns true if color(i) is QRgb(i, i, i)
33
+ /// for all indexes of the color table; otherwise returns false.
34
+ #[ rust_name = "is_gray_scale" ]
35
+ fn isGrayscale ( self : & QImage ) -> bool ;
36
+
37
+ /// Returns true if the image has a format that respects the alpha channel, otherwise returns false.
38
+ #[ rust_name = "has_alpha_channel" ]
39
+ fn hasAlphaChannel ( self : & QImage ) -> bool ;
40
+
41
+ /// Returns the size of the color table for the image.
42
+ #[ rust_name = "color_count" ]
43
+ fn colorCount ( self : & QImage ) -> i32 ;
44
+
45
+ /// Returns the depth of the image.
46
+ fn depth ( self : & QImage ) -> i32 ;
47
+
48
+ /// Returns the height of the image.
49
+ fn height ( self : & QImage ) -> i32 ;
50
+
51
+ /// Returns the width of the image.
52
+ fn width ( self : & QImage ) -> i32 ;
53
+
54
+ /// Returns the size of the image.
55
+ fn size ( self : & QImage ) -> QSize ;
56
+
57
+ /// Returns the enclosing rectangle (0, 0, width(), height()) of the image.
58
+ fn rect ( self : & QImage ) -> QRect ;
59
+
60
+ /// Returns the color of the pixel at coordinates (x, y) as a QColor.
61
+ #[ rust_name = "pixel_color" ]
62
+ fn pixelColor ( self : & QImage , x : i32 , y : i32 ) -> QColor ;
63
+
64
+ /// Returns the number of pixels that fit horizontally in a physical meter.
65
+ #[ rust_name = "dots_per_meterx" ]
66
+ fn dotsPerMeterX ( self : & QImage ) -> i32 ;
67
+
68
+ /// Returns the number of pixels that fit vertically in a physical meter.
69
+ #[ rust_name = "dots_per_metery" ]
70
+ fn dotsPerMeterY ( self : & QImage ) -> i32 ;
71
+
72
+ fn valid ( self : & QImage , x : i32 , y : i32 ) -> bool ;
20
73
}
21
74
22
75
#[ namespace = "rust::cxxqtlib1" ]
@@ -30,6 +83,10 @@ mod ffi {
30
83
#[ doc( hidden) ]
31
84
#[ rust_name = "qimage_init_from_data" ]
32
85
fn qimageInitFromData ( data : & [ u8 ] , format : & str ) -> QImage ;
86
+
87
+ #[ doc( hidden) ]
88
+ #[ rust_name = "qimage_cache_key" ]
89
+ fn qimageCacheKey ( image : & QImage ) -> i64 ;
33
90
}
34
91
}
35
92
@@ -79,4 +136,8 @@ impl QImage {
79
136
None
80
137
}
81
138
}
139
+ /// Returns a number that identifies the contents of this QImage object.
140
+ pub fn cache_key ( & self ) -> i64 {
141
+ ffi:: qimage_cache_key ( self )
142
+ }
82
143
}
0 commit comments