我如何仅在Java的Jframe中显示一部分图像 - 使用Graphics2D方法
因此,我正在尝试在Java中制作一个程序,该程序打开Jframe窗口并显示图像。这些图像是图块地图/精灵纸的一部分。
g2.drawImage(image, screenX, screenY, gp.tileSize, gp.tileSize, null);
图像是整个图像,屏幕X/y是位置,瓷砖是图像的大小 - 这显示了整个图像,我将如何以相同的大小显示,但仅显示图像的一部分。如果这还不清楚,请告诉我。
So, I am trying to make a program in Java that opens a JFrame window and displays images. these images are part of a Tile map/Sprite sheet.
g2.drawImage(image, screenX, screenY, gp.tileSize, gp.tileSize, null);
image is the whole image and ScreenX/Y is the location, and the tileSize is the size of the image - this is displaying the whole image, how would i display at the same size but only part of the image. If this is unclear please tell me so.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论