MCPcopy Create free account
hub / github.com/daniel-e/rustml / draw_text

Method draw_text

src/opencv/mod.rs:265–289  ·  view source on GitHub ↗

Draws text on the image at position `(x, y)`.

(&mut self, txt: &str, x: usize, y: usize, font: &Font)

Source from the content-addressed store, hash-verified

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 ///

Callers 1

test_fontFunction · 0.80

Implementers 1

mod.rssrc/opencv/mod.rs

Calls 2

to_stringMethod · 0.80
bufferMethod · 0.80

Tested by 1

test_fontFunction · 0.64