2006-04-26 Oliver Hunt <ojh16@student.canterbury.ac.nz>
authoreseidel <eseidel@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 25 Apr 2006 21:22:40 +0000 (21:22 +0000)
committereseidel <eseidel@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 25 Apr 2006 21:22:40 +0000 (21:22 +0000)
        Reviewed by eseidel.  Landed by eseidel.

        * WebCore.xcodeproj/project.pbxproj:
        * kcanvas/KCanvasFilters.cpp:
        (WebCore::operator<<):
        * kcanvas/KCanvasFilters.h:
        (WebCore::KCComponentTransferFunction::KCComponentTransferFunction):
        * kcanvas/device/quartz/KCanvasFilterQuartz.h:
        * kcanvas/device/quartz/KCanvasFilterQuartz.mm:
        (WebCore::getVectorForChannel):
        (WebCore::genImageFromTable):
        (WebCore::filterForComponentFunc):
        (WebCore::setParametersForComponentFunc):
        (WebCore::getFilterForFunc):
        (WebCore::KCanvasFEComponentTransferQuartz::getFunctionFilter):
        (WebCore::KCanvasFEComponentTransferQuartz::getCIFilter):
        * kcanvas/device/quartz/KRenderingDeviceQuartz.mm:
        (WebCore::KRenderingDeviceQuartz::createFilterEffect):
        * kcanvas/device/quartz/filters/WKComponentMergeFilter.cikernel: Added.
        * kcanvas/device/quartz/filters/WKComponentMergeFilter.h: Added.
        * kcanvas/device/quartz/filters/WKComponentMergeFilter.m: Added.
        (+[WKComponentMergeFilter initialize]):
        (+[WKComponentMergeFilter filterWithName:]):
        (-[WKComponentMergeFilter init]):
        (-[WKComponentMergeFilter outputImage]):
        * kcanvas/device/quartz/filters/WKDiscreteTransferFilter.cikernel: Added.
        * kcanvas/device/quartz/filters/WKDiscreteTransferFilter.h: Added.
        * kcanvas/device/quartz/filters/WKDiscreteTransferFilter.m: Added.
        (+[WKDiscreteTransferFilter initialize]):
        (+[WKDiscreteTransferFilter filterWithName:]):
        (-[WKDiscreteTransferFilter init]):
        (-[WKDiscreteTransferFilter outputImage]):
        * kcanvas/device/quartz/filters/WKGammaTransferFilter.cikernel: Added.
        * kcanvas/device/quartz/filters/WKGammaTransferFilter.h: Added.
        * kcanvas/device/quartz/filters/WKGammaTransferFilter.m: Added.
        (+[WKGammaTransferFilter initialize]):
        (+[WKGammaTransferFilter filterWithName:]):
        (-[WKGammaTransferFilter init]):
        (-[WKGammaTransferFilter outputImage]):
        * kcanvas/device/quartz/filters/WKIdentityTransferFilter.h: Added.
        * kcanvas/device/quartz/filters/WKIdentityTransferFilter.m: Added.
        (+[WKIdentityTransferFilter initialize]):
        (+[WKIdentityTransferFilter filterWithName:]):
        (-[WKIdentityTransferFilter init]):
        (-[WKIdentityTransferFilter outputImage]):
        * kcanvas/device/quartz/filters/WKLinearTransferFilter.cikernel: Added.
        * kcanvas/device/quartz/filters/WKLinearTransferFilter.h: Added.
        * kcanvas/device/quartz/filters/WKLinearTransferFilter.m: Added.
        (+[WKLinearTransferFilter initialize]):
        (+[WKLinearTransferFilter filterWithName:]):
        (-[WKLinearTransferFilter init]):
        (-[WKLinearTransferFilter outputImage]):
        * kcanvas/device/quartz/filters/WKTableTransferFilter.cikernel: Added.
        * kcanvas/device/quartz/filters/WKTableTransferFilter.h: Added.
        * kcanvas/device/quartz/filters/WKTableTransferFilter.m: Added.
        (+[WKTableTransferFilter initialize]):
        (+[WKTableTransferFilter filterWithName:]):
        (-[WKTableTransferFilter init]):
        (-[WKTableTransferFilter outputImage]):
        * ksvg2/svg/SVGComponentTransferFunctionElement.cpp:
        (SVGComponentTransferFunctionElement::parseMappedAttribute):
        (SVGComponentTransferFunctionElement::transferFunction):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@14058 268f45cc-cd09-0410-ab3c-d52691b4dbfc

57 files changed:
LayoutTests/ChangeLog
LayoutTests/svg/W3C-SVG-1.1/filters-comptran-01-b-expected.checksum
LayoutTests/svg/W3C-SVG-1.1/filters-comptran-01-b-expected.png
LayoutTests/svg/W3C-SVG-1.1/filters-comptran-01-b-expected.txt
LayoutTests/svg/custom/feComponentTransfer-Discrete-expected.checksum [new file with mode: 0644]
LayoutTests/svg/custom/feComponentTransfer-Discrete-expected.png [new file with mode: 0644]
LayoutTests/svg/custom/feComponentTransfer-Discrete-expected.txt [new file with mode: 0644]
LayoutTests/svg/custom/feComponentTransfer-Discrete.svg [new file with mode: 0644]
LayoutTests/svg/custom/feComponentTransfer-Gamma-expected.checksum [new file with mode: 0644]
LayoutTests/svg/custom/feComponentTransfer-Gamma-expected.png [new file with mode: 0644]
LayoutTests/svg/custom/feComponentTransfer-Gamma-expected.txt [new file with mode: 0644]
LayoutTests/svg/custom/feComponentTransfer-Gamma.svg [new file with mode: 0644]
LayoutTests/svg/custom/feComponentTransfer-Linear-expected.checksum [new file with mode: 0644]
LayoutTests/svg/custom/feComponentTransfer-Linear-expected.png [new file with mode: 0644]
LayoutTests/svg/custom/feComponentTransfer-Linear-expected.txt [new file with mode: 0644]
LayoutTests/svg/custom/feComponentTransfer-Linear.svg [new file with mode: 0644]
LayoutTests/svg/custom/feComponentTransfer-Table-expected.checksum [new file with mode: 0644]
LayoutTests/svg/custom/feComponentTransfer-Table-expected.png [new file with mode: 0644]
LayoutTests/svg/custom/feComponentTransfer-Table-expected.txt [new file with mode: 0644]
LayoutTests/svg/custom/feComponentTransfer-Table.svg [new file with mode: 0644]
WebCore/ChangeLog
WebCore/WebCore.xcodeproj/project.pbxproj
WebCore/WebCore/kcanvas/device/quartz/filters/WKComponentMergeFilter.cikernel [new file with mode: 0644]
WebCore/WebCore/kcanvas/device/quartz/filters/WKComponentMergeFilter.h [new file with mode: 0644]
WebCore/WebCore/kcanvas/device/quartz/filters/WKComponentMergeFilter.m [new file with mode: 0644]
WebCore/WebCore/kcanvas/device/quartz/filters/WKDiscreteTransferFilter.cikernel [new file with mode: 0644]
WebCore/WebCore/kcanvas/device/quartz/filters/WKDiscreteTransferFilter.h [new file with mode: 0644]
WebCore/WebCore/kcanvas/device/quartz/filters/WKDiscreteTransferFilter.m [new file with mode: 0644]
WebCore/WebCore/kcanvas/device/quartz/filters/WKGammaTransferFilter.h [new file with mode: 0644]
WebCore/WebCore/kcanvas/device/quartz/filters/WKIdentityTransferFilter.h [new file with mode: 0644]
WebCore/WebCore/kcanvas/device/quartz/filters/WKIdentityTransferFilter.m [new file with mode: 0644]
WebCore/WebCore/kcanvas/device/quartz/filters/WKLinearTransferFilter.cikernel [new file with mode: 0644]
WebCore/WebCore/kcanvas/device/quartz/filters/WKLinearTransferFilter.m [new file with mode: 0644]
WebCore/WebCore/kcanvas/device/quartz/filters/WKTableTransferFilter.m [new file with mode: 0644]
WebCore/kcanvas/KCanvasFilters.cpp
WebCore/kcanvas/KCanvasFilters.h
WebCore/kcanvas/device/quartz/KCanvasFilterQuartz.h
WebCore/kcanvas/device/quartz/KCanvasFilterQuartz.mm
WebCore/kcanvas/device/quartz/KRenderingDeviceQuartz.mm
WebCore/kcanvas/device/quartz/filters/WKComponentMergeFilter.cikernel [new file with mode: 0644]
WebCore/kcanvas/device/quartz/filters/WKComponentMergeFilter.h [new file with mode: 0644]
WebCore/kcanvas/device/quartz/filters/WKComponentMergeFilter.m [new file with mode: 0644]
WebCore/kcanvas/device/quartz/filters/WKDiscreteTransferFilter.cikernel [new file with mode: 0644]
WebCore/kcanvas/device/quartz/filters/WKDiscreteTransferFilter.h [new file with mode: 0644]
WebCore/kcanvas/device/quartz/filters/WKDiscreteTransferFilter.m [new file with mode: 0644]
WebCore/kcanvas/device/quartz/filters/WKGammaTransferFilter.cikernel [new file with mode: 0644]
WebCore/kcanvas/device/quartz/filters/WKGammaTransferFilter.h [new file with mode: 0644]
WebCore/kcanvas/device/quartz/filters/WKGammaTransferFilter.m [new file with mode: 0644]
WebCore/kcanvas/device/quartz/filters/WKIdentityTransferFilter.h [new file with mode: 0644]
WebCore/kcanvas/device/quartz/filters/WKIdentityTransferFilter.m [new file with mode: 0644]
WebCore/kcanvas/device/quartz/filters/WKLinearTransferFilter.cikernel [new file with mode: 0644]
WebCore/kcanvas/device/quartz/filters/WKLinearTransferFilter.h [new file with mode: 0644]
WebCore/kcanvas/device/quartz/filters/WKLinearTransferFilter.m [new file with mode: 0644]
WebCore/kcanvas/device/quartz/filters/WKTableTransferFilter.cikernel [new file with mode: 0644]
WebCore/kcanvas/device/quartz/filters/WKTableTransferFilter.h [new file with mode: 0644]
WebCore/kcanvas/device/quartz/filters/WKTableTransferFilter.m [new file with mode: 0644]
WebCore/ksvg2/svg/SVGComponentTransferFunctionElement.cpp

index a339c2e9d6017a1cf81d99646eff938c34b37e14..447758bc5e52831cbd405c61c3fab7cde26f0904 100644 (file)
@@ -1,3 +1,29 @@
+2006-04-26  Mitz Pettel  <opendarwin.org@mitzpettel.com>
+
+        Reviewed by darin.  Landed by eseidel.
+
+        - test for http://bugzilla.opendarwin.org/show_bug.cgi?id=8452
+          mangleme(0x58c22e11): Random crashes
+
+        * fast/frames/empty-cols-attribute-expected.checksum: Added.
+        * fast/frames/empty-cols-attribute-expected.png: Added.
+        * fast/frames/empty-cols-attribute-expected.txt: Added.
+        * fast/frames/empty-cols-attribute.html: Added.
+
+2006-04-26  Oliver Hunt  <ojh16@student.canterbury.ac.nz>
+
+        Reviewed by eseidel.  Landed by eseidel.
+
+        * svg/W3C-SVG-1.1/filters-comptran-01-b-expected.txt:
+        * svg/custom/feComponentTransfer-Discrete-expected.txt: Added.
+        * svg/custom/feComponentTransfer-Discrete.svg: Added.
+        * svg/custom/feComponentTransfer-Gamma-expected.txt: Added.
+        * svg/custom/feComponentTransfer-Gamma.svg: Added.
+        * svg/custom/feComponentTransfer-Linear-expected.txt: Added.
+        * svg/custom/feComponentTransfer-Linear.svg: Added.
+        * svg/custom/feComponentTransfer-Table-expected.txt: Added.
+        * svg/custom/feComponentTransfer-Table.svg: Added.
+
 2006-04-25  Eric Seidel  <eseidel@apple.com>
 
         Reviewed by mjs.
index a9957c6dbc46027a74bd8b78c40a5ed20be68c13..b788d8674de0827853c0d407f83ac3d7e0ecc532 100644 (file)
@@ -1 +1 @@
-1218741fa4d0f9b8a499d4d8c69f4545
\ No newline at end of file
+a45431d4850cfd56f901bca8af852429
\ No newline at end of file
index ca8d960e182ed3842ba3f93aa10d5bbb587ddc75..1e9cb4053e0f7fe8a0b22ee8eadb183f5f912d1b 100644 (file)
Binary files a/LayoutTests/svg/W3C-SVG-1.1/filters-comptran-01-b-expected.png and b/LayoutTests/svg/W3C-SVG-1.1/filters-comptran-01-b-expected.png differ
index 2d6583cd8c169eb8d66e6b863080c8a393773712..90a2fe5f2a56760c4613f8c89161cc2274d9f116 100644 (file)
@@ -1,8 +1,8 @@
 KRenderingPaintServer {id="MyGradient" [type=LINEAR-GRADIENT] [stops=[(0.00,#FF0000), (0.33,#00FF00), (0.67,#0000FF), (1.00,#000000)]] [bounding box mode=0] [start=(10,0)] [end=(590,0)]}
-KCanvasResource {id="Identity" [type=FILTER]  [bounding box=at (0,0) size 1x1] [effect bounding box mode=0]}
-KCanvasResource {id="Table" [type=FILTER]  [bounding box=at (0,0) size 1x1] [effect bounding box mode=0]}
-KCanvasResource {id="Linear" [type=FILTER]  [bounding box=at (0,0) size 1x1] [effect bounding box mode=0]}
-KCanvasResource {id="Gamma" [type=FILTER]  [bounding box=at (0,0) size 1x1] [effect bounding box mode=0]}
+KCanvasResource {id="Identity" [type=FILTER]  [bounding box=at (0,0) size 1x1] [effect bounding box mode=0] [effects=[[type=COMPONENT-TRANSFER]  [subregion="at (0,0) size 630x420"] [red func=[type=IDENTITY]] [green func=[type=IDENTITY]] [blue func=[type=IDENTITY]] [alpha func=[type=IDENTITY]]]]}
+KCanvasResource {id="Table" [type=FILTER]  [bounding box=at (0,0) size 1x1] [effect bounding box mode=0] [effects=[[type=COMPONENT-TRANSFER]  [subregion="at (0,0) size 630x420"] [red func=[type=TABLE] [table values=0.00 0.00 1.00 1.00]] [green func=[type=TABLE] [table values=1.00 1.00 0.00 0.00]] [blue func=[type=TABLE] [table values=0.00 1.00 1.00 0.00]] [alpha func=[type=IDENTITY]]]]}
+KCanvasResource {id="Linear" [type=FILTER]  [bounding box=at (0,0) size 1x1] [effect bounding box mode=0] [effects=[[type=COMPONENT-TRANSFER]  [subregion="at (0,0) size 630x420"] [red func=[type=LINEAR] [slope=0.50] [intercept=0.25]] [green func=[type=LINEAR] [slope=0.50] [intercept=0.00]] [blue func=[type=LINEAR] [slope=0.50] [intercept=0.50]] [alpha func=[type=IDENTITY]]]]}
+KCanvasResource {id="Gamma" [type=FILTER]  [bounding box=at (0,0) size 1x1] [effect bounding box mode=0] [effects=[[type=COMPONENT-TRANSFER]  [subregion="at (0,0) size 630x420"] [red func=[type=GAMMA] [amplitude=2.00] [exponent=5.00] [offset=0.00]] [green func=[type=GAMMA] [amplitude=2.00] [exponent=3.00] [offset=0.00]] [blue func=[type=GAMMA] [amplitude=2.00] [exponent=1.00] [offset=0.00]] [alpha func=[type=IDENTITY]]]]}
 layer at (0,0) size 480x360
   RenderCanvas at (0,0) size 480x360
     KCanvasContainer {svg} at (0.50,0.50) size 629x419
diff --git a/LayoutTests/svg/custom/feComponentTransfer-Discrete-expected.checksum b/LayoutTests/svg/custom/feComponentTransfer-Discrete-expected.checksum
new file mode 100644 (file)
index 0000000..3cd8c84
--- /dev/null
@@ -0,0 +1 @@
+13428be95babc37d09128984188bd622
\ No newline at end of file
diff --git a/LayoutTests/svg/custom/feComponentTransfer-Discrete-expected.png b/LayoutTests/svg/custom/feComponentTransfer-Discrete-expected.png
new file mode 100644 (file)
index 0000000..d0a50ba
Binary files /dev/null and b/LayoutTests/svg/custom/feComponentTransfer-Discrete-expected.png differ
diff --git a/LayoutTests/svg/custom/feComponentTransfer-Discrete-expected.txt b/LayoutTests/svg/custom/feComponentTransfer-Discrete-expected.txt
new file mode 100644 (file)
index 0000000..bc65b27
--- /dev/null
@@ -0,0 +1,29 @@
+KRenderingPaintServer {id="MyGradient" [type=LINEAR-GRADIENT] [stops=[(0.00,#00FF00), (1.00,#000000)]] [bounding box mode=0] [start=(10,0)] [end=(590,0)]}
+KCanvasResource {id="Identity" [type=FILTER]  [bounding box=at (0,0) size 1x1] [effect bounding box mode=0] [effects=[[type=COMPONENT-TRANSFER]  [subregion="at (0,0) size 650x420"] [red func=[type=IDENTITY]] [green func=[type=IDENTITY]] [blue func=[type=IDENTITY]] [alpha func=[type=IDENTITY]]]]}
+KCanvasResource {id="DiscreteBlank" [type=FILTER]  [bounding box=at (0,0) size 1x1] [effect bounding box mode=0] [effects=[[type=COMPONENT-TRANSFER]  [subregion="at (0,0) size 650x420"] [red func=[type=IDENTITY]] [green func=[type=DISCRETE] [table values=0.00]] [blue func=[type=IDENTITY]] [alpha func=[type=IDENTITY]]]]}
+KCanvasResource {id="DiscreteFull" [type=FILTER]  [bounding box=at (0,0) size 1x1] [effect bounding box mode=0] [effects=[[type=COMPONENT-TRANSFER]  [subregion="at (0,0) size 650x420"] [red func=[type=IDENTITY]] [green func=[type=DISCRETE] [table values=1.00]] [blue func=[type=IDENTITY]] [alpha func=[type=IDENTITY]]]]}
+KCanvasResource {id="DiscreteOrd" [type=FILTER]  [bounding box=at (0,0) size 1x1] [effect bounding box mode=0] [effects=[[type=COMPONENT-TRANSFER]  [subregion="at (0,0) size 650x420"] [red func=[type=IDENTITY]] [green func=[type=DISCRETE] [table values=0.00 0.25 0.50 0.75 1.00 1.00]] [blue func=[type=IDENTITY]] [alpha func=[type=IDENTITY]]]]}
+layer at (0,0) size 800x600
+  RenderCanvas at (0,0) size 800x600
+    KCanvasContainer {svg} at (0.83,0.83) size 1081.67x698.33
+      KCanvasContainer {g} at (0.83,0.83) size 1081.67x698.33
+        KCanvasContainer {svg} at (0.58,8.27) size 748.85x483.46
+          KCanvasItem {rect} at (0.58,8.27) size 748.85x483.46 [stroke={[type=SOLID] [color=#0000FF]}] [data="M1.00,1.00L649.00,1.00L649.00,419.00L1.00,419.00"]
+          KCanvasContainer {g} at (0.58,8.27) size 748.85x483.46
+            KCanvasItem {rect} at (0.58,8.27) size 748.85x483.46 [stroke={[type=SOLID] [color=#0000FF]}] [data="M1.00,1.00L649.00,1.00L649.00,419.00L1.00,419.00"]
+            KCanvasItem {rect} at (23.08,19.23) size 669.23x46.15 [fill={[type=LINEAR-GRADIENT] [stops=[(0.00,#00FF00), (1.00,#000000)]] [bounding box mode=0] [start=(10,0)] [end=(590,0)]}] [filter=#Identity] [data="M20.00,10.00L600.00,10.00L600.00,50.00L20.00,50.00"]
+            RenderSVGText {text} at (0,0) size 785x18
+              RenderText {#text} at (0,0) size 101x18
+                text run at (0,0) width 101: "type: identity"
+            KCanvasItem {rect} at (23.08,134.62) size 669.23x46.15 [fill={[type=LINEAR-GRADIENT] [stops=[(0.00,#00FF00), (1.00,#000000)]] [bounding box mode=0] [start=(10,0)] [end=(590,0)]}] [filter=#DiscreteBlank] [data="M20.00,110.00L600.00,110.00L600.00,150.00L20.00,150.00"]
+            RenderSVGText {text} at (0,0) size 785x18
+              RenderText {#text} at (0,0) size 323x18
+                text run at (0,0) width 323: "type: discrete [0] -- Result should be black"
+            KCanvasItem {rect} at (23.08,250) size 669.23x46.15 [fill={[type=LINEAR-GRADIENT] [stops=[(0.00,#00FF00), (1.00,#000000)]] [bounding box mode=0] [start=(10,0)] [end=(590,0)]}] [filter=#DiscreteFull] [data="M20.00,210.00L600.00,210.00L600.00,250.00L20.00,250.00"]
+            RenderSVGText {text} at (0,0) size 785x18
+              RenderText {#text} at (0,0) size 326x18
+                text run at (0,0) width 326: "type: discrete [1] -- Result should be green"
+            KCanvasItem {rect} at (23.08,365.38) size 669.23x46.15 [fill={[type=LINEAR-GRADIENT] [stops=[(0.00,#00FF00), (1.00,#000000)]] [bounding box mode=0] [start=(10,0)] [end=(590,0)]}] [filter=#DiscreteOrd] [data="M20.00,310.00L600.00,310.00L600.00,350.00L20.00,350.00"]
+            RenderSVGText {text} at (0,0) size 785x18
+              RenderText {#text} at (0,0) size 562x18
+                text run at (0,0) width 562: "type: discrete [0.0 0.25 0.5 0.75 1] -- Result should be quantized gradient"
diff --git a/LayoutTests/svg/custom/feComponentTransfer-Discrete.svg b/LayoutTests/svg/custom/feComponentTransfer-Discrete.svg
new file mode 100644 (file)
index 0000000..55ca6fd
--- /dev/null
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Basic//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-basic.dtd">
+<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" id="svg-root" width="100%" height="100%" viewBox="0 0 480 360" version="1.1" baseProfile="basic">
+       <title id="test-title">feComponentTransfer Test - Discrete</title>
+       <desc id="test-desc">feComponentTransfer tests.</desc>
+       <g id="test-body-content">
+               <svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="15" y="5" width="450" height="300" viewBox="0 0 650 420">
+                       <defs>
+                               <linearGradient id="MyGradient" gradientUnits="userSpaceOnUse" x1="10" y1="0" x2="590" y2="0">
+                                       <stop offset="0" stop-color="#00ff00"/>
+                                       <stop offset="1" stop-color="#000000"/>
+                               </linearGradient>
+                               <filter id="Identity" filterUnits="objectBoundingBox" x="0%" y="0%" width="100%" height="100%">
+                                       <feComponentTransfer>
+                                               <feFuncR type="identity"/>
+                                       </feComponentTransfer>
+                               </filter>
+                               <filter id="DiscreteBlank" filterUnits="objectBoundingBox" x="0%" y="0%" width="100%" height="100%">
+                                       <feComponentTransfer>
+                                               <feFuncG type="discrete" tableValues="0"/>
+                                       </feComponentTransfer>
+                               </filter>
+                               <filter id="DiscreteFull" filterUnits="objectBoundingBox" x="0%" y="0%" width="100%" height="100%">
+                                       <feComponentTransfer>
+                                               <feFuncG type="discrete" tableValues="1"/>
+                                       </feComponentTransfer>
+                               </filter>
+                               <filter id="DiscreteOrd" filterUnits="objectBoundingBox" x="0%" y="0%" width="100%" height="100%">
+                                       <feComponentTransfer>
+                                               <feFuncG type="discrete" tableValues="0.0 0.25 0.5 0.75 1 1"/>
+                                       </feComponentTransfer>
+                               </filter>
+                       </defs>
+                       <rect fill="none" stroke="blue" x="1" y="1" width="648" height="418"/>
+                       <g font-size="15" font-family="Verdana">
+                               <rect fill="none" stroke="blue" x="1" y="1" width="648" height="418"/>
+                               <rect x="20" y="10" width="580" height="40" fill="url(#MyGradient)" filter="url(#Identity)"/>
+                               <text x="20" y="70">type: identity</text>
+                               <rect x="20" y="110" width="580" height="40" fill="url(#MyGradient)" filter="url(#DiscreteBlank)"/>
+                               <text x="20" y="170">type: discrete [0] -- Result should be black</text>
+                               <rect x="20" y="210" width="580" height="40" fill="url(#MyGradient)" filter="url(#DiscreteFull)"/>
+                               <text x="20" y="270">type: discrete [1] -- Result should be green</text>
+                               <rect x="20" y="310" width="580" height="40" fill="url(#MyGradient)" filter="url(#DiscreteOrd)"/>
+                               <text x="20" y="370">type: discrete [0.0 0.25 0.5 0.75 1] -- Result should be quantized gradient</text>
+                       </g>
+               </svg>
+       </g>
+</svg>
diff --git a/LayoutTests/svg/custom/feComponentTransfer-Gamma-expected.checksum b/LayoutTests/svg/custom/feComponentTransfer-Gamma-expected.checksum
new file mode 100644 (file)
index 0000000..4b17e13
--- /dev/null
@@ -0,0 +1 @@
+dc1fd18a37d76a804c94a19f693882c4
\ No newline at end of file
diff --git a/LayoutTests/svg/custom/feComponentTransfer-Gamma-expected.png b/LayoutTests/svg/custom/feComponentTransfer-Gamma-expected.png
new file mode 100644 (file)
index 0000000..216e75a
Binary files /dev/null and b/LayoutTests/svg/custom/feComponentTransfer-Gamma-expected.png differ
diff --git a/LayoutTests/svg/custom/feComponentTransfer-Gamma-expected.txt b/LayoutTests/svg/custom/feComponentTransfer-Gamma-expected.txt
new file mode 100644 (file)
index 0000000..1e5e812
--- /dev/null
@@ -0,0 +1,35 @@
+KRenderingPaintServer {id="MyGradient" [type=LINEAR-GRADIENT] [stops=[(0.00,#00FF00), (1.00,#000000)]] [bounding box mode=0] [start=(10,0)] [end=(590,0)]}
+KCanvasResource {id="Identity" [type=FILTER]  [bounding box=at (0,0) size 1x1] [effect bounding box mode=0] [effects=[[type=COMPONENT-TRANSFER]  [subregion="at (0,0) size 650x420"] [red func=[type=IDENTITY]] [green func=[type=IDENTITY]] [blue func=[type=IDENTITY]] [alpha func=[type=IDENTITY]]]]}
+KCanvasResource {id="GammaBlank" [type=FILTER]  [bounding box=at (0,0) size 1x1] [effect bounding box mode=0] [effects=[[type=COMPONENT-TRANSFER]  [subregion="at (0,0) size 650x420"] [red func=[type=IDENTITY]] [green func=[type=GAMMA] [amplitude=1.00] [exponent=1.00] [offset=0.00]] [blue func=[type=IDENTITY]] [alpha func=[type=IDENTITY]]]]}
+KCanvasResource {id="GammaFull" [type=FILTER]  [bounding box=at (0,0) size 1x1] [effect bounding box mode=0] [effects=[[type=COMPONENT-TRANSFER]  [subregion="at (0,0) size 650x420"] [red func=[type=IDENTITY]] [green func=[type=GAMMA] [amplitude=1.00] [exponent=0.50] [offset=0.00]] [blue func=[type=IDENTITY]] [alpha func=[type=IDENTITY]]]]}
+KCanvasResource {id="GammaOrd" [type=FILTER]  [bounding box=at (0,0) size 1x1] [effect bounding box mode=0] [effects=[[type=COMPONENT-TRANSFER]  [subregion="at (0,0) size 650x420"] [red func=[type=IDENTITY]] [green func=[type=GAMMA] [amplitude=1.00] [exponent=2.00] [offset=0.00]] [blue func=[type=IDENTITY]] [alpha func=[type=IDENTITY]]]]}
+layer at (0,0) size 800x600
+  RenderCanvas at (0,0) size 800x600
+    KCanvasContainer {svg} at (0.83,0.83) size 1081.67x698.33
+      KCanvasContainer {g} at (0.83,0.83) size 1081.67x698.33
+        KCanvasContainer {svg} at (0.58,8.27) size 748.85x483.46
+          KCanvasItem {rect} at (0.58,8.27) size 748.85x483.46 [stroke={[type=SOLID] [color=#0000FF]}] [data="M1.00,1.00L649.00,1.00L649.00,419.00L1.00,419.00"]
+          KCanvasContainer {g} at (0.58,8.27) size 748.85x483.46
+            KCanvasItem {rect} at (0.58,8.27) size 748.85x483.46 [stroke={[type=SOLID] [color=#0000FF]}] [data="M1.00,1.00L649.00,1.00L649.00,419.00L1.00,419.00"]
+            KCanvasItem {rect} at (23.08,19.23) size 669.23x46.15 [fill={[type=LINEAR-GRADIENT] [stops=[(0.00,#00FF00), (1.00,#000000)]] [bounding box mode=0] [start=(10,0)] [end=(590,0)]}] [filter=#Identity] [data="M20.00,10.00L600.00,10.00L600.00,50.00L20.00,50.00"]
+            RenderSVGText {text} at (0,0) size 785x18
+              RenderText {#text} at (0,0) size 101x18
+                text run at (0,0) width 101: "type: identity"
+            KCanvasItem {rect} at (23.08,134.62) size 669.23x46.15 [fill={[type=LINEAR-GRADIENT] [stops=[(0.00,#00FF00), (1.00,#000000)]] [bounding box mode=0] [start=(10,0)] [end=(590,0)]}] [filter=#GammaBlank] [data="M20.00,110.00L600.00,110.00L600.00,150.00L20.00,150.00"]
+            RenderSVGText {text} at (0,0) size 785x18
+              RenderText {#text} at (0,0) size 575x18
+                text run at (0,0) width 575: "type: gamma amplitude=1 exponent=1 offset=0 -- Result should be identity"
+            KCanvasItem {rect} at (23.08,250) size 669.23x46.15 [fill={[type=LINEAR-GRADIENT] [stops=[(0.00,#00FF00), (1.00,#000000)]] [bounding box mode=0] [start=(10,0)] [end=(590,0)]}] [filter=#GammaFull] [data="M20.00,210.00L600.00,210.00L600.00,250.00L20.00,250.00"]
+            RenderSVGText {text} at (0,0) size 785x18
+              RenderText {#text} at (0,0) size 529x18
+                text run at (0,0) width 529: "type: gamma amplitude=1 exponent=0.5 offset=0 -- Result should be"
+            RenderSVGText {text} at (0,0) size 785x18
+              RenderText {#text} at (0,0) size 188x18
+                text run at (0,0) width 188: "delayed falloff in gradient"
+            KCanvasItem {rect} at (23.08,365.38) size 669.23x46.15 [fill={[type=LINEAR-GRADIENT] [stops=[(0.00,#00FF00), (1.00,#000000)]] [bounding box mode=0] [start=(10,0)] [end=(590,0)]}] [filter=#GammaOrd] [data="M20.00,310.00L600.00,310.00L600.00,350.00L20.00,350.00"]
+            RenderSVGText {text} at (0,0) size 785x18
+              RenderText {#text} at (0,0) size 568x18
+                text run at (0,0) width 568: "type: gamma amplitude=1 exponent=2 offset=0 -- Result should compress"
+            RenderSVGText {text} at (0,0) size 785x18
+              RenderText {#text} at (0,0) size 90x18
+                text run at (0,0) width 90: "the gradient"
diff --git a/LayoutTests/svg/custom/feComponentTransfer-Gamma.svg b/LayoutTests/svg/custom/feComponentTransfer-Gamma.svg
new file mode 100644 (file)
index 0000000..15ed022
--- /dev/null
@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Basic//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-basic.dtd">
+<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" id="svg-root" width="100%" height="100%" viewBox="0 0 480 360" version="1.1" baseProfile="basic">
+       <title id="test-title">feComponentTransfer Test - Gamma</title>
+       <desc id="test-desc">feComponentTransfer tests.</desc>
+       <g id="test-body-content">
+               <svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="15" y="5" width="450" height="300" viewBox="0 0 650 420">
+                       <defs>
+                               <linearGradient id="MyGradient" gradientUnits="userSpaceOnUse" x1="10" y1="0" x2="590" y2="0">
+                                       <stop offset="0" stop-color="#00ff00"/>
+                                       <stop offset="1" stop-color="#000000"/>
+                               </linearGradient>
+                               <filter id="Identity" filterUnits="objectBoundingBox" x="0%" y="0%" width="100%" height="100%">
+                                       <feComponentTransfer>
+                                               <feFuncR type="identity"/>
+                                       </feComponentTransfer>
+                               </filter>
+                               <filter id="GammaBlank" filterUnits="objectBoundingBox" x="0%" y="0%" width="100%" height="100%">
+                                       <feComponentTransfer>
+                                               <feFuncG type="gamma" amplitude="1" exponent="1" offset="0"/>
+                                       </feComponentTransfer>
+                               </filter>
+                               <filter id="GammaFull" filterUnits="objectBoundingBox" x="0%" y="0%" width="100%" height="100%">
+                                       <feComponentTransfer>
+                                               <feFuncG type="gamma" amplitude="1" exponent="0.5" offset="0"/>
+                                       </feComponentTransfer>
+                               </filter>
+                               <filter id="GammaOrd" filterUnits="objectBoundingBox" x="0%" y="0%" width="100%" height="100%">
+                                       <feComponentTransfer>
+                                               <feFuncG type="gamma" amplitude="1" exponent="2" offset="0"/>
+                                       </feComponentTransfer>
+                               </filter>
+                       </defs>
+                       <rect fill="none" stroke="blue" x="1" y="1" width="648" height="418"/>
+                       <g font-size="15" font-family="Verdana">
+                               <rect fill="none" stroke="blue" x="1" y="1" width="648" height="418"/>
+                               <rect x="20" y="10" width="580" height="40" fill="url(#MyGradient)" filter="url(#Identity)"/>
+                               <text x="20" y="70">type: identity</text>
+                               <rect x="20" y="110" width="580" height="40" fill="url(#MyGradient)" filter="url(#GammaBlank)"/>
+                               <text x="20" y="170">type: gamma amplitude=1 exponent=1 offset=0 -- Result should be identity</text>
+                               <rect x="20" y="210" width="580" height="40" fill="url(#MyGradient)" filter="url(#GammaFull)"/>
+                               <text x="20" y="270">type: gamma amplitude=1 exponent=0.5 offset=0 -- Result should be</text>
+                               <text x="20" y="290">delayed falloff in gradient</text>
+                               <rect x="20" y="310" width="580" height="40" fill="url(#MyGradient)" filter="url(#GammaOrd)"/>
+                               <text x="20" y="370">type: gamma amplitude=1 exponent=2 offset=0 -- Result should compress</text>
+                               <text x="20" y="390">the gradient</text>
+                       </g>
+               </svg>
+       </g>
+</svg>
diff --git a/LayoutTests/svg/custom/feComponentTransfer-Linear-expected.checksum b/LayoutTests/svg/custom/feComponentTransfer-Linear-expected.checksum
new file mode 100644 (file)
index 0000000..c78d270
--- /dev/null
@@ -0,0 +1 @@
+6547f926af04f7451df94085fb98d9fc
\ No newline at end of file
diff --git a/LayoutTests/svg/custom/feComponentTransfer-Linear-expected.png b/LayoutTests/svg/custom/feComponentTransfer-Linear-expected.png
new file mode 100644 (file)
index 0000000..01585d2
Binary files /dev/null and b/LayoutTests/svg/custom/feComponentTransfer-Linear-expected.png differ
diff --git a/LayoutTests/svg/custom/feComponentTransfer-Linear-expected.txt b/LayoutTests/svg/custom/feComponentTransfer-Linear-expected.txt
new file mode 100644 (file)
index 0000000..71dd9c2
--- /dev/null
@@ -0,0 +1,29 @@
+KRenderingPaintServer {id="MyGradient" [type=LINEAR-GRADIENT] [stops=[(0.00,#00FF00), (1.00,#000000)]] [bounding box mode=0] [start=(10,0)] [end=(590,0)]}
+KCanvasResource {id="Identity" [type=FILTER]  [bounding box=at (0,0) size 1x1] [effect bounding box mode=0] [effects=[[type=COMPONENT-TRANSFER]  [subregion="at (0,0) size 650x420"] [red func=[type=IDENTITY]] [green func=[type=IDENTITY]] [blue func=[type=IDENTITY]] [alpha func=[type=IDENTITY]]]]}
+KCanvasResource {id="DiscreteBlank" [type=FILTER]  [bounding box=at (0,0) size 1x1] [effect bounding box mode=0] [effects=[[type=COMPONENT-TRANSFER]  [subregion="at (0,0) size 650x420"] [red func=[type=IDENTITY]] [green func=[type=LINEAR] [slope=1.00] [intercept=0.00]] [blue func=[type=IDENTITY]] [alpha func=[type=IDENTITY]]]]}
+KCanvasResource {id="DiscreteFull" [type=FILTER]  [bounding box=at (0,0) size 1x1] [effect bounding box mode=0] [effects=[[type=COMPONENT-TRANSFER]  [subregion="at (0,0) size 650x420"] [red func=[type=IDENTITY]] [green func=[type=LINEAR] [slope=-1.00] [intercept=1.00]] [blue func=[type=IDENTITY]] [alpha func=[type=IDENTITY]]]]}
+KCanvasResource {id="DiscreteOrd" [type=FILTER]  [bounding box=at (0,0) size 1x1] [effect bounding box mode=0] [effects=[[type=COMPONENT-TRANSFER]  [subregion="at (0,0) size 650x420"] [red func=[type=IDENTITY]] [green func=[type=LINEAR] [slope=0.50] [intercept=0.25]] [blue func=[type=IDENTITY]] [alpha func=[type=IDENTITY]]]]}
+layer at (0,0) size 800x600
+  RenderCanvas at (0,0) size 800x600
+    KCanvasContainer {svg} at (0.83,0.83) size 1081.67x698.33
+      KCanvasContainer {g} at (0.83,0.83) size 1081.67x698.33
+        KCanvasContainer {svg} at (0.58,8.27) size 748.85x483.46
+          KCanvasItem {rect} at (0.58,8.27) size 748.85x483.46 [stroke={[type=SOLID] [color=#0000FF]}] [data="M1.00,1.00L649.00,1.00L649.00,419.00L1.00,419.00"]
+          KCanvasContainer {g} at (0.58,8.27) size 748.85x483.46
+            KCanvasItem {rect} at (0.58,8.27) size 748.85x483.46 [stroke={[type=SOLID] [color=#0000FF]}] [data="M1.00,1.00L649.00,1.00L649.00,419.00L1.00,419.00"]
+            KCanvasItem {rect} at (23.08,19.23) size 669.23x46.15 [fill={[type=LINEAR-GRADIENT] [stops=[(0.00,#00FF00), (1.00,#000000)]] [bounding box mode=0] [start=(10,0)] [end=(590,0)]}] [filter=#Identity] [data="M20.00,10.00L600.00,10.00L600.00,50.00L20.00,50.00"]
+            RenderSVGText {text} at (0,0) size 785x18
+              RenderText {#text} at (0,0) size 101x18
+                text run at (0,0) width 101: "type: identity"
+            KCanvasItem {rect} at (23.08,134.62) size 669.23x46.15 [fill={[type=LINEAR-GRADIENT] [stops=[(0.00,#00FF00), (1.00,#000000)]] [bounding box mode=0] [start=(10,0)] [end=(590,0)]}] [filter=#DiscreteBlank] [data="M20.00,110.00L600.00,110.00L600.00,150.00L20.00,150.00"]
+            RenderSVGText {text} at (0,0) size 785x18
+              RenderText {#text} at (0,0) size 452x18
+                text run at (0,0) width 452: "type: linear slope=1 intercept=0 -- Result should be identity"
+            KCanvasItem {rect} at (23.08,250) size 669.23x46.15 [fill={[type=LINEAR-GRADIENT] [stops=[(0.00,#00FF00), (1.00,#000000)]] [bounding box mode=0] [start=(10,0)] [end=(590,0)]}] [filter=#DiscreteFull] [data="M20.00,210.00L600.00,210.00L600.00,250.00L20.00,250.00"]
+            RenderSVGText {text} at (0,0) size 785x18
+              RenderText {#text} at (0,0) size 469x18
+                text run at (0,0) width 469: "type: linear slope=-1 intercept=0 -- Should invert the gradient"
+            KCanvasItem {rect} at (23.08,365.38) size 669.23x46.15 [fill={[type=LINEAR-GRADIENT] [stops=[(0.00,#00FF00), (1.00,#000000)]] [bounding box mode=0] [start=(10,0)] [end=(590,0)]}] [filter=#DiscreteOrd] [data="M20.00,310.00L600.00,310.00L600.00,350.00L20.00,350.00"]
+            RenderSVGText {text} at (0,0) size 785x18
+              RenderText {#text} at (0,0) size 599x18
+                text run at (0,0) width 599: "type: linear slope=0.5 intercept=0.25 -- Result should be less extreme gradient"
diff --git a/LayoutTests/svg/custom/feComponentTransfer-Linear.svg b/LayoutTests/svg/custom/feComponentTransfer-Linear.svg
new file mode 100644 (file)
index 0000000..18796ac
--- /dev/null
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Basic//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-basic.dtd">
+<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" id="svg-root" width="100%" height="100%" viewBox="0 0 480 360" version="1.1" baseProfile="basic">
+       <title id="test-title">feComponentTransfer Test - Linear</title>
+       <desc id="test-desc">feComponentTransfer tests.</desc>
+       <g id="test-body-content">
+               <svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="15" y="5" width="450" height="300" viewBox="0 0 650 420">
+                       <defs>
+                               <linearGradient id="MyGradient" gradientUnits="userSpaceOnUse" x1="10" y1="0" x2="590" y2="0">
+                                       <stop offset="0" stop-color="#00ff00"/>
+                                       <stop offset="1" stop-color="#000000"/>
+                               </linearGradient>
+                               <filter id="Identity" filterUnits="objectBoundingBox" x="0%" y="0%" width="100%" height="100%">
+                                       <feComponentTransfer>
+                                               <feFuncR type="identity"/>
+                                       </feComponentTransfer>
+                               </filter>
+                               <filter id="DiscreteBlank" filterUnits="objectBoundingBox" x="0%" y="0%" width="100%" height="100%">
+                                       <feComponentTransfer>
+                                               <feFuncG type="linear" slope="1" intercept="0.0"/>
+                                       </feComponentTransfer>
+                               </filter>
+                               <filter id="DiscreteFull" filterUnits="objectBoundingBox" x="0%" y="0%" width="100%" height="100%">
+                                       <feComponentTransfer>
+                                               <feFuncG type="linear" slope="-1" intercept="1.0"/>
+                                       </feComponentTransfer>
+                               </filter>
+                               <filter id="DiscreteOrd" filterUnits="objectBoundingBox" x="0%" y="0%" width="100%" height="100%">
+                                       <feComponentTransfer>
+                                               <feFuncG type="linear" slope="0.5" intercept="0.25"/>
+                                       </feComponentTransfer>
+                               </filter>
+                       </defs>
+                       <rect fill="none" stroke="blue" x="1" y="1" width="648" height="418"/>
+                       <g font-size="15" font-family="Verdana">
+                               <rect fill="none" stroke="blue" x="1" y="1" width="648" height="418"/>
+                               <rect x="20" y="10" width="580" height="40" fill="url(#MyGradient)" filter="url(#Identity)"/>
+                               <text x="20" y="70">type: identity</text>
+                               <rect x="20" y="110" width="580" height="40" fill="url(#MyGradient)" filter="url(#DiscreteBlank)"/>
+                               <text x="20" y="170">type: linear slope=1 intercept=0 -- Result should be identity</text>
+                               <rect x="20" y="210" width="580" height="40" fill="url(#MyGradient)" filter="url(#DiscreteFull)"/>
+                               <text x="20" y="270">type: linear slope=-1 intercept=0 -- Should invert the gradient</text>
+                               <rect x="20" y="310" width="580" height="40" fill="url(#MyGradient)" filter="url(#DiscreteOrd)"/>
+                               <text x="20" y="370">type: linear slope=0.5 intercept=0.25 -- Result should be less extreme gradient</text>
+                       </g>
+               </svg>
+       </g>
+</svg>
diff --git a/LayoutTests/svg/custom/feComponentTransfer-Table-expected.checksum b/LayoutTests/svg/custom/feComponentTransfer-Table-expected.checksum
new file mode 100644 (file)
index 0000000..ce6f092
--- /dev/null
@@ -0,0 +1 @@
+fffb31674cfeac133a0af966d8eaafad
\ No newline at end of file
diff --git a/LayoutTests/svg/custom/feComponentTransfer-Table-expected.png b/LayoutTests/svg/custom/feComponentTransfer-Table-expected.png
new file mode 100644 (file)
index 0000000..2db133e
Binary files /dev/null and b/LayoutTests/svg/custom/feComponentTransfer-Table-expected.png differ
diff --git a/LayoutTests/svg/custom/feComponentTransfer-Table-expected.txt b/LayoutTests/svg/custom/feComponentTransfer-Table-expected.txt
new file mode 100644 (file)
index 0000000..cf77f7b
--- /dev/null
@@ -0,0 +1,29 @@
+KRenderingPaintServer {id="MyGradient" [type=LINEAR-GRADIENT] [stops=[(0.00,#00FF00), (1.00,#000000)]] [bounding box mode=0] [start=(10,0)] [end=(590,0)]}
+KCanvasResource {id="Identity" [type=FILTER]  [bounding box=at (0,0) size 1x1] [effect bounding box mode=0] [effects=[[type=COMPONENT-TRANSFER]  [subregion="at (0,0) size 650x420"] [red func=[type=IDENTITY]] [green func=[type=IDENTITY]] [blue func=[type=IDENTITY]] [alpha func=[type=IDENTITY]]]]}
+KCanvasResource {id="TableBlank" [type=FILTER]  [bounding box=at (0,0) size 1x1] [effect bounding box mode=0] [effects=[[type=COMPONENT-TRANSFER]  [subregion="at (0,0) size 650x420"] [red func=[type=IDENTITY]] [green func=[type=TABLE] [table values=0.00]] [blue func=[type=IDENTITY]] [alpha func=[type=IDENTITY]]]]}
+KCanvasResource {id="TableFull" [type=FILTER]  [bounding box=at (0,0) size 1x1] [effect bounding box mode=0] [effects=[[type=COMPONENT-TRANSFER]  [subregion="at (0,0) size 650x420"] [red func=[type=IDENTITY]] [green func=[type=TABLE] [table values=1.00]] [blue func=[type=IDENTITY]] [alpha func=[type=IDENTITY]]]]}
+KCanvasResource {id="TableOrd" [type=FILTER]  [bounding box=at (0,0) size 1x1] [effect bounding box mode=0] [effects=[[type=COMPONENT-TRANSFER]  [subregion="at (0,0) size 650x420"] [red func=[type=IDENTITY]] [green func=[type=TABLE] [table values=0.00 0.00 1.00 1.00]] [blue func=[type=IDENTITY]] [alpha func=[type=IDENTITY]]]]}
+layer at (0,0) size 800x600
+  RenderCanvas at (0,0) size 800x600
+    KCanvasContainer {svg} at (0.83,0.83) size 1081.67x698.33
+      KCanvasContainer {g} at (0.83,0.83) size 1081.67x698.33
+        KCanvasContainer {svg} at (0.58,8.27) size 748.85x483.46
+          KCanvasItem {rect} at (0.58,8.27) size 748.85x483.46 [stroke={[type=SOLID] [color=#0000FF]}] [data="M1.00,1.00L649.00,1.00L649.00,419.00L1.00,419.00"]
+          KCanvasContainer {g} at (0.58,8.27) size 748.85x483.46
+            KCanvasItem {rect} at (0.58,8.27) size 748.85x483.46 [stroke={[type=SOLID] [color=#0000FF]}] [data="M1.00,1.00L649.00,1.00L649.00,419.00L1.00,419.00"]
+            KCanvasItem {rect} at (23.08,19.23) size 669.23x46.15 [fill={[type=LINEAR-GRADIENT] [stops=[(0.00,#00FF00), (1.00,#000000)]] [bounding box mode=0] [start=(10,0)] [end=(590,0)]}] [filter=#Identity] [data="M20.00,10.00L600.00,10.00L600.00,50.00L20.00,50.00"]
+            RenderSVGText {text} at (0,0) size 785x18
+              RenderText {#text} at (0,0) size 101x18
+                text run at (0,0) width 101: "type: identity"
+            KCanvasItem {rect} at (23.08,134.62) size 669.23x46.15 [fill={[type=LINEAR-GRADIENT] [stops=[(0.00,#00FF00), (1.00,#000000)]] [bounding box mode=0] [start=(10,0)] [end=(590,0)]}] [filter=#TableBlank] [data="M20.00,110.00L600.00,110.00L600.00,150.00L20.00,150.00"]
+            RenderSVGText {text} at (0,0) size 785x18
+              RenderText {#text} at (0,0) size 301x18
+                text run at (0,0) width 301: "type: table [0] -- Result should be black"
+            KCanvasItem {rect} at (23.08,250) size 669.23x46.15 [fill={[type=LINEAR-GRADIENT] [stops=[(0.00,#00FF00), (1.00,#000000)]] [bounding box mode=0] [start=(10,0)] [end=(590,0)]}] [filter=#TableFull] [data="M20.00,210.00L600.00,210.00L600.00,250.00L20.00,250.00"]
+            RenderSVGText {text} at (0,0) size 785x18
+              RenderText {#text} at (0,0) size 304x18
+                text run at (0,0) width 304: "type: table [1] -- Result should be green"
+            KCanvasItem {rect} at (23.08,365.38) size 669.23x46.15 [fill={[type=LINEAR-GRADIENT] [stops=[(0.00,#00FF00), (1.00,#000000)]] [bounding box mode=0] [start=(10,0)] [end=(590,0)]}] [filter=#TableOrd] [data="M20.00,310.00L600.00,310.00L600.00,350.00L20.00,350.00"]
+            RenderSVGText {text} at (0,0) size 785x18
+              RenderText {#text} at (0,0) size 463x18
+                text run at (0,0) width 463: "type: table [0 0 1 1] -- Result should be compressed gradient"
diff --git a/LayoutTests/svg/custom/feComponentTransfer-Table.svg b/LayoutTests/svg/custom/feComponentTransfer-Table.svg
new file mode 100644 (file)
index 0000000..9998cbd
--- /dev/null
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Basic//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-basic.dtd">
+<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" id="svg-root" width="100%" height="100%" viewBox="0 0 480 360" version="1.1" baseProfile="basic">
+       <title id="test-title">feComponentTransfer Test - Table</title>
+       <desc id="test-desc">feComponentTransfer tests.</desc>
+       <g id="test-body-content">
+               <svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="15" y="5" width="450" height="300" viewBox="0 0 650 420">
+                       <defs>
+                               <linearGradient id="MyGradient" gradientUnits="userSpaceOnUse" x1="10" y1="0" x2="590" y2="0">
+                                       <stop offset="0" stop-color="#00ff00"/>
+                                       <stop offset="1" stop-color="#000000"/>
+                               </linearGradient>
+                               <filter id="Identity" filterUnits="objectBoundingBox" x="0%" y="0%" width="100%" height="100%">
+                                       <feComponentTransfer>
+                                               <feFuncR type="identity"/>
+                                       </feComponentTransfer>
+                               </filter>
+                               <filter id="TableBlank" filterUnits="objectBoundingBox" x="0%" y="0%" width="100%" height="100%">
+                                       <feComponentTransfer>
+                                               <feFuncG type="table" tableValues="0"/>
+                                       </feComponentTransfer>
+                               </filter>
+                               <filter id="TableFull" filterUnits="objectBoundingBox" x="0%" y="0%" width="100%" height="100%">
+                                       <feComponentTransfer>
+                                               <feFuncG type="table" tableValues="1"/>
+                                       </feComponentTransfer>
+                               </filter>
+                               <filter id="TableOrd" filterUnits="objectBoundingBox" x="0%" y="0%" width="100%" height="100%">
+                                       <feComponentTransfer>
+                                               <feFuncG type="table" tableValues="0 0 1 1"/>
+                                       </feComponentTransfer>
+                               </filter>
+                       </defs>
+                       <rect fill="none" stroke="blue" x="1" y="1" width="648" height="418"/>
+                       <g font-size="15" font-family="Verdana">
+                               <rect fill="none" stroke="blue" x="1" y="1" width="648" height="418"/>
+                               <rect x="20" y="10" width="580" height="40" fill="url(#MyGradient)" filter="url(#Identity)"/>
+                               <text x="20" y="70">type: identity</text>
+                               <rect x="20" y="110" width="580" height="40" fill="url(#MyGradient)" filter="url(#TableBlank)"/>
+                               <text x="20" y="170">type: table [0] -- Result should be black</text>
+                               <rect x="20" y="210" width="580" height="40" fill="url(#MyGradient)" filter="url(#TableFull)"/>
+                               <text x="20" y="270">type: table [1] -- Result should be green</text>
+                               <rect x="20" y="310" width="580" height="40" fill="url(#MyGradient)" filter="url(#TableOrd)"/>
+                               <text x="20" y="370">type: table [0 0 1 1] -- Result should be compressed gradient</text>
+                       </g>
+               </svg>
+       </g>
+</svg>
index 731bb507b193942b1e80818703b83d9e6370d057..3fd1ec81d35a1d73d88fc20dffddf28305fe5288 100644 (file)
@@ -1,3 +1,86 @@
+2006-04-26  Mitz Pettel  <opendarwin.org@mitzpettel.com>
+
+        Reviewed by darin.  Landed by eseidel.
+
+        - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=8452
+          mangleme(0x58c22e11): Random crashes
+
+        Test: fast/frames/empty-cols-attribute.html
+
+        * platform/StringImpl.cpp:
+        (WebCore::StringImpl::toLengthArray): If the string is empty, return 0
+        but set len to 1. This gives the same behavior you get if you don't specify
+        the attribute at all, matching WinIE and Firefox. Previously, the empty
+        string resulted in len being set to 0 (and a memory smasher in
+        RenderFrameSet::layout()).
+        * rendering/render_frames.cpp:
+        (WebCore::RenderFrameSet::layout): Added an assert.
+
+2006-04-26  Oliver Hunt  <ojh16@student.canterbury.ac.nz>
+
+        Reviewed by eseidel.  Landed by eseidel.
+
+        * WebCore.xcodeproj/project.pbxproj:
+        * kcanvas/KCanvasFilters.cpp:
+        (WebCore::operator<<):
+        * kcanvas/KCanvasFilters.h:
+        (WebCore::KCComponentTransferFunction::KCComponentTransferFunction):
+        * kcanvas/device/quartz/KCanvasFilterQuartz.h:
+        * kcanvas/device/quartz/KCanvasFilterQuartz.mm:
+        (WebCore::getVectorForChannel):
+        (WebCore::genImageFromTable):
+        (WebCore::filterForComponentFunc):
+        (WebCore::setParametersForComponentFunc):
+        (WebCore::getFilterForFunc):
+        (WebCore::KCanvasFEComponentTransferQuartz::getFunctionFilter):
+        (WebCore::KCanvasFEComponentTransferQuartz::getCIFilter):
+        * kcanvas/device/quartz/KRenderingDeviceQuartz.mm:
+        (WebCore::KRenderingDeviceQuartz::createFilterEffect):
+        * kcanvas/device/quartz/filters/WKComponentMergeFilter.cikernel: Added.
+        * kcanvas/device/quartz/filters/WKComponentMergeFilter.h: Added.
+        * kcanvas/device/quartz/filters/WKComponentMergeFilter.m: Added.
+        (+[WKComponentMergeFilter initialize]):
+        (+[WKComponentMergeFilter filterWithName:]):
+        (-[WKComponentMergeFilter init]):
+        (-[WKComponentMergeFilter outputImage]):
+        * kcanvas/device/quartz/filters/WKDiscreteTransferFilter.cikernel: Added.
+        * kcanvas/device/quartz/filters/WKDiscreteTransferFilter.h: Added.
+        * kcanvas/device/quartz/filters/WKDiscreteTransferFilter.m: Added.
+        (+[WKDiscreteTransferFilter initialize]):
+        (+[WKDiscreteTransferFilter filterWithName:]):
+        (-[WKDiscreteTransferFilter init]):
+        (-[WKDiscreteTransferFilter outputImage]):
+        * kcanvas/device/quartz/filters/WKGammaTransferFilter.cikernel: Added.
+        * kcanvas/device/quartz/filters/WKGammaTransferFilter.h: Added.
+        * kcanvas/device/quartz/filters/WKGammaTransferFilter.m: Added.
+        (+[WKGammaTransferFilter initialize]):
+        (+[WKGammaTransferFilter filterWithName:]):
+        (-[WKGammaTransferFilter init]):
+        (-[WKGammaTransferFilter outputImage]):
+        * kcanvas/device/quartz/filters/WKIdentityTransferFilter.h: Added.
+        * kcanvas/device/quartz/filters/WKIdentityTransferFilter.m: Added.
+        (+[WKIdentityTransferFilter initialize]):
+        (+[WKIdentityTransferFilter filterWithName:]):
+        (-[WKIdentityTransferFilter init]):
+        (-[WKIdentityTransferFilter outputImage]):
+        * kcanvas/device/quartz/filters/WKLinearTransferFilter.cikernel: Added.
+        * kcanvas/device/quartz/filters/WKLinearTransferFilter.h: Added.
+        * kcanvas/device/quartz/filters/WKLinearTransferFilter.m: Added.
+        (+[WKLinearTransferFilter initialize]):
+        (+[WKLinearTransferFilter filterWithName:]):
+        (-[WKLinearTransferFilter init]):
+        (-[WKLinearTransferFilter outputImage]):
+        * kcanvas/device/quartz/filters/WKTableTransferFilter.cikernel: Added.
+        * kcanvas/device/quartz/filters/WKTableTransferFilter.h: Added.
+        * kcanvas/device/quartz/filters/WKTableTransferFilter.m: Added.
+        (+[WKTableTransferFilter initialize]):
+        (+[WKTableTransferFilter filterWithName:]):
+        (-[WKTableTransferFilter init]):
+        (-[WKTableTransferFilter outputImage]):
+        * ksvg2/svg/SVGComponentTransferFunctionElement.cpp:
+        (SVGComponentTransferFunctionElement::parseMappedAttribute):
+        (SVGComponentTransferFunctionElement::transferFunction):
+
 2006-04-25  Eric Seidel  <eseidel@apple.com>
 
         Reviewed by ggaren.
index 58ecc3e8e13249cebe712bb8490177c0722eaadb..bcd782e1a2d49a041aa31fb5027298c2e3aa2c01 100644 (file)
                A7638A92099592C30007E14F /* WKDisplacementMapFilter.cikernel in Resources */ = {isa = PBXBuildFile; fileRef = A7638A91099592C30007E14F /* WKDisplacementMapFilter.cikernel */; };
                A7638A970995965D0007E14F /* SVGFEDisplacementMapElement.h in Headers */ = {isa = PBXBuildFile; fileRef = A7638A950995965D0007E14F /* SVGFEDisplacementMapElement.h */; };
                A7638A980995965D0007E14F /* SVGFEDisplacementMapElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A7638A960995965D0007E14F /* SVGFEDisplacementMapElement.cpp */; };
+               A7B97B770979C3A1000E8EB1 /* WKComponentMergeFilter.cikernel in Resources */ = {isa = PBXBuildFile; fileRef = A7B97B660979C3A1000E8EB1 /* WKComponentMergeFilter.cikernel */; };
+               A7B97B780979C3A1000E8EB1 /* WKComponentMergeFilter.h in Headers */ = {isa = PBXBuildFile; fileRef = A7B97B670979C3A1000E8EB1 /* WKComponentMergeFilter.h */; };
+               A7B97B790979C3A1000E8EB1 /* WKComponentMergeFilter.m in Sources */ = {isa = PBXBuildFile; fileRef = A7B97B680979C3A1000E8EB1 /* WKComponentMergeFilter.m */; };
+               A7B97B7A0979C3A1000E8EB1 /* WKDiscreteTransferFilter.cikernel in Resources */ = {isa = PBXBuildFile; fileRef = A7B97B690979C3A1000E8EB1 /* WKDiscreteTransferFilter.cikernel */; };
+               A7B97B7B0979C3A1000E8EB1 /* WKDiscreteTransferFilter.h in Headers */ = {isa = PBXBuildFile; fileRef = A7B97B6A0979C3A1000E8EB1 /* WKDiscreteTransferFilter.h */; };
+               A7B97B7C0979C3A1000E8EB1 /* WKDiscreteTransferFilter.m in Sources */ = {isa = PBXBuildFile; fileRef = A7B97B6B0979C3A1000E8EB1 /* WKDiscreteTransferFilter.m */; };
+               A7B97B7D0979C3A1000E8EB1 /* WKGammaTransferFilter.cikernel in Resources */ = {isa = PBXBuildFile; fileRef = A7B97B6C0979C3A1000E8EB1 /* WKGammaTransferFilter.cikernel */; };
+               A7B97B7E0979C3A1000E8EB1 /* WKGammaTransferFilter.h in Headers */ = {isa = PBXBuildFile; fileRef = A7B97B6D0979C3A1000E8EB1 /* WKGammaTransferFilter.h */; };
+               A7B97B7F0979C3A1000E8EB1 /* WKGammaTransferFilter.m in Sources */ = {isa = PBXBuildFile; fileRef = A7B97B6E0979C3A1000E8EB1 /* WKGammaTransferFilter.m */; };
+               A7B97B800979C3A1000E8EB1 /* WKIdentityTransferFilter.h in Headers */ = {isa = PBXBuildFile; fileRef = A7B97B6F0979C3A1000E8EB1 /* WKIdentityTransferFilter.h */; };
+               A7B97B810979C3A1000E8EB1 /* WKIdentityTransferFilter.m in Sources */ = {isa = PBXBuildFile; fileRef = A7B97B700979C3A1000E8EB1 /* WKIdentityTransferFilter.m */; };
+               A7B97B820979C3A1000E8EB1 /* WKLinearTransferFilter.cikernel in Resources */ = {isa = PBXBuildFile; fileRef = A7B97B710979C3A1000E8EB1 /* WKLinearTransferFilter.cikernel */; };
+               A7B97B830979C3A1000E8EB1 /* WKLinearTransferFilter.h in Headers */ = {isa = PBXBuildFile; fileRef = A7B97B720979C3A1000E8EB1 /* WKLinearTransferFilter.h */; };
+               A7B97B840979C3A1000E8EB1 /* WKLinearTransferFilter.m in Sources */ = {isa = PBXBuildFile; fileRef = A7B97B730979C3A1000E8EB1 /* WKLinearTransferFilter.m */; };
+               A7B97B850979C3A1000E8EB1 /* WKTableTransferFilter.cikernel in Resources */ = {isa = PBXBuildFile; fileRef = A7B97B740979C3A1000E8EB1 /* WKTableTransferFilter.cikernel */; };
+               A7B97B860979C3A1000E8EB1 /* WKTableTransferFilter.h in Headers */ = {isa = PBXBuildFile; fileRef = A7B97B750979C3A1000E8EB1 /* WKTableTransferFilter.h */; };
+               A7B97B870979C3A1000E8EB1 /* WKTableTransferFilter.m in Sources */ = {isa = PBXBuildFile; fileRef = A7B97B760979C3A1000E8EB1 /* WKTableTransferFilter.m */; };
                A81369CA097374F600D74463 /* HTMLIsIndexElement.h in Headers */ = {isa = PBXBuildFile; fileRef = A81369AE097374F500D74463 /* HTMLIsIndexElement.h */; };
                A81369CB097374F600D74463 /* HTMLIsIndexElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A81369AF097374F500D74463 /* HTMLIsIndexElement.cpp */; };
                A81369CC097374F600D74463 /* HTMLInputElement.h in Headers */ = {isa = PBXBuildFile; fileRef = A81369B0097374F500D74463 /* HTMLInputElement.h */; };
                A7638A91099592C30007E14F /* WKDisplacementMapFilter.cikernel */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = WKDisplacementMapFilter.cikernel; sourceTree = "<group>"; };
                A7638A950995965D0007E14F /* SVGFEDisplacementMapElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGFEDisplacementMapElement.h; sourceTree = "<group>"; };
                A7638A960995965D0007E14F /* SVGFEDisplacementMapElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGFEDisplacementMapElement.cpp; sourceTree = "<group>"; };
+               A7B97B660979C3A1000E8EB1 /* WKComponentMergeFilter.cikernel */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = WKComponentMergeFilter.cikernel; sourceTree = "<group>"; };
+               A7B97B670979C3A1000E8EB1 /* WKComponentMergeFilter.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = WKComponentMergeFilter.h; sourceTree = "<group>"; };
+               A7B97B680979C3A1000E8EB1 /* WKComponentMergeFilter.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = WKComponentMergeFilter.m; sourceTree = "<group>"; };
+               A7B97B690979C3A1000E8EB1 /* WKDiscreteTransferFilter.cikernel */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = WKDiscreteTransferFilter.cikernel; sourceTree = "<group>"; };
+               A7B97B6A0979C3A1000E8EB1 /* WKDiscreteTransferFilter.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = WKDiscreteTransferFilter.h; sourceTree = "<group>"; };
+               A7B97B6B0979C3A1000E8EB1 /* WKDiscreteTransferFilter.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = WKDiscreteTransferFilter.m; sourceTree = "<group>"; };
+               A7B97B6C0979C3A1000E8EB1 /* WKGammaTransferFilter.cikernel */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = WKGammaTransferFilter.cikernel; sourceTree = "<group>"; };
+               A7B97B6D0979C3A1000E8EB1 /* WKGammaTransferFilter.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = WKGammaTransferFilter.h; sourceTree = "<group>"; };
+               A7B97B6E0979C3A1000E8EB1 /* WKGammaTransferFilter.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = WKGammaTransferFilter.m; sourceTree = "<group>"; };
+               A7B97B6F0979C3A1000E8EB1 /* WKIdentityTransferFilter.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = WKIdentityTransferFilter.h; sourceTree = "<group>"; };
+               A7B97B700979C3A1000E8EB1 /* WKIdentityTransferFilter.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = WKIdentityTransferFilter.m; sourceTree = "<group>"; };
+               A7B97B710979C3A1000E8EB1 /* WKLinearTransferFilter.cikernel */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = WKLinearTransferFilter.cikernel; sourceTree = "<group>"; };
+               A7B97B720979C3A1000E8EB1 /* WKLinearTransferFilter.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = WKLinearTransferFilter.h; sourceTree = "<group>"; };
+               A7B97B730979C3A1000E8EB1 /* WKLinearTransferFilter.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = WKLinearTransferFilter.m; sourceTree = "<group>"; };
+               A7B97B740979C3A1000E8EB1 /* WKTableTransferFilter.cikernel */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = WKTableTransferFilter.cikernel; sourceTree = "<group>"; };
+               A7B97B750979C3A1000E8EB1 /* WKTableTransferFilter.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = WKTableTransferFilter.h; sourceTree = "<group>"; };
+               A7B97B760979C3A1000E8EB1 /* WKTableTransferFilter.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = WKTableTransferFilter.m; sourceTree = "<group>"; };
                A810E39308A4160F00333D98 /* KCanvasTreeDebug.h */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = KCanvasTreeDebug.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
                A810E39408A4160F00333D98 /* KCanvasTreeDebug.cpp */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.cpp.cpp; path = KCanvasTreeDebug.cpp; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
                A8122C7E08D564B000844FA3 /* GetSVGDocument.idl */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = text; path = GetSVGDocument.idl; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
                        isa = PBXGroup;
                        children = (
                                A8C32920093BB732000B9CAC /* WKArithmeticFilter.cikernel */,
+                               A7B97B660979C3A1000E8EB1 /* WKComponentMergeFilter.cikernel */,
+                               A7B97B670979C3A1000E8EB1 /* WKComponentMergeFilter.h */,
+                               A7B97B680979C3A1000E8EB1 /* WKComponentMergeFilter.m */,
+                               A7B97B690979C3A1000E8EB1 /* WKDiscreteTransferFilter.cikernel */,
+                               A7B97B6A0979C3A1000E8EB1 /* WKDiscreteTransferFilter.h */,
+                               A7B97B6B0979C3A1000E8EB1 /* WKDiscreteTransferFilter.m */,
+                               A7B97B6C0979C3A1000E8EB1 /* WKGammaTransferFilter.cikernel */,
+                               A7B97B6D0979C3A1000E8EB1 /* WKGammaTransferFilter.h */,
+                               A7B97B6E0979C3A1000E8EB1 /* WKGammaTransferFilter.m */,
+                               A7B97B6F0979C3A1000E8EB1 /* WKIdentityTransferFilter.h */,
+                               A7B97B700979C3A1000E8EB1 /* WKIdentityTransferFilter.m */,
+                               A7B97B710979C3A1000E8EB1 /* WKLinearTransferFilter.cikernel */,
+                               A7B97B720979C3A1000E8EB1 /* WKLinearTransferFilter.h */,
+                               A7B97B730979C3A1000E8EB1 /* WKLinearTransferFilter.m */,
+                               A7B97B740979C3A1000E8EB1 /* WKTableTransferFilter.cikernel */,
+                               A7B97B750979C3A1000E8EB1 /* WKTableTransferFilter.h */,
+                               A7B97B760979C3A1000E8EB1 /* WKTableTransferFilter.m */,
                                A8C32921093BB732000B9CAC /* WKArithmeticFilter.h */,
                                A8C32922093BB732000B9CAC /* WKArithmeticFilter.m */,
                                A8C32923093BB732000B9CAC /* WKDiffuseLightingFilter.cikernel */,
                                A81369E2097374F600D74463 /* HTMLLabelElement.h in Headers */,
                                A81369E4097374F600D74463 /* HTMLKeygenElement.h in Headers */,
                                A8136D380973A8E700D74463 /* FormDataList.h in Headers */,
+                               A7B97B780979C3A1000E8EB1 /* WKComponentMergeFilter.h in Headers */,
+                               A7B97B7B0979C3A1000E8EB1 /* WKDiscreteTransferFilter.h in Headers */,
+                               A7B97B7E0979C3A1000E8EB1 /* WKGammaTransferFilter.h in Headers */,
+                               A7B97B800979C3A1000E8EB1 /* WKIdentityTransferFilter.h in Headers */,
+                               A7B97B830979C3A1000E8EB1 /* WKLinearTransferFilter.h in Headers */,
+                               A7B97B860979C3A1000E8EB1 /* WKTableTransferFilter.h in Headers */,
                                65BF022F0974816300C43196 /* Frame.h in Headers */,
                                65BF02300974816300C43196 /* FramePrivate.h in Headers */,
                                65BF02440974819000C43196 /* FrameMac.h in Headers */,
                                A88AD3A10952486D001DD196 /* WKPointLightFilter.cikernel in Resources */,
                                A88AD3A40952486D001DD196 /* WKSpecularLightingFilter.cikernel in Resources */,
                                A88AD3A70952486D001DD196 /* WKSpotLightFilter.cikernel in Resources */,
+                               A7B97B770979C3A1000E8EB1 /* WKComponentMergeFilter.cikernel in Resources */,
+                               A7B97B7A0979C3A1000E8EB1 /* WKDiscreteTransferFilter.cikernel in Resources */,
+                               A7B97B7D0979C3A1000E8EB1 /* WKGammaTransferFilter.cikernel in Resources */,
+                               A7B97B820979C3A1000E8EB1 /* WKLinearTransferFilter.cikernel in Resources */,
+                               A7B97B850979C3A1000E8EB1 /* WKTableTransferFilter.cikernel in Resources */,
                                A7638A92099592C30007E14F /* WKDisplacementMapFilter.cikernel in Resources */,
                                14CF787209F587CA00EB3665 /* CSSValue.idl in Resources */,
                                14CF7A7109F5CF9A00EB3665 /* CSSRule.idl in Resources */,
                                A81369E3097374F600D74463 /* HTMLLabelElement.cpp in Sources */,
                                A81369E5097374F600D74463 /* HTMLKeygenElement.cpp in Sources */,
                                A8136D390973A8E700D74463 /* FormDataList.cpp in Sources */,
+                               A7B97B790979C3A1000E8EB1 /* WKComponentMergeFilter.m in Sources */,
+                               A7B97B7C0979C3A1000E8EB1 /* WKDiscreteTransferFilter.m in Sources */,
+                               A7B97B7F0979C3A1000E8EB1 /* WKGammaTransferFilter.m in Sources */,
+                               A7B97B810979C3A1000E8EB1 /* WKIdentityTransferFilter.m in Sources */,
+                               A7B97B840979C3A1000E8EB1 /* WKLinearTransferFilter.m in Sources */,
+                               A7B97B870979C3A1000E8EB1 /* WKTableTransferFilter.m in Sources */,
                                65BF022E0974816300C43196 /* Frame.cpp in Sources */,
                                65BF02450974819000C43196 /* FrameMac.mm in Sources */,
                                FAE0418C09759694000540BE /* RenderSVGImage.cpp in Sources */,
diff --git a/WebCore/WebCore/kcanvas/device/quartz/filters/WKComponentMergeFilter.cikernel b/WebCore/WebCore/kcanvas/device/quartz/filters/WKComponentMergeFilter.cikernel
new file mode 100644 (file)
index 0000000..f33f20c
--- /dev/null
@@ -0,0 +1,33 @@
+/*
+ * Copyright (C) 2006 Oliver Hunt <ojh16@student.canterbury.ac.nz>.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+
+kernel vec4 mergeComponents(sampler funcR, sampler funcG, sampler funcB, sampler funcA)
+{
+    float r = sample(funcR, samplerCoord(funcR)).r;
+    float g = sample(funcG, samplerCoord(funcG)).g;
+    float b = sample(funcB, samplerCoord(funcB)).b;
+    float a = sample(funcA, samplerCoord(funcA)).a;
+    return vec4(r, g, b, a);
+}
diff --git a/WebCore/WebCore/kcanvas/device/quartz/filters/WKComponentMergeFilter.h b/WebCore/WebCore/kcanvas/device/quartz/filters/WKComponentMergeFilter.h
new file mode 100644 (file)
index 0000000..6036e9a
--- /dev/null
@@ -0,0 +1,35 @@
+/*
+ * Copyright (C) 2006 Oliver Hunt <ojh16@student.canterbury.ac.nz>.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+
+#import <QuartzCore/CoreImage.h>
+
+@interface WKComponentMergeFilter : CIFilter {
+    CIImage  *inputFuncR;
+    CIImage  *inputFuncG;
+    CIImage  *inputFuncB;
+    CIImage  *inputFuncA;
+}
+
+@end
diff --git a/WebCore/WebCore/kcanvas/device/quartz/filters/WKComponentMergeFilter.m b/WebCore/WebCore/kcanvas/device/quartz/filters/WKComponentMergeFilter.m
new file mode 100644 (file)
index 0000000..5e527eb
--- /dev/null
@@ -0,0 +1,65 @@
+/*
+ * Copyright (C) 2006 Oliver Hunt <ojh16@student.canterbury.ac.nz>.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+
+#import "WKComponentMergeFilter.h"
+
+static CIKernel *componentMergeFilter = nil;
+
+@implementation WKComponentMergeFilter
++ (void)initialize
+{
+    [CIFilter registerFilterName:@"WKComponentMerge"
+                     constructor:self
+                 classAttributes:[NSDictionary dictionaryWithObjectsAndKeys:
+                     @"WebKit Component Merge", kCIAttributeFilterDisplayName,
+                     [NSArray arrayWithObjects:kCICategoryStylize, kCICategoryVideo,
+                         kCICategoryStillImage, kCICategoryNonSquarePixels,nil], kCIAttributeFilterCategories,
+                     nil]];
+}
+
++ (CIFilter *)filterWithName:(NSString *)name
+{
+    return [[[self alloc] init] autorelease];
+}
+
+- (id)init
+{
+    if (!componentMergeFilter) {
+        NSBundle *bundle = [NSBundle bundleForClass:[self class]];
+        NSString *kernelFile = [bundle pathForResource:@"WKComponentMergeFilter" ofType:@"cikernel"];
+        NSString *code = [NSString stringWithContentsOfFile:kernelFile];
+        NSArray *kernels = [CIKernel kernelsWithString:code];
+        componentMergeFilter = [[kernels objectAtIndex:0] retain];
+    }
+    return [super init];
+}
+
+- (CIImage *)outputImage
+{
+    return [self apply:componentMergeFilter, [CISampler samplerWithImage: inputFuncR], 
+        [CISampler samplerWithImage: inputFuncG], [CISampler samplerWithImage: inputFuncB], [CISampler samplerWithImage: inputFuncA], @"definition", [inputFuncR definition], nil];
+}
+
+@end
diff --git a/WebCore/WebCore/kcanvas/device/quartz/filters/WKDiscreteTransferFilter.cikernel b/WebCore/WebCore/kcanvas/device/quartz/filters/WKDiscreteTransferFilter.cikernel
new file mode 100644 (file)
index 0000000..db3cefd
--- /dev/null
@@ -0,0 +1,32 @@
+/*
+ * Copyright (C) 2006 Oliver Hunt <ojh16@student.canterbury.ac.nz>.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+
+kernel vec4 discreteTransfer(sampler image, sampler table, vec4 rgbaSelector, float maxIndex)
+{
+    vec4 C = sample(image, samplerCoord(image));
+    float k = floor(dot(rgbaSelector, C) * maxIndex);
+    vec4 res = sample(table, vec2(k+0.0, 0.0));
+    return res;
+}
diff --git a/WebCore/WebCore/kcanvas/device/quartz/filters/WKDiscreteTransferFilter.h b/WebCore/WebCore/kcanvas/device/quartz/filters/WKDiscreteTransferFilter.h
new file mode 100644 (file)
index 0000000..a7664b7
--- /dev/null
@@ -0,0 +1,34 @@
+/*
+ * Copyright (C) 2006 Oliver Hunt <ojh16@student.canterbury.ac.nz>.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+
+#import <QuartzCore/CoreImage.h>
+
+@interface WKDiscreteTransferFilter : CIFilter {
+    CIImage  *inputImage;
+    CIImage  *inputTable;
+    CIVector *inputSelector;
+}
+
+@end
diff --git a/WebCore/WebCore/kcanvas/device/quartz/filters/WKDiscreteTransferFilter.m b/WebCore/WebCore/kcanvas/device/quartz/filters/WKDiscreteTransferFilter.m
new file mode 100644 (file)
index 0000000..8f1ae46
--- /dev/null
@@ -0,0 +1,68 @@
+/*
+ * Copyright (C) 2006 Oliver Hunt <ojh16@student.canterbury.ac.nz>.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+
+#import "WKDiscreteTransferFilter.h"
+
+static CIKernel *discreteTransferFilter = nil;
+
+@implementation WKDiscreteTransferFilter
++ (void)initialize
+{
+    [CIFilter registerFilterName:@"WKDiscreteTransfer"
+                     constructor:self
+                 classAttributes:[NSDictionary dictionaryWithObjectsAndKeys:
+                     @"WebKit Discrete Transfer", kCIAttributeFilterDisplayName,
+                     [NSArray arrayWithObjects:kCICategoryStylize, kCICategoryVideo,
+                         kCICategoryStillImage, kCICategoryNonSquarePixels,nil], kCIAttributeFilterCategories,
+                     nil]];
+}
+
++ (CIFilter *)filterWithName:(NSString *)name
+{
+    return [[[self alloc] init] autorelease];
+}
+
+- (id)init
+{
+    if (!discreteTransferFilter) {
+        NSBundle *bundle = [NSBundle bundleForClass:[self class]];
+        NSString *kernelFile = [bundle pathForResource:@"WKDiscreteTransferFilter" ofType:@"cikernel"];
+        NSString *code = [NSString stringWithContentsOfFile:kernelFile];
+        NSArray *kernels = [CIKernel kernelsWithString:code];
+        discreteTransferFilter = [[kernels objectAtIndex:0] retain];
+    }
+    return [super init];
+}
+
+- (CIImage *)outputImage
+{
+    CISampler *inputSampler = [CISampler samplerWithImage: inputImage];
+    CISampler *tableSampler = [CISampler samplerWithImage: inputTable keysAndValues:kCISamplerFilterMode, kCISamplerFilterNearest, kCISamplerWrapMode, kCISamplerWrapClamp, nil];
+    NSArray *args = [NSArray arrayWithObjects:inputSampler, tableSampler, inputSelector, 
+        [NSNumber numberWithFloat:[inputTable extent].size.width-1.0], @"definition", [inputSampler definition], nil];
+    return [self apply:discreteTransferFilter arguments:args options:nil];
+}
+
+@end
diff --git a/WebCore/WebCore/kcanvas/device/quartz/filters/WKGammaTransferFilter.h b/WebCore/WebCore/kcanvas/device/quartz/filters/WKGammaTransferFilter.h
new file mode 100644 (file)
index 0000000..525240f
--- /dev/null
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2006 Oliver Hunt <ojh16@student.canterbury.ac.nz>.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+
+#import <QuartzCore/CoreImage.h>
+
+
+@interface WKGammaTransferFilter : CIFilter {
+    CIImage  *inputImage;
+    NSNumber *inputAmplitude;
+    NSNumber *inputExponent;
+    NSNumber *inputOffset;
+}
+
+@end
diff --git a/WebCore/WebCore/kcanvas/device/quartz/filters/WKIdentityTransferFilter.h b/WebCore/WebCore/kcanvas/device/quartz/filters/WKIdentityTransferFilter.h
new file mode 100644 (file)
index 0000000..d7fbd8e
--- /dev/null
@@ -0,0 +1,32 @@
+/*
+ * Copyright (C) 2006 Oliver Hunt <ojh16@student.canterbury.ac.nz>.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+
+#import <QuartzCore/CoreImage.h>
+
+@interface WKIdentityTransferFilter : CIFilter {
+    CIImage  *inputImage;
+}
+
+@end
diff --git a/WebCore/WebCore/kcanvas/device/quartz/filters/WKIdentityTransferFilter.m b/WebCore/WebCore/kcanvas/device/quartz/filters/WKIdentityTransferFilter.m
new file mode 100644 (file)
index 0000000..7e5910f
--- /dev/null
@@ -0,0 +1,56 @@
+/*
+ * Copyright (C) 2006 Oliver Hunt <ojh16@student.canterbury.ac.nz>.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+
+#import "WKIdentityTransferFilter.h"
+
+
+@implementation WKIdentityTransferFilter
++ (void)initialize
+{
+    [CIFilter registerFilterName:@"WKIdentityTransfer"
+                     constructor:self
+                 classAttributes:[NSDictionary dictionaryWithObjectsAndKeys:
+                     @"WebKit Identity Transfer", kCIAttributeFilterDisplayName,
+                     [NSArray arrayWithObjects:kCICategoryStylize, kCICategoryVideo,
+                         kCICategoryStillImage, kCICategoryNonSquarePixels,nil], kCIAttributeFilterCategories,
+                     nil]];
+}
+
++ (CIFilter *)filterWithName:(NSString *)name
+{
+    return [[[self alloc] init] autorelease];
+}
+
+- (id)init
+{
+    return [super init];
+}
+
+- (CIImage *)outputImage
+{
+    return inputImage;
+}
+
+@end
diff --git a/WebCore/WebCore/kcanvas/device/quartz/filters/WKLinearTransferFilter.cikernel b/WebCore/WebCore/kcanvas/device/quartz/filters/WKLinearTransferFilter.cikernel
new file mode 100644 (file)
index 0000000..17d57e4
--- /dev/null
@@ -0,0 +1,30 @@
+/*
+ * Copyright (C) 2006 Oliver Hunt <ojh16@student.canterbury.ac.nz>.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+
+kernel vec4 linearTransfer(sampler image, float slope, float intercept)
+{
+    vec4 C = sample(image, samplerCoord(image));
+    return slope * C + intercept;
+}
diff --git a/WebCore/WebCore/kcanvas/device/quartz/filters/WKLinearTransferFilter.m b/WebCore/WebCore/kcanvas/device/quartz/filters/WKLinearTransferFilter.m
new file mode 100644 (file)
index 0000000..89e74a7
--- /dev/null
@@ -0,0 +1,75 @@
+/*
+ * Copyright (C) 2006 Oliver Hunt <ojh16@student.canterbury.ac.nz>.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+
+#import "WKLinearTransferFilter.h"
+
+static CIKernel *linearTransferFilter = nil;
+
+@implementation WKLinearTransferFilter
++ (void)initialize
+{
+    [CIFilter registerFilterName:@"WKLinearTransfer"
+                     constructor:self
+                 classAttributes:[NSDictionary dictionaryWithObjectsAndKeys:
+                     @"WebKit Linear Transfer", kCIAttributeFilterDisplayName,
+                     [NSArray arrayWithObjects:kCICategoryStylize, kCICategoryVideo,
+                         kCICategoryStillImage, kCICategoryNonSquarePixels,nil], kCIAttributeFilterCategories,
+                     [NSDictionary dictionaryWithObjectsAndKeys:
+                         [NSNumber numberWithDouble:1.0], kCIAttributeDefault,
+                         [NSNumber numberWithDouble:1.0], kCIAttributeIdentity,
+                         kCIAttributeTypeScalar, kCIAttributeType,
+                         nil], @"inputSlope",
+                     [NSDictionary dictionaryWithObjectsAndKeys:
+                         [NSNumber numberWithDouble:0.0], kCIAttributeDefault,
+                         [NSNumber numberWithDouble:0.0], kCIAttributeIdentity,
+                         kCIAttributeTypeScalar, kCIAttributeType,
+                         nil], @"inputIntersection",
+                     nil]];
+}
+
++ (CIFilter *)filterWithName:(NSString *)name
+{
+    return [[[self alloc] init] autorelease];
+}
+
+- (id)init
+{
+    if (!linearTransferFilter) {
+        NSBundle *bundle = [NSBundle bundleForClass:[self class]];
+        NSString *kernelFile = [bundle pathForResource:@"WKLinearTransferFilter" ofType:@"cikernel"];
+        NSString *code = [NSString stringWithContentsOfFile:kernelFile];
+        NSArray *kernels = [CIKernel kernelsWithString:code];
+        linearTransferFilter = [[kernels objectAtIndex:0] retain];
+    }
+    return [super init];
+}
+
+- (CIImage *)outputImage
+{
+    CISampler *inputSampler = [CISampler samplerWithImage: inputImage];
+    return [self apply:linearTransferFilter, inputSampler, inputSlope, inputIntercept, @"definition", [inputSampler definition], nil];
+}
+
+@end
diff --git a/WebCore/WebCore/kcanvas/device/quartz/filters/WKTableTransferFilter.m b/WebCore/WebCore/kcanvas/device/quartz/filters/WKTableTransferFilter.m
new file mode 100644 (file)
index 0000000..8bfe0b1
--- /dev/null
@@ -0,0 +1,71 @@
+/*
+ * Copyright (C) 2006 Oliver Hunt <ojh16@student.canterbury.ac.nz>.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+
+#import "WKTableTransferFilter.h"
+
+static CIKernel *tableTransferFilter = nil;
+
+@implementation WKTableTransferFilter
++ (void)initialize
+{
+    [CIFilter registerFilterName:@"WKTableTransfer"
+                     constructor:self
+                 classAttributes:[NSDictionary dictionaryWithObjectsAndKeys:
+                     @"WebKit Table Transfer", kCIAttributeFilterDisplayName,
+                     [NSArray arrayWithObjects:kCICategoryStylize, kCICategoryVideo,
+                         kCICategoryStillImage, kCICategoryNonSquarePixels,nil], kCIAttributeFilterCategories,              
+                     [NSDictionary dictionaryWithObjectsAndKeys:
+                         kCIAttributeTypeGradient, kCIAttributeType,
+                         nil], @"inputTable",   
+                     nil]];
+}
+
++ (CIFilter *)filterWithName:(NSString *)name
+{
+    return [[[self alloc] init] autorelease];
+}
+
+- (id)init
+{
+    if (!tableTransferFilter) {
+        NSBundle *bundle = [NSBundle bundleForClass:[self class]];
+        NSString *kernelFile = [bundle pathForResource:@"WKTableTransferFilter" ofType:@"cikernel"];
+        NSString *code = [NSString stringWithContentsOfFile:kernelFile];
+        NSArray *kernels = [CIKernel kernelsWithString:code];
+        tableTransferFilter = [[kernels objectAtIndex:0] retain];
+    }
+    return [super init];
+}
+
+- (CIImage *)outputImage
+{
+    CISampler *inputSampler = [CISampler samplerWithImage: inputImage];
+    CISampler *tableSampler = [CISampler samplerWithImage: inputTable keysAndValues:kCISamplerFilterMode, kCISamplerFilterLinear, kCISamplerWrapMode, kCISamplerWrapClamp, nil];
+    NSArray *args = [NSArray arrayWithObjects:inputSampler, tableSampler, inputSelector, 
+        [NSNumber numberWithFloat:[inputTable extent].size.width-1.0], @"definition", [inputSampler definition], nil];
+    return [self apply:tableTransferFilter arguments:args options:nil];
+}
+
+@end
index fb74bb72aea58869423fb45c478a0bc0312f7fb0..df33e6e0047662c02454079c84124ada5dff670c 100644 (file)
@@ -236,13 +236,32 @@ static QTextStream &operator<<(QTextStream &ts, KCComponentTransferType t)
 
 static QTextStream &operator<<(QTextStream &ts, const KCComponentTransferFunction &func)
 {
-    ts << "[type=" << func.type << "]" 
-        << " [table values=" << func.tableValues << "]"
-        << " [slope=" << func.slope << "]"
-        << " [intercept=" << func.intercept << "]"
-        << " [amplitude=" << func.amplitude << "]"
-        << " [exponent=" << func.exponent << "]"
-        << " [offset=" << func.offset << "]";
+    ts << "[type=" << func.type << "]"; 
+    switch (func.type) {
+        case CT_IDENTITY:
+            break;
+        case CT_TABLE:
+        case CT_DISCRETE:
+            ts << " [table values=";
+            Vector<float>::const_iterator itr=func.tableValues.begin();
+            if (itr != func.tableValues.end()) {
+                ts << *itr++;
+                for (; itr!=func.tableValues.end(); itr++) {
+                    ts << " " << *itr;
+                }
+            }
+            ts << "]";
+            break;
+        case CT_LINEAR:
+            ts << " [slope=" << func.slope << "]"
+               << " [intercept=" << func.intercept << "]";
+            break;
+        case CT_GAMMA:
+            ts << " [amplitude=" << func.amplitude << "]"
+               << " [exponent=" << func.exponent << "]"
+               << " [offset=" << func.offset << "]";
+            break;
+    }
     return ts;        
 }
 
index 9140a4612194755dbc8e80570d68c6cbf1c89fd0..368056970fedb118e75f71e18f798dfd318edd33 100644 (file)
@@ -212,8 +212,9 @@ typedef enum {
 
 struct KCComponentTransferFunction
 {
+    KCComponentTransferFunction() : type(CT_IDENTITY) {}
     KCComponentTransferType type;
-    Q3ValueList<float> tableValues;
+    Vector<float> tableValues;
     float slope;
     float intercept;
     float amplitude;
index e110c14928f4cc076b80924cb68b4f089e495bf7..3d44e0bbbc57ca4528e642497236ca285e6e4d9a 100644 (file)
@@ -71,10 +71,12 @@ public:
     virtual CIFilter *getCIFilter(KCanvasFilterQuartz *quartzFilter) const;
 };
 
-//class KCanvasFEComponentTransferQuartz : public KCanvasFEComponentTransfer {
-//public:
-//    virtual CIFilter *getCIFilter(KCanvasFilterQuartz *quartzFilter) const;
-//};
+class KCanvasFEComponentTransferQuartz : public KCanvasFEComponentTransfer {
+public:
+    virtual CIFilter *getCIFilter(KCanvasFilterQuartz *quartzFilter) const;
+private:
+    CIFilter *getFunctionFilter(KCChannelSelectorType channel, CIImage *inputImage) const;
+};
 
 class KCanvasFEConvolveMatrixQuartz : public KCanvasFEConvolveMatrix {
 public:
index 48ec58b865265b83635375a67d2b23a9e78f779b..bb356fb80707e9d27a737c31424093b2d37a1b96 100644 (file)
 #import "WKDisplacementMapFilter.h"
 #import "WKDistantLightFilter.h"
 #import "WKNormalMapFilter.h"
+#import "WKArithmeticFilter.h"
+#import "WKComponentMergeFilter.h"
+#import "WKIdentityTransferFilter.h"
+#import "WKTableTransferFilter.h"
+#import "WKDiscreteTransferFilter.h"
+#import "WKLinearTransferFilter.h"
+#import "WKGammaTransferFilter.h"
 #import "WKPointLightFilter.h"
 #import "WKSpecularLightingFilter.h"
 #import "WKSpotLightFilter.h"
@@ -66,6 +73,22 @@ static inline CIVector *ciVector(FloatPoint point)
     return [CIVector vectorWithX:point.x() Y:point.y()];
 }
 
+static inline CIVector *getVectorForChannel(KCChannelSelectorType channel)
+{
+    switch (channel) {
+        case CS_RED:
+            return [CIVector vectorWithX:1.0 Y:0.0 Z:0.0 W:0.0];
+        case CS_GREEN:
+            return [CIVector vectorWithX:0.0 Y:1.0 Z:0.0 W:0.0];            
+        case CS_BLUE:
+            return [CIVector vectorWithX:0.0 Y:0.0 Z:1.0 W:0.0];
+        case CS_ALPHA:
+            return [CIVector vectorWithX:0.0 Y:0.0 Z:0.0 W:1.0];
+        default:
+            return [CIVector vectorWithX:0.0 Y:0.0 Z:0.0 W:0.0];
+    }
+}
+
 KCanvasFilterQuartz::KCanvasFilterQuartz() : m_filterCIContext(0), m_filterCGLayer(0)
 {
     m_imagesByName = KWQRetainNSRelease([[NSMutableDictionary alloc] init]);
@@ -347,6 +370,130 @@ CIFilter *KCanvasFEColorMatrixQuartz::getCIFilter(KCanvasFilterQuartz *quartzFil
     FE_QUARTZ_OUTPUT_RETURN;
 }
 
+static CIImage *genImageFromTable(const Vector<float>& table)
+{
+    int length = table.size();
+    int nBytes = length*4*sizeof(float);
+    float *tableStore = (float *)malloc(nBytes);
+    NSData *bitmapData = [NSData dataWithBytesNoCopy:tableStore length:nBytes];
+    for (Vector<float>::const_iterator it = table.begin(); it != table.end(); it++) {
+        const float value = *it;
+        *tableStore++ = value;
+        *tableStore++ = value;
+        *tableStore++ = value;
+        *tableStore++ = value;
+    }
+    return [CIImage imageWithBitmapData:bitmapData bytesPerRow:nBytes size:CGSizeMake(length, 1) format:kCIFormatRGBAf colorSpace:nil];
+}
+
+static CIFilter *filterForComponentFunc(const KCComponentTransferFunction& func)
+{
+    CIFilter *filter;
+    switch (func.type) {
+        case CT_IDENTITY:
+            filter = [CIFilter filterWithName:@"WKIdentityTransfer"];
+            break;
+        case CT_TABLE:
+            filter = [CIFilter filterWithName:@"WKTableTransferFilter"];
+            break;
+        case CT_DISCRETE:
+            filter = [CIFilter filterWithName:@"WKDiscreteTransferFilter"];
+            break;
+        case CT_LINEAR:
+            filter = [CIFilter filterWithName:@"WKLinearTransfer"];            
+            break;
+        case CT_GAMMA:
+            filter = [CIFilter filterWithName:@"WKGammaTransfer"];
+            break;
+        default:
+            NSLog(@"WARNING: Unknown function type for feComponentTransfer");
+            //and to prevent the entire svg from failing as a result
+            filter = [CIFilter filterWithName:@"WKIdentityTransfer"];
+            break;
+    }
+    return filter;
+}
+
+static void setParametersForComponentFunc(CIFilter *filter, const KCComponentTransferFunction& func, CIVector *channelSelector)
+{
+    switch (func.type) {
+        case CT_TABLE:
+            [filter setValue:genImageFromTable(func.tableValues) forKey:@"inputTable"];
+            [filter setValue:channelSelector forKey:@"inputSelector"];
+            break;
+        case CT_DISCRETE:
+            [filter setValue:genImageFromTable(func.tableValues) forKey:@"inputTable"];
+            [filter setValue:channelSelector forKey:@"inputSelector"];
+            break;
+        case CT_LINEAR:
+            [filter setValue:[NSNumber numberWithFloat:func.slope] forKey:@"inputSlope"];
+            [filter setValue:[NSNumber numberWithFloat:func.intercept] forKey:@"inputIntercept"];          
+            break;
+        case CT_GAMMA:
+            [filter setValue:[NSNumber numberWithFloat:func.amplitude] forKey:@"inputAmplitude"];
+            [filter setValue:[NSNumber numberWithFloat:func.exponent] forKey:@"inputExponent"];
+            [filter setValue:[NSNumber numberWithFloat:func.offset] forKey:@"inputOffset"];   
+            break;
+        default:
+            //identity has no args
+            break;
+    }
+}
+
+static CIFilter *getFilterForFunc(const KCComponentTransferFunction& func, CIImage *inputImage, CIVector *channelSelector) 
+{
+    CIFilter *filter = filterForComponentFunc(func);
+    [filter setDefaults];
+    
+    setParametersForComponentFunc(filter, func, channelSelector);
+    [filter setValue:inputImage forKey:@"inputImage"];
+    return filter;
+}
+
+CIFilter *KCanvasFEComponentTransferQuartz::getFunctionFilter(KCChannelSelectorType channel, CIImage *inputImage) const
+{
+    switch (channel) {
+        case CS_RED:
+            return [getFilterForFunc(redFunction(), inputImage, getVectorForChannel(channel)) valueForKey:@"outputImage"];
+        case CS_GREEN: 
+            return [getFilterForFunc(greenFunction(), inputImage, getVectorForChannel(channel)) valueForKey:@"outputImage"];
+        case CS_BLUE:
+            return [getFilterForFunc(blueFunction(), inputImage, getVectorForChannel(channel)) valueForKey:@"outputImage"];
+        case CS_ALPHA:
+            return [getFilterForFunc(alphaFunction(), inputImage, getVectorForChannel(channel)) valueForKey:@"outputImage"];
+        default:
+            return nil;
+    }
+    
+}
+
+CIFilter *KCanvasFEComponentTransferQuartz::getCIFilter(KCanvasFilterQuartz *quartzFilter) const
+{
+    [WKComponentMergeFilter class];
+    [WKIdentityTransferFilter class];
+    [WKTableTransferFilter class];
+    [WKDiscreteTransferFilter class];
+    [WKLinearTransferFilter class];
+    [WKGammaTransferFilter class];
+    
+    CIFilter *filter = nil;
+    BEGIN_BLOCK_OBJC_EXCEPTIONS;
+    filter = [CIFilter filterWithName:@"WKComponentMerge"];
+    if (!filter)
+        return nil;
+    [filter setDefaults];
+    CIImage *inputImage = quartzFilter->inputImage(this);
+    FE_QUARTZ_CHECK_INPUT(inputImage);    
+    
+    [filter setValue:getFunctionFilter(CS_RED, inputImage) forKey:@"inputFuncR"];
+    [filter setValue:getFunctionFilter(CS_GREEN, inputImage) forKey:@"inputFuncG"];
+    [filter setValue:getFunctionFilter(CS_BLUE, inputImage) forKey:@"inputFuncB"];
+    [filter setValue:getFunctionFilter(CS_ALPHA, inputImage) forKey:@"inputFuncA"];
+    
+    FE_QUARTZ_OUTPUT_RETURN;
+    return nil;
+}
+
 CIFilter *KCanvasFECompositeQuartz::getCIFilter(KCanvasFilterQuartz *quartzFilter) const
 {
     CIFilter *filter = nil;
@@ -392,21 +539,6 @@ CIFilter *KCanvasFECompositeQuartz::getCIFilter(KCanvasFilterQuartz *quartzFilte
     FE_QUARTZ_OUTPUT_RETURN;
 }
 
-static inline CIVector *getVectorForChannel(int idx){
-    switch(idx){
-    case 0:
-        return [CIVector vectorWithX:1.0 Y:0.0 Z:0.0 W:0.0];
-    case 1:
-        return [CIVector vectorWithX:0.0 Y:1.0 Z:0.0 W:0.0];            
-    case 2:
-        return [CIVector vectorWithX:0.0 Y:0.0 Z:1.0 W:0.0];
-    case 3:
-        return [CIVector vectorWithX:0.0 Y:0.0 Z:0.0 W:1.0];
-    default:
-        return [CIVector vectorWithX:0.0 Y:0.0 Z:0.0 W:0.0];
-    }
-}
-
 CIFilter *KCanvasFEDisplacementMapQuartz::getCIFilter(KCanvasFilterQuartz *quartzFilter) const
 {
     CIFilter *filter = nil;
index e42a6a102212af5e2131519b3217f0190b60c7e7..687b7ed0b538f1647362f6f38ff5f3fb81670e8d 100644 (file)
@@ -257,7 +257,7 @@ KCanvasFilterEffect *KRenderingDeviceQuartz::createFilterEffect(const KCFilterEf
     */
     case FE_BLEND: return new KCanvasFEBlendQuartz();
     case FE_COLOR_MATRIX: return new KCanvasFEColorMatrixQuartz();
-//  case FE_COMPONENT_TRANSFER: 
+    case FE_COMPONENT_TRANSFER: return new KCanvasFEComponentTransferQuartz();
     case FE_COMPOSITE: return new KCanvasFECompositeQuartz();
 //  case FE_CONVOLVE_MATRIX: 
     case FE_DIFFUSE_LIGHTING: return new KCanvasFEDiffuseLightingQuartz();
diff --git a/WebCore/kcanvas/device/quartz/filters/WKComponentMergeFilter.cikernel b/WebCore/kcanvas/device/quartz/filters/WKComponentMergeFilter.cikernel
new file mode 100644 (file)
index 0000000..f33f20c
--- /dev/null
@@ -0,0 +1,33 @@
+/*
+ * Copyright (C) 2006 Oliver Hunt <ojh16@student.canterbury.ac.nz>.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+
+kernel vec4 mergeComponents(sampler funcR, sampler funcG, sampler funcB, sampler funcA)
+{
+    float r = sample(funcR, samplerCoord(funcR)).r;
+    float g = sample(funcG, samplerCoord(funcG)).g;
+    float b = sample(funcB, samplerCoord(funcB)).b;
+    float a = sample(funcA, samplerCoord(funcA)).a;
+    return vec4(r, g, b, a);
+}
diff --git a/WebCore/kcanvas/device/quartz/filters/WKComponentMergeFilter.h b/WebCore/kcanvas/device/quartz/filters/WKComponentMergeFilter.h
new file mode 100644 (file)
index 0000000..6036e9a
--- /dev/null
@@ -0,0 +1,35 @@
+/*
+ * Copyright (C) 2006 Oliver Hunt <ojh16@student.canterbury.ac.nz>.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+
+#import <QuartzCore/CoreImage.h>
+
+@interface WKComponentMergeFilter : CIFilter {
+    CIImage  *inputFuncR;
+    CIImage  *inputFuncG;
+    CIImage  *inputFuncB;
+    CIImage  *inputFuncA;
+}
+
+@end
diff --git a/WebCore/kcanvas/device/quartz/filters/WKComponentMergeFilter.m b/WebCore/kcanvas/device/quartz/filters/WKComponentMergeFilter.m
new file mode 100644 (file)
index 0000000..5e527eb
--- /dev/null
@@ -0,0 +1,65 @@
+/*
+ * Copyright (C) 2006 Oliver Hunt <ojh16@student.canterbury.ac.nz>.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+
+#import "WKComponentMergeFilter.h"
+
+static CIKernel *componentMergeFilter = nil;
+
+@implementation WKComponentMergeFilter
++ (void)initialize
+{
+    [CIFilter registerFilterName:@"WKComponentMerge"
+                     constructor:self
+                 classAttributes:[NSDictionary dictionaryWithObjectsAndKeys:
+                     @"WebKit Component Merge", kCIAttributeFilterDisplayName,
+                     [NSArray arrayWithObjects:kCICategoryStylize, kCICategoryVideo,
+                         kCICategoryStillImage, kCICategoryNonSquarePixels,nil], kCIAttributeFilterCategories,
+                     nil]];
+}
+
++ (CIFilter *)filterWithName:(NSString *)name
+{
+    return [[[self alloc] init] autorelease];
+}
+
+- (id)init
+{
+    if (!componentMergeFilter) {
+        NSBundle *bundle = [NSBundle bundleForClass:[self class]];
+        NSString *kernelFile = [bundle pathForResource:@"WKComponentMergeFilter" ofType:@"cikernel"];
+        NSString *code = [NSString stringWithContentsOfFile:kernelFile];
+        NSArray *kernels = [CIKernel kernelsWithString:code];
+        componentMergeFilter = [[kernels objectAtIndex:0] retain];
+    }
+    return [super init];
+}
+
+- (CIImage *)outputImage
+{
+    return [self apply:componentMergeFilter, [CISampler samplerWithImage: inputFuncR], 
+        [CISampler samplerWithImage: inputFuncG], [CISampler samplerWithImage: inputFuncB], [CISampler samplerWithImage: inputFuncA], @"definition", [inputFuncR definition], nil];
+}
+
+@end
diff --git a/WebCore/kcanvas/device/quartz/filters/WKDiscreteTransferFilter.cikernel b/WebCore/kcanvas/device/quartz/filters/WKDiscreteTransferFilter.cikernel
new file mode 100644 (file)
index 0000000..db3cefd
--- /dev/null
@@ -0,0 +1,32 @@
+/*
+ * Copyright (C) 2006 Oliver Hunt <ojh16@student.canterbury.ac.nz>.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+
+kernel vec4 discreteTransfer(sampler image, sampler table, vec4 rgbaSelector, float maxIndex)
+{
+    vec4 C = sample(image, samplerCoord(image));
+    float k = floor(dot(rgbaSelector, C) * maxIndex);
+    vec4 res = sample(table, vec2(k+0.0, 0.0));
+    return res;
+}
diff --git a/WebCore/kcanvas/device/quartz/filters/WKDiscreteTransferFilter.h b/WebCore/kcanvas/device/quartz/filters/WKDiscreteTransferFilter.h
new file mode 100644 (file)
index 0000000..a7664b7
--- /dev/null
@@ -0,0 +1,34 @@
+/*
+ * Copyright (C) 2006 Oliver Hunt <ojh16@student.canterbury.ac.nz>.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+
+#import <QuartzCore/CoreImage.h>
+
+@interface WKDiscreteTransferFilter : CIFilter {
+    CIImage  *inputImage;
+    CIImage  *inputTable;
+    CIVector *inputSelector;
+}
+
+@end
diff --git a/WebCore/kcanvas/device/quartz/filters/WKDiscreteTransferFilter.m b/WebCore/kcanvas/device/quartz/filters/WKDiscreteTransferFilter.m
new file mode 100644 (file)
index 0000000..8f1ae46
--- /dev/null
@@ -0,0 +1,68 @@
+/*
+ * Copyright (C) 2006 Oliver Hunt <ojh16@student.canterbury.ac.nz>.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+
+#import "WKDiscreteTransferFilter.h"
+
+static CIKernel *discreteTransferFilter = nil;
+
+@implementation WKDiscreteTransferFilter
++ (void)initialize
+{
+    [CIFilter registerFilterName:@"WKDiscreteTransfer"
+                     constructor:self
+                 classAttributes:[NSDictionary dictionaryWithObjectsAndKeys:
+                     @"WebKit Discrete Transfer", kCIAttributeFilterDisplayName,
+                     [NSArray arrayWithObjects:kCICategoryStylize, kCICategoryVideo,
+                         kCICategoryStillImage, kCICategoryNonSquarePixels,nil], kCIAttributeFilterCategories,
+                     nil]];
+}
+
++ (CIFilter *)filterWithName:(NSString *)name
+{
+    return [[[self alloc] init] autorelease];
+}
+
+- (id)init
+{
+    if (!discreteTransferFilter) {
+        NSBundle *bundle = [NSBundle bundleForClass:[self class]];
+        NSString *kernelFile = [bundle pathForResource:@"WKDiscreteTransferFilter" ofType:@"cikernel"];
+        NSString *code = [NSString stringWithContentsOfFile:kernelFile];
+        NSArray *kernels = [CIKernel kernelsWithString:code];
+        discreteTransferFilter = [[kernels objectAtIndex:0] retain];
+    }
+    return [super init];
+}
+
+- (CIImage *)outputImage
+{
+    CISampler *inputSampler = [CISampler samplerWithImage: inputImage];
+    CISampler *tableSampler = [CISampler samplerWithImage: inputTable keysAndValues:kCISamplerFilterMode, kCISamplerFilterNearest, kCISamplerWrapMode, kCISamplerWrapClamp, nil];
+    NSArray *args = [NSArray arrayWithObjects:inputSampler, tableSampler, inputSelector, 
+        [NSNumber numberWithFloat:[inputTable extent].size.width-1.0], @"definition", [inputSampler definition], nil];
+    return [self apply:discreteTransferFilter arguments:args options:nil];
+}
+
+@end
diff --git a/WebCore/kcanvas/device/quartz/filters/WKGammaTransferFilter.cikernel b/WebCore/kcanvas/device/quartz/filters/WKGammaTransferFilter.cikernel
new file mode 100644 (file)
index 0000000..810edb6
--- /dev/null
@@ -0,0 +1,30 @@
+/*
+ * Copyright (C) 2006 Oliver Hunt <ojh16@student.canterbury.ac.nz>.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+
+kernel vec4 gammaTransfer(sampler image, float amplitude, float exponent, float offset)
+{
+    vec4 C = sample(image, samplerCoord(image));
+    return amplitude * pow(C, vec4(exponent)) + offset;
+}
diff --git a/WebCore/kcanvas/device/quartz/filters/WKGammaTransferFilter.h b/WebCore/kcanvas/device/quartz/filters/WKGammaTransferFilter.h
new file mode 100644 (file)
index 0000000..525240f
--- /dev/null
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2006 Oliver Hunt <ojh16@student.canterbury.ac.nz>.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+
+#import <QuartzCore/CoreImage.h>
+
+
+@interface WKGammaTransferFilter : CIFilter {
+    CIImage  *inputImage;
+    NSNumber *inputAmplitude;
+    NSNumber *inputExponent;
+    NSNumber *inputOffset;
+}
+
+@end
diff --git a/WebCore/kcanvas/device/quartz/filters/WKGammaTransferFilter.m b/WebCore/kcanvas/device/quartz/filters/WKGammaTransferFilter.m
new file mode 100644 (file)
index 0000000..fb2a903
--- /dev/null
@@ -0,0 +1,80 @@
+/*
+ * Copyright (C) 2006 Oliver Hunt <ojh16@student.canterbury.ac.nz>.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+
+#import "WKGammaTransferFilter.h"
+
+static CIKernel *gammaTransferFilter = nil;
+
+@implementation WKGammaTransferFilter
++ (void)initialize
+{
+    [CIFilter registerFilterName:@"WKGammaTransfer"
+                     constructor:self
+                 classAttributes:[NSDictionary dictionaryWithObjectsAndKeys:
+                     @"WebKit Gamma Transfer", kCIAttributeFilterDisplayName,
+                     [NSArray arrayWithObjects:kCICategoryStylize, kCICategoryVideo,
+                         kCICategoryStillImage, kCICategoryNonSquarePixels,nil], kCIAttributeFilterCategories,
+                     [NSDictionary dictionaryWithObjectsAndKeys:
+                         [NSNumber numberWithDouble:1.0], kCIAttributeDefault,
+                         [NSNumber numberWithDouble:1.0], kCIAttributeIdentity,
+                         kCIAttributeTypeScalar, kCIAttributeType,
+                         nil], @"inputAmplitude",
+                     [NSDictionary dictionaryWithObjectsAndKeys:
+                         [NSNumber numberWithDouble:1.0], kCIAttributeDefault,
+                         [NSNumber numberWithDouble:1.0], kCIAttributeIdentity,
+                         kCIAttributeTypeScalar, kCIAttributeType,
+                         nil], @"inputExponent",
+                     [NSDictionary dictionaryWithObjectsAndKeys:
+                         [NSNumber numberWithDouble:0.0], kCIAttributeDefault,
+                         [NSNumber numberWithDouble:0.0], kCIAttributeIdentity,
+                         kCIAttributeTypeScalar, kCIAttributeType,
+                         nil], @"inputOffset",
+                     nil]];
+}
+
++ (CIFilter *)filterWithName:(NSString *)name
+{
+    return [[[self alloc] init] autorelease];
+}
+
+- (id)init
+{
+    if (!gammaTransferFilter) {
+        NSBundle *bundle = [NSBundle bundleForClass:[self class]];
+        NSString *kernelFile = [bundle pathForResource:@"WKGammaTransferFilter" ofType:@"cikernel"];
+        NSString *code = [NSString stringWithContentsOfFile:kernelFile];
+        NSArray *kernels = [CIKernel kernelsWithString:code];
+        gammaTransferFilter = [[kernels objectAtIndex:0] retain];
+    }
+    return [super init];
+}
+
+- (CIImage *)outputImage
+{
+    CISampler *inputSampler = [CISampler samplerWithImage: inputImage];
+    return [self apply:gammaTransferFilter, inputSampler, inputAmplitude, inputExponent, inputOffset, @"definition", [inputSampler definition], nil];
+}
+
+@end
diff --git a/WebCore/kcanvas/device/quartz/filters/WKIdentityTransferFilter.h b/WebCore/kcanvas/device/quartz/filters/WKIdentityTransferFilter.h
new file mode 100644 (file)
index 0000000..d7fbd8e
--- /dev/null
@@ -0,0 +1,32 @@
+/*
+ * Copyright (C) 2006 Oliver Hunt <ojh16@student.canterbury.ac.nz>.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+
+#import <QuartzCore/CoreImage.h>
+
+@interface WKIdentityTransferFilter : CIFilter {
+    CIImage  *inputImage;
+}
+
+@end
diff --git a/WebCore/kcanvas/device/quartz/filters/WKIdentityTransferFilter.m b/WebCore/kcanvas/device/quartz/filters/WKIdentityTransferFilter.m
new file mode 100644 (file)
index 0000000..7e5910f
--- /dev/null
@@ -0,0 +1,56 @@
+/*
+ * Copyright (C) 2006 Oliver Hunt <ojh16@student.canterbury.ac.nz>.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+
+#import "WKIdentityTransferFilter.h"
+
+
+@implementation WKIdentityTransferFilter
++ (void)initialize
+{
+    [CIFilter registerFilterName:@"WKIdentityTransfer"
+                     constructor:self
+                 classAttributes:[NSDictionary dictionaryWithObjectsAndKeys:
+                     @"WebKit Identity Transfer", kCIAttributeFilterDisplayName,
+                     [NSArray arrayWithObjects:kCICategoryStylize, kCICategoryVideo,
+                         kCICategoryStillImage, kCICategoryNonSquarePixels,nil], kCIAttributeFilterCategories,
+                     nil]];
+}
+
++ (CIFilter *)filterWithName:(NSString *)name
+{
+    return [[[self alloc] init] autorelease];
+}
+
+- (id)init
+{
+    return [super init];
+}
+
+- (CIImage *)outputImage
+{
+    return inputImage;
+}
+
+@end
diff --git a/WebCore/kcanvas/device/quartz/filters/WKLinearTransferFilter.cikernel b/WebCore/kcanvas/device/quartz/filters/WKLinearTransferFilter.cikernel
new file mode 100644 (file)
index 0000000..17d57e4
--- /dev/null
@@ -0,0 +1,30 @@
+/*
+ * Copyright (C) 2006 Oliver Hunt <ojh16@student.canterbury.ac.nz>.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+
+kernel vec4 linearTransfer(sampler image, float slope, float intercept)
+{
+    vec4 C = sample(image, samplerCoord(image));
+    return slope * C + intercept;
+}
diff --git a/WebCore/kcanvas/device/quartz/filters/WKLinearTransferFilter.h b/WebCore/kcanvas/device/quartz/filters/WKLinearTransferFilter.h
new file mode 100644 (file)
index 0000000..c594816
--- /dev/null
@@ -0,0 +1,35 @@
+/*
+ * Copyright (C) 2006 Oliver Hunt <ojh16@student.canterbury.ac.nz>.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+
+#import <QuartzCore/CoreImage.h>
+
+
+@interface WKLinearTransferFilter : CIFilter {
+    CIImage  *inputImage;
+    NSNumber *inputSlope;
+    NSNumber *inputIntercept;
+}
+
+@end
diff --git a/WebCore/kcanvas/device/quartz/filters/WKLinearTransferFilter.m b/WebCore/kcanvas/device/quartz/filters/WKLinearTransferFilter.m
new file mode 100644 (file)
index 0000000..89e74a7
--- /dev/null
@@ -0,0 +1,75 @@
+/*
+ * Copyright (C) 2006 Oliver Hunt <ojh16@student.canterbury.ac.nz>.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+
+#import "WKLinearTransferFilter.h"
+
+static CIKernel *linearTransferFilter = nil;
+
+@implementation WKLinearTransferFilter
++ (void)initialize
+{
+    [CIFilter registerFilterName:@"WKLinearTransfer"
+                     constructor:self
+                 classAttributes:[NSDictionary dictionaryWithObjectsAndKeys:
+                     @"WebKit Linear Transfer", kCIAttributeFilterDisplayName,
+                     [NSArray arrayWithObjects:kCICategoryStylize, kCICategoryVideo,
+                         kCICategoryStillImage, kCICategoryNonSquarePixels,nil], kCIAttributeFilterCategories,
+                     [NSDictionary dictionaryWithObjectsAndKeys:
+                         [NSNumber numberWithDouble:1.0], kCIAttributeDefault,
+                         [NSNumber numberWithDouble:1.0], kCIAttributeIdentity,
+                         kCIAttributeTypeScalar, kCIAttributeType,
+                         nil], @"inputSlope",
+                     [NSDictionary dictionaryWithObjectsAndKeys:
+                         [NSNumber numberWithDouble:0.0], kCIAttributeDefault,
+                         [NSNumber numberWithDouble:0.0], kCIAttributeIdentity,
+                         kCIAttributeTypeScalar, kCIAttributeType,
+                         nil], @"inputIntersection",
+                     nil]];
+}
+
++ (CIFilter *)filterWithName:(NSString *)name
+{
+    return [[[self alloc] init] autorelease];
+}
+
+- (id)init
+{
+    if (!linearTransferFilter) {
+        NSBundle *bundle = [NSBundle bundleForClass:[self class]];
+        NSString *kernelFile = [bundle pathForResource:@"WKLinearTransferFilter" ofType:@"cikernel"];
+        NSString *code = [NSString stringWithContentsOfFile:kernelFile];
+        NSArray *kernels = [CIKernel kernelsWithString:code];
+        linearTransferFilter = [[kernels objectAtIndex:0] retain];
+    }
+    return [super init];
+}
+
+- (CIImage *)outputImage
+{
+    CISampler *inputSampler = [CISampler samplerWithImage: inputImage];
+    return [self apply:linearTransferFilter, inputSampler, inputSlope, inputIntercept, @"definition", [inputSampler definition], nil];
+}
+
+@end
diff --git a/WebCore/kcanvas/device/quartz/filters/WKTableTransferFilter.cikernel b/WebCore/kcanvas/device/quartz/filters/WKTableTransferFilter.cikernel
new file mode 100644 (file)
index 0000000..19dfcdf
--- /dev/null
@@ -0,0 +1,38 @@
+/*
+ * Copyright (C) 2006 Oliver Hunt <ojh16@student.canterbury.ac.nz>.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+
+/* For some reason CI is ignoring the request to interpolate the colour returned
+ * when we sample the lookup table.  Therefore it is necessary to implement the
+ * blend operation ourselves.
+ */
+kernel vec4 tableTransfer(sampler image, sampler table, vec4 rgbaSelector, float maxIndex)
+{
+    vec4 C = sample(image, samplerCoord(image));
+    float k = dot(rgbaSelector, C) * maxIndex;
+    float t = fract(k);
+    k = floor(k);
+    vec4 res = sample(table, vec2(k, 0.0))*(1.0-t)+sample(table, vec2(k+1.0, 0.0))*(t);
+    return res;
+}
diff --git a/WebCore/kcanvas/device/quartz/filters/WKTableTransferFilter.h b/WebCore/kcanvas/device/quartz/filters/WKTableTransferFilter.h
new file mode 100644 (file)
index 0000000..6844415
--- /dev/null
@@ -0,0 +1,34 @@
+/*
+ * Copyright (C) 2006 Oliver Hunt <ojh16@student.canterbury.ac.nz>.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+
+#import <QuartzCore/CoreImage.h>
+
+@interface WKTableTransferFilter : CIFilter {
+    CIImage *inputImage;
+    CIImage *inputTable;
+    CIVector *inputSelector;
+}
+
+@end
diff --git a/WebCore/kcanvas/device/quartz/filters/WKTableTransferFilter.m b/WebCore/kcanvas/device/quartz/filters/WKTableTransferFilter.m
new file mode 100644 (file)
index 0000000..8bfe0b1
--- /dev/null
@@ -0,0 +1,71 @@
+/*
+ * Copyright (C) 2006 Oliver Hunt <ojh16@student.canterbury.ac.nz>.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+
+#import "WKTableTransferFilter.h"
+
+static CIKernel *tableTransferFilter = nil;
+
+@implementation WKTableTransferFilter
++ (void)initialize
+{
+    [CIFilter registerFilterName:@"WKTableTransfer"
+                     constructor:self
+                 classAttributes:[NSDictionary dictionaryWithObjectsAndKeys:
+                     @"WebKit Table Transfer", kCIAttributeFilterDisplayName,
+                     [NSArray arrayWithObjects:kCICategoryStylize, kCICategoryVideo,
+                         kCICategoryStillImage, kCICategoryNonSquarePixels,nil], kCIAttributeFilterCategories,              
+                     [NSDictionary dictionaryWithObjectsAndKeys:
+                         kCIAttributeTypeGradient, kCIAttributeType,
+                         nil], @"inputTable",   
+                     nil]];
+}
+
++ (CIFilter *)filterWithName:(NSString *)name
+{
+    return [[[self alloc] init] autorelease];
+}
+
+- (id)init
+{
+    if (!tableTransferFilter) {
+        NSBundle *bundle = [NSBundle bundleForClass:[self class]];
+        NSString *kernelFile = [bundle pathForResource:@"WKTableTransferFilter" ofType:@"cikernel"];
+        NSString *code = [NSString stringWithContentsOfFile:kernelFile];
+        NSArray *kernels = [CIKernel kernelsWithString:code];
+        tableTransferFilter = [[kernels objectAtIndex:0] retain];
+    }
+    return [super init];
+}
+
+- (CIImage *)outputImage
+{
+    CISampler *inputSampler = [CISampler samplerWithImage: inputImage];
+    CISampler *tableSampler = [CISampler samplerWithImage: inputTable keysAndValues:kCISamplerFilterMode, kCISamplerFilterLinear, kCISamplerWrapMode, kCISamplerWrapClamp, nil];
+    NSArray *args = [NSArray arrayWithObjects:inputSampler, tableSampler, inputSelector, 
+        [NSNumber numberWithFloat:[inputTable extent].size.width-1.0], @"definition", [inputSampler definition], nil];
+    return [self apply:tableTransferFilter arguments:args options:nil];
+}
+
+@end
index b8b8b1e2585db4fac645d8f76e3a55dc51f24c0c..bcec8bc0f67cb645723175ba5240a20d737a0617 100644 (file)
@@ -105,7 +105,7 @@ void SVGComponentTransferFunctionElement::parseMappedAttribute(MappedAttribute *
         else if(value == "gamma")
             type()->setBaseVal(SVG_FECOMPONENTTRANSFER_TYPE_GAMMA);
     }
-    else if (attr->name() == SVGNames::valuesAttr)
+    else if (attr->name() == SVGNames::tableValuesAttr)
         tableValues()->baseVal()->parse(value.deprecatedString());
     else if (attr->name() == SVGNames::slopeAttr)
         slope()->setBaseVal(value.deprecatedString().toDouble());
@@ -130,6 +130,10 @@ KCComponentTransferFunction SVGComponentTransferFunctionElement::transferFunctio
     func.amplitude = amplitude()->baseVal();
     func.exponent = exponent()->baseVal();
     func.offset = offset()->baseVal();
+    SVGNumberList *numbers = tableValues()->baseVal();
+    unsigned int nr = numbers->numberOfItems();
+    for (unsigned int i = 0; i < nr; i++)
+        func.tableValues.append(numbers->getItem(i)->value());
     return func;
 }