如何从BufferedImage裁剪多边形 [英] How to crop a polygon from BufferedImage

查看:145
本文介绍了如何从BufferedImage裁剪多边形的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何裁剪BufferedImage的多边形部分并将其写入另一个BufferedImage?

How to crop a polygon shaped portion of BufferedImage and write it to another BufferedImage?

推荐答案

Graphics2D具有clip(Shape)和draw(Shape)方法.因此,我想您可以将Shape设置为多边形,然后从一个BufferedImage绘制到另一个.

Graphics2D has clip(Shape) and draw(Shape) methods. So I would guess you can set the Shape to be your polygon and then paint from one BufferedImage to the other.

这篇关于如何从BufferedImage裁剪多边形的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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