Java中Shape对象转换为Image对象
如何将 Rectangle2D.Double 等 Shape 对象转换为 Image 对象?
这样我就可以使用 Shape 对象来替换鼠标光标。
How do I convert a Shape object like Rectangle2D.Double to an Image object?
This way I can use a Shape object for a mousecursor replacement.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
执行 < code>draw(shape) 在
BufferedImage
中,如此处所示。Do
draw(shape)
in aBufferedImage
, as shown here.您必须创建一个图像对象,其中在正确的位置包含正确的像素。
一种方法是这样的:
不过,您可能想要使用另一种颜色模型,让您的形状以透明背景显示,而不是白底黑字或其他颜色。
You'll have to create an image object which contains the right pixels at the right locations.
One way would be something like this:
You may want to use another color model, though, to have your shape show up with transparent background, instead of black-on-white or otherwise around.