tint

How to tint a Bitmap to a solid color

折月煮酒 提交于 2019-12-09 14:14:21
问题 How would one go about tinting a Bitmap to a solid color, effectively replacing all pixels that have an alpha > 0 to a given RGB value? In addition how to do the same thing, but keeping the alpha for every pixel? I'm not looking for per-pixel operations as they tend to be slow. I tried using a ColorMatrixColorFilter and a ColorFilter, which do tint the Bitmap, but they colorize instead of performing a 100% tint. 回答1: I solved this by using a PorterDuffColorFilter Paint paint = new Paint();

How can I tint a sprite to white in XNA?

≯℡__Kan透↙ 提交于 2019-12-07 04:44:47
问题 I don't think this is possible just using the color setting in SpriteBatch, so I'm trying to work out a simple shader that would take every pixel and make it white, while respecting the alpha value of the pixel. The answer Joel Martinez gave looks right, but how do I incorporate that when I draw the sprite with SpriteBatch? 回答1: I think this is what you're looking for sampler2D baseMap; struct PS_INPUT { float2 Texcoord : TEXCOORD0; }; float4 ps_main( PS_INPUT Input ) : COLOR0 { float4 color

Color of UIToolbar not changing

时间秒杀一切 提交于 2019-12-06 02:10:31
问题 I have created a UIToolbar. I am trying to give it black color using: toolbar.barStyle = UIBarStyleBlackOpaque; or toolbar's background property. But its color does not change in either case. How can I change it? 回答1: Have you tried setting the tint property on UIToolbar? ie: - (void)viewDidLoad { [super viewDidLoad]; UIToolbar *toolbar=[[UIToolbar alloc] initWithFrame:CGRectMake(0, 0, 320, 46)]; toolbar.tintColor=[UIColor redColor]; [self.view addSubview:toolbar]; [toolbar release]; }

UIActionSheet Tinting

不羁的心 提交于 2019-12-05 06:27:17
问题 Anyone know anyway to tint uiactionsheet in uikit? 回答1: Yes, because it's an UIView (as described by kmit) you can use the following commands: addSubview, thereby you can add your own background and order it back with sendSubviewToBack. (you can delete the old background by this: [[youralert.subviews objectAtIndex:0] removeFromSuperview]) 来源: https://stackoverflow.com/questions/1301909/uiactionsheet-tinting

How can I tint a sprite to white in XNA?

泪湿孤枕 提交于 2019-12-05 06:10:57
I don't think this is possible just using the color setting in SpriteBatch, so I'm trying to work out a simple shader that would take every pixel and make it white, while respecting the alpha value of the pixel. The answer Joel Martinez gave looks right, but how do I incorporate that when I draw the sprite with SpriteBatch? I think this is what you're looking for sampler2D baseMap; struct PS_INPUT { float2 Texcoord : TEXCOORD0; }; float4 ps_main( PS_INPUT Input ) : COLOR0 { float4 color = tex2D( baseMap, Input.Texcoord ); return float4(1.0f, 1.0f, 1.0f, color.w); } It's very simple, it just

UINavigationBar change Tint color with animation

[亡魂溺海] 提交于 2019-12-04 08:39:13
问题 Is it possible to change the tint with animation for a smoother effect? This doesn't work for me: [UIView beginAnimations:nil context:nil]; [self.navigationController.navigationBar setTintColor:[UIColor greenColor]]; [UIView commitAnimations]; I a not sure if it is even possible using native apple components as I guess they will be using CG to generate the gradient ... just want to find out before I'll start building my own solution ... Cheers guys :) 回答1: You wouldn't believe the length I

Color of UIToolbar not changing

有些话、适合烂在心里 提交于 2019-12-04 08:23:59
I have created a UIToolbar. I am trying to give it black color using: toolbar.barStyle = UIBarStyleBlackOpaque; or toolbar's background property. But its color does not change in either case. How can I change it? Have you tried setting the tint property on UIToolbar? ie: - (void)viewDidLoad { [super viewDidLoad]; UIToolbar *toolbar=[[UIToolbar alloc] initWithFrame:CGRectMake(0, 0, 320, 46)]; toolbar.tintColor=[UIColor redColor]; [self.view addSubview:toolbar]; [toolbar release]; } Detailed in the apple docs IN iOS 7 you need to set the barTintColor Property- UIToolbar *doneToolbar=[[UIToolbar

Apply tint to PreferenceActivity widgets with AppCompat v21

妖精的绣舞 提交于 2019-12-03 18:26:16
问题 I'm using CheckboxPreference in a PreferenceActivity and an AppCompat theme from the v21 support library. As you already know, with this latest library widgets like checkboxes, editTexts, radio buttons etc are tinted with the secondary color defined in the theme. In the preference screen, text is in the right color as specifified by my theme, but checkboxes and edittext are not. It seems that when the CheckboxPreference instance creates the widget, it doesn't apply my theme to it. Radio

CSS equivalent for Text Tint

ε祈祈猫儿з 提交于 2019-12-03 17:20:42
I'm trying to export files from Adobe InDesign to basic HTML + CSS. A user can select some text and change the text colour. Using the InDesign SDK I can fetch the RGB values for that colour and in the CSS file declare color: rgb(R,G,B) which works perfectly fine. You can also change the text tint value. Upto now I was just taking the tint value, converting it to the range 0-1 and in the CSS putting an entry as color: rgba(R,G,B,Tint) During testing I realized that tint = 0 should actually mean white text, but it didn't show on the HTML because A (in RGBA) = 0 means transparent!!! Anyone knows

Change colour of dark grey highlight when holding down custom UIButton?

浪尽此生 提交于 2019-12-03 06:32:51
问题 I have a custom UIButton which is a cloud, transparent black and white .png file, with no down state, just one image. When tapping and holding the finger over it, it turns dark grey. I'm trying to change that dark grey to something a little less oppressive. The button is out in the open in a view, not in a tab bar, tool bar, or navigation controller. I've already tried setting tintColor (which the documentation helpfully informs me is only suitable for 'some' types of buttons, which no