使用非矩形形状在 Flex 中裁剪图像
我一直在按照本教程在 Flex 中裁剪图像: http://code.mediablur.com /ImageCropper/ImageCropperDemo.html。
其裁剪的核心是使用一种称为“copyPixels”的方法。然而,该方法将矩形形状作为其裁剪区域的参数之一。我可以使用其他策略来裁剪它而不是使用矩形吗?
我将让用户指定应该使用一系列点裁剪的区域。
I've been following this tutorial to crop images in flex: http://code.mediablur.com/ImageCropper/ImageCropperDemo.html.
At the heart of its cropping is using a method called "copyPixels". However, this method takes as one of its arguments a rectangular shape for its crop region. Are there other strategies I can use to crop it not using a rectangle.
I am going after letting the user specify the region that should be cropped using a series of points.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
当然,生成的图像必须是矩形,但您可以使用
BitmapData.draw
和BlendMode
:对于裁剪,您可能会在最后几行中做一些更奇特的事情 - 复制一个区域而不是克隆整个区域
originalImage
,和/或在应用maskShape
时应用变换。(我认为有必要使用
DisplayObject
来使用BlendMode
,但这在文档中并不清楚。)The resulting image has to be a rectangle, of course, but you can mask with transparency using
BitmapData.draw
andBlendMode
:For cropping, you would probably do something more fancy in the last few lines--copying a region instead of cloning the whole
originalImage
, and/or applying a transform when applying themaskShape
.(I believe it's necessary to use a
DisplayObject
to useBlendMode
s, but that's not clear in the documentation.)