<bdo id='jPkdh'></bdo><ul id='jPkdh'></ul>

<legend id='jPkdh'><style id='jPkdh'><dir id='jPkdh'><q id='jPkdh'></q></dir></style></legend>

<small id='jPkdh'></small><noframes id='jPkdh'>

<i id='jPkdh'><tr id='jPkdh'><dt id='jPkdh'><q id='jPkdh'><span id='jPkdh'><b id='jPkdh'><form id='jPkdh'><ins id='jPkdh'></ins><ul id='jPkdh'></ul><sub id='jPkdh'></sub></form><legend id='jPkdh'></legend><bdo id='jPkdh'><pre id='jPkdh'><center id='jPkdh'></center></pre></bdo></b><th id='jPkdh'></th></span></q></dt></tr></i><div id='jPkdh'><tfoot id='jPkdh'></tfoot><dl id='jPkdh'><fieldset id='jPkdh'></fieldset></dl></div>

  • <tfoot id='jPkdh'></tfoot>
      1. 创建 UIImage 抠图

        Create UIImage cutout(创建 UIImage 抠图)

          <i id='JYUde'><tr id='JYUde'><dt id='JYUde'><q id='JYUde'><span id='JYUde'><b id='JYUde'><form id='JYUde'><ins id='JYUde'></ins><ul id='JYUde'></ul><sub id='JYUde'></sub></form><legend id='JYUde'></legend><bdo id='JYUde'><pre id='JYUde'><center id='JYUde'></center></pre></bdo></b><th id='JYUde'></th></span></q></dt></tr></i><div id='JYUde'><tfoot id='JYUde'></tfoot><dl id='JYUde'><fieldset id='JYUde'></fieldset></dl></div>
              • <bdo id='JYUde'></bdo><ul id='JYUde'></ul>
                  <tfoot id='JYUde'></tfoot>

                  <legend id='JYUde'><style id='JYUde'><dir id='JYUde'><q id='JYUde'></q></dir></style></legend>

                • <small id='JYUde'></small><noframes id='JYUde'>

                    <tbody id='JYUde'></tbody>
                  本文介绍了创建 UIImage 抠图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我有一个 UIView 包含 2 个 UIImageViews - 一个框架和框架后面的图片.框架不是矩形 - 它是不规则的形状.用户可以操作框架后面的图片(缩放、旋转和平移),完成后,我想捕捉框架内图片的剪切 - 而不是图片和框架一起.有什么办法可以做到吗?

                  I have a UIView containing 2 UIImageViews - a frame and a picture behind the frame. The frame is not a rectangle - it's an irregular shape. The user can manipulate the picture behind the frame (zoom, rotate and pan) and when they're done, I want to capture the cutout of the picture within the frame - not the picture and the frame together. Is there a way I can do this?

                  我已经设法将图片和框架拼合为一个图像,如下所示,但我只想要图片,如果成功提取,它将具有框架形状的边框.

                  I've managed to flatten the picture and the frame together in to a single image as below, but I only want the picture, which if extracted successfully will have a border in the shape of the frame.

                  - (IBAction)renderPhoto:(id)sender {
                      //Combine the layers into a single image
                      UIView *canvas = [[[sender superview] subviews] objectAtIndex:0];
                      UIGraphicsBeginImageContext(canvas.bounds.size);
                      [canvas.layer renderInContext:UIGraphicsGetCurrentContext()];
                      UIImage *combinedImage = UIGraphicsGetImageFromCurrentImageContext();
                      UIGraphicsEndImageContext();
                  }
                  

                  推荐答案

                  你可以从你的框架中创建一个蒙版,并将这个蒙版应用到目标图像上,以从目标图像上切下框架.或者,根据您最终使用最终图像的方式,在执行绘图时使用框架剪辑上下文可能更简单.

                  You could create a mask from your frame and apply this mask to the target image to essentially cut the frame off the target image. Or, depending how you end up using the final image, it may be simpler to clip the context using the frame while you perform your drawing.

                  本主题涵盖了所有内容:https://developer.apple.com/library/mac/#documentation/graphicsimaging/conceptual/drawingwithquartz2d/dq_images/dq_images.html#//apple_ref/doc/uid/TP30001066-CH212-TPXREF101

                  This topic covers it all: https://developer.apple.com/library/mac/#documentation/graphicsimaging/conceptual/drawingwithquartz2d/dq_images/dq_images.html#//apple_ref/doc/uid/TP30001066-CH212-TPXREF101

                  第二个选项(剪切上下文)位于 通过剪切上下文来屏蔽图像.

                  The second option (clipping the context) is under Masking an Image by Clipping the Context.

                  这篇关于创建 UIImage 抠图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  what#39;s property copy means in Cocoa#39;s Framework?(like UITabBar#39;s items property)(Cocoa 框架中的属性副本是什么意思?(如 UITabBar 的 items 属性))
                  Difference between retain and copy?(保留和复制的区别?)
                  Can`t copy file from bundle to documents directory in iOS(无法将文件从捆绑包复制到 iOS 中的文档目录)
                  When compiling for multiple targets in XCode, how do i ensure that certain files will not be included one target(在 XCode 中为多个目标编译时,我如何确保某些文件不会包含在一个目标中)
                  Automatically copy property values from one object to another of a different type but the same protocol (Objective-C)(自动将属性值从一个对象复制到另一个类型不同但协议相同的对象 (Objective-C))
                  What is the difference between quot;copyquot; and quot;retainquot;?(“复制和“复制有什么区别?和“保留?)
                  <i id='X2Ry3'><tr id='X2Ry3'><dt id='X2Ry3'><q id='X2Ry3'><span id='X2Ry3'><b id='X2Ry3'><form id='X2Ry3'><ins id='X2Ry3'></ins><ul id='X2Ry3'></ul><sub id='X2Ry3'></sub></form><legend id='X2Ry3'></legend><bdo id='X2Ry3'><pre id='X2Ry3'><center id='X2Ry3'></center></pre></bdo></b><th id='X2Ry3'></th></span></q></dt></tr></i><div id='X2Ry3'><tfoot id='X2Ry3'></tfoot><dl id='X2Ry3'><fieldset id='X2Ry3'></fieldset></dl></div>
                  <tfoot id='X2Ry3'></tfoot>

                    <tbody id='X2Ry3'></tbody>
                      • <bdo id='X2Ry3'></bdo><ul id='X2Ry3'></ul>

                        <small id='X2Ry3'></small><noframes id='X2Ry3'>

                          <legend id='X2Ry3'><style id='X2Ry3'><dir id='X2Ry3'><q id='X2Ry3'></q></dir></style></legend>