안녕하세요.  

안드로이드의  canvas 에서 제공하는  함수들의  파라미터값 좌표 기준이 궁금해서 문의 드립니다.


public void drawBitmap (Bitmap bitmap, float left, float top, Paint paint)

Since: API Level 1

Draw the specified bitmap, with its top/left corner at (x,y), using the specified paint, transformed by the current matrix.

Note: if the paint contains a maskfilter that generates a mask which extends beyond the bitmap's original width/height (e.g. BlurMaskFilter), then the bitmap will be drawn as if it were in a Shader with CLAMP mode. Thus the color outside of the original width/height will be the edge color replicated.

If the bitmap and canvas have different densities, this function will take care of automatically scaling the bitmap to draw at the same density as the canvas.

Parameters
bitmap The bitmap to be drawn
left The position of the left side of the bitmap being drawn
top The position of the top side of the bitmap being drawn
paint The paint used to draw the bitmap (may be null)


이 Canvas 의  함수를 보면       출력할 이미지의  왼쪽과 위쪽 좌표를  넣어주는 것으로 되어 있는데,

이 좌표의 단위가 무엇인지요?


제가 "구글의 안드로이드 프로그래밍"  이라는 책을 보고  예제를  입력해서 실행하면,  아래와 같이  화면 깨집니다.

and.png 

코드는

private void doDraw(Canvas c) {
   c.drawBitmap(mImgBack0, 0, 0, null);
   c.drawBitmap(mImgBack1, 0, 90, null);
   c.drawBitmap(mImgBack21, 0, 190, null);
   c.drawBitmap(mImgBack31, 0, 310, null);

이렇게 되어 있구요.

이미지의 높이가   90  ,  100,  120   이거든요.


그런데, 희한한 것은   책에서 제공하는  소스는 실행하면  전체화면  꽉 차게 잘 나옵니다. 

and2.png

에뮬레이터의 크기가  480x800 (WVGA800)  인가 하는 크기 인데요.

어디서 저  크기를  자동으로 맞추어두는지요?

그리고,  코드상에서 입력하는   좌표는  무엇을 기준으로 봐야 하는지요?


Thanks ^^