@@ -11,12 +11,100 @@ 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 ;
20
+ include ! ( "cxx-qt-lib/qpoint.h" ) ;
21
+ type QPoint = crate :: QPoint ;
14
22
15
23
/// Whether the QImage is null.
16
24
///
17
25
/// This means that the QImage has all parameters set to zero and no allocated data.
18
26
#[ rust_name = "is_null" ]
19
27
fn isNull ( self : & QImage ) -> bool ;
28
+
29
+ /// Returns true if all the colors in the image are shades of gray
30
+ #[ rust_name = "all_gray" ]
31
+ fn allGray ( self : & QImage ) -> bool ;
32
+
33
+ /// For 32-bit images, this function is equivalent to allGray().
34
+ /// For color indexed images, this function returns true if color(i) is QRgb(i, i, i)
35
+ /// for all indexes of the color table; otherwise returns false.
36
+ #[ rust_name = "is_gray_scale" ]
37
+ fn isGrayscale ( self : & QImage ) -> bool ;
38
+
39
+ /// Returns true if the image has a format that respects the alpha channel, otherwise returns false.
40
+ #[ rust_name = "has_alpha_channel" ]
41
+ fn hasAlphaChannel ( self : & QImage ) -> bool ;
42
+
43
+ /// Returns a sub-area of the image as a new image.
44
+ fn copy ( self : & QImage , rect : & QRect ) -> QImage ;
45
+
46
+ /// Returns the size of the color table for the image.
47
+ #[ rust_name = "color_count" ]
48
+ fn colorCount ( self : & QImage ) -> i32 ;
49
+
50
+ /// Resizes the color table to contain colorCount entries.
51
+ #[ rust_name = "set_color_count" ]
52
+ fn setColorCount ( self : & mut QImage , colorCount : i32 ) ;
53
+
54
+ /// Returns the depth of the image.
55
+ fn depth ( self : & QImage ) -> i32 ;
56
+
57
+ /// Fills the entire image with the given color.
58
+ fn fill ( self : & mut QImage , color : & QColor ) ;
59
+
60
+ /// Returns the height of the image.
61
+ fn height ( self : & QImage ) -> i32 ;
62
+
63
+ /// Returns the width of the image.
64
+ fn width ( self : & QImage ) -> i32 ;
65
+
66
+ /// Returns the size of the image.
67
+ fn size ( self : & QImage ) -> QSize ;
68
+
69
+ /// Returns the enclosing rectangle (0, 0, width(), height()) of the image.
70
+ fn rect ( self : & QImage ) -> QRect ;
71
+
72
+ /// Returns the color of the pixel at coordinates (x, y) as a QColor.
73
+ #[ rust_name = "pixel_color" ]
74
+ fn pixelColor ( self : & QImage , x : i32 , y : i32 ) -> QColor ;
75
+
76
+ /// Sets the pixel color at (x, y) to color.
77
+ #[ rust_name = "set_pixel_color" ]
78
+ fn setPixelColor ( self : & mut QImage , x : i32 , y : i32 , color : & QColor ) ;
79
+
80
+ /// Returns the number of pixels that fit horizontally in a physical meter.
81
+ #[ rust_name = "dots_per_meterx" ]
82
+ fn dotsPerMeterX ( self : & QImage ) -> i32 ;
83
+
84
+ /// Returns the number of pixels that fit vertically in a physical meter.
85
+ #[ rust_name = "dots_per_metery" ]
86
+ fn dotsPerMeterY ( self : & QImage ) -> i32 ;
87
+
88
+ /// Returns true if pos is a valid coordinate pair within the image.
89
+ fn valid ( self : & QImage , x : i32 , y : i32 ) -> bool ;
90
+
91
+ /// Returns the number of pixels by which the image is intended to be offset by when positioning relative to other images.
92
+ fn offset ( self : & QImage ) -> QPoint ;
93
+
94
+ /// Sets the number of pixels by which the image is intended to be offset by when positioning relative to other images, to offset.
95
+ #[ rust_name = "set_offset" ]
96
+ fn setOffset ( self : & mut QImage , point : & QPoint ) ;
97
+
98
+ /// Returns the pixel index at (x, y).
99
+ #[ rust_name = "pixel_index" ]
100
+ fn pixelIndex ( self : & QImage , x : i32 , y : i32 ) -> i32 ;
101
+
102
+ /// Mirrors of the image in the horizontal and/or the vertical direction depending on whether horizontal and vertical are set to true or false.
103
+ fn mirror ( self : & mut QImage , horizontal : bool , vertical : bool ) ;
104
+
105
+ /// Sets the alpha channel of this image to the given alphaChannel.
106
+ #[ rust_name = "set_alpha_channel" ]
107
+ fn setAlphaChannel ( self : & mut QImage , alphaChannel : & QImage ) ;
20
108
}
21
109
22
110
#[ namespace = "rust::cxxqtlib1" ]
@@ -30,6 +118,10 @@ mod ffi {
30
118
#[ doc( hidden) ]
31
119
#[ rust_name = "qimage_init_from_data" ]
32
120
fn qimageInitFromData ( data : & [ u8 ] , format : & str ) -> QImage ;
121
+
122
+ #[ doc( hidden) ]
123
+ #[ rust_name = "qimage_cache_key" ]
124
+ fn qimageCacheKey ( image : & QImage ) -> i64 ;
33
125
}
34
126
}
35
127
@@ -79,4 +171,8 @@ impl QImage {
79
171
None
80
172
}
81
173
}
174
+ /// Returns a number that identifies the contents of this QImage object.
175
+ pub fn cache_key ( & self ) -> i64 {
176
+ ffi:: qimage_cache_key ( self )
177
+ }
82
178
}
0 commit comments