我正在尝试以与 photoshop 或 paint.net 相同的方式混合两个图像,使用不同的混合模式,例如 Difference、Multiply、Additive、Color燃烧、发光等
我发现 PorterDuff.Mode
工作得很好,但它缺乏混合效果(它只有 Add、Multiply、screen)有没有办法获得更大范围的混合模式?有没有办法编辑 android.graphics.PorterDuff;
库以获得更多混合模式?
有什么想法吗?
顺便说一下,这是我使用的 porterduff 代码:
private static Bitmap Result(Bitmap bottomImage, Bitmap topImage){
int sizex = bottomImage.getWidth();
int sizey = bottomImage.getHeight();
Paint paint = new Paint();
Bitmap imageBitmap = Bitmap.createBitmap(sizex, sizey , Bitmap.Config.ARGB_8888);
Canvas comboImage = new Canvas(imageBitmap);
comboImage.drawBitmap(bottomImage, 0f, 0f, paint);;
PorterDuff.Mode mode = PorterDuff.Mode.MULTIPLY;//Porterduff MODE
paint.setXfermode(new PorterDuffXfermode(mode));
Bitmap ScaledtopImage = Bitmap.createScaledBitmap(topImage, sizex, sizey, false);
comboImage.drawBitmap(ScaledtopImage, 0f, 0f, paint);
return imageBitmap;
}
最佳答案
我不是真正的图像处理专家,但 PorterDuff 有一些混合模式,即变暗、变亮、乘法、屏幕和叠加。然后,您可以使用 in、atop、xor 等来获得您想要的混合部分的选择。
http://ssp.impulsetrain.com/porterduff.html https://developer.android.com/reference/android/graphics/PorterDuff.Mode
关于android - Android Studio 中的图像混合模式(如 photoshop、paint.net)?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51996300/