Graphics2D 在定义的四边形内部绘制图像
我找不到 Graphics2D 内部的绘制图像重载,这将使我能够执行这样的任务,有人可以帮助我弄清楚如何做到这一点 - 最好不要切换到更高级的图形框架,例如 OpenGl,
谢谢。
澄清一下,四边形可以由任何具有四个边的物体来定义;这意味着菱形或矩形或更复杂的形状。
Mre 删除了他的许多言论,所以我似乎没有回应任何人,但我在评论中所说的只是对 mre 所说内容的回应。
I cannot find a draw image overload inside of Graphics2D which will enable me to perform such a task, can someone help me figure out how one might do this - preferably without swapping to more advanced graphics frameworks such as OpenGl,
thanks.
To clarify, a quad can be defined by anything with four-sides; that means a diamond or a rectangle or more elaborate shapes.
Mre has removed many of his remarks and so It seems as though I am responding to no-one, however all I have said in the comments were responses to what mre had said.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
有关基础知识,请参阅 Andrew Thomson 的解决方案。
我没有使用“文本形状”,而是使用以下方法创建了一个形状:
See Andrew Thomson's solution for the basics.
Instead of using a "text shape", I created a Shape using:
继承
图形
图像绘制方法drawImage(图像 img, int x, int y, 颜色 bgcolor, ImageObserver 观察者)
drawImage(图像 img, int x, int y, ImageObserver 观察者)
drawImage(Image img, int x, int y, int width, int height, Color bgcolor, ImageObserverobserver)
drawImage(图像 img, int x, int y, int width, int高度,ImageObserver 观察者)
drawImage(图像 img, int dx1, int dy1, int dx2, int dy2, int sx1, int sy1, int sx2, int sy2, 颜色 bgcolor, ImageObserver 观察者)
drawImage(Image img, int dx1, int dy1, int dx2, int dy2, int sx1, int sy1, int sx2, int sy2, ImageObserverobserver)
选择你的毒药。由于您甚至无法找到这些,我假设在面对缩放和频繁渲染时详细了解中间图像是徒劳的。
示例 1 -- 在正方形中画圆
输出
示例 2 -- 在正方形中绘制图像
输出
Inherited
Graphics
image drawing methodsdrawImage(Image img, int x, int y, Color bgcolor, ImageObserver observer)
drawImage(Image img, int x, int y, ImageObserver observer)
drawImage(Image img, int x, int y, int width, int height, Color bgcolor, ImageObserver observer)
drawImage(Image img, int x, int y, int width, int height, ImageObserver observer)
drawImage(Image img, int dx1, int dy1, int dx2, int dy2, int sx1, int sy1, int sx2, int sy2, Color bgcolor, ImageObserver observer)
drawImage(Image img, int dx1, int dy1, int dx2, int dy2, int sx1, int sy1, int sx2, int sy2, ImageObserver observer)
Choose your poison. Since you weren't even able to locate these, I'm assuming that going into detail about Intermediate Images when faced with scaling and frequent rendering would be futile.
Example 1 -- drawing a circle in a square
Output
Example 2 -- draw an image in a square
Output