【发布时间】:2019-01-30 10:52:18
【问题描述】:
我正在尝试以 photoshop 或 paint.net 混合它们的相同方式混合两个图像,使用不同的混合模式,例如 Difference, Multiply, Additive, Color Burn, Glow, etc.
我发现PorterDuff.Mode 工作得很好,但它缺乏混合效果(它只有加、乘、屏幕)有没有办法获得更大范围的混合模式?有没有办法编辑android.graphics.PorterDuff; 库以获得更多混合模式?
有什么想法吗?
这是我使用 btw 的 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;
}
【问题讨论】:
-
你有什么合适的方法吗?
标签: android android-bitmap porter-duff blend-mode