1 18 package org.apache.batik.ext.awt.image.renderable; 19 20 import java.awt.color.ColorSpace ; 21 import java.awt.image.RenderedImage ; 22 import java.util.List ; 23 import java.util.Map ; 24 25 import org.apache.batik.ext.awt.image.GraphicsUtil; 26 import org.apache.batik.ext.awt.image.rendered.CachableRed; 27 28 36 public abstract class AbstractColorInterpolationRable extends AbstractRable { 37 38 42 protected boolean csLinear = true; 43 44 49 protected AbstractColorInterpolationRable() { 50 super(); 51 } 52 53 59 protected AbstractColorInterpolationRable(Filter src) { 60 super(src); 61 } 62 63 69 protected AbstractColorInterpolationRable(Filter src, Map props) { 70 super(src, props); 71 } 72 73 80 protected AbstractColorInterpolationRable(List srcs) { 81 super(srcs); 82 } 83 84 91 protected AbstractColorInterpolationRable(List srcs, Map props) { 92 super(srcs, props); 93 } 94 95 100 public boolean isColorSpaceLinear() { return csLinear; } 101 102 108 public void setColorSpaceLinear(boolean csLinear) { 109 touch(); 110 this.csLinear = csLinear; 111 } 112 113 public ColorSpace getOperationColorSpace() { 114 if (csLinear) 115 return ColorSpace.getInstance(ColorSpace.CS_LINEAR_RGB); 116 else 117 return ColorSpace.getInstance(ColorSpace.CS_sRGB); 118 } 119 120 protected CachableRed convertSourceCS(CachableRed cr) { 121 if (csLinear) 122 return GraphicsUtil.convertToLsRGB(cr); 123 else 124 return GraphicsUtil.convertTosRGB(cr); 125 } 126 127 protected CachableRed convertSourceCS(RenderedImage ri) { 128 return convertSourceCS(GraphicsUtil.wrap(ri)); 129 } 130 } 131 | Popular Tags |