Jason
Jason

Reputation: 1441

Flip bitmap in .NET Compact Framework

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.

Upvotes: 0

Views: 2305

Answers (2)

Jeroen Pot
Jeroen Pot

Reputation: 386

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.

Upvotes: 1

ctacke
ctacke

Reputation: 67198

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.

Upvotes: 2

Related Questions