Skip to content

Instantly share code, notes, and snippets.

@dymk
Created April 24, 2013 03:10
Show Gist options
  • Select an option

  • Save dymk/5449307 to your computer and use it in GitHub Desktop.

Select an option

Save dymk/5449307 to your computer and use it in GitHub Desktop.
fn exportPixels(&self) -> ~[RGB] {
//Determine the size of the vector we need to allocate
let mut pixel_buffer = vec::with_capacity::<self::RGB>(self.numPixels());
unsafe {
let buffer_ptr = vec::raw::to_ptr(pixel_buffer);
wand_extern::MagickExportImagePixels(buffer_ptr);
vec::raw::set_len::<RGB>(pixel_buffer, self.numPixels());
}
pixel_buffer
}
//wand.rs:125:28: 125:40 error: mismatched types: expected `&mut ~[RGB]` but found `~[RGB]` (expected &-ptr but found vector)
//wand.rs:125 vec::raw::set_len::<RGB>(pixel_buffer, num_pixels);
^~~~~~~~~~~~
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment