gradient

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

和自甴很熟 提交于 2019-11-27 17:44:29
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 = CGGradientCreateWithColorComponents(myColorspace, components, locations, num_locations); CGPoint myStartPoint, myEndPoint;

Gradient colors in Internet Explorer

岁酱吖の 提交于 2019-11-27 17:14:56
I know that Internet Explorer has some proprietary extensions so that you can do things like create divs with a gradient background. I can't remember the element name or it's usage. Does anyone have some examples or links? Look at the custom CSS filters IE can handle http://msdn.microsoft.com/en-us/library/ms532847.aspx The code I use for all browser gradients: background: #0A284B; background: -webkit-gradient(linear, left top, left bottom, from(#0A284B), to(#135887)); background: -webkit-linear-gradient(#0A284B, #135887); background: -moz-linear-gradient(top, #0A284B, #135887); background:

Circular gradient in android

ε祈祈猫儿з 提交于 2019-11-27 17:00:55
I'm trying to make a gradient that emits from the middle of the screen in white, and turns to black as it moves toward the edges of the screen. As I make a "normal" gradient like this, I have been experimenting with different shapes: <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"> <gradient android:startColor="#E9E9E9" android:endColor="#D4D4D4" android:angle="270"/> </shape> When using the "oval"-shape I at least got a round shape, but there were no gradient effect. How can I achieve this?' You can get a circular gradient using android:type="radial

Heatmap style gradients in .NET

醉酒当歌 提交于 2019-11-27 15:31:18
I am trying to create a heat map with gradients that look similar to this: This image shows three points and the gradients blend nicely together. Here is what I am currently doing in my drawing function: public void DrawGradient(int x, int y, Graphics g) { using (var ellipsePath = new GraphicsPath()) { var bounds = new Rectangle(x, y, 100, 100); ellipsePath.AddEllipse(bounds); var brush = new PathGradientBrush(ellipsePath); Color[] colors = { Color.FromArgb(64, 0, 0, 255), Color.FromArgb(140, 0, 255, 0), Color.FromArgb(216, 255, 255, 0), Color.FromArgb(255, 255, 0, 0) }; float[]

Why can't I reference an SVG linear gradient defined in an external file (paint server)?

∥☆過路亽.° 提交于 2019-11-27 14:48:55
Please have a look at this Pen: http://codepen.io/troywarr/pen/VYmbaa What I'm doing here is: defining an SVG symbol ( <symbol> ) defining an SVG linear gradient ( <linearGradient> ) using the <use> element to reference the SVG symbol I've created in the CSS, defining two classes: external , which references the linear gradient defined in this external .svg file (right click and view source) internal , which references the linear gradient defined in the local HTML (which is, I believe, effectively identical to the one in the external file) Because I've applied the internal class to the <svg>

How do you make a gradient background in css?

邮差的信 提交于 2019-11-27 14:31:43
问题 Is there any way to create a gradient background using nothing but CSS? You can see an example of what I want to achieve on this website. 回答1: Use this in your CSS: background-image: -o-linear-gradient(bottom, rgb(254,133,107) 24%, rgb(35,171,17) 62%); background-image: -moz-linear-gradient(bottom, rgb(254,133,107) 24%, rgb(35,171,17) 62%); background-image: -webkit-gradient(linear, left bottom, left top, color-stop(0.24, rgb(254,133,107)), color-stop(0.62, rgb(35,171,17))); background-image:

Gradient Stroke Along Curve in Canvas

六眼飞鱼酱① 提交于 2019-11-27 14:25:31
I'm trying to draw a curve in canvas with a linear gradient stoke style along the curve, as in this image . On that page there is a linked svg file that gives instructions on how to accomplish the effect in svg. Maybe a similar method would be possible in canvas? A Demo: http://jsfiddle.net/m1erickson/4fX5D/ It's fairly easy to create a gradient that changes along the path : It's more difficult to create a gradient that changes across the path : To create a gradient across the path you draw many gradient lines tangent to the path: If you draw enough tangent lines then the eye sees the curve as

How to set gradient as the text color of a TextView? [duplicate]

二次信任 提交于 2019-11-27 14:05:59
问题 This question already has answers here : Text with gradient in Android (8 answers) Closed 6 years ago . I have a file containing a gradient( textgradient.xml ) in my drawable folder. I need to put this gradient as the text color of a TextView through Java. How to do that? 回答1: This links solves your query: Text with gradient in Android It used LinearGradient class to create a shader ,which is set on the text view 回答2: It doesn't appear possible to extend TextView to draw text with a gradient.

How do I get a rainbow color gradient in C#?

柔情痞子 提交于 2019-11-27 13:35:09
I'd like to have an enumeration of Colors based on the rainbow colors (red... yellow... green... blue...). I see basically two ways to do that: Create a lookup table containing some important reference colors and interpolate between these. I don't like this idea at all. Apply some more or less fancy math. Probably less, but I don't quite see how it works. Any ideas? (Oh, and while I did some SO research, I found no good results. If this question was already posted, please just point me to the location and I'll delete this.) Edit: I'd prefer to have this independent of the used technology to

Can I apply a gradient along an SVG path?

谁说胖子不能爱 提交于 2019-11-27 13:24:33
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="transparent"/> </linearGradient> </defs> <path d="M50 10 A40 40 0 1 0 90 50" stroke="url(#grad1)"