Andreas Limberg
Andreas Limberg

Reputation: 51

Showing only the half of an Image on Slick2D?

I'd like to show only the half of an Image in 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!

Upvotes: 0

Views: 178

Answers (1)

RPresle
RPresle

Reputation: 2561

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. 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)

Source: last comment on gamedev.SE

Upvotes: 1

Related Questions