diff options
52 files changed, 1 insertions, 2986 deletions
diff --git a/WebCore/Android.v8.mk b/WebCore/Android.v8.mk index e85cae8..dffe8a3 100644 --- a/WebCore/Android.v8.mk +++ b/WebCore/Android.v8.mk @@ -972,9 +972,7 @@ LOCAL_SRC_FILES := $(LOCAL_SRC_FILES) \ svg/graphics/filters/SVGFETile.cpp \ svg/graphics/filters/SVGFETurbulence.cpp \ svg/graphics/filters/SVGFilterEffect.cpp \ - svg/graphics/filters/SVGLightSource.cpp \ - \ - svg/graphics/skia/SVGResourceFilterSkia.cpp + svg/graphics/filters/SVGLightSource.cpp endif LOCAL_SRC_FILES := $(LOCAL_SRC_FILES) \ diff --git a/WebCore/svg/graphics/cairo/SVGResourceFilterCairo.cpp b/WebCore/svg/graphics/cairo/SVGResourceFilterCairo.cpp deleted file mode 100644 index a27038a..0000000 --- a/WebCore/svg/graphics/cairo/SVGResourceFilterCairo.cpp +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright (C) 2008 Collabora Ltd. All rights reserved. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include "config.h" - -#if ENABLE(SVG) && ENABLE(SVG_FILTERS) - -#include "NotImplemented.h" -#include "SVGResourceFilter.h" - -namespace WebCore { - -SVGResourceFilterPlatformData* SVGResourceFilter::createPlatformData() -{ - notImplemented(); - return 0; -} - -void SVGResourceFilter::prepareFilter(GraphicsContext*&, const FloatRect&) -{ - notImplemented(); -} - -void SVGResourceFilter::applyFilter(GraphicsContext*&, const FloatRect&) -{ - notImplemented(); -} - -} // namespace WebCore - -#endif - diff --git a/WebCore/svg/graphics/cg/SVGResourceFilterCg.cpp b/WebCore/svg/graphics/cg/SVGResourceFilterCg.cpp deleted file mode 100644 index ecfcdd8..0000000 --- a/WebCore/svg/graphics/cg/SVGResourceFilterCg.cpp +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (C) 2005, 2006, 2007 Apple Inc. All rights reserved. - * Copyright (C) 2006 Dave MacLachlan (dmaclach@mac.com) - * 2006 Rob Buis <buis@kde.org> - * - * 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 APPLE COMPUTER, INC. ``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 APPLE COMPUTER, INC. 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. - */ - - -#include "config.h" -#if ENABLE(SVG) && ENABLE(SVG_FILTERS) -#include "NotImplemented.h" -#include "SVGResourceFilter.h" - -namespace WebCore { - -SVGResourceFilterPlatformData* SVGResourceFilter::createPlatformData() -{ - return 0; -} - -void SVGResourceFilter::prepareFilter(GraphicsContext*&, const FloatRect&) -{ - notImplemented(); -} - -void SVGResourceFilter::applyFilter(GraphicsContext*&, const FloatRect&) -{ - notImplemented(); -} - -} - -#endif // ENABLE(SVG) && ENABLE(SVG_FILTERS) diff --git a/WebCore/svg/graphics/cg/SVGResourceFilterCg.mm b/WebCore/svg/graphics/cg/SVGResourceFilterCg.mm deleted file mode 100644 index a89ec1d..0000000 --- a/WebCore/svg/graphics/cg/SVGResourceFilterCg.mm +++ /dev/null @@ -1,143 +0,0 @@ -/* - * Copyright (C) 2005 Apple Computer, Inc. All rights reserved. - * (C) 2007 Nikolas Zimmermann <zimmermann@kde.org> - * - * 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 APPLE COMPUTER, INC. ``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 APPLE COMPUTER, INC. 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. - */ - -#include "config.h" - -#if ENABLE(SVG) && ENABLE(SVG_FILTERS) -#include "SVGResourceFilter.h" - -#include "TransformationMatrix.h" -#include "GraphicsContext.h" - -#include "SVGResourceFilterPlatformDataMac.h" - -#include <QuartzCore/CoreImage.h> - -// Setting to a value > 0 allows to dump the output image as JPEG. -#define DEBUG_OUTPUT_IMAGE 0 - -namespace WebCore { - -SVGResourceFilterPlatformData* SVGResourceFilter::createPlatformData() -{ - return new SVGResourceFilterPlatformDataMac(this); -} - -void SVGResourceFilter::prepareFilter(GraphicsContext*& context, const FloatRect& bbox) -{ - if (bbox.isEmpty() || m_effects.isEmpty()) - return; - - SVGResourceFilterPlatformDataMac* platform = static_cast<SVGResourceFilterPlatformDataMac*>(platformData()); - - CGContextRef cgContext = context->platformContext(); - - // Use of CGBegin/EndTransparencyLayer around this call causes over release - // of cgContext due to it being created on an autorelease pool, and released - // after CGEndTransparencyLayer. Create local pool to fix. - // <http://bugs.webkit.org/show_bug.cgi?id=8425> - // <http://bugs.webkit.org/show_bug.cgi?id=6947> - // <rdar://problem/4647735> - NSAutoreleasePool* filterContextPool = [[NSAutoreleasePool alloc] init]; - platform->m_filterCIContext = [CIContext contextWithCGContext:cgContext options:nil]; - [filterContextPool drain]; - - FloatRect filterRect = filterBBoxForItemBBox(bbox); - - // TODO: Ensure the size is not greater than the nearest <svg> size and/or the window size. - // This is also needed for masking & gradients-on-stroke-of-text. File a bug on this. - float width = filterRect.width(); - float height = filterRect.height(); - - platform->m_filterCGLayer = [platform->m_filterCIContext.get() createCGLayerWithSize:CGSizeMake(width, height) info:NULL]; - - context = new GraphicsContext(CGLayerGetContext(platform->m_filterCGLayer)); - context->save(); - - context->translate(-filterRect.x(), -filterRect.y()); -} - -#ifndef NDEBUG -// Extremly helpful debugging utilities for any paint server / resource that creates -// internal image buffers (ie. gradients on text, masks, filters...) -void dumpCIOutputImage(CIImage* outputImage, NSString* fileName) -{ - CGSize extentSize = [outputImage extent].size; - NSImage* image = [[[NSImage alloc] initWithSize:NSMakeSize(extentSize.width, extentSize.height)] autorelease]; - [image addRepresentation:[NSCIImageRep imageRepWithCIImage:outputImage]]; - - NSData* imageData = [image TIFFRepresentation]; - NSBitmapImageRep* imageRep = [NSBitmapImageRep imageRepWithData:imageData]; - imageData = [imageRep representationUsingType:NSJPEGFileType properties:nil]; - - [imageData writeToFile:fileName atomically:YES]; -} - -void dumpCGOutputImage(CGImage* outputImage, NSString* fileName) -{ - if (CIImage* ciOutputImage = [CIImage imageWithCGImage:outputImage]) - dumpCIOutputImage(ciOutputImage, fileName); -} -#endif - -void SVGResourceFilter::applyFilter(GraphicsContext*& context, const FloatRect& bbox) -{ - if (bbox.isEmpty() || m_effects.isEmpty()) - return; - - SVGResourceFilterPlatformDataMac* platform = static_cast<SVGResourceFilterPlatformDataMac*>(platformData()); - - // actually apply the filter effects - CIImage* inputImage = [CIImage imageWithCGLayer:platform->m_filterCGLayer]; - NSArray* filterStack = platform->getCIFilterStack(inputImage, bbox); - if ([filterStack count]) { - CIImage* outputImage = [[filterStack lastObject] valueForKey:@"outputImage"]; - - if (outputImage) { -#if DEBUG_OUTPUT_IMAGE > 0 - dumpOutputImage(outputImage); -#endif - - FloatRect filterRect = filterBBoxForItemBBox(bbox); - FloatPoint destOrigin = filterRect.location(); - filterRect.setLocation(FloatPoint(0.0f, 0.0f)); - - [platform->m_filterCIContext.get() drawImage:outputImage atPoint:CGPoint(destOrigin) fromRect:filterRect]; - } - } - - CGLayerRelease(platform->m_filterCGLayer); - platform->m_filterCGLayer = 0; - - platform->m_filterCIContext = 0; - - delete context; - context = 0; -} - -} - -#endif // ENABLE(SVG) ENABLE(SVG_FILTERS) diff --git a/WebCore/svg/graphics/filters/cg/SVGFEHelpersCg.h b/WebCore/svg/graphics/filters/cg/SVGFEHelpersCg.h deleted file mode 100644 index f35e028..0000000 --- a/WebCore/svg/graphics/filters/cg/SVGFEHelpersCg.h +++ /dev/null @@ -1,88 +0,0 @@ -/* - Copyright (C) 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org> - - This file is part of the KDE project - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - aint with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#if ENABLE(SVG) && ENABLE(SVG_FILTERS) - -#include "BlockExceptions.h" -#include "SVGFEDisplacementMap.h" -#include "SVGResourceFilter.h" -#include "SVGResourceFilterPlatformDataMac.h" -#include <QuartzCore/CoreImage.h> -#include <wtf/MathExtras.h> - -class Color; -class LightSource; - -namespace WebCore { - -CIVector* getVectorForChannel(ChannelSelectorType channel); -CIColor* ciColor(const Color& c); - -// Lighting -CIFilter* getPointLightVectors(CIFilter* normals, CIVector* lightPosition, float surfaceScale); -CIFilter* getLightVectors(CIFilter* normals, const LightSource* light, float surfaceScale); -CIFilter* getNormalMap(CIImage* bumpMap, float scale); - -}; - -// Macros used by the SVGFE*Cg classes -#define FE_QUARTZ_SETUP_INPUT(name) \ - SVGResourceFilterPlatformDataMac* filterPlatformData = static_cast<SVGResourceFilterPlatformDataMac*>(svgFilter->platformData()); \ - CIImage* inputImage = filterPlatformData->inputImage(this); \ - FE_QUARTZ_CHECK_INPUT(inputImage) \ - CIFilter* filter; \ - BEGIN_BLOCK_OBJC_EXCEPTIONS; \ - filter = [CIFilter filterWithName:name]; \ - [filter setDefaults]; \ - [filter setValue:inputImage forKey:@"inputImage"]; - -#define FE_QUARTZ_CHECK_INPUT(input) \ - if (!input) \ - return nil; - -#define FE_QUARTZ_OUTPUT_RETURN \ - filterPlatformData->setOutputImage(this, [filter valueForKey:@"outputImage"]); \ - return filter; \ - END_BLOCK_OBJC_EXCEPTIONS; \ - return nil; - -#define FE_QUARTZ_MAP_TO_SUBREGION_PREPARE(bbox) \ - FloatRect filterRect = svgFilter->filterBBoxForItemBBox(bbox); \ - FloatRect cropRect = primitiveBBoxForFilterBBox(filterRect, bbox); \ - cropRect.intersect(filterRect); \ - cropRect.move(-filterRect.x(), -filterRect.y()); - -#define FE_QUARTZ_MAP_TO_SUBREGION_APPLY(cropRect) \ - { \ - CIFilter* crop = [CIFilter filterWithName:@"CICrop"]; \ - [crop setDefaults]; \ - if (CIImage* currentFilterOutputImage = [filter valueForKey:@"outputImage"]) { \ - [crop setValue:currentFilterOutputImage forKey:@"inputImage"]; \ - [crop setValue:[CIVector vectorWithX:cropRect.x() Y:cropRect.y() Z:cropRect.width() W:cropRect.height()] forKey:@"inputRectangle"]; \ - filter = crop; \ - } \ - } - -#define FE_QUARTZ_MAP_TO_SUBREGION(bbox) \ - FE_QUARTZ_MAP_TO_SUBREGION_PREPARE(bbox); \ - FE_QUARTZ_MAP_TO_SUBREGION_APPLY(cropRect); - -#endif // ENABLE(SVG) && ENABLE(SVG_FILTERS) diff --git a/WebCore/svg/graphics/filters/cg/SVGFEHelpersCg.mm b/WebCore/svg/graphics/filters/cg/SVGFEHelpersCg.mm deleted file mode 100644 index 399d4c1..0000000 --- a/WebCore/svg/graphics/filters/cg/SVGFEHelpersCg.mm +++ /dev/null @@ -1,162 +0,0 @@ -/* - Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org> - - This file is part of the KDE project - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - aint with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "config.h" - -#if ENABLE(SVG) && ENABLE(SVG_FILTERS) -#include "SVGFEHelpersCg.h" - -#include "Color.h" -#include "SVGDistantLightSource.h" -#include "SVGLightSource.h" -#include "SVGPointLightSource.h" -#include "SVGSpotLightSource.h" - -#import "WKDistantLightFilter.h" -#import "WKNormalMapFilter.h" -#import "WKPointLightFilter.h" -#import "WKSpotLightFilter.h" - -#include <wtf/MathExtras.h> - -namespace WebCore { - -CIVector* getVectorForChannel(ChannelSelectorType channel) -{ - switch (channel) { - case CHANNEL_UNKNOWN: - return nil; - case CHANNEL_R: - return [CIVector vectorWithX:1.0f Y:0.0f Z:0.0f W:0.0f]; - case CHANNEL_G: - return [CIVector vectorWithX:0.0f Y:1.0f Z:0.0f W:0.0f]; - case CHANNEL_B: - return [CIVector vectorWithX:0.0f Y:0.0f Z:1.0f W:0.0f]; - case CHANNEL_A: - return [CIVector vectorWithX:0.0f Y:0.0f Z:0.0f W:1.0f]; - default: - return [CIVector vectorWithX:0.0f Y:0.0f Z:0.0f W:0.0f]; - } -} - -CIColor* ciColor(const Color& c) -{ - CGColorRef colorCG = createCGColor(c); - CIColor* colorCI = [CIColor colorWithCGColor:colorCG]; - CGColorRelease(colorCG); - return colorCI; -} - -// Lighting -CIFilter* getPointLightVectors(CIFilter* normals, CIVector* lightPosition, float surfaceScale) -{ - CIFilter* filter; - BEGIN_BLOCK_OBJC_EXCEPTIONS; - filter = [CIFilter filterWithName:@"WKPointLight"]; - if (!filter) - return nil; - [filter setDefaults]; - [filter setValue:[normals valueForKey:@"outputImage"] forKey:@"inputNormalMap"]; - [filter setValue:lightPosition forKey:@"inputLightPosition"]; - [filter setValue:[NSNumber numberWithFloat:surfaceScale] forKey:@"inputSurfaceScale"]; - return filter; - END_BLOCK_OBJC_EXCEPTIONS; - return nil; -} - -CIFilter* getLightVectors(CIFilter* normals, const LightSource* light, float surfaceScale) -{ - [WKDistantLightFilter class]; - [WKPointLightFilter class]; - [WKSpotLightFilter class]; - - CIFilter* filter = nil; - BEGIN_BLOCK_OBJC_EXCEPTIONS; - - switch (light->type()) { - case LS_DISTANT: - { - const DistantLightSource* dlight = static_cast<const DistantLightSource*>(light); - - filter = [CIFilter filterWithName:@"WKDistantLight"]; - if (!filter) - return nil; - [filter setDefaults]; - - float azimuth = dlight->azimuth(); - float elevation = dlight->elevation(); - azimuth = deg2rad(azimuth); - elevation = deg2rad(elevation); - float Lx = cosf(azimuth)*cosf(elevation); - float Ly = sinf(azimuth)*cosf(elevation); - float Lz = sinf(elevation); - - [filter setValue:[normals valueForKey:@"outputImage"] forKey:@"inputNormalMap"]; - [filter setValue:[CIVector vectorWithX:Lx Y:Ly Z:Lz] forKey:@"inputLightDirection"]; - return filter; - } - case LS_POINT: - { - const PointLightSource* plight = static_cast<const PointLightSource*>(light); - return getPointLightVectors(normals, [CIVector vectorWithX:plight->position().x() Y:plight->position().y() Z:plight->position().z()], surfaceScale); - } - case LS_SPOT: - { - const SpotLightSource* slight = static_cast<const SpotLightSource*>(light); - filter = [CIFilter filterWithName:@"WKSpotLight"]; - if (!filter) - return nil; - - CIFilter* pointLightFilter = getPointLightVectors(normals, [CIVector vectorWithX:slight->position().x() Y:slight->position().y() Z:slight->position().z()], surfaceScale); - if (!pointLightFilter) - return nil; - [filter setDefaults]; - - [filter setValue:[pointLightFilter valueForKey:@"outputImage"] forKey:@"inputLightVectors"]; - [filter setValue:[CIVector vectorWithX:slight->direction().x() Y:slight->direction().y() Z:slight->direction().z()] forKey:@"inputLightDirection"]; - [filter setValue:[NSNumber numberWithFloat:slight->specularExponent()] forKey:@"inputSpecularExponent"]; - [filter setValue:[NSNumber numberWithFloat:deg2rad(slight->limitingConeAngle())] forKey:@"inputLimitingConeAngle"]; - return filter; - } - } - - END_BLOCK_OBJC_EXCEPTIONS; - return nil; -} - -CIFilter* getNormalMap(CIImage* bumpMap, float scale) -{ - [WKNormalMapFilter class]; - CIFilter* filter; - BEGIN_BLOCK_OBJC_EXCEPTIONS; - filter = [CIFilter filterWithName:@"WKNormalMap"]; - [filter setDefaults]; - - [filter setValue:bumpMap forKey:@"inputImage"]; - [filter setValue:[NSNumber numberWithFloat:scale] forKey:@"inputSurfaceScale"]; - return filter; - END_BLOCK_OBJC_EXCEPTIONS; - return nil; -} - -} - -#endif // ENABLE(SVG) && ENABLE(SVG_FILTERS) diff --git a/WebCore/svg/graphics/filters/cg/SVGFilterEffectCg.mm b/WebCore/svg/graphics/filters/cg/SVGFilterEffectCg.mm deleted file mode 100644 index 4b0a233..0000000 --- a/WebCore/svg/graphics/filters/cg/SVGFilterEffectCg.mm +++ /dev/null @@ -1,37 +0,0 @@ -/* - Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org> - - This file is part of the KDE project - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - aint with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "config.h" - -#if ENABLE(SVG) && ENABLE(SVG_FILTERS) - -#include "SVGFilterEffect.h" - -namespace WebCore { - -CIFilter* SVGFilterEffect::getCIFilter(const FloatRect& bbox) const -{ - return nil; -} - -} - -#endif // ENABLE(SVG) && ENABLE(SVG_FILTERS) diff --git a/WebCore/svg/graphics/filters/cg/WKArithmeticFilter.cikernel b/WebCore/svg/graphics/filters/cg/WKArithmeticFilter.cikernel deleted file mode 100644 index 3c32c3a..0000000 --- a/WebCore/svg/graphics/filters/cg/WKArithmeticFilter.cikernel +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (C) 2005 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 arithmeticComposite(sampler in1, sampler in2, float k1, float k2, float k3, float k4) -{ - vec4 vin1 = sample(in1, samplerCoord(in1)); - vec4 vin2 = sample(in2, samplerCoord(in2)); - vec4 res = k1*vin1*vin2 + k2*vin1 + k3*vin2 + vec4(k4); - return res; -} diff --git a/WebCore/svg/graphics/filters/cg/WKArithmeticFilter.h b/WebCore/svg/graphics/filters/cg/WKArithmeticFilter.h deleted file mode 100644 index 4693853..0000000 --- a/WebCore/svg/graphics/filters/cg/WKArithmeticFilter.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (C) 2005 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> - -#if ENABLE(SVG) && ENABLE(SVG_FILTERS) - -@interface WKArithmeticFilter : CIFilter { - CIImage *inputImage; - CIImage *inputBackgroundImage; - NSNumber *inputK1; - NSNumber *inputK2; - NSNumber *inputK3; - NSNumber *inputK4; -} - -@end - -#endif // ENABLE(SVG) && ENABLE(SVG_FILTERS) diff --git a/WebCore/svg/graphics/filters/cg/WKArithmeticFilter.m b/WebCore/svg/graphics/filters/cg/WKArithmeticFilter.m deleted file mode 100644 index 389f25d..0000000 --- a/WebCore/svg/graphics/filters/cg/WKArithmeticFilter.m +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Copyright (C) 2005 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 "config.h" -#import "WKArithmeticFilter.h" - -#if ENABLE(SVG) && ENABLE(SVG_FILTERS) - -static CIKernel *arithmeticFilter = nil; - -@implementation WKArithmeticFilter -+ (void)initialize -{ - [CIFilter registerFilterName:@"WKArithmeticFilter" - constructor:self - classAttributes:[NSDictionary dictionaryWithObjectsAndKeys: - @"WebKit Arithmetic Filter", kCIAttributeFilterDisplayName, - [NSArray arrayWithObjects:kCICategoryStylize, kCICategoryVideo, - kCICategoryStillImage, kCICategoryNonSquarePixels,nil], kCIAttributeFilterCategories, - [NSDictionary dictionaryWithObjectsAndKeys: - [NSNumber numberWithDouble:0.0], kCIAttributeMin, - [NSNumber numberWithDouble:0.0], kCIAttributeDefault, - [NSNumber numberWithDouble:1.0], kCIAttributeIdentity, - kCIAttributeTypeScalar, kCIAttributeType, - nil], @"inputK1", - [NSDictionary dictionaryWithObjectsAndKeys: - [NSNumber numberWithDouble:0.0], kCIAttributeMin, - [NSNumber numberWithDouble:0.0], kCIAttributeDefault, - [NSNumber numberWithDouble:1.0], kCIAttributeIdentity, - kCIAttributeTypeScalar, kCIAttributeType, - nil], @"inputK2", - [NSDictionary dictionaryWithObjectsAndKeys: - [NSNumber numberWithDouble:0.0], kCIAttributeMin, - [NSNumber numberWithDouble:0.0], kCIAttributeDefault, - [NSNumber numberWithDouble:1.0], kCIAttributeIdentity, - kCIAttributeTypeScalar, kCIAttributeType, - nil], @"inputK3", - [NSDictionary dictionaryWithObjectsAndKeys: - [NSNumber numberWithDouble:0.0], kCIAttributeMin, - [NSNumber numberWithDouble:0.0], kCIAttributeDefault, - [NSNumber numberWithDouble:1.0], kCIAttributeIdentity, - kCIAttributeTypeScalar, kCIAttributeType, - nil], @"inputK4", - nil]]; -} - -+ (CIFilter *)filterWithName:(NSString *)name -{ - return [[[self alloc] init] autorelease]; -} - -- (id)init -{ - if (!arithmeticFilter) { - NSBundle *bundle = [NSBundle bundleForClass:[self class]]; - NSString *kernelFile = [bundle pathForResource:@"WKArithmeticFilter" ofType:@"cikernel"]; - NSString *code = [NSString stringWithContentsOfFile:kernelFile encoding:NSUTF8StringEncoding error:0]; - NSArray *kernels = [CIKernel kernelsWithString:code]; - arithmeticFilter = [[kernels objectAtIndex:0] retain]; - } - return [super init]; -} - -- (CIImage *)outputImage -{ - return [self apply:arithmeticFilter, inputImage, inputBackgroundImage, inputK1, inputK2, inputK3, - inputK4, nil]; -} - -@end - -#endif // ENABLE(SVG) && ENABLE(SVG_FILTERS) diff --git a/WebCore/svg/graphics/filters/cg/WKComponentMergeFilter.cikernel b/WebCore/svg/graphics/filters/cg/WKComponentMergeFilter.cikernel deleted file mode 100644 index f33f20c..0000000 --- a/WebCore/svg/graphics/filters/cg/WKComponentMergeFilter.cikernel +++ /dev/null @@ -1,33 +0,0 @@ -/* - * 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/svg/graphics/filters/cg/WKComponentMergeFilter.h b/WebCore/svg/graphics/filters/cg/WKComponentMergeFilter.h deleted file mode 100644 index 778e326..0000000 --- a/WebCore/svg/graphics/filters/cg/WKComponentMergeFilter.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - * 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> - -#if ENABLE(SVG) && ENABLE(SVG_FILTERS) - -@interface WKComponentMergeFilter : CIFilter { - CIImage *inputFuncR; - CIImage *inputFuncG; - CIImage *inputFuncB; - CIImage *inputFuncA; -} - -@end - -#endif // ENABLE(SVG) && ENABLE(SVG_FILTERS) diff --git a/WebCore/svg/graphics/filters/cg/WKComponentMergeFilter.m b/WebCore/svg/graphics/filters/cg/WKComponentMergeFilter.m deleted file mode 100644 index 4f2045a..0000000 --- a/WebCore/svg/graphics/filters/cg/WKComponentMergeFilter.m +++ /dev/null @@ -1,70 +0,0 @@ -/* - * 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 "config.h" -#import "WKComponentMergeFilter.h" - -#if ENABLE(SVG) && ENABLE(SVG_FILTERS) - -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 encoding:NSUTF8StringEncoding error:0]; - 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 - -#endif // ENABLE(SVG) && ENABLE(SVG_FILTERS) diff --git a/WebCore/svg/graphics/filters/cg/WKDiffuseLightingFilter.cikernel b/WebCore/svg/graphics/filters/cg/WKDiffuseLightingFilter.cikernel deleted file mode 100644 index 870956a..0000000 --- a/WebCore/svg/graphics/filters/cg/WKDiffuseLightingFilter.cikernel +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (C) 2005 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 diffuseLighting(sampler normalVectors, sampler lightVectors, __color lightingColor, - float surfaceScale, float diffuseConstant, float kernelLengthX, float kernelLengthY) -{ - vec2 pos = samplerCoord(lightVectors); - vec2 posn = samplerCoord(normalVectors); - vec4 l4 = sample(lightVectors, pos); - vec3 l = l4.xyz; - l = normalize(l); - vec3 n = sample(normalVectors, posn).xyz; - float nl = dot(l, n) * diffuseConstant; - vec4 res = vec4(lightingColor.r * nl, lightingColor.g * nl, lightingColor.b * nl, 1.0); - res.xyz *= l4.w; - return res; -} diff --git a/WebCore/svg/graphics/filters/cg/WKDiffuseLightingFilter.h b/WebCore/svg/graphics/filters/cg/WKDiffuseLightingFilter.h deleted file mode 100644 index 2731986..0000000 --- a/WebCore/svg/graphics/filters/cg/WKDiffuseLightingFilter.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (C) 2005 Apple Computer, Inc. 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 APPLE COMPUTER, INC. ``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 APPLE COMPUTER, INC. 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> - -#if ENABLE(SVG) && ENABLE(SVG_FILTERS) - -@interface WKDiffuseLightingFilter : CIFilter { - CISampler *inputNormalMap; - CISampler *inputLightVectors; - CIColor *inputLightingColor; - NSNumber *inputSurfaceScale; - NSNumber *inputDiffuseConstant; - NSNumber *inputKernelUnitLengthX; - NSNumber *inputKernelUnitLengthY; -} -@end - -#endif // ENABLE(SVG) && ENABLE(SVG_FILTERS) diff --git a/WebCore/svg/graphics/filters/cg/WKDiffuseLightingFilter.m b/WebCore/svg/graphics/filters/cg/WKDiffuseLightingFilter.m deleted file mode 100644 index 3675af8..0000000 --- a/WebCore/svg/graphics/filters/cg/WKDiffuseLightingFilter.m +++ /dev/null @@ -1,97 +0,0 @@ -/* - * Copyright (C) 2005 Apple Computer, Inc. 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 APPLE COMPUTER, INC. ``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 APPLE COMPUTER, INC. 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 "config.h" -#import "WKDiffuseLightingFilter.h" - -#if ENABLE(SVG) && ENABLE(SVG_FILTERS) - -static CIKernel *diffuseLightingFilter = nil; -@implementation WKDiffuseLightingFilter - -+ (void)initialize -{ - [CIFilter registerFilterName:@"WKDiffuseLighting" - constructor:self - classAttributes:[NSDictionary dictionaryWithObjectsAndKeys: - @"WebKit Diffuse Lighting", kCIAttributeFilterDisplayName, - [NSArray arrayWithObjects:kCICategoryStylize, kCICategoryVideo, - kCICategoryStillImage, kCICategoryNonSquarePixels,nil], kCIAttributeFilterCategories, - [NSDictionary dictionaryWithObjectsAndKeys: - [CIColor colorWithRed:1.0f green:1.0f blue:1.0f alpha:1.0f], - kCIAttributeDefault, nil], @"inputLightingColor", - [NSDictionary dictionaryWithObjectsAndKeys: - [NSNumber numberWithDouble:0.0], kCIAttributeMin, - [NSNumber numberWithDouble:1.0], kCIAttributeDefault, - [NSNumber numberWithDouble:1.0], kCIAttributeIdentity, - kCIAttributeTypeScalar, kCIAttributeType, - nil], @"inputSurfaceScale", - [NSDictionary dictionaryWithObjectsAndKeys: - [NSNumber numberWithDouble:0.0], kCIAttributeMin, - [NSNumber numberWithDouble:1.0], kCIAttributeDefault, - [NSNumber numberWithDouble:1.0], kCIAttributeIdentity, - kCIAttributeTypeScalar, kCIAttributeType, - nil], @"inputDiffuseConstant", - [NSDictionary dictionaryWithObjectsAndKeys: - [NSNumber numberWithDouble:0.0], kCIAttributeMin, - [NSNumber numberWithDouble:1.0], kCIAttributeDefault, - [NSNumber numberWithDouble:1.0], kCIAttributeIdentity, - kCIAttributeTypeScalar, kCIAttributeType, - nil], @"inputKernelUnitLengthX", - [NSDictionary dictionaryWithObjectsAndKeys: - [NSNumber numberWithDouble:0.0], kCIAttributeMin, - [NSNumber numberWithDouble:1.0], kCIAttributeDefault, - [NSNumber numberWithDouble:1.0], kCIAttributeIdentity, - kCIAttributeTypeScalar, kCIAttributeType, - nil], @"inputKernelUnitLengthY", - nil]]; -} - -+ (CIFilter *)filterWithName:(NSString *)name -{ - return [[[self alloc] init] autorelease]; -} - -- (id)init -{ - if (!diffuseLightingFilter) { - NSBundle *bundle = [NSBundle bundleForClass:[self class]]; - NSString *kernelFile = [bundle pathForResource:@"WKDiffuseLightingFilter" ofType:@"cikernel"]; - NSString *code = [NSString stringWithContentsOfFile:kernelFile encoding:NSUTF8StringEncoding error:0]; - NSArray *kernels = [CIKernel kernelsWithString:code]; - diffuseLightingFilter = [[kernels objectAtIndex:0] retain]; - } - return [super init]; -} - -- (CIImage *)outputImage -{ - return [self apply:diffuseLightingFilter, inputNormalMap, inputLightVectors, inputLightingColor, inputSurfaceScale, inputDiffuseConstant, - inputKernelUnitLengthX, inputKernelUnitLengthY, nil]; -} - -@end - -#endif // ENABLE(SVG) && ENABLE(SVG_FILTERS) diff --git a/WebCore/svg/graphics/filters/cg/WKDiscreteTransferFilter.cikernel b/WebCore/svg/graphics/filters/cg/WKDiscreteTransferFilter.cikernel deleted file mode 100644 index db3cefd..0000000 --- a/WebCore/svg/graphics/filters/cg/WKDiscreteTransferFilter.cikernel +++ /dev/null @@ -1,32 +0,0 @@ -/* - * 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/svg/graphics/filters/cg/WKDiscreteTransferFilter.h b/WebCore/svg/graphics/filters/cg/WKDiscreteTransferFilter.h deleted file mode 100644 index d444c75..0000000 --- a/WebCore/svg/graphics/filters/cg/WKDiscreteTransferFilter.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - * 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> - -#if ENABLE(SVG) && ENABLE(SVG_FILTERS) - -@interface WKDiscreteTransferFilter : CIFilter { - CIImage *inputImage; - CIImage *inputTable; - CIVector *inputSelector; -} - -@end - -#endif // ENABLE(SVG) && ENABLE(SVG_FILTERS) diff --git a/WebCore/svg/graphics/filters/cg/WKDiscreteTransferFilter.m b/WebCore/svg/graphics/filters/cg/WKDiscreteTransferFilter.m deleted file mode 100644 index dc6ca76..0000000 --- a/WebCore/svg/graphics/filters/cg/WKDiscreteTransferFilter.m +++ /dev/null @@ -1,73 +0,0 @@ -/* - * 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 "config.h" -#import "WKDiscreteTransferFilter.h" - -#if ENABLE(SVG) && ENABLE(SVG_FILTERS) - -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 encoding:NSUTF8StringEncoding error:0]; - 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 numberWithDouble:[inputTable extent].size.width - 1.0f], @"definition", [inputSampler definition], nil]; - return [self apply:discreteTransferFilter arguments:args options:nil]; -} - -@end - -#endif // ENABLE(SVG) && ENABLE(SVG_FILTERS) diff --git a/WebCore/svg/graphics/filters/cg/WKDisplacementMapFilter.cikernel b/WebCore/svg/graphics/filters/cg/WKDisplacementMapFilter.cikernel deleted file mode 100644 index 95b19c6..0000000 --- a/WebCore/svg/graphics/filters/cg/WKDisplacementMapFilter.cikernel +++ /dev/null @@ -1,45 +0,0 @@ -/* - * 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. - */ - -/* - * Performs the transformation: - * P'(x,y) <- P( x + scale * (XC(x,y) - .5), y + scale * (YC(x,y) - .5)) - * - * x/ychannel arguments are used to select the appropriate channel for x and - * y displacement. Hence each vector should have only one non-zero element, - * which should have the value 1.0. - * - */ - -kernel vec4 displacementMap(sampler image, sampler map, vec4 xchannel, vec4 ychannel, float scale) -{ - vec2 samplePos = samplerCoord(image); - vec4 XCYC = sample(map, samplerCoord(map)); - float xc = dot(XCYC, xchannel); - float yc = dot(XCYC, ychannel); - samplePos.x += scale*(xc-0.5); - samplePos.y += scale*(yc-0.5); - return sample(image, samplePos); -} diff --git a/WebCore/svg/graphics/filters/cg/WKDisplacementMapFilter.h b/WebCore/svg/graphics/filters/cg/WKDisplacementMapFilter.h deleted file mode 100644 index e594495..0000000 --- a/WebCore/svg/graphics/filters/cg/WKDisplacementMapFilter.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - * 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> - -#if ENABLE(SVG) && ENABLE(SVG_FILTERS) - -@interface WKDisplacementMapFilter : CIFilter { - CIImage *inputImage; - CIImage *inputDisplacementMap; - CIVector *inputXChannelSelector; - CIVector *inputYChannelSelector; - NSNumber *inputScale; -} - -@end - -#endif // ENABLE(SVG) && ENABLE(SVG_FILTERS) diff --git a/WebCore/svg/graphics/filters/cg/WKDisplacementMapFilter.m b/WebCore/svg/graphics/filters/cg/WKDisplacementMapFilter.m deleted file mode 100644 index 8ccd52c..0000000 --- a/WebCore/svg/graphics/filters/cg/WKDisplacementMapFilter.m +++ /dev/null @@ -1,81 +0,0 @@ -/* - * 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 "config.h" -#import "WKDisplacementMapFilter.h" - -#if ENABLE(SVG) && ENABLE(SVG_FILTERS) - -static CIKernel *displacementMapFilter = nil; - -@implementation WKDisplacementMapFilter - -+ (void)initialize -{ - [CIFilter registerFilterName:@"WKDisplacementMapFilter" - constructor:self - classAttributes:[NSDictionary dictionaryWithObjectsAndKeys: - @"WebKit Displacement Map Filter", kCIAttributeFilterDisplayName, - [NSArray arrayWithObjects:kCICategoryStylize, kCICategoryVideo, - kCICategoryStillImage, kCICategoryNonSquarePixels,nil], kCIAttributeFilterCategories, - [NSDictionary dictionaryWithObjectsAndKeys: - [CIVector vectorWithX:1.0f Y:0.0f Z:0.0f W:0.0f], - kCIAttributeDefault, nil], @"inputXChannelSelector", - [NSDictionary dictionaryWithObjectsAndKeys: - [CIVector vectorWithX:0.0f Y:1.0f Z:0.0f W:0.0f], - kCIAttributeDefault, nil], @"inputYChannelSelector", - [NSDictionary dictionaryWithObjectsAndKeys: - [NSNumber numberWithDouble:0.0], kCIAttributeDefault, - [NSNumber numberWithDouble:0.0], kCIAttributeIdentity, - kCIAttributeTypeScalar, kCIAttributeType, - nil], @"inputScale", - nil]]; -} - -+ (CIFilter *)filterWithName:(NSString *)name -{ - return [[[self alloc] init] autorelease]; -} - -- (id)init -{ - if (!displacementMapFilter) { - NSBundle *bundle = [NSBundle bundleForClass:[self class]]; - NSString *kernelFile = [bundle pathForResource:@"WKDisplacementMapFilter" ofType:@"cikernel"]; - NSString *code = [NSString stringWithContentsOfFile:kernelFile encoding:NSUTF8StringEncoding error:0]; - NSArray *kernels = [CIKernel kernelsWithString:code]; - displacementMapFilter = [[kernels objectAtIndex:0] retain]; - } - return [super init]; -} - -- (CIImage *)outputImage -{ - return [self apply:displacementMapFilter, inputImage, inputDisplacementMap, inputXChannelSelector, inputYChannelSelector, inputScale, nil]; -} - -@end - -#endif // ENABLE(SVG) && ENABLE(SVG_FILTERS) diff --git a/WebCore/svg/graphics/filters/cg/WKDistantLightFilter.cikernel b/WebCore/svg/graphics/filters/cg/WKDistantLightFilter.cikernel deleted file mode 100644 index c14677c..0000000 --- a/WebCore/svg/graphics/filters/cg/WKDistantLightFilter.cikernel +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright (C) 2005 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 distantLightGenerator(sampler image, vec3 direction) -{ - return vec4(direction.x, direction.y, direction.z, 1.0); -} diff --git a/WebCore/svg/graphics/filters/cg/WKDistantLightFilter.h b/WebCore/svg/graphics/filters/cg/WKDistantLightFilter.h deleted file mode 100644 index e5fe15a..0000000 --- a/WebCore/svg/graphics/filters/cg/WKDistantLightFilter.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (C) 2005 Apple Computer, Inc. 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 APPLE COMPUTER, INC. ``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 APPLE COMPUTER, INC. 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> - -#if ENABLE(SVG) && ENABLE(SVG_FILTERS) - -@interface WKDistantLightFilter : CIFilter { - CIImage * inputNormalMap; - CIVector * inputLightDirection; -} -@end - -#endif // ENABLE(SVG) && ENABLE(SVG_FILTERS) diff --git a/WebCore/svg/graphics/filters/cg/WKDistantLightFilter.m b/WebCore/svg/graphics/filters/cg/WKDistantLightFilter.m deleted file mode 100644 index 29e3caf..0000000 --- a/WebCore/svg/graphics/filters/cg/WKDistantLightFilter.m +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright (C) 2005 Apple Computer, Inc. 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 APPLE COMPUTER, INC. ``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 APPLE COMPUTER, INC. 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 "config.h" -#import "WKDistantLightFilter.h" - -#if ENABLE(SVG) && ENABLE(SVG_FILTERS) - -static CIKernel *distantLightFilter = nil; - -@implementation WKDistantLightFilter - -+ (void)initialize -{ - [CIFilter registerFilterName:@"WKDistantLight" - constructor:self - classAttributes:[NSDictionary dictionaryWithObjectsAndKeys: - @"WebKit Distant Light", kCIAttributeFilterDisplayName, - [NSArray arrayWithObjects:kCICategoryStylize, kCICategoryVideo, - kCICategoryStillImage, kCICategoryNonSquarePixels,nil], kCIAttributeFilterCategories, - [NSDictionary dictionaryWithObjectsAndKeys: - kCIAttributeTypePosition3, kCIAttributeType, - nil], @"inputLightDirection", - nil]]; -} - -+ (CIFilter *)filterWithName:(NSString *)name -{ - return [[[self alloc] init] autorelease]; -} - -- (id)init -{ - if (!distantLightFilter) { - NSBundle *bundle = [NSBundle bundleForClass:[self class]]; - NSString *kernelFile = [bundle pathForResource:@"WKDistantLightFilter" ofType:@"cikernel"]; - NSString *code = [NSString stringWithContentsOfFile:kernelFile encoding:NSUTF8StringEncoding error:0]; - NSArray *kernels = [CIKernel kernelsWithString:code]; - distantLightFilter = [[kernels objectAtIndex:0] retain]; - } - return [super init]; -} - -- (CIImage *)outputImage -{ - return [self apply:distantLightFilter, [CISampler samplerWithImage:inputNormalMap], inputLightDirection, nil]; -} - -@end - -#endif // ENABLE(SVG) && ENABLE(SVG_FILTERS) diff --git a/WebCore/svg/graphics/filters/cg/WKGammaTransferFilter.cikernel b/WebCore/svg/graphics/filters/cg/WKGammaTransferFilter.cikernel deleted file mode 100644 index 810edb6..0000000 --- a/WebCore/svg/graphics/filters/cg/WKGammaTransferFilter.cikernel +++ /dev/null @@ -1,30 +0,0 @@ -/* - * 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/svg/graphics/filters/cg/WKGammaTransferFilter.h b/WebCore/svg/graphics/filters/cg/WKGammaTransferFilter.h deleted file mode 100644 index 7e0c1e4..0000000 --- a/WebCore/svg/graphics/filters/cg/WKGammaTransferFilter.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - * 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> - -#if ENABLE(SVG) && ENABLE(SVG_FILTERS) - -@interface WKGammaTransferFilter : CIFilter { - CIImage *inputImage; - NSNumber *inputAmplitude; - NSNumber *inputExponent; - NSNumber *inputOffset; -} - -@end - -#endif // ENABLE(SVG) && ENABLE(SVG_FILTERS) diff --git a/WebCore/svg/graphics/filters/cg/WKGammaTransferFilter.m b/WebCore/svg/graphics/filters/cg/WKGammaTransferFilter.m deleted file mode 100644 index 8642931..0000000 --- a/WebCore/svg/graphics/filters/cg/WKGammaTransferFilter.m +++ /dev/null @@ -1,85 +0,0 @@ -/* - * 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 "config.h" -#import "WKGammaTransferFilter.h" - -#if ENABLE(SVG) && ENABLE(SVG_FILTERS) - -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 encoding:NSUTF8StringEncoding error:0]; - 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 - -#endif // ENABLE(SVG) && ENABLE(SVG_FILTERS) diff --git a/WebCore/svg/graphics/filters/cg/WKIdentityTransferFilter.h b/WebCore/svg/graphics/filters/cg/WKIdentityTransferFilter.h deleted file mode 100644 index 0c36daa..0000000 --- a/WebCore/svg/graphics/filters/cg/WKIdentityTransferFilter.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - * 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> - -#if ENABLE(SVG) && ENABLE(SVG_FILTERS) - -@interface WKIdentityTransferFilter : CIFilter { - CIImage *inputImage; -} - -@end - -#endif // ENABLE(SVG) && ENABLE(SVG_FILTERS) diff --git a/WebCore/svg/graphics/filters/cg/WKIdentityTransferFilter.m b/WebCore/svg/graphics/filters/cg/WKIdentityTransferFilter.m deleted file mode 100644 index 935c305..0000000 --- a/WebCore/svg/graphics/filters/cg/WKIdentityTransferFilter.m +++ /dev/null @@ -1,60 +0,0 @@ -/* - * 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 "config.h" -#import "WKIdentityTransferFilter.h" - -#if ENABLE(SVG) && ENABLE(SVG_FILTERS) - -@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 - -#endif // ENABLE(SVG) && ENABLE(SVG_FILTERS) diff --git a/WebCore/svg/graphics/filters/cg/WKLinearTransferFilter.cikernel b/WebCore/svg/graphics/filters/cg/WKLinearTransferFilter.cikernel deleted file mode 100644 index 17d57e4..0000000 --- a/WebCore/svg/graphics/filters/cg/WKLinearTransferFilter.cikernel +++ /dev/null @@ -1,30 +0,0 @@ -/* - * 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/svg/graphics/filters/cg/WKLinearTransferFilter.h b/WebCore/svg/graphics/filters/cg/WKLinearTransferFilter.h deleted file mode 100644 index 91a99f5..0000000 --- a/WebCore/svg/graphics/filters/cg/WKLinearTransferFilter.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - * 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> - -#if ENABLE(SVG) && ENABLE(SVG_FILTERS) - -@interface WKLinearTransferFilter : CIFilter { - CIImage *inputImage; - NSNumber *inputSlope; - NSNumber *inputIntercept; -} - -@end - -#endif // ENABLE(SVG) && ENABLE(SVG_FILTERS) diff --git a/WebCore/svg/graphics/filters/cg/WKLinearTransferFilter.m b/WebCore/svg/graphics/filters/cg/WKLinearTransferFilter.m deleted file mode 100644 index 6582f9f..0000000 --- a/WebCore/svg/graphics/filters/cg/WKLinearTransferFilter.m +++ /dev/null @@ -1,80 +0,0 @@ -/* - * 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 "config.h" -#import "WKLinearTransferFilter.h" - -#if ENABLE(SVG) && ENABLE(SVG_FILTERS) - -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 encoding:NSUTF8StringEncoding error:0]; - 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 - -#endif // ENABLE(SVG) && ENABLE(SVG_FILTERS) diff --git a/WebCore/svg/graphics/filters/cg/WKNormalMapFilter.cikernel b/WebCore/svg/graphics/filters/cg/WKNormalMapFilter.cikernel deleted file mode 100644 index 589f475..0000000 --- a/WebCore/svg/graphics/filters/cg/WKNormalMapFilter.cikernel +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (C) 2005 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. - */ - -//TODO: We currently ignore the input kernel lengths -kernel vec4 convolve3x3(sampler image, float divisor, float bias, - vec3 m0, vec3 m1, vec3 m2) -{ - vec4 colour = vec4(0.0, 0.0, 0.0, 0.0); - vec2 pos= samplerCoord(image); - colour = sample(image, pos + vec2(-1.0, -1.0)) *m0.x; - colour += sample(image, pos + vec2(-1.0, 0.0)) *m0.y; - colour += sample(image, pos + vec2(-1.0, 1.0)) *m0.z; - colour += sample(image, pos + vec2( 0.0, -1.0)) *m1.x; - colour += sample(image, pos) * m1.y; - colour += sample(image, pos + vec2( 0.0, 1.0))*m1.z; - colour += sample(image, pos + vec2( 1.0, -1.0))*m2.x; - colour += sample(image, pos + vec2( 1.0, 0.0))*m2.y; - colour += sample(image, pos + vec2( 1.0, 1.0))*m2.z; - return colour / divisor + bias; -} - -kernel vec4 mergeNormals(sampler Nx, sampler Ny, sampler src, float surfaceScale) -{ - vec3 N = vec3(surfaceScale * sample(Nx, samplerCoord(Nx)).a, -surfaceScale * sample(Ny, samplerCoord(Ny)).a, 1.0); - N = normalize(N); - return vec4(N.x, N.y, N.z, sample(src, samplerCoord(src)).a); -} diff --git a/WebCore/svg/graphics/filters/cg/WKNormalMapFilter.h b/WebCore/svg/graphics/filters/cg/WKNormalMapFilter.h deleted file mode 100644 index fb27447..0000000 --- a/WebCore/svg/graphics/filters/cg/WKNormalMapFilter.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (C) 2005 Apple Computer, Inc. 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 APPLE COMPUTER, INC. ``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 APPLE COMPUTER, INC. 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> - -#if ENABLE(SVG) && ENABLE(SVG_FILTERS) - -@interface WKNormalMapFilter : CIFilter { - CIImage *inputImage; - NSNumber *inputSurfaceScale; -} -@end - -#endif // ENABLE(SVG) && ENABLE(SVG_FILTERS) diff --git a/WebCore/svg/graphics/filters/cg/WKNormalMapFilter.m b/WebCore/svg/graphics/filters/cg/WKNormalMapFilter.m deleted file mode 100644 index b462008..0000000 --- a/WebCore/svg/graphics/filters/cg/WKNormalMapFilter.m +++ /dev/null @@ -1,109 +0,0 @@ -/* - * Copyright (C) 2005 Apple Computer, Inc. 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 APPLE COMPUTER, INC. ``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 APPLE COMPUTER, INC. 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 "config.h" -#import "WKNormalMapFilter.h" - -#if ENABLE(SVG) && ENABLE(SVG_FILTERS) - -static CIKernel *convolveKernel = nil; -static CIKernel *normalMapKernel = nil; - -@implementation WKNormalMapFilter - -+ (void)initialize -{ - [CIFilter registerFilterName:@"WKNormalMap" - constructor:self - classAttributes:[NSDictionary dictionaryWithObjectsAndKeys: - @"WebKit Normal Map", kCIAttributeFilterDisplayName, - [NSArray arrayWithObjects: kCICategoryBlur, kCICategoryVideo, - kCICategoryStillImage, kCICategoryNonSquarePixels, nil], kCIAttributeFilterCategories, - [NSDictionary dictionaryWithObjectsAndKeys: - [NSNumber numberWithDouble:0.0], kCIAttributeMin, - [NSNumber numberWithDouble:1.0], kCIAttributeDefault, - [NSNumber numberWithDouble:1.0], kCIAttributeIdentity, - kCIAttributeTypeScalar, kCIAttributeType, - nil], @"inputSurfaceScale", - nil]]; -} - -+ (CIFilter *)filterWithName:(NSString *)name -{ - return [[[self alloc] init] autorelease]; -} - -- (id)init -{ - if (!normalMapKernel) { - NSBundle *bundle = [NSBundle bundleForClass:[self class]]; - NSString *kernelFile = [bundle pathForResource:@"WKNormalMapFilter" ofType:@"cikernel"]; - NSString *code = [NSString stringWithContentsOfFile:kernelFile encoding:NSUTF8StringEncoding error:0]; - NSArray *kernels = [CIKernel kernelsWithString:code]; - convolveKernel = [[kernels objectAtIndex:0] retain]; - normalMapKernel = [[kernels objectAtIndex:1] retain]; - } - return [super init]; -} - -- (NSArray *)xConvolveArgsWithBumpMap:(CISampler *)bumpMap { - return [NSArray arrayWithObjects: - bumpMap, - [NSNumber numberWithFloat:4], - [NSNumber numberWithFloat:0], - [CIVector vectorWithX:1 Y:2 Z:1], - [CIVector vectorWithX:0 Y:0 Z:0], - [CIVector vectorWithX:-1 Y:-2 Z:-1], - nil]; -} - -- (NSArray *)yConvolveArgsWithBumpMap:(CISampler *)bumpMap { - return [NSArray arrayWithObjects: - bumpMap, - [NSNumber numberWithFloat:4], - [NSNumber numberWithFloat:0], - [CIVector vectorWithX:1 Y:0 Z:-1], - [CIVector vectorWithX:2 Y:0 Z:-2], - [CIVector vectorWithX:1 Y:0 Z:-1], - nil]; -} - -- (CIImage *)outputImage -{ - CISampler *image = [CISampler samplerWithImage:inputImage]; - NSDictionary *applyOptions = [NSDictionary dictionaryWithObjectsAndKeys:[image definition], kCIApplyOptionDefinition, nil]; - - CIImage *convolveX = [self apply:convolveKernel arguments:[self xConvolveArgsWithBumpMap:image] options:applyOptions]; - CIImage *convolveY = [self apply:convolveKernel arguments:[self yConvolveArgsWithBumpMap:image] options:applyOptions]; - CISampler *samplerX = [CISampler samplerWithImage:convolveX]; - CISampler *samplerY = [CISampler samplerWithImage:convolveY]; - - NSArray *normalMapArgs = [NSArray arrayWithObjects:samplerX, samplerY, image, inputSurfaceScale, nil]; - return [self apply:normalMapKernel arguments:normalMapArgs options:applyOptions]; -} - -@end - -#endif // ENABLE(SVG) && ENABLE(SVG_FILTERS) diff --git a/WebCore/svg/graphics/filters/cg/WKPointLightFilter.cikernel b/WebCore/svg/graphics/filters/cg/WKPointLightFilter.cikernel deleted file mode 100644 index fd0a851..0000000 --- a/WebCore/svg/graphics/filters/cg/WKPointLightFilter.cikernel +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (C) 2005 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 genPointLight(sampler normalMap, vec3 lightPos, float surfaceScale) -{ - vec2 pos = samplerCoord(normalMap); - vec3 P = vec3(pos.x, pos.y, surfaceScale * sample(normalMap, pos).a); - vec3 L = lightPos - P; - L = normalize(L); - return vec4(L.x, L.y, L.z, 1.0); -} diff --git a/WebCore/svg/graphics/filters/cg/WKPointLightFilter.h b/WebCore/svg/graphics/filters/cg/WKPointLightFilter.h deleted file mode 100644 index 58ec689..0000000 --- a/WebCore/svg/graphics/filters/cg/WKPointLightFilter.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (C) 2005 Apple Computer, Inc. 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 APPLE COMPUTER, INC. ``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 APPLE COMPUTER, INC. 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> - -#if ENABLE(SVG) && ENABLE(SVG_FILTERS) - -@interface WKPointLightFilter : CIFilter { - CIImage *inputNormalMap; - CIVector *inputLightPosition; - NSNumber *inputSurfaceScale; -} - -@end - -#endif // ENABLE(SVG) && ENABLE(SVG_FILTERS) diff --git a/WebCore/svg/graphics/filters/cg/WKPointLightFilter.m b/WebCore/svg/graphics/filters/cg/WKPointLightFilter.m deleted file mode 100644 index 331207e..0000000 --- a/WebCore/svg/graphics/filters/cg/WKPointLightFilter.m +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright (C) 2005 Apple Computer, Inc. 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 APPLE COMPUTER, INC. ``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 APPLE COMPUTER, INC. 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 "config.h" -#import "WKPointLightFilter.h" - -#if ENABLE(SVG) && ENABLE(SVG_FILTERS) - -static CIKernel *pointLightFilter = nil; - -@implementation WKPointLightFilter - -+ (void)initialize -{ - [CIFilter registerFilterName:@"WKPointLight" - constructor:self - classAttributes:[NSDictionary dictionaryWithObjectsAndKeys: - @"WebKit Point Light", kCIAttributeFilterDisplayName, - [NSArray arrayWithObjects:kCICategoryStylize, kCICategoryVideo, - kCICategoryStillImage, kCICategoryNonSquarePixels,nil], kCIAttributeFilterCategories, - [NSDictionary dictionaryWithObjectsAndKeys: - kCIAttributeTypePosition3, kCIAttributeType, - nil], @"inputLightPosition", - nil]]; -} - -+ (CIFilter *)filterWithName:(NSString *)name -{ - return [[[self alloc] init] autorelease]; -} - -- (id)init -{ - if (!pointLightFilter) { - NSBundle *bundle = [NSBundle bundleForClass:[self class]]; - NSString *kernelFile = [bundle pathForResource:@"WKPointLightFilter" ofType:@"cikernel"]; - NSString *code = [NSString stringWithContentsOfFile:kernelFile encoding:NSUTF8StringEncoding error:0]; - NSArray *kernels = [CIKernel kernelsWithString:code]; - pointLightFilter = [[kernels objectAtIndex:0] retain]; - } - return [super init]; -} - -- (CIImage *)outputImage -{ - return [self apply:pointLightFilter, inputNormalMap, inputLightPosition, inputSurfaceScale, nil]; -} - -@end - -#endif // ENABLE(SVG) && ENABLE(SVG_FILTERS) diff --git a/WebCore/svg/graphics/filters/cg/WKSpecularLightingFilter.cikernel b/WebCore/svg/graphics/filters/cg/WKSpecularLightingFilter.cikernel deleted file mode 100644 index 64228f0..0000000 --- a/WebCore/svg/graphics/filters/cg/WKSpecularLightingFilter.cikernel +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (C) 2005 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 basic(sampler inputNormalVectors, sampler inputLightVectors, __color inputLightingColor, float inputSurfaceScale, float inputSpecularConstant, - float inputSpecularExponent, float inputKernelUnitLengthX, float inputKernelUnitLengthY) -{ - vec2 pos = samplerCoord(inputLightVectors); - vec2 posn = samplerCoord(inputNormalVectors); - vec3 l = sample(inputLightVectors, pos).xyz; - vec3 n = sample(inputNormalVectors, posn).xyz; - vec3 h = l+vec3(0.0, 0.0, 1.0); - h = normalize(h); - float nh = inputSpecularConstant*pow((dot(n, h)), inputSpecularExponent); - vec4 res = inputLightingColor * nh; - res.a = max(res.r, res.g); - res.a = max(res.a, res.b); - return res; -} diff --git a/WebCore/svg/graphics/filters/cg/WKSpecularLightingFilter.h b/WebCore/svg/graphics/filters/cg/WKSpecularLightingFilter.h deleted file mode 100644 index cce9e06..0000000 --- a/WebCore/svg/graphics/filters/cg/WKSpecularLightingFilter.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (C) 2005 Apple Computer, Inc. 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 APPLE COMPUTER, INC. ``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 APPLE COMPUTER, INC. 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> - -#if ENABLE(SVG) && ENABLE(SVG_FILTERS) - -@interface WKSpecularLightingFilter : CIFilter { - CISampler *inputNormalMap; - CISampler *inputLightVectors; - CIColor *inputLightingColor; - NSNumber *inputSurfaceScale; - NSNumber *inputSpecularConstant; - NSNumber *inputSpecularExponent; - NSNumber *inputKernelUnitLengthX; - NSNumber *inputKernelUnitLengthY; -} -@end - -#endif // ENABLE(SVG) && ENABLE(SVG_FILTERS) diff --git a/WebCore/svg/graphics/filters/cg/WKSpecularLightingFilter.m b/WebCore/svg/graphics/filters/cg/WKSpecularLightingFilter.m deleted file mode 100644 index 22495ae..0000000 --- a/WebCore/svg/graphics/filters/cg/WKSpecularLightingFilter.m +++ /dev/null @@ -1,96 +0,0 @@ -/* - * Copyright (C) 2005 Apple Computer, Inc. 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 APPLE COMPUTER, INC. ``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 APPLE COMPUTER, INC. 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 "config.h" -#import "WKSpecularLightingFilter.h" - -#if ENABLE(SVG) && ENABLE(SVG_FILTERS) - -static CIKernel *specularLightingFilter = nil; - -@implementation WKSpecularLightingFilter - -+ (void)initialize -{ - [CIFilter registerFilterName:@"WKSpecularLighting" - constructor:self - classAttributes:[NSDictionary dictionaryWithObjectsAndKeys: - @"WebKit Specular Lighting", kCIAttributeFilterDisplayName, - [NSArray arrayWithObjects:kCICategoryStylize, kCICategoryVideo, - kCICategoryStillImage, kCICategoryNonSquarePixels,nil], kCIAttributeFilterCategories, - [NSDictionary dictionaryWithObjectsAndKeys: - [CIColor colorWithRed:1.0f green:1.0f blue:1.0f alpha:1.0f], - kCIAttributeDefault, nil], @"inputLightingColor", - [NSDictionary dictionaryWithObjectsAndKeys: - [NSNumber numberWithDouble:0.0], kCIAttributeMin, - [NSNumber numberWithDouble:1.0], kCIAttributeDefault, - [NSNumber numberWithDouble:1.0], kCIAttributeIdentity, - kCIAttributeTypeScalar, kCIAttributeType, - nil], @"inputSurfaceScale", - [NSDictionary dictionaryWithObjectsAndKeys: - [NSNumber numberWithDouble:0.0], kCIAttributeMin, - [NSNumber numberWithDouble:1.0], kCIAttributeDefault, - [NSNumber numberWithDouble:1.0], kCIAttributeIdentity, - kCIAttributeTypeScalar, kCIAttributeType, - nil], @"inputSpecularConstant", - [NSDictionary dictionaryWithObjectsAndKeys: - [NSNumber numberWithDouble:0.0], kCIAttributeMin, - [NSNumber numberWithDouble:128.0], kCIAttributeMin, - [NSNumber numberWithDouble:1.0], kCIAttributeDefault, - [NSNumber numberWithDouble:1.0], kCIAttributeIdentity, - kCIAttributeTypeScalar, kCIAttributeType, - nil], @"inputSpecularExponent", - [NSDictionary dictionaryWithObjectsAndKeys: - kCIAttributeTypeOffset, kCIAttributeType, - nil], @"inputKernelUnitLength", - nil]]; -} - -+ (CIFilter *)filterWithName:(NSString *)name -{ - return [[[self alloc] init] autorelease]; -} - -- (id)init -{ - if (!specularLightingFilter) { - NSBundle *bundle = [NSBundle bundleForClass:[self class]]; - NSString *kernelFile = [bundle pathForResource:@"WKSpecularLightingFilter" ofType:@"cikernel"]; - NSString *code = [NSString stringWithContentsOfFile:kernelFile encoding:NSUTF8StringEncoding error:0]; - NSArray *kernels = [CIKernel kernelsWithString:code]; - specularLightingFilter = [[kernels objectAtIndex:0] retain]; - } - return [super init]; -} - -- (CIImage *)outputImage -{ - return [self apply:specularLightingFilter, inputNormalMap, inputLightVectors, inputLightingColor, inputSurfaceScale, inputSpecularConstant, - inputSpecularExponent, inputKernelUnitLengthX, inputKernelUnitLengthY, nil]; -} - -@end - -#endif // ENABLE(SVG) && ENABLE(SVG_FILTERS) diff --git a/WebCore/svg/graphics/filters/cg/WKSpotLightFilter.cikernel b/WebCore/svg/graphics/filters/cg/WKSpotLightFilter.cikernel deleted file mode 100644 index 0fa83a8..0000000 --- a/WebCore/svg/graphics/filters/cg/WKSpotLightFilter.cikernel +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright (C) 2005 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 spotLightFilter(sampler lightVectors, vec3 lightDirection, float specularExponent, float cosCutoffAngle) -{ - vec2 pos = samplerCoord(lightVectors); - vec3 l = sample(lightVectors, pos).xyz; - float sl = -dot(lightDirection, l); - sl = max(sl, 0.0); - sl = pow(sl, specularExponent) * sign(sl - cosCutoffAngle); - return vec4(l.x, l.y, l.z, sl); -} diff --git a/WebCore/svg/graphics/filters/cg/WKSpotLightFilter.h b/WebCore/svg/graphics/filters/cg/WKSpotLightFilter.h deleted file mode 100644 index d87beca..0000000 --- a/WebCore/svg/graphics/filters/cg/WKSpotLightFilter.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (C) 2005 Apple Computer, Inc. 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 APPLE COMPUTER, INC. ``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 APPLE COMPUTER, INC. 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> - -#if ENABLE(SVG) && ENABLE(SVG_FILTERS) - -@interface WKSpotLightFilter : CIFilter { - CIImage *inputLightVectors; - CIVector *inputLightDirection; - NSNumber *inputSpecularExponent; - NSNumber *inputLimitingConeAngle; -} -@end - -#endif // ENABLE(SVG) && ENABLE(SVG_FILTERS) diff --git a/WebCore/svg/graphics/filters/cg/WKSpotLightFilter.m b/WebCore/svg/graphics/filters/cg/WKSpotLightFilter.m deleted file mode 100644 index 62973ef..0000000 --- a/WebCore/svg/graphics/filters/cg/WKSpotLightFilter.m +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright (C) 2005 Apple Computer, Inc. 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 APPLE COMPUTER, INC. ``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 APPLE COMPUTER, INC. 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 "config.h" -#import "WKSpotLightFilter.h" - -#if ENABLE(SVG) && ENABLE(SVG_FILTERS) - -static CIKernel *spotLightFilter = nil; - -@implementation WKSpotLightFilter - -+ (void)initialize -{ - [CIFilter registerFilterName:@"WKSpotLight" - constructor:self - classAttributes:[NSDictionary dictionaryWithObjectsAndKeys: - @"WebKit Spot Light", kCIAttributeFilterDisplayName, - [NSArray arrayWithObjects:kCICategoryStylize, kCICategoryVideo, - kCICategoryStillImage, kCICategoryNonSquarePixels,nil], kCIAttributeFilterCategories, - [NSDictionary dictionaryWithObjectsAndKeys: - kCIAttributeTypePosition3, kCIAttributeType, - nil], @"inputLightDirection", - [NSDictionary dictionaryWithObjectsAndKeys: - [NSNumber numberWithDouble:1.0], kCIAttributeDefault, - [NSNumber numberWithDouble:1.0], kCIAttributeIdentity, - kCIAttributeTypeScalar, kCIAttributeType, - nil], @"inputSpecularExponent", - [NSDictionary dictionaryWithObjectsAndKeys: - kCIAttributeTypeAngle, kCIAttributeType, - nil], @"inputLimitingConeAngle", - nil]]; -} - -+ (CIFilter *)filterWithName:(NSString *)name -{ - return [[[self alloc] init] autorelease]; -} - -- (id)init -{ - if (!spotLightFilter) { - NSBundle *bundle = [NSBundle bundleForClass:[self class]]; - NSString *kernelFile = [bundle pathForResource:@"WKSpotLightFilter" ofType:@"cikernel"]; - NSString *code = [NSString stringWithContentsOfFile:kernelFile encoding:NSUTF8StringEncoding error:0]; - NSArray *kernels = [CIKernel kernelsWithString:code]; - spotLightFilter = [[kernels objectAtIndex:0] retain]; - } - return [super init]; -} - -- (CIImage *)outputImage -{ - float coscutoff = cosf([inputLimitingConeAngle floatValue]); - if (coscutoff < 0) - coscutoff = -coscutoff; - return [self apply:spotLightFilter, inputLightVectors, inputLightDirection, inputSpecularExponent, [NSNumber numberWithFloat:coscutoff], nil]; -} - -@end - -#endif // ENABLE(SVG) && ENABLE(SVG_FILTERS) diff --git a/WebCore/svg/graphics/filters/cg/WKTableTransferFilter.cikernel b/WebCore/svg/graphics/filters/cg/WKTableTransferFilter.cikernel deleted file mode 100644 index 19dfcdf..0000000 --- a/WebCore/svg/graphics/filters/cg/WKTableTransferFilter.cikernel +++ /dev/null @@ -1,38 +0,0 @@ -/* - * 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/svg/graphics/filters/cg/WKTableTransferFilter.h b/WebCore/svg/graphics/filters/cg/WKTableTransferFilter.h deleted file mode 100644 index 34adf00..0000000 --- a/WebCore/svg/graphics/filters/cg/WKTableTransferFilter.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - * 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> - -#if ENABLE(SVG) && ENABLE(SVG_FILTERS) - -@interface WKTableTransferFilter : CIFilter { - CIImage *inputImage; - CIImage *inputTable; - CIVector *inputSelector; -} - -@end - -#endif diff --git a/WebCore/svg/graphics/filters/cg/WKTableTransferFilter.m b/WebCore/svg/graphics/filters/cg/WKTableTransferFilter.m deleted file mode 100644 index 55d7c9d..0000000 --- a/WebCore/svg/graphics/filters/cg/WKTableTransferFilter.m +++ /dev/null @@ -1,76 +0,0 @@ -/* - * 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 "config.h" -#import "WKTableTransferFilter.h" - -#if ENABLE(SVG) && ENABLE(SVG_FILTERS) - -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 encoding:NSUTF8StringEncoding error:0]; - 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 numberWithDouble:[inputTable extent].size.width - 1.0f], @"definition", [inputSampler definition], nil]; - return [self apply:tableTransferFilter arguments:args options:nil]; -} - -@end - -#endif // ENABLE(SVG) && ENABLE(SVG_FILTERS) diff --git a/WebCore/svg/graphics/mac/SVGResourceFilterPlatformDataMac.h b/WebCore/svg/graphics/mac/SVGResourceFilterPlatformDataMac.h deleted file mode 100644 index 54f8237..0000000 --- a/WebCore/svg/graphics/mac/SVGResourceFilterPlatformDataMac.h +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright (C) 2007 Eric Seidel <eric@webkit.org> - * - * 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 APPLE COMPUTER, INC. ``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 APPLE COMPUTER, INC. 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. - */ - -#ifndef SVGResourceFilterPlatformDataMac_h -#define SVGResourceFilterPlatformDataMac_h - -#if ENABLE(SVG) && ENABLE(SVG_FILTERS) - -#include "SVGResourceFilter.h" - -#include <ApplicationServices/ApplicationServices.h> -#include <wtf/RetainPtr.h> - -@class CIImage; -@class CIFilter; -@class CIContext; -@class NSArray; -@class NSMutableDictionary; - -namespace WebCore { - class SVGResourceFilterPlatformDataMac : public SVGResourceFilterPlatformData { - public: - SVGResourceFilterPlatformDataMac(SVGResourceFilter*); - virtual ~SVGResourceFilterPlatformDataMac(); - - CIImage* imageForName(const String&) const; - void setImageForName(CIImage*, const String&); - - void setOutputImage(const SVGFilterEffect*, CIImage*); - CIImage* inputImage(const SVGFilterEffect*); - - NSArray* getCIFilterStack(CIImage* inputImage, const FloatRect& bbox); - - RetainPtr<CIContext> m_filterCIContext; - CGLayerRef m_filterCGLayer; - RetainPtr<NSMutableDictionary> m_imagesByName; - SVGResourceFilter* m_filter; - }; -} - -#endif // #if ENABLE(SVG) && ENABLE(SVG_FILTERS) - -#endif // SVGResourceFilterPlatformDataMac_h diff --git a/WebCore/svg/graphics/mac/SVGResourceFilterPlatformDataMac.mm b/WebCore/svg/graphics/mac/SVGResourceFilterPlatformDataMac.mm deleted file mode 100644 index 225c649..0000000 --- a/WebCore/svg/graphics/mac/SVGResourceFilterPlatformDataMac.mm +++ /dev/null @@ -1,128 +0,0 @@ -/* - * Copyright (C) 2007 Eric Seidel <eric@webkit.org> - * - * 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 APPLE COMPUTER, INC. ``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 APPLE COMPUTER, INC. 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. - */ - -#include "config.h" -#if ENABLE(SVG) && ENABLE(SVG_FILTERS) - -#include "SVGResourceFilterPlatformDataMac.h" -#include <QuartzCore/CoreImage.h> - -namespace WebCore { - -static const char* const SVGPreviousFilterOutputName = "__previousOutput__"; - -SVGResourceFilterPlatformDataMac::SVGResourceFilterPlatformDataMac(SVGResourceFilter* filter) - : m_filterCGLayer(0) - , m_imagesByName(AdoptNS, [[NSMutableDictionary alloc] init]) - , m_filter(filter) -{ -} - -SVGResourceFilterPlatformDataMac::~SVGResourceFilterPlatformDataMac() -{ - ASSERT(!m_filterCGLayer); - ASSERT(!m_filterCIContext); -} - - -NSArray* SVGResourceFilterPlatformDataMac::getCIFilterStack(CIImage* inputImage, const FloatRect& bbox) -{ - NSMutableArray* filterEffects = [NSMutableArray array]; - - setImageForName(inputImage, "SourceGraphic"); // input - - for (unsigned int i = 0; i < m_filter->effects().size(); i++) { - CIFilter* filter = m_filter->effects()[i]->getCIFilter(bbox); - if (filter) - [filterEffects addObject:filter]; - } - - [m_imagesByName.get() removeAllObjects]; // clean up before next time. - - return filterEffects; -} - -static inline CIImage* alphaImageForImage(CIImage* image) -{ - CIFilter* onlyAlpha = [CIFilter filterWithName:@"CIColorMatrix"]; - CGFloat zero[4] = {0, 0, 0, 0}; - [onlyAlpha setDefaults]; - [onlyAlpha setValue:image forKey:@"inputImage"]; - [onlyAlpha setValue:[CIVector vectorWithValues:zero count:4] forKey:@"inputRVector"]; - [onlyAlpha setValue:[CIVector vectorWithValues:zero count:4] forKey:@"inputGVector"]; - [onlyAlpha setValue:[CIVector vectorWithValues:zero count:4] forKey:@"inputBVector"]; - return [onlyAlpha valueForKey:@"outputImage"]; -} - -CIImage* SVGResourceFilterPlatformDataMac::imageForName(const String& name) const -{ - return [m_imagesByName.get() objectForKey:name]; -} - -void SVGResourceFilterPlatformDataMac::setImageForName(CIImage* image, const String& name) -{ - [m_imagesByName.get() setValue:image forKey:name]; -} - -void SVGResourceFilterPlatformDataMac::setOutputImage(const SVGFilterEffect* filterEffect, CIImage* output) -{ - if (!filterEffect->result().isEmpty()) - setImageForName(output, filterEffect->result()); - - setImageForName(output, SVGPreviousFilterOutputName); -} - -CIImage* SVGResourceFilterPlatformDataMac::inputImage(const SVGFilterEffect* filterEffect) -{ - if (filterEffect->in().isEmpty()) { - CIImage* inImage = imageForName(SVGPreviousFilterOutputName); - - if (!inImage) - inImage = imageForName("SourceGraphic"); - - return inImage; - } else if (filterEffect->in() == "SourceAlpha") { - CIImage* sourceAlpha = imageForName(filterEffect->in()); - - if (!sourceAlpha) { - CIImage* sourceGraphic = imageForName("SourceGraphic"); - - if (!sourceGraphic) - return nil; - - sourceAlpha = alphaImageForImage(sourceGraphic); - setImageForName(sourceAlpha, "SourceAlpha"); - } - - return sourceAlpha; - } - - return imageForName(filterEffect->in()); -} - - -} - -#endif // #if ENABLE(SVG) && ENABLE(SVG_FILTERS) diff --git a/WebCore/svg/graphics/qt/SVGResourceFilterQt.cpp b/WebCore/svg/graphics/qt/SVGResourceFilterQt.cpp deleted file mode 100644 index cbf90cd..0000000 --- a/WebCore/svg/graphics/qt/SVGResourceFilterQt.cpp +++ /dev/null @@ -1,50 +0,0 @@ -/* - Copyright (C) 2006 Nikolas Zimmermann <wildfox@kde.org> - - This file is part of the KDE project - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - aint with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "config.h" - -#if ENABLE(SVG) && ENABLE(SVG_FILTERS) -#include "SVGResourceFilter.h" -#include "NotImplemented.h" - -namespace WebCore { - -SVGResourceFilterPlatformData* SVGResourceFilter::createPlatformData() -{ - notImplemented(); - return 0; -} - -void SVGResourceFilter::prepareFilter(GraphicsContext*&, const FloatRect&) -{ - notImplemented(); -} - -void SVGResourceFilter::applyFilter(GraphicsContext*&, const FloatRect&) -{ - notImplemented(); -} - -} // namespace WebCore - -#endif - -// vim:ts=4:noet diff --git a/WebCore/svg/graphics/skia/SVGResourceFilterSkia.cpp b/WebCore/svg/graphics/skia/SVGResourceFilterSkia.cpp deleted file mode 100644 index b54eb4b..0000000 --- a/WebCore/svg/graphics/skia/SVGResourceFilterSkia.cpp +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright (c) 2008, Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * 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. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "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 COPYRIGHT - * OWNER 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. - */ - -#include "config.h" -#if ENABLE(SVG) && ENABLE(SVG_FILTERS) -#include "NotImplemented.h" -#include "SVGResourceFilter.h" - -namespace WebCore { - -SVGResourceFilterPlatformData* SVGResourceFilter::createPlatformData() -{ - return 0; -} - -void SVGResourceFilter::prepareFilter(GraphicsContext*&, const FloatRect&) -{ - notImplemented(); -} - -void SVGResourceFilter::applyFilter(GraphicsContext*&, const FloatRect&) -{ - notImplemented(); -} - -} - -#endif // ENABLE(SVG) && ENABLE(SVG_FILTERS) |