<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	>
<channel>
	<title>Comments on: JavaScript Gradient Roundrects</title>
	<atom:link href="http://osteele.com/archives/2006/03/javascript-gradient-roundrects/feed" rel="self" type="application/rss+xml" />
	<link>http://osteele.com/archives/2006/03/javascript-gradient-roundrects</link>
	<description>Languages of the real and artificial.</description>
	<pubDate>Tue, 06 Jan 2009 12:20:36 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.7</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: free essays</title>
		<link>http://osteele.com/archives/2006/03/javascript-gradient-roundrects/comment-page-1#comment-285</link>
		<dc:creator>free essays</dc:creator>
		<pubDate>Wed, 07 May 2008 23:29:57 +0000</pubDate>
		<guid isPermaLink="false">http://osteele.com/2006/03/23/javascript-gradient-roundrects#comment-285</guid>
		<description>Great info, thanks for the demo!</description>
		<content:encoded><![CDATA[<p>Great info, thanks for the demo!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: firefox</title>
		<link>http://osteele.com/archives/2006/03/javascript-gradient-roundrects/comment-page-1#comment-286</link>
		<dc:creator>firefox</dc:creator>
		<pubDate>Wed, 02 Apr 2008 21:54:57 +0000</pubDate>
		<guid isPermaLink="false">http://osteele.com/2006/03/23/javascript-gradient-roundrects#comment-286</guid>
		<description>You should make a search on google i think there is a solution.</description>
		<content:encoded><![CDATA[<p>You should make a search on google i think there is a solution.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Gobinath</title>
		<link>http://osteele.com/archives/2006/03/javascript-gradient-roundrects/comment-page-1#comment-284</link>
		<dc:creator>Gobinath</dc:creator>
		<pubDate>Tue, 08 Jan 2008 13:49:41 +0000</pubDate>
		<guid isPermaLink="false">http://osteele.com/2006/03/23/javascript-gradient-roundrects#comment-284</guid>
		<description>is there way where i can add border</description>
		<content:encoded><![CDATA[<p>is there way where i can add border</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jean-Francois Bouzereau</title>
		<link>http://osteele.com/archives/2006/03/javascript-gradient-roundrects/comment-page-1#comment-283</link>
		<dc:creator>Jean-Francois Bouzereau</dc:creator>
		<pubDate>Mon, 19 Nov 2007 14:13:46 +0000</pubDate>
		<guid isPermaLink="false">http://osteele.com/2006/03/23/javascript-gradient-roundrects#comment-283</guid>
		<description>Hello,

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 :

http://membres.lycos.fr/jfbouzereau/gradient.html

Thanks in advance for any ideas ...

Cheers.</description>
		<content:encoded><![CDATA[<p>Hello,</p>
<p>I&#8217;m quite aware that <span class="caps">CSS</span> styles are preferably used with <span class="caps">DEV</span> 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 :</p>
<p><a href="http://membres.lycos.fr/jfbouzereau/gradient.html" rel="nofollow">http://membres.lycos.fr/jfbouzereau/gradient.html</a></p>
<p>Thanks in advance for any ideas &#8230;</p>
<p>Cheers.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Norm Fox</title>
		<link>http://osteele.com/archives/2006/03/javascript-gradient-roundrects/comment-page-1#comment-282</link>
		<dc:creator>Norm Fox</dc:creator>
		<pubDate>Tue, 11 Sep 2007 23:47:22 +0000</pubDate>
		<guid isPermaLink="false">http://osteele.com/2006/03/23/javascript-gradient-roundrects#comment-282</guid>
		<description>useful tool thanks.

altering the createCanvasGradient function as follows will allow you to pass a 'direction' parm via the enhanced style.
possible values are:: 'horizontal', 'vertical', 'diagonal-down', 'diagonal-up'

OSGradient.prototype.createCanvasGradient = function(e, width, height) {

	var canvas = document.createElement('canvas');
	var ctx;
	// Return null if canvas isn't supported.  The caller will
	// fall back on divs.
	try {ctx = canvas.getContext('2d')} catch (e) {return null}

	// Safari requires the following prior to rendering
	e.appendChild(canvas);
	if (navigator.appVersion.match(/Konqueror&#124;Safari&#124;KHTML/))
		canvas.style.position = 'fixed';
    canvas.setAttribute('width', width);
    canvas.setAttribute('height', height);

	var style = this.style;
    var c0 = style['gradient-start-color'];
    var c1 = style['gradient-end-color'];
    var r = style['border-radius'];
    var direction = style['direction'];

	ctx.beginPath();
	ctx.moveTo(0,r);
	//arcTo() produces NS_ERROR_NOT_IMPLEMENT in Firefox 1.5; use arc() instead:
	//ctx.arcTo(0,0,r,0,r);
	ctx.arc(r,r,r,Math.PI,-Math.PI/2,false);
	ctx.lineTo(width-r,0);
	//ctx.arcTo(width,0,width,r,r);
	ctx.arc(width-r,r,r,-Math.PI/2,0,false);
	ctx.lineTo(width,height-r);
	//ctx.arcTo(width,height,width-r,height,r);
	ctx.arc(width-r,height-r,r,0,Math.PI/2,false);
	ctx.lineTo(r,height);
	//ctx.arcTo(0,height,0,height-r,r);
	ctx.arc(r,height-r,r,Math.PI/2,Math.PI,false);
	ctx.clip();

	switch (direction){
		case "vertical":
			var g = ctx.fillStyle = ctx.createLinearGradient(0,0,0,height);
			break;
		case "horizontal":
			var g = ctx.fillStyle = ctx.createLinearGradient(0,0,width,0);
			break;
		case "diagonal-down":
			var g = ctx.fillStyle = ctx.createLinearGradient(0,0,width,height);
			break;
		case "diagonal-up":
			var g = ctx.fillStyle = ctx.createLinearGradient(0,height,width,0);
			break;
		default:  //maintain backwards compatibility with code not passing direction parm
			var g = ctx.fillStyle = ctx.createLinearGradient(0,0,0,height);
			break;

	}

	g.addColorStop(0, OSUtils.color.long2css(c0));
	g.addColorStop(1, OSUtils.color.long2css(c1));
	ctx.rect(0,0,width,height);
	ctx.fill();

	return canvas;
};


Cheers</description>
		<content:encoded><![CDATA[<p>useful tool thanks.</p>
<p>altering the createCanvasGradient function as follows will allow you to pass a &#8216;direction&#8217; parm via the enhanced style.<br />
possible values are:: &#8216;horizontal&#8217;, &#8216;vertical&#8217;, &#8216;diagonal-down&#8217;, &#8216;diagonal-up&#8217;</p>
<p>OSGradient.prototype.createCanvasGradient = function(e, width, height) {</p>
<p>var canvas = document.createElement(&#8216;canvas&#8217;);<br />
var ctx;<br />
// Return null if canvas isn&#8217;t supported.  The caller will<br />
// fall back on divs.<br />
try {ctx = canvas.getContext(&#8216;2d&#8217;)} catch (e) {return null}</p>
<p>// Safari requires the following prior to rendering<br />
e.appendChild(canvas);<br />
if (navigator.appVersion.match(/Konqueror|Safari|KHTML/))<br />
canvas.style.position = &#8216;fixed&#8217;;</p>
<p>    canvas.setAttribute(&#8216;width&#8217;, width);<br />
    canvas.setAttribute(&#8216;height&#8217;, height);</p>
<p>var style = this.style;</p>
<p>    var c0 = style[&#8216;gradient-start-color&#8217;];<br />
    var c1 = style[&#8216;gradient-end-color&#8217;];<br />
    var r = style[&#8216;border-radius&#8217;];<br />
    var direction = style[&#8216;direction&#8217;];</p>
<p>ctx.beginPath();<br />
ctx.moveTo(0,r);<br />
//arcTo() produces NS_ERROR_NOT_IMPLEMENT in Firefox 1.5; use arc() instead:<br />
//ctx.arcTo(0,0,r,0,r);<br />
ctx.arc(r,r,r,Math.PI,-Math.PI/2,false);<br />
ctx.lineTo(width-r,0);<br />
//ctx.arcTo(width,0,width,r,r);<br />
ctx.arc(width-r,r,r,-Math.PI/2,0,false);<br />
ctx.lineTo(width,height-r);<br />
//ctx.arcTo(width,height,width-r,height,r);<br />
ctx.arc(width-r,height-r,r,0,Math.PI/2,false);<br />
ctx.lineTo(r,height);<br />
//ctx.arcTo(0,height,0,height-r,r);<br />
ctx.arc(r,height-r,r,Math.PI/2,Math.PI,false);<br />
ctx.clip();</p>
<p>switch (direction){<br />
case &#8220;vertical&#8221;:<br />
var g = ctx.fillStyle = ctx.createLinearGradient(0,0,0,height);<br />
break;<br />
case &#8220;horizontal&#8221;:<br />
var g = ctx.fillStyle = ctx.createLinearGradient(0,0,width,0);<br />
break;<br />
case &#8220;diagonal-down&#8221;:<br />
var g = ctx.fillStyle = ctx.createLinearGradient(0,0,width,height);<br />
break;<br />
case &#8220;diagonal-up&#8221;:<br />
var g = ctx.fillStyle = ctx.createLinearGradient(0,height,width,0);<br />
break;<br />
default:  //maintain backwards compatibility with code not passing direction parm<br />
var g = ctx.fillStyle = ctx.createLinearGradient(0,0,0,height);<br />
break;</p>
<p>}</p>
<p>g.addColorStop(0, OSUtils.color.long2css(c0));<br />
g.addColorStop(1, OSUtils.color.long2css(c1));<br />
ctx.rect(0,0,width,height);<br />
ctx.fill();</p>
<p>return canvas;<br />
};</p>
<p>Cheers</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Norman Harebottle</title>
		<link>http://osteele.com/archives/2006/03/javascript-gradient-roundrects/comment-page-1#comment-281</link>
		<dc:creator>Norman Harebottle</dc:creator>
		<pubDate>Fri, 13 Apr 2007 22:36:03 +0000</pubDate>
		<guid isPermaLink="false">http://osteele.com/2006/03/23/javascript-gradient-roundrects#comment-281</guid>
		<description>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?</description>
		<content:encoded><![CDATA[<p>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?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: aqeel ahmed</title>
		<link>http://osteele.com/archives/2006/03/javascript-gradient-roundrects/comment-page-1#comment-280</link>
		<dc:creator>aqeel ahmed</dc:creator>
		<pubDate>Tue, 15 Aug 2006 07:58:09 +0000</pubDate>
		<guid isPermaLink="false">http://osteele.com/2006/03/23/javascript-gradient-roundrects#comment-280</guid>
		<description>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.....

thanks
aqeel ahmed</description>
		<content:encoded><![CDATA[<p>hi love your code and stuff but is it possible t print the gradient horizontally left to right&#8230;..very much appreciated your code and effort u put in it&#8230;..</p>
<p>thanks<br />
aqeel ahmed</p>
]]></content:encoded>
	</item>
</channel>
</rss>
