- android - RelativeLayout 背景可绘制重叠内容
- android - 如何链接 cpufeatures lib 以获取 native android 库?
- java - OnItemClickListener 不起作用,但 OnLongItemClickListener 在自定义 ListView 中起作用
- java - Android 文件转字符串
我正在创建一个应用程序,它使用 UIImagePickerController
向用户展示一个带有自定义覆盖层的相机,其中包括相机“ View ”本身上的两个网格/图案之一。
网格本身是添加到叠加层的 UIImageView
中的 .png 文件,它们非常复杂,所以我真的很想避免在代码中绘制网格,即使那样会为我的问题提供简洁明了的答案。
我希望能够提供多种颜色的网格。显而易见的解决方案是创建更多不同颜色的 .png 图像,但对于每种颜色,必须有四个单独的图像(每个网格的常规图像和视网膜图像),这样很快就会增加很多 Assets 。
我认为最理想的解决方案是只创建白色/灰色的网格,然后对其应用色调以适本地着色。
这可能吗?还是我需要寻求替代解决方案?
最佳答案
感谢 Ananth 指点我 iPhone - How do you color an image?
我已按照问题中的建议将此方法添加到我的代码中,并在 willc2 的答案中进行了修改:
-(UIImage *)colorizeImage:(UIImage *)baseImage color:(UIColor *)theColor {
UIGraphicsBeginImageContext(baseImage.size);
CGContextRef ctx = UIGraphicsGetCurrentContext();
CGRect area = CGRectMake(0, 0, baseImage.size.width, baseImage.size.height);
CGContextScaleCTM(ctx, 1, -1);
CGContextTranslateCTM(ctx, 0, -area.size.height);
CGContextSaveGState(ctx);
CGContextClipToMask(ctx, area, baseImage.CGImage);
[theColor set];
CGContextFillRect(ctx, area);
CGContextRestoreGState(ctx);
CGContextSetBlendMode(ctx, kCGBlendModeMultiply);
CGContextDrawImage(ctx, area, baseImage.CGImage);
UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return newImage;
}
...我得到了我想要的。
关于objective-c - 为图像添加色调,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11241363/
我想将一些颜色值从众所周知的 HSL 转换为鲜为人知的 HSLum 怎么做? hsl(0, 1.0, 0.5) - rgb red is hslum(0, 1.0., 0.54) hsl(120,
在 xml 中为 ImageView 设置色调时,我收到一条警告,显示:- 必须使用 app:tint 而不是 android:tint 为什么我应该使用 app:tint? 最佳答案 因为有一些问题
如果我有一个 alpha 整数和三个用于色调、饱和度和亮度的 float ,我如何使用一种方法以最紧凑的方式将它们转换为一个 argb 值? 编辑:我知道我可以使用 HSBtoRGB,我已经通读了 j
尝试在 firemonkey 中实现类似于此的环形颜色选择器:http://dph.am/iDropper/ 我认为可以使用在笔划上具有多点渐变的 TCircle 来完成。根据我的实验和研究,渐变只能
我在 Hadoop 2.6.2 集群中使用 Hue 3.9。这些计算机都有 Ubuntu 14.04。我能够成功安装 Hue,但从 Web UI 查看 hue 时确实出现了一些错误。我试图一次解决这些
有没有一种方法可以使用 jQ 或某些插件对图像进行着色(应用色调)?谢谢 最佳答案 我能想到的最简单的方法是在图像上覆盖一个半透明的 div。 一个小例子: HTML CSS .overlay
类似于this previous question ,我想将任意颜色的色调应用于任意图像(UIImageView)。然而,我希望色调在 N 秒的时间内逐渐消失,以产生“脉冲”效果。我将每 M 秒触发一
是否有任何命令来检查Hadoop中当前正在运行多少个色调 session ,以及是否有任何方法可以查看已随着年龄运行的 session ? 最佳答案 一个可以帮助解决这个问题的吉拉是HUE-2288
我是 seaborn 的新手,我有这个数据集,想创建一个这样的图表,但要使用 seaborn。 这是我的数据: max_depth = [ 3, 3, 3, 3, 3, 5, 5, 5,
我是 seaborn 的新手,我有这个数据集,想创建一个这样的图表,但要使用 seaborn。 这是我的数据: max_depth = [ 3, 3, 3, 3, 3, 5, 5, 5,
如何使用 Stylus 更改十六进制颜色值的色调和增加饱和度? 最佳答案 Stylus 实际上内置了这些功能。基于文档 hue , saturation : 以下应该有效: 色调(#00c, 90de
我正在尝试创建一个应用程序,允许我通过调整上述每个字段的搜索栏来调整图像的色调、饱和度、亮度、对比度和清晰度。喜欢 http://ronbigelow.com/articles/workflow_ba
我为此问题创建了一个示例数据集 import pandas as pd from pandas import DataFrame import seaborn as sns import numpy
(HI) 我不是比色学方面的专家,但我想知道如何实现基于主色生成随机颜色的脚本。 可能是随机的阴影或色调 例如:#f25f9a。 http://www.color-hex.com/color/f25f
我用 TextView 制作了一些复选框和单选按钮,但它们在 Lollipop 之前没有着色。 我的 TextView 扩展 AppCompatCheckedTextView,样式如下: ?
我创建了一个启用了分析的 Solr 仪表板。计数器按钮现在显示,但它是灰色的。 Hue 或 solr 中是否有任何我应该启用的附加标志? 谢谢 我正在使用 Solr 7 + Hue 4 最佳答案 这是
正如标题所说,如何将状态栏图标的颜色更改为深色调而不是默认的白色。 来自 到 最佳答案 要使状态栏图标具有深色而不是默认的白色,请在 styles.xml 中添加以下标记(或者更准确地说是在 valu
刚刚在我的 iPhone 3GS 上切换到 iOS 4,我的一些应用程序崩溃了。 我遇到的一个问题是,我有一个带有一些按钮的 UIToolbar,颜色为粉红色,在 3.1.3 操作系统上运行良好。升级
我有一个“位图”类型,其中包含一些随机位图数据。我已经编写了自己的亮度、颜色、饱和度和色调调整,这些调整分别作用于每个位,毫不奇怪,速度非常慢。 在我的研究中,我注意到使用矩阵可以非常快地调整这些。此
假 --> HEX color:
我是一名优秀的程序员,十分优秀!