Search code examples
androidwallpaperlive-wallpaper

android wallpaper onOffsetsChanged image shadow


public void onOffsetsChanged(float xOffset, float yOffset,
float xOffsetStep, float yOffsetStep, int xPixelOffset,
int yPixelOffset) {

after onOffsetsChanged, I run my draw method, which has

c.drawBitmap(_background, xPixelOffset, 0, null);

when I swipe/scroll to the right on the screen, the image displays correctly.

But if I scroll all the way left, the right part of the image is repeated in a pattern...like instead of displaying...say a...X on the screen, it is showing XXXXXXXXXXXXXXXX like a shadow effect

I tried different width size pictures, some are better, some are worse...but I can't seem to pinpoint the problem

Could someone comment on why this might be happening?

thanks


Solution

  • I would guess that you are drawing your bitmap offset so it isn't completely drawing the surface, and the artifacts you are seeing is just previously drawn junk left in the surface that you haven't touched when drawing the new frame. You'd need to either erase it to some color, or not allow the bitmap to move in a way that makes it no longer cover the entire surface.