Draws text on the image at position `(x, y)`.
(&mut self, txt: &str, x: usize, y: usize, font: &Font)
| 263 | |
| 264 | /// Draws text on the image at position `(x, y)`. |
| 265 | fn draw_text(&mut self, txt: &str, x: usize, y: usize, font: &Font) { |
| 266 | |
| 267 | let mut s = txt.to_string(); |
| 268 | s.push('\0'); |
| 269 | |
| 270 | let p = CvPoint { |
| 271 | x: x as c_int, |
| 272 | y: y as c_int |
| 273 | }; |
| 274 | |
| 275 | // TODO color |
| 276 | let sc = CvScalar { |
| 277 | val: [255 as c_double, 255 as c_double, 255 as c_double, 255 as c_double] |
| 278 | }; |
| 279 | |
| 280 | unsafe { |
| 281 | cvPutText( |
| 282 | self.buffer() as *mut CvArr, |
| 283 | s.as_ptr() as *const c_char, |
| 284 | p, |
| 285 | & *(font.font) as *const CvFont, |
| 286 | sc |
| 287 | ); |
| 288 | } |
| 289 | } |
| 290 | |
| 291 | /// Creates a new image by organizing the given list of images into a grid. |
| 292 | /// |