在Android中对图像应用效果

时间:2017-06-12 08:13:26

标签: android

我正在尝试在图像上应用图像效果。

这是我正在尝试的代码。

select CAST( 1234567890 AS DECIMAL(10,2)) from SYSIBM.SYSDUMMY1;

当我运行此代码时,应用程序不会崩溃,但始终会显示public class MainActivity extends AppCompatActivity { public ImageView imageView; public ImageButton btn1, btn2, btn3, btn4, btn5, btn6; private Bitmap operation; public Bitmap bmp; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); imageView = (ImageView) findViewById(R.id.imageView); btn1 = (ImageButton) findViewById(R.id.imageButton); btn1.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { ImageFilter imageFilter = new ImageFilter(MainActivity.this); imageFilter.execute(); } }); BitmapDrawable abmp = (BitmapDrawable) imageView.getDrawable(); bmp = abmp.getBitmap(); } public class ImageFilter extends AsyncTask<Void, Void, Bitmap> { Context context; public ProgressDialog progressDialog; public ImageFilter(Context ctx){ context = ctx; } @Override protected Bitmap doInBackground(Void... params) { operation = Bitmap.createBitmap(bmp.getWidth(),bmp.getHeight(), bmp.getConfig()); double red = 0.33; double green = 0.59; double blue = 0.11; for (int i = 0; i < bmp.getWidth(); i++) { for (int j = 0; j < bmp.getHeight(); j++) { int p = bmp.getPixel(i, j); int r = Color.red(p); int g = Color.green(p); int b = Color.blue(p); r = (int) red * r; g = (int) green * g; b = (int) blue * b; operation.setPixel(i, j, Color.argb(Color.alpha(p), r, g, b)); } } return operation; } @Override protected void onPreExecute() { progressDialog = new ProgressDialog(context); progressDialog.setMessage("Processing..."); progressDialog.show(); } @Override protected void onPostExecute(Bitmap bitmap) { imageView.setImageBitmap(bitmap); progressDialog.dismiss(); } } } 根本没有影响图像。我检查了日志,发现了两个警告。

警告#1

processDialog

警告#2

 W/art: Before Android 4.1, method android.graphics.PorterDuffColorFilter

我的代码有什么问题?

0 个答案:

没有答案