- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在使用以下代码使我的图片变黑
BitmapDrawable bdarw = new BitmapDrawable(imagePath);
ColorMatrix cm = new ColorMatrix();
cm.set(new float[] {
2, 1f, 0, 0, 0,
0, 2, 0f, 0, 0,
0, 0, 2, 0f, 0,
0, 0, 0, 1f, 0 });
bdarw.setColorFilter(new ColorMatrixColorFilter(cm));
Bitmap bitmap= bdarw.getBitmap();
ImageView imageView = (ImageView) findViewById(R.id.imgV);
imageView.setImageBitmap(bitmap);
但颜色矩阵似乎不正确,你能帮帮我吗
最佳答案
当然,对于黑色,所有颜色分量都需要 0。唯一要担心的是 alpha。让它保持原样。
cm.set(new float[] {
0, 0, 0, 0, 0,
0, 0, 0, 0, 0,
0, 0, 0, 0, 0,
0, 0, 0, 1f, 0 });
要强制 alpha 为零,请将 1 更改为 0,要强制 alpha 为 ff,请将最后一个 0 更改为 1 或 255 我不确定是哪个,试试看。
ColorMatrix文档。
关于黑色的android colormatrix,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9138797/
我正在更改 ImageView 的亮度、对比度、饱和度和色调。我在上面搜索了很多。 我得到了一些适用于 ColorMatrix 的代码。 [1.] 对于亮度 ColorMatrix 是类似的东西
我正在使用以下代码使我的图片变黑 BitmapDrawable bdarw = new BitmapDrawable(imagePath); ColorMatrix c
作为学校项目的一部分,我正在尝试运行 MSDN 文章中的一些稍微修改过的代码。目标是使用颜色矩阵为图片框中的位图重新着色。这是我的代码: float[][] colorMatrixEl
我正在根据计算更改图像中每个像素的颜色值。问题是这在我的机器上使用 1000x1333 图像需要超过 5 秒,我正在寻找一种方法来优化它以使其更快。 我想 ColorMatrix可能是一种选择,但我很
我想尝试使用 ColorMatrix ,但我只能找到将图像转换为灰度的示例。即便如此,它们往往会被呈现为一大块“魔数(Magic Number)”代码,没有任何解释。 有人知道如何使用 ColorMa
我正在尝试使用 ColorMatrix 调整图像的亮度(您可以在 Photoshop 中尝试调整色相时看到此选项,亮度和亮度也是两个不同的功能)使用 ColorMatrix 但不知道要更改哪些值才能实
在开始之前,我使用的是 C#。我想使用 ColorMatrix 类进行一些转换。问题是有时 r、g 或 b 会发生溢出。矩阵没有将值固定在 255,而是循环并再次从 0 开始。这意味着,对于应该显示为
我已阅读 ColorMatrix文档,它说了以下内容: 5x4 matrix for transforming the color+alpha components of a Bitmap. The
我正在做一些图像处理应用程序的工作(为了好玩),并且正在努力完全理解 ColorMatrix 转换的工作原理。我掌握了线性/仿射变换的基础知识,并且可以通过在线复制示例很好地掌握,但我想完全掌握某些东
在 XNA 中,如何实现与应用 System.Drawing.Imaging.ColorMatrix 相同的效果?下面的文章展示了我想如何渲染我的 Sprite ,但它使用了 GDI+: http:/
我的工具栏上有一个圆形的 ProgressBar 来显示一些不确定的进度,但是 ProgressBar 的默认样式(我知道的唯一一个使它变成圆环的样式)与工具栏的颜色相同('colorPrimary
我有一张图片,如果像素 (x,y).R < 165,我想将像素设置为白色。 之后我想将所有非白色的像素设置为黑色。 我可以使用 ColorMatrix 做到这一点吗? 最佳答案 你不能用颜色矩阵来做到
我需要创建一个自定义 CSS 过滤器,将黑白图像转换为具有两种自定义颜色的双色图像。 我想以这种方式应用过滤器(不确定这种语法是否可行,可能必须单独传递 6 个参数): .duotone {
我正在尝试在 Swift 中重新编写我的 Android 应用程序以启动 iOS,但我已经遇到了障碍...... Android 应用程序是关于基于 ColorMatrix 总和的图像处理......
我正在尝试使用 ColorMatrix 为整个图像设置一个恒定的色调值。我的目标是使整个图像看起来颜色相同,而不会失去任何区域的亮度。我找到了一种使用 ColorMatrix 来移动图像的色调值的方法
我正在 Canvas 上工作,并使用 EaselJS 库来玩。使用 EaselJS,我可以使用过滤器应用 ColorMatrix const myGraphics = new createjs
查看 Android 文档,ColorMatrix setSaturation() method说: Set the matrix to affect the saturation of colors
为了回答这个问题,我将粘贴 Vibrance 的定义以及它与常规 Saturation 的不同之处。 Vibrance is a smart-tool which cleverly increases
我有 2 个表单,A 和 B。在表单 A 上,我单击一个按钮,图像被加载到位于表单 B 上的 PictureBox 中。并且,我想通过以下方式将 GrayScale 设置为此图像: public
我想改变图像特定部分的亮度。我知道如何使用 ColorMatrix 更改图像的亮度(或色调)。但它将应用于整个图像。 我有一个 mask 文件(黑白图像)。我想仅在该 mask 的白色部分应用亮度变化
我是一名优秀的程序员,十分优秀!