<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title>Languages of the real and artificial - Latest Comments in JavaScript Gradient Roundrects</title><link>http://osteele.disqus.com/</link><description></description><atom:link href="https://osteele.disqus.com/javascript_gradient_roundrects/latest.rss" rel="self"></atom:link><language>en</language><lastBuildDate>Tue, 08 Jan 2008 08:49:41 -0000</lastBuildDate><item><title>Re: JavaScript Gradient Roundrects</title><link>http://blog.osteele.com/archives/2006/03/javascript-gradient-roundrects#comment-4881074</link><description>&lt;p&gt;is there way where i can add border&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Gobinath Mallaiyan</dc:creator><pubDate>Tue, 08 Jan 2008 08:49:41 -0000</pubDate></item><item><title>Re: JavaScript Gradient Roundrects</title><link>http://blog.osteele.com/archives/2006/03/javascript-gradient-roundrects#comment-4881073</link><description>&lt;p&gt;Hello,&lt;/p&gt;&lt;p&gt;I'm quite aware that CSS styles are preferably used with DEV elements, but I wanted to use roundrects in html table. Unfortunately the result is wrong, the roundrect is positionned in absolute coordinates 0,0, both in firefox and safari on mac. You can see my test page and the corresponding screen dumps here :&lt;/p&gt;&lt;p&gt;&lt;a href="http://membres.lycos.fr/jfbouzereau/gradient.html" rel="nofollow noopener" target="_blank" title="http://membres.lycos.fr/jfbouzereau/gradient.html"&gt;http://membres.lycos.fr/jfb...&lt;/a&gt;&lt;/p&gt;&lt;p&gt;Thanks in advance for any ideas ...&lt;/p&gt;&lt;p&gt;Cheers.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Jean-Francois Bouzereau</dc:creator><pubDate>Mon, 19 Nov 2007 09:13:46 -0000</pubDate></item><item><title>Re: JavaScript Gradient Roundrects</title><link>http://blog.osteele.com/archives/2006/03/javascript-gradient-roundrects#comment-4881072</link><description>&lt;p&gt;useful tool thanks.&lt;/p&gt;&lt;p&gt;altering the createCanvasGradient function as follows will allow you to pass a 'direction' parm via the enhanced style.&lt;br&gt;possible values are:: 'horizontal', 'vertical', 'diagonal-down', 'diagonal-up'&lt;/p&gt;&lt;p&gt;OSGradient.prototype.createCanvasGradient = function(e, width, height) {&lt;/p&gt;&lt;p&gt;	var canvas = document.createElement('canvas');&lt;br&gt;	var ctx;&lt;br&gt;	// Return null if canvas isn't supported.  The caller will&lt;br&gt;	// fall back on divs.&lt;br&gt;	try {ctx = canvas.getContext('2d')} catch (e) {return null}&lt;/p&gt;&lt;p&gt;	// Safari requires the following prior to rendering&lt;br&gt;	e.appendChild(canvas);&lt;br&gt;	if (navigator.appVersion.match(/Konqueror|Safari|KHTML/))&lt;br&gt;		canvas.style.position = 'fixed';&lt;br&gt;    canvas.setAttribute('width', width);&lt;br&gt;    canvas.setAttribute('height', height);&lt;/p&gt;&lt;p&gt;	var style = &lt;a href="http://this.style" rel="nofollow noopener" target="_blank" title="this.style"&gt;this.style&lt;/a&gt;;&lt;br&gt;    var c0 = style['gradient-start-color'];&lt;br&gt;    var c1 = style['gradient-end-color'];&lt;br&gt;    var r = style['border-radius'];&lt;br&gt;    var direction = style['direction'];&lt;/p&gt;&lt;p&gt;	ctx.beginPath();&lt;br&gt;	ctx.moveTo(0,r);&lt;br&gt;	//arcTo() produces NS_ERROR_NOT_IMPLEMENT in Firefox 1.5; use arc() instead:&lt;br&gt;	//ctx.arcTo(0,0,r,0,r);&lt;br&gt;	ctx.arc(r,r,r,Math.PI,-Math.PI/2,false);&lt;br&gt;	ctx.lineTo(width-r,0);&lt;br&gt;	//ctx.arcTo(width,0,width,r,r);&lt;br&gt;	ctx.arc(width-r,r,r,-Math.PI/2,0,false);&lt;br&gt;	ctx.lineTo(width,height-r);&lt;br&gt;	//ctx.arcTo(width,height,width-r,height,r);&lt;br&gt;	ctx.arc(width-r,height-r,r,0,Math.PI/2,false);&lt;br&gt;	ctx.lineTo(r,height);&lt;br&gt;	//ctx.arcTo(0,height,0,height-r,r);&lt;br&gt;	ctx.arc(r,height-r,r,Math.PI/2,Math.PI,false);&lt;br&gt;	ctx.clip();&lt;/p&gt;&lt;p&gt;	switch (direction){&lt;br&gt;		case "vertical":&lt;br&gt;			var g = ctx.fillStyle = ctx.createLinearGradient(0,0,0,height);&lt;br&gt;			break;&lt;br&gt;		case "horizontal":&lt;br&gt;			var g = ctx.fillStyle = ctx.createLinearGradient(0,0,width,0);&lt;br&gt;			break;&lt;br&gt;		case "diagonal-down":&lt;br&gt;			var g = ctx.fillStyle = ctx.createLinearGradient(0,0,width,height);&lt;br&gt;			break;&lt;br&gt;		case "diagonal-up":&lt;br&gt;			var g = ctx.fillStyle = ctx.createLinearGradient(0,height,width,0);&lt;br&gt;			break;&lt;br&gt;		default:  //maintain backwards compatibility with code not passing direction parm&lt;br&gt;			var g = ctx.fillStyle = ctx.createLinearGradient(0,0,0,height);&lt;br&gt;			break;&lt;/p&gt;&lt;p&gt;	}&lt;/p&gt;&lt;p&gt;	g.addColorStop(0, OSUtils.color.long2css(c0));&lt;br&gt;	g.addColorStop(1, OSUtils.color.long2css(c1));&lt;br&gt;	ctx.rect(0,0,width,height);&lt;br&gt;	ctx.fill();&lt;/p&gt;&lt;p&gt;	return canvas;&lt;br&gt;};&lt;/p&gt;&lt;p&gt;Cheers&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Norm Fox</dc:creator><pubDate>Tue, 11 Sep 2007 19:47:22 -0000</pubDate></item><item><title>Re: JavaScript Gradient Roundrects</title><link>http://blog.osteele.com/archives/2006/03/javascript-gradient-roundrects#comment-4881071</link><description>&lt;p&gt;I just ran across your gradient and rounded corners implementation and it looks really good. To be honest, I have not looked through the JavaScript intently yet, but I am wondering if there is not a fairly easy way to make the gradient a horizontal gradient as opposed to the current vertical gradient?&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Norman Harebottle</dc:creator><pubDate>Fri, 13 Apr 2007 18:36:03 -0000</pubDate></item><item><title>Re: JavaScript Gradient Roundrects</title><link>http://blog.osteele.com/archives/2006/03/javascript-gradient-roundrects#comment-4881070</link><description>&lt;p&gt;hi love your code and stuff but is it possible t print the gradient horizontally left to right.....very much appreciated your code and effort u put in it.....&lt;/p&gt;&lt;p&gt;thanks&lt;br&gt;aqeel ahmed&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">aqeel ahmed</dc:creator><pubDate>Tue, 15 Aug 2006 03:58:09 -0000</pubDate></item></channel></rss>