简体   繁体   English

仅在Slick2D上显示图像的一半?

[英]Showing only the half of an Image on Slick2D?

I'd like to show only the half of an Image in Slick2D ! 我只想在Slick2D中显示图像的Slick2D The Problem is: I do NOT want to stretch it in any direction, so the method 问题是:我不想在任何方向上拉伸它,所以该方法

image.draw(float x, float y, float srcx, float srcy, float srcx2, float srcy2)

doesn't help me. 对我没有帮助。 (That method streches the specified part to the size of the full image and renders then!) (该方法将指定的部分拉伸为完整图像的大小,然后渲染!)

An image crop method may be helpful. 图像裁剪方法可能会有所帮助。

I'd be thankful to get help! 我很感谢得到帮助!

The method you named take the picture, crop it with the src parameters but then stretch the cropped part to the original size of the image. 您命名的方法拍摄图片,使用src参数进行裁剪,然后将裁剪的部分拉伸到图像的原始大小。 That is why you have some problem. 这就是为什么您有一些问题。

In order to solve this, you must indicate the size of the target area where you want to draw the image. 为了解决这个问题,必须指出要绘制图像的目标区域的大小。 To do so, use the method 为此,使用方法

draw(float x, float y, float x2, float y2, float srcx, float srcy, float srcx2, float srcy2) draw(float x,float y,float x2,float y2,float srcx,float srcy,float srcx2,float srcy2)

Source : last comment on gamedev.SE 资料来源 :对gamedev.SE的最新评论

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM