5
나는 원활한 비트 맵을 받아 세계 좌표를 사용하여 모든 방향으로 화면에 스크롤 기능을 가지고있다. 4 개의 드로우가 있습니다 (플레이 영역은 전체 비트 맵 크기보다 작습니다. 따라서 최대 4 개의 비트 맵 복사본을 볼 수 있습니다.이 섹션은 매끄러운 효과를 유지하기 위해 그려집니다). 내가 알고 싶은 것은 rect 경계에 수정 사항을 적용하여 화면에 표시해야하는 부분 만 블리 칭하도록해야합니까? 아니면 안드로이드가 처리하도록해야합니까? 그리고 직접 해보면 어떻게 처리해야합니까? 수학이 진행되는 한 세계는 좌표와 번역이 정말 혼란 스럽습니다. :/안드로이드에 의존해서 화면을 그릴 수 있습니까?
여기에 코드입니다.
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();
}