Game Development Reference
In-Depth Information
public static void
cutBitmap(Bitmap source,Bitmap [] result,
int
imgid,
int
px,
int
py,
int
rows,
int
cols,
int
w,
int
h){
for
(
int
i=0;i<rows;i++){
for
(
int
j=0;j<cols;j++){
result[imgid+i*cols+j]
= Bitmap.createBitmap(source, px+j*w, py+i*h, w,
h);
}
}
}
To render animations smoothly and efficiently, using cutBitmap() method is handy and
helpful. This method can be applied to any Bitmap sheet that contains subset frames with
identical sizes.
Search WWH ::
Custom Search