如何在图像上制作波普艺术照片滤镜

时间:2018-12-20 05:12:47

标签: java android

我想制作一个称为流行艺术滤镜的滤镜

Pop Art Filter

我正在尝试此解决方案

  public static Bitmap setPopArtGradientFromBitmap(Context context, Bitmap bmp) {
            int[] co = new int[]{Color.parseColor("#FFD900"),Color.parseColor("#FF5300"),Color.parseColor("#FF0D00"),Color.parseColor("#AD009F"),Color.parseColor("#1924B1")};
            float[] coP = new float[]{0.2f,0.4f,0.6f,0.8f,1.0f};

            Bitmap bitmap = bmp.copy(Bitmap.Config.ARGB_8888, true);
            Canvas canvas = new Canvas(bitmap);

            /* Create your gradient. */
            LinearGradient grad = new LinearGradient(0, 0, 0, canvas.getHeight(), co, coP, Shader.TileMode.CLAMP);

            /* Draw your gradient to the top of your bitmap. */
            Paint p = new Paint();
            p.setStyle(Paint.Style.FILL);
            p.setAlpha(110);
            p.setShader(grad);
            canvas.drawRect(0, 0, canvas.getWidth(), canvas.getHeight(), p);

            return bitmap;
        }

还有我得到的结果。

enter image description here

0 个答案:

没有答案