gradient

OpenGL: How to render perfect rectangular gradient?

允我心安 提交于 2019-12-30 00:41:05
问题 I can render triangular gradient with simply just one triangle and using glColor for each corner. But how to render perfect rectangular gradient? I tried with one quad, but the middle will get ugly seam. I also tried with texture of 2x2 size, it was like it should be done: proper blending from each corner, but the texture sampling precision becomes unprecise when stretched too much (i started to see pixels bigger than 1x1 size). Is there some way of calculating this in a shader perhaps? --

Drawing an angle/angular/“Conical”/“Arcing” gradient in Objective-C (IOS) using Core Graphics

无人久伴 提交于 2019-12-29 07:53:09
问题 I'm trying to draw a "conical"/"arcing" gradient (I don't know what would be the correct term for this) (Photoshop calls it an "angle" gradient —your friendly neighborhood stackoverflow editor) using Objective-C (IOS), pretty much exactly like the image shown in the following thread. After days of googling and searching the internet to no avail, I've decided to ask for help here. A little background on what I'm trying to do. My objective is to create a custom UIView, which is circular

Linear Gradient Brush Fade WPF

为君一笑 提交于 2019-12-29 06:19:16
问题 I have a brush that colors the background of a header. I like the way the brush looks but would like it to fade to transparent in the bottom third. Any ideas how to do this? <LinearGradientBrush x:Key="HeaderBackgroundBrush" EndPoint=".5,1" StartPoint="1,0"> <GradientStop Color="#006699" Offset="1"/> <GradientStop Color="#80A8CC" Offset="0.5"/> </LinearGradientBrush> 回答1: I'm not sure you can do it by working only at the brush level, however you could apply an OpacityMask to your control:

CSS3 White to Transparent Gradient

送分小仙女□ 提交于 2019-12-29 06:12:15
问题 I'm using CSS3 and RGBA to create a white-to-transparent gradient: div { background-image: -moz-linear-gradient(left, rgba(255, 255, 255, 1), rgba(0, 0, 0, 0)); background-image: -ms-linear-gradient(left, rgba(255, 255, 255, 1), rgba(0, 0, 0, 0)); background-image: -webkit-gradient(linear, 0 0, 100% 0, from(rgba(255, 255, 255, 1)), to(rgba(0, 0, 0, 0))); background-image: -webkit-linear-gradient(left, rgba(255, 255, 255, 1), rgba(0, 0, 0, 0)); background-image: -o-linear-gradient(left, rgba

How to make a color gradient in a SeekBar?

Deadly 提交于 2019-12-29 05:36:07
问题 I want to use a SeekBar (i.e. old school Java Slider) into a color gradient picker. I have seen some examples like this but they all require making new classes and such. There has got to be a way to modify or override the original classes. Or just replace the background with a gradient. 回答1: I figured it out here is how you do it. You create a standard seekbar in your XML. <SeekBar android:id="@+id/seekbar_font" android:layout_width="fill_parent" android:layout_height="wrap_content" android

iOS - Draw gradient - Swift

左心房为你撑大大i 提交于 2019-12-28 16:27:20
问题 I'm trying to draw a gradient to UILabel, but it draws only the colors I can't see the text. I saw the code from here StackOverflow my modification: extension String{ func gradient(x:CGFloat,y:CGFloat, fontSize:CGFloat)->UIImage{ let font:UIFont = UIFont.systemFontOfSize(fontSize) let name:String = NSFontAttributeName let textSize: CGSize = self.sizeWithAttributes([name:font]) let width:CGFloat = textSize.width // max 1024 due to Core Graphics limitations let height:CGFloat = textSize.height

How can I prevent CSS gradient banding?

大兔子大兔子 提交于 2019-12-28 12:56:37
问题 I started using CSS gradients, rather than actual images, for two reasons: first, the CSS gradient definitely loads faster than an image, and second, they aren't supposed to show banding, like so many raster graphics. I started testing my site on various screens recently, and on larger ones (24+ inches), the CSS linear gradient which constitutes my site's background shows very visible banding. As a provisional fix, I've overlaid the gradient with a small, repeating, transparent PNG image of

How can I do programmatically gradient border color UIButton with Swift [closed]

你。 提交于 2019-12-28 03:35:05
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 3 years ago . How can I design programmatically UIButton like this gradient border color? ] Thanks for help 回答1: let gradient = CAGradientLayer() gradient.frame = CGRect(origin: CGPointZero, size: self.myButton.frame.size) gradient.colors = [UIColor.blueColor().CGColor, UIColor.greenColor()

Machine learning - Linear regression using batch gradient descent

大兔子大兔子 提交于 2019-12-28 03:32:16
问题 I am trying to implement batch gradient descent on a data set with a single feature and multiple training examples ( m ). When I try using the normal equation, I get the right answer but the wrong one with this code below which performs batch gradient descent in MATLAB. function [theta] = gradientDescent(X, y, theta, alpha, iterations) m = length(y); delta=zeros(2,1); for iter =1:1:iterations for i=1:1:m delta(1,1)= delta(1,1)+( X(i,:)*theta - y(i,1)) ; delta(2,1)=delta(2,1)+ (( X(i,:)*theta

using two scale colour gradients on one ggplot

大兔子大兔子 提交于 2019-12-28 03:06:09
问题 I would like to combine a colour scale gradient for the points on a scatter plot together with a colour scale gradient for some text that goes on the plot. I can do them separately as shown in my example below, but i can't seem to put them together...is there a way of doing this? Here is my example code of the two types of plots (p and p1) that I want to combine l <- data.frame(prev=rnorm(1266), aft=rnorm(1266), day=as.factor(wday(sample(c(2:6),1266,replace=TRUE),abbr=TRUE, label=TRUE)),