MonoTouch的:当色相调整Retina显示屏上加倍外观图像大小 [英] MonoTouch: Doubling Appearance Image size when Hue adjusted on Retina display

查看:180
本文介绍了MonoTouch的:当色相调整Retina显示屏上加倍外观图像大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我设置的NavBar与此代码,在视网膜和非Retina显示屏的伟大工程的背景。有一个@ 2倍和正常图像。所以,所有的好:

I am setting the NavBar's background with this code which works great in Retina and non-Retina displays. There is a @2x and normal image. So, all good:

UINavigationBar.Appearance.SetBackgroundImage(
     GetImage(ImageTheme.menubar), UIBarMetrics.Default);

现在,当我将此 ChangeHue()变换图像调整其色调,在视网膜显示图像的大小的两倍。非Retina显示屏的罚款:

Now, when I apply this ChangeHue() transformation to the image to adjust its hue, on Retina displays the image is twice the size. Non-Retina displays are fine:

    UINavigationBar.Appearance.SetBackgroundImage(
       ChangeHue(GetImage(ImageTheme.menubar)), UIBarMetrics.Default);
    ...

    UIImage ChangeHue(UIImage originalImage){
        var hueAdjust = new CIHueAdjust() {
            Image = CIImage.FromCGImage(originalImage.CGImage),
            Angle = hue * (float)Math.PI / 180f // angles to radians
        };

        var output = hueAdjust.OutputImage;
        var context = CIContext.FromOptions(null);
        var cgimage = context.CreateCGImage(output, output.Extent);
        var i = UIImage.FromImage(cgimage);
        return i;
}

下面是导致非视网膜Retina显示屏应用色相后

Here is the result in Non-Retina and Retina displays after the Hue is applied:

推荐答案

提起的错误与MonoTouch的团队。不久将发布的解决方案。

Filed a bug with the MonoTouch team. Will post solution shortly.

这篇关于MonoTouch的:当色相调整Retina显示屏上加倍外观图像大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆