API updates

I have hidden all the unsafe straight binding code in a separate file. I
have updated the API used by the thumbnail example to be a bit more
Rust-y.