tint

What is new in Drawable Tinting in Android L Developer Preview compared to previous version?

笑着哭i 提交于 2019-11-30 08:10:11
I am working of new Android L preview and now dealing with tinting concept on drawable. I want to know if there is anything new regarding drawable tinting in Android L Developer Preview. I read this this documentation which says: The Android L Developer Preview enables you to define bitmaps or nine-patches as alpha masks and to tint them using a color resource or a theme attribute that resolves to a color resource (for example, ?android:attr/colorPrimary ). You can create these assets only once and color them automatically to match your theme. But I didn't understand how it is different from

Darkening an image with CSS (In any shape)

时间秒杀一切 提交于 2019-11-30 07:53:22
So I have seen quite a few ways to darken images with CSS, including ones with rounded corners, but my problem is different. Let's say I have an .png image that looks like a little dog (just go with it, I don't have any good examples), when I place it on my page, I give it dimensions of 100 x 100. But I can't just overlay something on it, or tint the entire image, as it will cause the background of the dog to be tinted as well, which looks ugly. Is it possible to tint an image of arbitrary shape with CSS? (I'm assuming you understand my point, and useless code is not necessary) Thanks! You

Tint Navigation Icon in Toolbar

ぐ巨炮叔叔 提交于 2019-11-29 17:41:09
问题 How to tint menu icons is already covered a few times, like here: Toolbar icon tinting on Android Additionally to this solution there is still the problem of the navigation icon. Applying a Theme(Overlay) to your Toolbar just tints the text and the whitelisted icons (see: https://stackoverflow.com/a/26817918/2417724) If you set a custom icon (which happens to be quite easy the case, as you need to change it if you don't want to display the default back arrow) then this custom icon does not

Darkening an image with CSS (In any shape)

爷,独闯天下 提交于 2019-11-29 11:06:31
问题 So I have seen quite a few ways to darken images with CSS, including ones with rounded corners, but my problem is different. Let's say I have an .png image that looks like a little dog (just go with it, I don't have any good examples), when I place it on my page, I give it dimensions of 100 x 100. But I can't just overlay something on it, or tint the entire image, as it will cause the background of the dog to be tinted as well, which looks ugly. Is it possible to tint an image of arbitrary

DrawableCompat tinting does not work on pre-Lollipop

馋奶兔 提交于 2019-11-28 19:42:16
问题 I'm using the new TextInputLayout to wrap an EditText. When I determine a field has an error I do the following: Drawable drawable = DrawableCompat.wrap(getEditText().getBackground()); DrawableCompat.setTintList(drawable, ColorStateList.valueOf(Color.RED)); This works on 5.0 and turns the underline red, but does nothing on 4.4 or 4.1 test devices. What am I missing here? Seems so simple and according to google "just works"... pretty sure I have the latest version of it as well: compile 'com

UIToolbar tint on iOS 4

白昼怎懂夜的黑 提交于 2019-11-28 07:39:00
just switched to iOS 4 on my iPhone 3GS and some of my apps broke. One issue I had is that I had a UIToolbar with some buttons, tinted to pink, that worked well on the 3.1.3 OS. After upgrading to iOS 4, the toolbar was still tinted, but the buttons it contained were no longer affected by the tint. The toolbar was pink while the buttons were regular-blue. Looked around for it on the net, but found no reference of such a thing. Anyone knows what broke in the process? (must be frank here - I knew the answer before posting, just didn't know how to load this data to StackOverflow. Thought the

Unity 渲染教程(二):着色器基础

爷,独闯天下 提交于 2019-11-27 20:48:11
转载: https://www.jianshu.com/p/7db167704056 这是关于渲染基础的系列教程的第二部分。这个渲染基础的系列教程的第一部分是有关矩阵的内容。在这篇文章中我们将编写我们的第一个着色器代码并导入纹理。 这个系列教程是使用Unity 5.4.0开发的,这个版本目前还是开放测试版本。我使用的是build 5.4.0b10版本。 对球使用纹理。 1. 默认的场景 当你在Unity中创建新的场景的时候,你将使用默认的相机和定向的光源。 通过GameObject / 3D Object / Sphere这个菜单项来创建一个简单的球体,然后把这个简单的球体放在原点,并把相机放在它的前面。 默认场景中的默认球体。 这是一个非常简单的场景,但是已经有很多复杂的渲染内容了。为了更好地抓住渲染过程,摆脱所有奇怪的东西是非常有帮助的,首先让我们只关心渲染的基础部分。 1.1 剥离那些和渲染无关的内容 通过菜单项Window / Lighting来查看场景的光照设置。 这将打开一个具有三个选项卡的光照窗口。我们只对默认情况下处于激活状态的“场景”选项卡感兴趣。 默认的光照设置。 这是一个关于环境光照的部分,你可以在其中选择天空盒。这个天空盒目前用于场景背景、环境光照和反射。让我们将其设置为none进行关闭。 在你进行设置的时候,你还可以关闭预计算和实时全局光照的面板

How can I tint a UIImage with gradient?

只谈情不闲聊 提交于 2019-11-27 17:43:33
I searched everywhere but didn't find the solution. I have image 1. How can I programatically tint them with gradient to get images 2 and 3? Here are those images: Tints that I applied to them via Photoshop are simple 2-color linear gradients. And my question is: how can I achieve this effect programatically? Solution: jrtc27 gave me almost working example. I fixed it (for ARC) and made it reusable (using UIImage's category). Here is it: - (UIImage *)tintedWithLinearGradientColors:(NSArray *)colorsArr { CGFloat scale = self.scale; UIGraphicsBeginImageContext(CGSizeMake(self.size.width * scale,

Android: Tint using DrawableCompat

丶灬走出姿态 提交于 2019-11-27 06:24:55
I'm trying to tint an image prior to Android API level 21. I've successfully tinted items using: <android:tint="@color/red"/> However, I can't seem to figure out how to do this through code on an ImageView: Drawable iconDrawable = this.mContext.getResources().getDrawable(R.drawable.somedrawable); DrawableCompat.setTint(iconDrawable, this.mContext.getResources().getColor(R.color.red)); imageView.setImageDrawable(iconDrawable); I've tried setting the TintMode but this seems to make no different. Am I using the v4 compatibility class DrawableCompat incorrectly? The simplest way to tint cross

How to tint a transparent PNG image in iPhone?

℡╲_俬逩灬. 提交于 2019-11-27 02:22:54
I know it's possible to tint a rectangular image by drawing a CGContextFillRect over it and setting the blend mode. However, I can't figure out how to do a tint on a transparent image such as an icon. It must be possible since the SDK does it itself on tab-bars in such. Would anyone be able to provide a snippet? UPDATE: Lots of great suggestions have been given for this problem since I originally asked. Be sure to read through all the answers to figure out what suits you best. UPDATE (Apr 30, 2015): With iOS 7.0, I can now just do the following, which would satisfy the needs of my original