티스토리 뷰

Computer/Android

Bitmap Merge

jamezc 2013. 5. 26. 02:07

public Bitmap mergeBitmap(Bitmap src, Bitmap mergeBitmap) {
int width = src.getWidth();
int height = src.getHeight();

mergeBitmap2 = Bitmap.createScaledBitmap(mergeBitmap, width,
height, true);

int maskPixel;int tilePixel;int mergedPixel;
for (int x = 0; x < width; x++) {
for (int y = 0; y < height; y++) {
maskPixel = mergeBitmap2.getPixel(x, y);
tilePixel = src.getPixel(x, y);

mergedPixel = Color.argb(Color.alpha(maskPixel),
Color.red(maskPixel), Color.green(maskPixel),
Color.blue(maskPixel));

mergeBitmap2.setPixel(x, y, mergedPixel);

mergedPixel = Color.argb(Color.alpha(tilePixel),
Color.red(tilePixel), Color.green(tilePixel),
Color.blue(tilePixel));

mergeBitmap2.setPixel(x, y, mergedPixel);
}
}

return mergeBitmap2;

댓글

파트너스 활동을 통해 일정액의 수수료를 제공받을 수 있음



Total
Today
Yesterday
최근에 달린 댓글