W3C home > Mailing lists > Public > www-svg@w3.org > June 2000

Re: inverse colors

From: Jon Ferraiolo <jferraio@Adobe.COM>
Date: Thu, 08 Jun 2000 13:30:19 -0700
Message-Id: <200006082027.NAA02909@mail-345.corp.Adobe.COM>
To: Justin Friedl <justin.friedl@aspentech.com>
Cc: "'www-svg@w3.org'" <www-svg@w3.org>
I'm not an expert in color theory, but an approach that will do something
along the lines of what you want is to leverage the 'enable-background' and
feColorMatrix/hueRotate feature in filter effects.

Set 'enable-background' on the container element that surrounds all of your
rectangles and your text. (Maybe your outermost 'svg' element, but that
might use more memory than you want to use.) This feature causes all of the
rendering of the rectangles to be saved off on the side for down-the-road
referencing from a filter effect.

Then, create a filter effect on the 'text' element which takes the
background image, masks it using the alpha channel of the text element, and
then performs a hue rotation of 180 degrees on it. For example:

<g style="enable-background:new">
    <filter id="MyFilter">
       <feComposite in="BackgroundImage" in2="SourceAlpha" operator="in"/>
       <feColorMatrix type="hueRotate" values="180"/>
    <rect ... />
    <rect ... />
    <rect ... />
    <text ... style="filter:url(#MyFilter)">Inverted text</text>

Sorry, I don't have time to test this, but maybe this can be a starting
point for you to experiment.

And maybe there are other, simpler approaches. I just can't think of one
right now.

Jon Ferraiolo
SVG Editor
Adobe Systems Incorporated

At 03:47 PM 6/8/00 -0400, Justin Friedl wrote:
>Is it possible to inverse(negative) colors.  For example:
>I want to put text over several different colored rectangles. I don't know
>in advance what thos colors will be.  Is there any way of taking an inverse
>of the rectangle color so that the text can be seen on top?
>thanks in advance
Received on Thursday, 8 June 2000 16:27:45 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 8 March 2017 09:46:48 UTC