w3schools    w3Schools
Search W3Schools :
HOME HTML CSS XML JAVASCRIPT ASP PHP SQL MORE...   References Examples Forum About

XML Certification
Download XML editor
Custom Programming
Table of contents
SVG Basic
SVG Intro
SVG Example

SVG Shapes
SVG Rectangle
SVG Circle
SVG Ellipse
SVG Line
SVG Polygon
SVG Polyline
SVG Path

SVG Filters
SVG Intro
SVG Gaussian

SVG Gradients
SVG Linear
SVG Radial

SVG Examples
SVG Examples

SVG Reference
SVG Elements

Selected Reading
Web Statistics
Web Glossary
Web Hosting
Web Quality

W3Schools Tutorials
W3Schools Forum

Helping W3Schools


SVG feColorMatrix Element

SVG Reference Complete SVG Reference

Definition and Usage

The SVG feColorMatrix element is used to apply a matrix transformation.

The type attribute defines the type of matrix operation. The type attribute can take one of the following values:

  • matrix
  • saturate
  • hueRotate
  • luminanceToAlpha

The value attribute's value depends on the value of the type attribute:

  • For type="matrix", values is a list of 20 matrix values
  • For type="saturate", values is a single real number value (0 to 1)
  • For type="hueRotate", values is a single one real number value (degrees)
  • For type="luminanceToAlpha", values is not applicable

Example 1

The following example shows examples of the four types of feColorMatrix operations.

Copy the following code into Notepad and save the file as "fecolormatrix_1.svg". Place the file in your Web directory:

<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" 
<svg width="100%" height="100%" version="1.1"
<linearGradient id="MyGrad" gradientUnits="userSpaceOnUse"
x1="100" y1="0" x2="500" y2="0"> 
<stop offset="0" style="stop-color:#ff00ff"/> 
<stop offset=".33" style="stop-color:#88ff88"/> 
<stop offset=".67" style="stop-color:#2020ff"/> 
<stop offset="1" style="stop-color:#d00000"/> 
<filter id="Matrix"> 
<feColorMatrix type="matrix"
values="1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0"/> 
<filter id="Saturate"> 
<feColorMatrix type="saturate" values="0.4"/> 
<filter id="HueRotate"> 
<feColorMatrix type="hueRotate" values="90"/> 
<filter id="Luminance"> 
<feColorMatrix type="luminanceToAlpha" result="a"/> 
<feComposite in="SourceGraphic" in2="a" operator="in"/> 
<g style="font-size:50;fill:url(#MyGrad)">
<text x="50" y="60">Unfiltered</text> 
<text x="50" y="120" style="filter:url(#Matrix)">Matrix
<text x="50" y="180" style="filter:url(#Saturate)">Saturate
<text x="50" y="240" style="filter:url(#HueRotate)">HueRotate
<text x="50" y="300" style="filter:url(#Luminance)">Luminance

View example

SVG Reference Complete SVG Reference

Learn XML with <oXygen/> XML Editor - Free Trial!

oXygen - Probably The World's Best XML Editor   

oXygen helps you learn to define, edit, validate and transform XML documents. Supported technologies include XML Schema, DTD, Relax NG, XSLT, XPath, XQuery, CSS.

Understand in no time how XSLT and XQuery work by using the intuitive oXygen debugger!

Do you have any XML related questions? Get free answers from the oXygen XML forum and from the video demonstrations.

Download a FREE 30-day trial today!

Name Registration
Domain Name
Registration & More!
$15 Domain Name
Save $20 / year!
Buy UK Domain Names
Register Domain Names
Cheap Domain Names
Cheap Web Hosting
Best Web Hosting
PHP MySQL Hosting
Top 10 Web Hosting
UK Reseller Hosting
Web Hosting
FREE Web Hosting
Website Templates
Flash Templates
Website Builder
Internet Business Opportunity
Custom Programming
FREE Trial or Demo
Web Content Manager
Forms,Web Alerts,RSS
Download XML editor
FREE Flash Website
FREE Web Templates
US Web Design Schools
HTML Certification
JavaScript Certification
XML Certification
PHP Certification
ASP Certification
Home HOME or Top of Page Validate   Validate   W3C-WAI level A conformance icon Printer Friendly  Printer Friendly

W3Schools is for training only. We do not warrant the correctness of its content. The risk from using it lies entirely with the user.
While using this site, you agree to have read and accepted our terms of use and privacy policy.
Copyright 1999-2009 by Refsnes Data. All Rights Reserved.