【问题标题】:Strange behavior with drawing an UImage into graphic context将图像绘制到图形上下文中的奇怪行为
【发布时间】:2013-04-25 06:29:40
【问题描述】:

我有以下代码可以水平并排合并两张图片:

        CGFloat firstWidth = ImageLeft.size.width;
        CGFloat firstHeight = ImageLeft.size.height;


        CGFloat secondWidth = ImageRight.size.width;
        CGFloat secondHeight = ImageRight.size.height;

        CGSize sizetoNewImage = CGSizeMake(firstWidth+secondWidth , firstHeight); // Here merging two images horizontally ,

        UIGraphicsBeginImageContext(sizetoNewImage);

        [ImageLeft drawInRect : CGRectMake(0,0,firstWidth,firstHeight)];
        [ImageRight drawInRect:CGRectMake(firstWidth,0,secondWidth,secondHeight)];// Here merging two images horizontally ,

        backgroundImage = UIGraphicsGetImageFromCurrentImageContext();
        UIGraphicsEndImageContext();

问题是,当我显示 backgroundImage 时,它​​的所有文本都模糊了。虽然,如果我显示单独的图像,这些图像用于连接到一个图像中 - 它们显示所有文本都很好。 我在那里想念什么???

提前致谢

【问题讨论】:

    标签: ios uiimage core-graphics


    【解决方案1】:

    来自another answer,使用视网膜图像时,使用以下内容创建图像上下文。

    UIGraphicsBeginImageContextWithOptions(size, NO, 0.0f); // 0.0 means [UIScreen mainScreen].scale
    

    【讨论】:

      猜你喜欢
      • 2017-01-22
      • 1970-01-01
      • 2010-12-28
      • 2017-02-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-08-29
      相关资源
      最近更新 更多