0
所以我有一個巨大的問題。我不能解決它多年,所以請任何人都可以幫助 - 這將是驚人的。 所以問題出在ColorMatrix上。正如你在圖片中看到的,當我在照片上添加效果並將其保存到我的記憶中時,我會在左邊看到一張帶有白線的圖片。有趣的是,當我將對比度增加到7時,這條線變得越來越大。所以我猜想的問題是對比度和亮度。無論如何,它的效果很好,而且我滿意的任何其他事情......只有這一個錯誤會讓我有一天會殺死我,我猜。任何幫助? 我的代碼:使用Colormatrix的白線bug
public void effect(View view) {
float contrast = 1;
float brightness = 0;
Bitmap.Config config = bmp.getConfig();
if (config == null) {
config = Bitmap.Config.ARGB_8888;
}
operation = Bitmap.createBitmap(bmp.getWidth(), bmp.getHeight(), config);
ColorMatrix cm = new ColorMatrix(new float[]
{
contrast, 0, 0, 0, brightness,
0, contrast, 0, 0, brightness,
0, 0, contrast, 0, brightness,
0, 0, 0, 1, 0,
0, 0, 0, 0, 1
});
Canvas canvas = new Canvas(operation);
Paint paint = new Paint();
paint.setColorFilter(new ColorMatrixColorFilter(cm));
canvas.drawBitmap(bmp, contrast, brightness, paint);
imageview.setImageBitmap(operation);
}
IMAGE OF BUG. The white line in the left
任何人誰將會在這方面幫助。謝謝!
什麼是經過'contrast'和'brightness'爲'x'和'y'在'canvas.drawBitmap(BMP,對比度,亮度,油漆)的隱藏的想法' ? – pskink
@pskink我在學校學到最後我需要這樣寫。你的報價是?如果你能分享你的想法如何解決這個問題,我會非常感激。 – BENZG55