gradient

Diagonal Gradient in IE

雨燕双飞 提交于 2019-12-17 22:43:09
问题 Is there a way to have a diagonal gradient in IE? In Chrome I could do something like this: body{ background-image:-webkit-gradient( linear, left top, right bottom, color-stop(0%,#f00), color-stop(50%,#0f0), color-stop(100%,#00f)); } but this doesn't work in IE. 回答1: Yes, it is possible! Although it does not work as well as a real diagonal gradient in other browswers. There are two important aspects of this solution that make it work: Two divs with the same position and different z-index

How to draw a smooth/dithered gradient on a canvas in Android

╄→尐↘猪︶ㄣ 提交于 2019-12-17 17:28:58
问题 Several answers mention to use GradientDrawable.setDither(true) to draw smooth gradients in Android. That has no effect in my code. Any idea what I have to change to get a well looking gradient in my live wallpaper? GradientDrawable gradient = new GradientDrawable(Orientation.TL_BR, colors); gradient.setGradientType(GradientDrawable.RADIAL_GRADIENT); gradient.setGradientRadius(canvas.getWidth() * 2); gradient.setDither(true); gradient.setGradientCenter(-0.1f, -0.1f); gradient.setBounds(cb);

Get Slightly Lighter and Darker Color from UIColor

情到浓时终转凉″ 提交于 2019-12-17 17:18:21
问题 I was looking to be able to turn any UIColor into a gradient. The way I am intending to do this is by using Core Graphics to draw a gradient. What I am trying to do is to get a color, lets say: [UIColor colorWithRed:0.5 green:0.5 blue:0.5 alpha:1.0]; and get a UIColor which is a few shades darker and a few shades lighter. Does anyone know how to do this? Thank you. 回答1: - (UIColor *)lighterColorForColor:(UIColor *)c { CGFloat r, g, b, a; if ([c getRed:&r green:&g blue:&b alpha:&a]) return

create an arrow with gradient color

余生颓废 提交于 2019-12-17 16:37:51
问题 how can I create an arrow or segment with gradient color using R? 回答1: Try this, library(grid) png("mask.png") grid.polygon(c(-0.06, 0.06, 0.06, 0.15, 0, -0.15, -0.06), c(-5, -5, 2.5, 2, 5, 2, 2.5), gp=gpar(fill="black"), def="native", vp=viewport(xs=c(-0.15, 0.15), ys=c(-5, 5))) dev.off() library(png) m <- readPNG("mask.png", native=FALSE) mask <- matrix(rgb(m[,,1],m[,,2],m[,,3]), nrow=nrow(m)) rmat <- matrix(rgb(colorRamp(c("blue","white","red"))(seq(0,1,length=nrow(m))), maxColorValue=255)

How can I use a gradient map to tone a HTML5 canvas with an image in the canvas.

吃可爱长大的小学妹 提交于 2019-12-17 16:32:13
问题 I currently have a string, like the one displayed below, that I would like to tone an image with. I have searched Google in-access of 16 hours over the period of 2 weeks trying to figure out an answer. I can load an image into the canvas. This is what I am looking to do. This is a GIMP example (an Adobe Photoshop like program that is open source): http://gimpguru.org/tutorials/sampletoning/ 0,0,0 0,0,0 0,0,2 0,0,20 0,0,38 0,0,50 0,0,35 0,0,53 0,0,35 0,2,33 0,0,64 0,2,58 0,4,66 0,6,64 0,7,63 0

Multi-color linear gradient in WinForms

牧云@^-^@ 提交于 2019-12-17 15:45:06
问题 How to create multi-color linear gradient in WinForms? System.Drawing.Drawing2D.LinearGradientBrush allows only two colors. 回答1: same answer as here: Multi-color diagonal gradient in winforms Multi-color diagonal gradient in winforms Here is a little example void MainFormPaint(object sender, PaintEventArgs e) { LinearGradientBrush br = new LinearGradientBrush(this.ClientRectangle, Color.Black, Color.Black, 0 , false); ColorBlend cb = new ColorBlend(); cb.Positions = new[] {0, 1/6f, 2/6f, 3/6f

Generating gradients programmatically?

孤街浪徒 提交于 2019-12-17 10:18:38
问题 Given 2 rgb colors and a rectangular area, I'd like to generate a basic linear gradient between the colors. I've done a quick search and the only thing I've been able to find is this blog entry, but the example code seems to be missing, or at least it was as of this posting. Anything helps, algorithms, code examples, whatever. This will be written in Java, but the display layer is already taken care of, I just need to figure out how to figure out what to display. 回答1: you want an

Angle gradient in canvas

拈花ヽ惹草 提交于 2019-12-17 09:51:34
问题 I'm looking for a code that permits to have this effect on a canvas' stroke. I've already got an animated circular stroke, I only need to get the ANGLE gradient, not linear and not radial. I've got only 3 colours. The existing one is available here (the review rating) 回答1: A context strokeStyle can be a gradient: // create a gradient gradient = ctx.createLinearGradient(xStart, yStart, xEnd, yEnd); gradient.addColorStop(0.0,"blue"); gradient.addColorStop(1.0,"purple"); // stroke using that

Can I apply a gradient along an SVG path?

我与影子孤独终老i 提交于 2019-12-17 07:28:02
问题 I'd like to put a simple loading indicator on my website that's triggered by a script. It should be a simple circle arc that's got a gradient and is spinning while the user is waiting. I haven't tried the animation part, but got stuck on the static styling for now. Here's what I've got so far: <svg version="1.1" baseProfile="full" xmlns="http://www.w3.org/2000/svg" width="100" height="100"> <defs> <linearGradient id="grad1"> <stop offset="0%" stop-color="red"/> <stop offset="100%" stop-color=

Can I apply a gradient along an SVG path?

无人久伴 提交于 2019-12-17 07:27:13
问题 I'd like to put a simple loading indicator on my website that's triggered by a script. It should be a simple circle arc that's got a gradient and is spinning while the user is waiting. I haven't tried the animation part, but got stuck on the static styling for now. Here's what I've got so far: <svg version="1.1" baseProfile="full" xmlns="http://www.w3.org/2000/svg" width="100" height="100"> <defs> <linearGradient id="grad1"> <stop offset="0%" stop-color="red"/> <stop offset="100%" stop-color=