Search code examples
playn

Displaying a large image in an ImmediateLayer


Screenshot: https://i.sstatic.net/z95vw.jpg

EDIT - In an attempt to demonstrate this issue better, it appears that a large image in an Immediate layer is being clipped to the size of the ImmediateLayer.

In the sample image, there's two ImmediateLayers. The left hand size displays an image that's bigger than the size of the ImmediateLayer and appears clipped when rotated or translated. On the right hand side a low res version of the image is scaled up and displayed in the same position. Unclipped.

In the background the original hires version of the image is shown, showing that its loaded in its entirety, and only being clipped when shown in the ImmediateLayer.

So, not a rotation issue, but an issue of can an image be displayed and translated in an ImmediateLayer without being clipped?

ORIGINAL -

In PlayN, I'm trying to rotate an image when rendering to a clipped ImmediateLayer. I can rotate an image by setting the surface's rotation at render time, but this causes an image to be clipped then rotated. So, a star image would have its points clipped before its rotated into place.

Is this rotation code correct and the clipping a bug?

surface.save();

surface.rotate(rotation);

surface.drawImage(star, 0, 0);
surface.restore();

Bit of background, the reason for using an ImmediateLayer is to have 2 player split-screen view, side-by-side.


Solution

  • @samskivert - running your example code and comparing it to your screenshot I noticed I had completely different results - I had no clipping at all.

    Moving my project's playn dependency from 1.2 to 1.3.1 and therefore to Lwjgl resolved the issue:

    https://i.sstatic.net/Mljoj.jpg

    Exact same code, wrong dependency. Thanks for your help getting to the bottom of the issue, and thanks for piling so much good work into playn!