gradient

How to bind GradientStop Colours or GradientStops Property in Silverlight?

最后都变了- 提交于 2019-11-27 07:53:29
问题 I want to be able to have a dynamic Gradient in Silverlight, such as below: <RadialGradientBrush GradientOrigin="0.20,0.5" Center="0.25,0.50" RadiusX="0.75" RadiusY="0.5"> <GradientStop Color="{Binding Path=GradientStart}" Offset="0" /> <GradientStop Color="{Binding Path=GradientEnd}" Offset="1" /> </RadialGradientBrush> I am binding to two properties which return the type "Color" however I always get this message: AG_E_PARSER_BAD_PROPERTY_VALUE If I try to bind to a GradientStop Collection

Changing gradient background colors on Android at runtime

拟墨画扇 提交于 2019-11-27 06:55:22
I'm experimenting with Drawable backgrounds and have had no problems so far. I'm now trying to change the gradient background color at runtime. Unfortunately, there's no API to change it at runtime, it seems. Not even by trying to mutate() the drawable, as explained here: Drawable mutations The sample XML looks like this. It works, as expected. <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"> <gradient android:startColor="#330000FF" android:endColor="#110000FF" android:angle="90"/> </shape> Sadly, I want a list with various colors, and they'd have to

Calculate the color at a given point on a gradient between two colors?

只谈情不闲聊 提交于 2019-11-27 05:21:50
问题 So this is essentially the method I would like to write (in Objective-C/Cocoa, using UIColors , but I'm really just interested in the underlying math): + (UIColor *)colorBetweenColor:(UIColor *)startColor andColor:(UIColor *)endColor atLocation:(CGFloat)location; So as an example, say I have two colors, pure red and pure blue. Given a linear gradient between the two, I want to calculate the color that's at, say, the 33% mark on that gradient: So if I were to call my method like so: UIColor

angle attribute in android gradient

本小妞迷上赌 提交于 2019-11-27 05:06:02
问题 I am going through test example. Where for some Image background they are using gradient, the code goes like this <?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android"> <gradient android:startColor="#ff0000" android:centerColor="#00ff00" android:endColor="#0000ff" android:angle="180"/> <corners android:radius="5dp" /> </shape> In the above xml I didn't get angle attribute. but when I change the value of angle slightly the pattern slants. Can

iOS Find Color at Point Between Two Colors

喜夏-厌秋 提交于 2019-11-27 04:24:31
问题 I have a problem: I need to be able to take two colors and make a 'virtual gradient' out of them. I then need to be able to find the color at any point on this line. My current approach is this: if (fahrenheit < kBottomThreshold) { return [UIColor colorWithRed:kBottomR/255.0f green:kBottomG/255.0f blue:kBottomB/255.0f alpha:1]; } if (fahrenheit > kTopThreshold) { return [UIColor colorWithRed:kTopR/255.0f green:kTopG/255.0f blue:kTopB/255.0f alpha:1]; } double rDiff = kTopR - kBottomR; double

How to update model parameters with accumulated gradients?

二次信任 提交于 2019-11-27 04:23:45
问题 I'm using TensorFlow to build a deep learning model. And new to TensorFlow. Due to some reason, my model has limited batch size, then this limited batch-size will make the model has a high variance. So, I want to use some trick to make the batch size larger. My idea is to store the gradients of each mini-batch, for example 64 mini-batches, and then sum the gradients together, use the mean gradients of this 64 mini batches of training data to update the model's parameters. This means that for

Creating Gradient Brush along a Circular Path

南楼画角 提交于 2019-11-27 04:19:33
问题 I need to create a multi-step gradient along a circular path, as demonstrated in the following image: Does anyone have any ideas on how this could be accomplished in XAML rather than code? Would it be possible to use the existing gradient brushes or composite them somehow to achieve this effect? 回答1: You can get a cross-radial effect by using a non-affine transformation such as a perspective transform. I used the ideas in this article by Charles Petzold: Non-Affine Transforms in 2D? to create

How to draw a gradient line (fading in/out) with Core Graphics/iPhone?

让人想犯罪 __ 提交于 2019-11-27 04:13:35
问题 I know how to draw a simple line: CGContextSetRGBStrokeColor(context, 1.0, 1.0, 1.0, 1.0); CGContextMoveToPoint(context, x, y); CGContextAddLineToPoint(context, x2, y2); CGContextStrokePath(context); And I know how to do a gradient rectangle, i.g.: CGColorSpaceRef myColorspace=CGColorSpaceCreateDeviceRGB(); size_t num_locations = 2; CGFloat locations[2] = { 1.0, 0.0 }; CGFloat components[8] = { 0.0, 0.0, 0.0, 1.0, 1.0, 1.0, 1.0, 1.0 }; CGGradientRef myGradient =

2D grid data visualization in Python

白昼怎懂夜的黑 提交于 2019-11-27 03:58:17
问题 I need to visualize some data. It's basic 2D grid, where each cell have float value. I know how to e.g. assign color to value and paint grid in OpenCV. But the point here is that there are so many values so it's nearly impossible to do that. I am looking for some method, where I could use gradient. For example value -5.0 will be represented by blue, 0 - black, and +5.0 as red. Is there any way to do that in Python? Here is sample data I am talking about A B C D A -1.045 2.0 3.5 -4.890 B -5

How to make gradient color filled timeseries plot in R

半腔热情 提交于 2019-11-27 03:54:23
How to fill area under and above (sp)line with gradient color ? This example has been drawn in Inkscape - BUT I NEED vertical gradient - NOT horizontal. Interval from zero to positive == from white to red . Interval from zero to negative == from white to red . Is there any package which could do this? I fabricated some source data.... set.seed(1) x<-seq(from = -10, to = 10, by = 0.25) data <- data.frame(value = sample(x, 25, replace = TRUE), time = 1:25) plot(data$time, data$value, type = "n") my.spline <- smooth.spline(data$time, data$value, df = 15) lines(my.spline$x, my.spline$y, lwd = 2.5,