001package com.hfg.svg.filtereffect; 002 003import com.hfg.svg.AbstractSvgNode; 004import com.hfg.svg.SVG; 005import com.hfg.svg.SvgAttr; 006import com.hfg.util.collection.CollectionUtil; 007import com.hfg.xml.XMLAttribute; 008import com.hfg.xml.XMLTag; 009 010//------------------------------------------------------------------------------ 011/** 012 Object representation of an SVG (Scalable Vector Graphics) 'feComposite' filter effect tag. 013 <div> 014 From <a href='http://www.w3.org/TR/2003/REC-SVG11-20030114/filters.html#feComposite'> 015 http://www.w3.org/TR/2003/REC-SVG11-20030114/filters.html#feComposite</a>: 016 </div> 017 <div style='font-style:italic'> 018 <p> 019 "This filter performs the combination of the two input images pixel-wise in image space 020 using one of the Porter-Duff [PORTERDUFF] compositing operations: over, in, atop, out, xor. 021 Additionally, a component-wise arithmetic operation (with the result clamped between [0..1]) can be applied. 022 </p> 023 <p> 024 The arithmetic operation is useful for combining the output from the 'feDiffuseLighting' and ' 025 feSpecularLighting' filters with texture data. It is also useful for implementing dissolve. 026 If the arithmetic operation is chosen, each result pixel is computed using the following formula: 027 </p> 028 <pre> 029 result = k1*i1*i2 + k2*i1 + k3*i2 + k4 030 </pre> 031 032 </div> 033 @author J. Alex Taylor, hairyfatguy.com 034 */ 035//------------------------------------------------------------------------------ 036// com.hfg XML/HTML Coding Library 037// 038// This library is free software; you can redistribute it and/or 039// modify it under the terms of the GNU Lesser General Public 040// License as published by the Free Software Foundation; either 041// version 2.1 of the License, or (at your option) any later version. 042// 043// This library is distributed in the hope that it will be useful, 044// but WITHOUT ANY WARRANTY; without even the implied warranty of 045// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 046// Lesser General Public License for more details. 047// 048// You should have received a copy of the GNU Lesser General Public 049// License along with this library; if not, write to the Free Software 050// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 051// 052// J. Alex Taylor, President, Founder, CEO, COO, CFO, OOPS hairyfatguy.com 053// jataylor@hairyfatguy.com 054//------------------------------------------------------------------------------ 055 056public class SvgFeComposite extends AbstractSvgNode 057{ 058 059 //########################################################################### 060 // CONSTRUCTORS 061 //########################################################################### 062 063 //--------------------------------------------------------------------------- 064 public SvgFeComposite() 065 { 066 super(SVG.feComposite); 067 } 068 069 //--------------------------------------------------------------------------- 070 public SvgFeComposite(XMLTag inXMLTag) 071 { 072 this(); 073 initFromXMLTag(inXMLTag); 074 } 075 076 //########################################################################### 077 // PUBLIC METHODS 078 //########################################################################### 079 080 081 //--------------------------------------------------------------------------- 082 public SvgFeComposite setColorInterpolationFilters(ColorInterpolationFilters inValue) 083 { 084 setAttribute(SvgAttr.colorInterpolationFilters, inValue); 085 return this; 086 } 087 088 //--------------------------------------------------------------------------- 089 public SvgFeComposite setIn(FeInput inValue) 090 { 091 setAttribute(SvgAttr.in, inValue); 092 return this; 093 } 094 095 //--------------------------------------------------------------------------- 096 public SvgFeComposite setIn2(FeInput inValue) 097 { 098 setAttribute(SvgAttr.in2, inValue); 099 return this; 100 } 101 102 //--------------------------------------------------------------------------- 103 public SvgFeComposite setOperator(CompositingOperatorType inValue) 104 { 105 setAttribute(SvgAttr.operator, inValue); 106 return this; 107 } 108 109 //--------------------------------------------------------------------------- 110 public SvgFeComposite setK1(float inValue) 111 { 112 setAttribute(SvgAttr.k1, inValue); 113 return this; 114 } 115 116 //--------------------------------------------------------------------------- 117 public SvgFeComposite setK2(float inValue) 118 { 119 setAttribute(SvgAttr.k2, inValue); 120 return this; 121 } 122 123 //--------------------------------------------------------------------------- 124 public SvgFeComposite setK3(float inValue) 125 { 126 setAttribute(SvgAttr.k3, inValue); 127 return this; 128 } 129 130 //--------------------------------------------------------------------------- 131 public SvgFeComposite setK4(float inValue) 132 { 133 setAttribute(SvgAttr.k4, inValue); 134 return this; 135 } 136 137 138 //--------------------------------------------------------------------------- 139 public SvgFeComposite setHeight(int inValue) 140 { 141 setAttribute(SvgAttr.height, inValue); 142 return this; 143 } 144 145 //--------------------------------------------------------------------------- 146 public SvgFeComposite setHeight(String inValue) 147 { 148 setAttribute(SvgAttr.height, inValue); 149 return this; 150 } 151 152 //--------------------------------------------------------------------------- 153 public SvgFeComposite setResult(String inValue) 154 { 155 setAttribute(SvgAttr.result, inValue); 156 return this; 157 } 158 159 //--------------------------------------------------------------------------- 160 public SvgFeComposite setWidth(int inValue) 161 { 162 setAttribute(SvgAttr.width, inValue); 163 return this; 164 } 165 166 //--------------------------------------------------------------------------- 167 public SvgFeComposite setWidth(String inValue) 168 { 169 setAttribute(SvgAttr.width, inValue); 170 return this; 171 } 172 173 //--------------------------------------------------------------------------- 174 public SvgFeComposite setX(int inValue) 175 { 176 setAttribute(SvgAttr.x, inValue); 177 return this; 178 } 179 180 //--------------------------------------------------------------------------- 181 public SvgFeComposite setX(String inValue) 182 { 183 setAttribute(SvgAttr.x, inValue); 184 return this; 185 } 186 187 188 //--------------------------------------------------------------------------- 189 public SvgFeComposite setY(int inValue) 190 { 191 setAttribute(SvgAttr.y, inValue); 192 return this; 193 } 194 195 //--------------------------------------------------------------------------- 196 public SvgFeComposite setY(String inValue) 197 { 198 setAttribute(SvgAttr.y, inValue); 199 return this; 200 } 201 202 203 204}