비트 맵 이미지 데이터에 이미지 효과를 수행하는 데 도움을주십시오.안드로이드의 비트 맵 이미지에서 사진 효과를 적용하는 방법
다음 코드를 검색하여 사진 효과를 적용합니다. 하지만 정확히 무슨 가치가 효과를 위해 통과해야하는지에 관해 나는 모른다.
코드는 ..
public Bitmap createEffect(Bitmap src, int depth, double red, double green, double blue) {
// image size
int width = src.getWidth();
int height = src.getHeight();
// create output bitmap
Bitmap bmOut = Bitmap.createBitmap(width, height, src.getConfig());
// constant grayscale
final double GS_RED = 0.3;
final double GS_GREEN = 0.59;
final double GS_BLUE = 0.11;
// color information
int A, R, G, B;
int pixel;
// scan through all pixels
for(int x = 0; x < width; ++x) {
for(int y = 0; y < height; ++y) {
// get pixel color
pixel = src.getPixel(x, y);
// get color on each channel
A = Color.alpha(pixel);
R = Color.red(pixel);
G = Color.green(pixel);
B = Color.blue(pixel);
// apply grayscale sample
B = G = R = (int)(GS_RED * R + GS_GREEN * G + GS_BLUE * B);
// apply intensity level for sepid-toning on each channel
R += (depth * red);
if(R > 255) { R = 255; }
G += (depth * green);
if(G > 255) { G = 255; }
B += (depth * blue);
if(B > 255) { B = 255; }
// set new pixel color to output image
bmOut.setPixel(x, y, Color.argb(A, R, G, B));
}
}
// return final image
return bmOut;
}
나는 this 응용 프로그램처럼 작동하고 싶다. 효과와 그림이 따르고 있습니다
답장을 보내 주셔서 감사합니다.하지만 이미하고 싶은 말을하고 있지만 정확한 출력을 얻지 못했습니다. 값을 전달할 때 배경에 영향을주지 않습니다. –
이 출력을 얻을 때까지 값을 실험하십시오. 또한 게시 한 기능을 사용하여 예제 그림을 만들었습니까? – Renard
최종 이미지를 얻는 데 필요한 값은 –