I have a function that takes a seamless raster image and scrolls it on the screen in any direction using world coordinates. There are 4 draws (the playing area is smaller than the full size of the bitmap). At best, you will see 4 copies of the bitmap, only different sections created to preserve the effect of a seamless effect). I want to know if I should apply the changes to the borders of the rectangle so that it only shines the parts that it should display on the screen? Or should I let Android handle this? And if I do it myself, how can I handle this? The world coordinates and translates really confuse me as far as math goes.: /
Here is the code.
public void draw(Canvas canvas){
oCoords.x=(int) fX;
oCoords.y=(int) fY;
oTopLeft = gridContainingPoint(oCoords);
oTopRight.x = gridContainingPoint(oCoords).x + iWidth;
oTopRight.y = gridContainingPoint(oCoords).y;
oBottomLeft.x = gridContainingPoint(oCoords).x;
oBottomLeft.y = gridContainingPoint(oCoords).y + iHeight;
oBottomRight.x = gridContainingPoint(oCoords).x + iWidth;
oBottomRight.y = gridContainingPoint(oCoords).y + iHeight;
canvas.save();
canvas.translate(-fX, -fY);
oCloud.setBounds(oTopLeft.x, oTopLeft.y, oTopLeft.x + this.iImageWidth, oTopLeft.y + this.iImageHeight);
oCloud.draw(canvas);
oCloud.setBounds(oTopLeft.x + this.iImageWidth, oTopLeft.y, oTopLeft.x + (this.iImageWidth * 2), oTopLeft.y + this.iImageHeight);
oCloud.draw(canvas);
oCloud.setBounds(oTopLeft.x, oTopLeft.y + this.iImageHeight, oTopLeft.x + this.iImageWidth, oTopLeft.y + (this.iImageHeight * 2));
oCloud.draw(canvas);
oCloud.setBounds(oTopLeft.x + this.iImageWidth, oTopLeft.y + this.iImageHeight, oTopLeft.x + (this.iImageWidth * 2),oTopLeft.y + (this.iImageHeight * 2));
oCloud.draw(canvas);
canvas.restore();
}