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

Method copy_from

src/opencv/mod.rs:250–262  ·  view source on GitHub ↗

Copies an area from the given image at location `(x,y )` with width `width` and height `height` into this image at position `(dstx, dsty)`.

(&mut self, 
            img: &T, x: usize, y: usize, width: usize, height: usize, // source
            dstx: usize, dsty: usize)

Source from the content-addressed store, hash-verified

248 /// Copies an area from the given image at location `(x,y )` with width `width`
249 /// and height `height` into this image at position `(dstx, dsty)`.
250 fn copy_from<T: Image>(&mut self,
251 img: &T, x: usize, y: usize, width: usize, height: usize, // source
252 dstx: usize, dsty: usize) { // dst
253
254 // TODO bounce checking, error handling, performance
255 for iy in (0..height) {
256 for ix in (0..width) {
257 self.set_pixel_from_rgb(
258 dstx + ix, dsty + iy, &img.pixel_as_rgb(x + ix, y + iy).unwrap()
259 );
260 }
261 }
262 }
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) {

Callers 2

gridFunction · 0.80
dupMethod · 0.80

Implementers 1

mod.rssrc/opencv/mod.rs

Calls 2

set_pixel_from_rgbMethod · 0.80
pixel_as_rgbMethod · 0.80

Tested by

no test coverage detected