W3C home > Mailing lists > Public > www-svg@w3.org > August 2004

Re: howto fill a divided figure?

From: Cameron McCormack <cam-www-svg@aka.mcc.id.au>
Date: Tue, 31 Aug 2004 18:50:53 +1000
To: www-svg@w3.org
Message-ID: <20040831085053.GA1374@mcc.id.au>

Hi Jonathan.

Jonathan Chetwynd:
> draw a figure, let's say a rectangle.
> divide it, let's say bisect it.
> now fill the 2 halves with complementary colours.
> 
> seems simple, but is it?

Sure it is.

  <linearGradient id="g1" x1="0" y1="0" x2="0" y2="100%">
    <stop color="red" stop-offset="0%"/>
    <stop color="red" stop-offset="50%"/>
    <stop color="blue" stop-offset="50%"/>
    <stop color="blue" stop-offset="100%"/>
  </linearGradient>

  <rect x="10" y="10" width="100" height="50" fill="url(#g1)"
        stroke="black" stroke-width="3"/>

Ok, so it may not be immediately obvious that you could use a gradient
for this, but it's possible.  Otherwise, just use paths.

Cameron

-- 
Cameron McCormack
|  Web: http://mcc.id.au/
|  ICQ: 26955922
Received on Tuesday, 31 August 2004 08:51:00 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 5 February 2014 07:14:53 UTC