将图像绘制为多边形 [英] Draw image as a polygon

查看:104
本文介绍了将图像绘制为多边形的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在Swing中将图像绘制为多边形,但我不知道如何.现在我 只有代码来绘制填充的多边形.这不是裁剪的图像,而是变形的.

I'm trying to draw an image as a polygon in Swing but I don't know how. Now I only have code to draw filled polygon. This is not a cropped image, it is distorted.

我需要什么(带纹理的多边形):

What I need (Polygon with texture):

我拥有的-填充多边形

What I have - Filled polygon

gr.fillPolygon(x_points, y_points, points.length);

推荐答案

渲染3D的最简单方法是使用 JOGL 库,它使用OpenGL在JPanel中进行渲染.

The easiest way to render 3D is using JOGL library which uses OpenGL to render in JPanel.

这篇关于将图像绘制为多边形的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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