views:

650

answers:

2

I have a Bitmap object that I need to sometimes flip horizontally, sometimes vertically, sometimes both. The full framework has the Image.RotateFlip() method which is exactly what I need. Unfortunately like most useful features on the full framework, this method does not exist on the compact framework. Is there a simple way to do this? The best I could find was this, but it uses unsafe code which I'd like to avoid and it could only do rotation not flipping.

Edit: Ok, I found a way to do some optimizations where I only need to do a vertical flip.

+2  A: 

The CF doesn't support it, but if your device supports the Imaging Library, then you can P/Invoke down to IBasicBitmapOps::Flip. The SDF already has this wrapped in the OpenNETCF.Drawing.Imaging.ImageUtils class.

ctacke
This is what I was looking for. I had already implemented it myself using unsafe pointer manipulation, but this is probably the safer way to go.
Jason
+1  A: 

I recently read an article about this. I haven't tried it, because i need other rotations than 90/180/270, but it claims to be a fast way to rotate.

http://www.codeproject.com/KB/graphics/ImageRotationForCF.aspx

[edit] damn, i didn't read correctly, you already found this.. sorry.

Jeroen