简体   繁体   English

.NET Compact Framework中的翻转位图

[英]Flip bitmap in .NET Compact Framework

I have a Bitmap object that I need to sometimes flip horizontally, sometimes vertically, sometimes both. 我有一个Bitmap对象,有时需要水平翻转,有时需要垂直翻转,有时两者都要翻转。 The full framework has the Image.RotateFlip() method which is exactly what I need. 完整的框架具有Image.RotateFlip()方法,这正是我所需要的。 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. 编辑:好的,我找到了一种做一些优化的方法,我只需要进行垂直翻转即可。

The CF doesn't support it, but if your device supports the Imaging Library, then you can P/Invoke down to IBasicBitmapOps::Flip . CF不支持它,但是如果您的设备支持映像库,则可以P / Invoke到IBasicBitmapOps :: Flip The SDF already has this wrapped in the OpenNETCF.Drawing.Imaging.ImageUtils class. SDF已将其包装在OpenNETCF.Drawing.Imaging.ImageUtils类中。

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. 我没有尝试过,因为我需要90/180/270以外的其他旋转方式,但是它声称是一种快速旋转方式。

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

[edit] damn, i didn't read correctly, you already found this.. sorry. [编辑]该死,我没有正确阅读,您已经找到了这个。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM