[webkit-changes] cvs commit: SVGSupport/ksvg2/svg
SVGAnimatedColorImpl.cpp SVGAnimatedColorImpl.h
SVGFEDiffuseLightingElementImpl.cpp
SVGFEDiffuseLightingElementImpl.h SVGFEDistantLightElementImpl.cpp
SVGFEDistantLightElementImpl.h SVGFELightElementImpl.cpp
SVGFELightElementImpl.h SVGFEPointLightElementImpl.cpp
SVGFEPointLightElementImpl.h SVGFESpecularLightingElementImpl.cpp
SVGFESpecularLightingElementImpl.h
SVGFESpotLightElementImpl.cpp SVGFESpotLightElementImpl.h
SVGElementImpl.cpp SVGFECompositeElementImpl.cpp
SVGSVGElementImpl.cpp
Eric
eseidel at opensource.apple.com
Mon Nov 28 15:34:11 PST 2005
eseidel 05/11/28 15:34:10
Modified: . ChangeLog
WebCore.xcodeproj project.pbxproj
kcanvas KCanvasFilters.cpp KCanvasFilters.h
KCanvasTreeDebug.cpp
kcanvas/device/quartz KCanvasFilterQuartz.h
KCanvasFilterQuartz.mm KRenderingDeviceQuartz.mm
ksvg2/scripts make_names.pl
ksvg2/svg SVGElementImpl.cpp SVGFECompositeElementImpl.cpp
SVGSVGElementImpl.cpp
Added: kcanvas/device/quartz/filters WKArithmeticFilter.cikernel
WKArithmeticFilter.h WKArithmeticFilter.m
WKDiffuseLightingFilter.cikernel
WKDiffuseLightingFilter.h WKDiffuseLightingFilter.m
WKDistantLightFilter.cikernel
WKDistantLightFilter.h WKDistantLightFilter.m
WKNormalMapFilter.cikernel WKNormalMapFilter.h
WKNormalMapFilter.m WKPointLightFilter.cikernel
WKPointLightFilter.h WKPointLightFilter.m
WKSpecularLightingFilter.cikernel
WKSpecularLightingFilter.h
WKSpecularLightingFilter.m
WKSpotLightFilter.cikernel WKSpotLightFilter.h
WKSpotLightFilter.m
ksvg2/svg SVGAnimatedColorImpl.cpp SVGAnimatedColorImpl.h
SVGFEDiffuseLightingElementImpl.cpp
SVGFEDiffuseLightingElementImpl.h
SVGFEDistantLightElementImpl.cpp
SVGFEDistantLightElementImpl.h
SVGFELightElementImpl.cpp SVGFELightElementImpl.h
SVGFEPointLightElementImpl.cpp
SVGFEPointLightElementImpl.h
SVGFESpecularLightingElementImpl.cpp
SVGFESpecularLightingElementImpl.h
SVGFESpotLightElementImpl.cpp
SVGFESpotLightElementImpl.h
Log:
Bug #: 5192
Submitted by: oliver hunt
Reviewed by: eseidel
Fixes 2 lighting test cases.
First-pass lighting filter implementation from Oliver.
Also incomplete first-pass feConvolveMatrix
Adding temporary QPointF, QSizeF for filter use.
* WebCore.xcodeproj/project.pbxproj: added lighting classes
* kcanvas/KCanvasFilters.cpp:
(KCanvasPoint3F::normalize): added
(operator<<):
(KCPointLightSource::externalRepresentation): added
(KCSpotLightSource::externalRepresentation): added
(KCDistantLightSource::externalRepresentation): added
(KCanvasFEConvolveMatrix::externalRepresentation): added
(KCanvasFEDiffuseLighting::externalRepresentation): added
* kcanvas/KCanvasFilters.h:
(KCanvasPoint3F::KCanvasPoint3F): added
(KCanvasPoint3F::x): added
(KCanvasPoint3F::setX): added
(KCanvasPoint3F::y): added
(KCanvasPoint3F::setY): added
(KCanvasPoint3F::z): added
(KCanvasPoint3F::setZ): added
(QPointF::QPointF): added
(QPointF::x): added
(QPointF::setX): added
(QPointF::y): added
(QPointF::setY): added
(QSizeF::QPointF): added
(QSizeF::width): added
(QSizeF::setWidth): added
(QSizeF::height): added
(QSizeF::setHeight): added
(KCanvasFEConvolveMatrix::kernelSize): added
(KCanvasFEConvolveMatrix::setKernelSize): added
(KCanvasFEConvolveMatrix::kernel): added
(KCanvasFEConvolveMatrix::setKernel): added
(KCanvasFEConvolveMatrix::divisor): added
(KCanvasFEConvolveMatrix::setDivisor): added
(KCanvasFEConvolveMatrix::bias): added
(KCanvasFEConvolveMatrix::setBias): added
(KCanvasFEConvolveMatrix::targetOffset): added
(KCanvasFEConvolveMatrix::setTargetOffset): added
(KCanvasFEConvolveMatrix::edgeMode): added
(KCanvasFEConvolveMatrix::setEdgeMode): added
(KCanvasFEConvolveMatrix::kernelUnitLength): added
(KCanvasFEConvolveMatrix::setKernelUnitLength): added
(KCanvasFEConvolveMatrix::preserveAlpha): added
(KCanvasFEConvolveMatrix::setPreserveAlpha): added
(KCLightSource::KCLightSource): added
(KCLightSource::~KCLightSource): added
(KCLightSource::type): added
(KCDistantLightSource::KCDistantLightSource): added
(KCDistantLightSource::azimuth): added
(KCDistantLightSource::elevation): added
(KCPointLightSource::KCPointLightSource) added:
(KCPointLightSource::position): added
(KCSpotLightSource::KCSpotLightSource): added
(KCSpotLightSource::position): added
(KCSpotLightSource::direction): added
(KCSpotLightSource::specularExponent): added
(KCSpotLightSource::limitingConeAngle): added
(KCanvasFEDiffuseLighting::lightingColor): added
(KCanvasFEDiffuseLighting::setLightingColor): added
(KCanvasFEDiffuseLighting::surfaceScale): added
(KCanvasFEDiffuseLighting::setSurfaceScale): added
(KCanvasFEDiffuseLighting::diffuseConstant): added
(KCanvasFEDiffuseLighting::setDiffuseConstant): added
(KCanvasFEDiffuseLighting::kernelUnitLengthX): added
(KCanvasFEDiffuseLighting::setKernelUnitLengthX): added
(KCanvasFEDiffuseLighting::kernelUnitLengthY): added
(KCanvasFEDiffuseLighting::setKernelUnitLengthY): added
(KCanvasFEDiffuseLighting::lightSource): added
(KCanvasFEDiffuseLighting::setLightSource): added
(KCanvasFESpecularLighting::lightingColor): added
(KCanvasFESpecularLighting::setLightingColor): added
(KCanvasFESpecularLighting::surfaceScale): added
(KCanvasFESpecularLighting::setSurfaceScale): added
(KCanvasFESpecularLighting::specularConstant): added
(KCanvasFESpecularLighting::setSpecularConstant): added
(KCanvasFESpecularLighting::specularExponent): added
(KCanvasFESpecularLighting::setSpecularExponent): added
(KCanvasFESpecularLighting::kernelUnitLengthX): added
(KCanvasFESpecularLighting::setKernelUnitLengthX): added
(KCanvasFESpecularLighting::kernelUnitLengthY): added
(KCanvasFESpecularLighting::setKernelUnitLengthY): added
(KCanvasFESpecularLighting::lightSource): added
(KCanvasFESpecularLighting::setLightSource): added
* kcanvas/KCanvasTreeDebug.cpp:
* kcanvas/device/quartz/KCanvasFilterQuartz.h:
* kcanvas/device/quartz/KCanvasFilterQuartz.mm:
(ciColor): uncommented
(ciVector): added
(KCanvasFECompositeQuartz::getCIFilter): spacing fix
(getPointLightVectors): added
(getLightVectors): added
(getNormalMap): added
(KCanvasFEDiffuseLightingQuartz::getCIFilter): added
(KCanvasFEGaussianBlurQuartz::getCIFilter): changed CI filter
(KCanvasFESpecularLightingQuartz::getCIFilter): added
* kcanvas/device/quartz/KRenderingDeviceQuartz.mm:
(KRenderingDeviceQuartz::createFilterEffect): added lighting
* kcanvas/device/quartz/filters/WKArithmeticFilter.cikernel: Added.
* kcanvas/device/quartz/filters/WKArithmeticFilter.h: Added.
* kcanvas/device/quartz/filters/WKArithmeticFilter.m: Added.
(+[WKArithmeticFilter initialize]): added
(+[WKArithmeticFilter filterWithName:]): added
(-[WKArithmeticFilter init]): added
(-[WKArithmeticFilter outputImage]): added
* kcanvas/device/quartz/filters/WKDiffuseLightingFilter.cikernel: Added.
* kcanvas/device/quartz/filters/WKDiffuseLightingFilter.h: Added.
* kcanvas/device/quartz/filters/WKDiffuseLightingFilter.m: Added.
(+[WKDiffuseLightingFilter initialize]): added
(+[WKDiffuseLightingFilter filterWithName:]): added
(-[WKDiffuseLightingFilter init]): added
(-[WKDiffuseLightingFilter outputImage]): added
* kcanvas/device/quartz/filters/WKDistantLightFilter.cikernel: Added.
* kcanvas/device/quartz/filters/WKDistantLightFilter.h: Added.
* kcanvas/device/quartz/filters/WKDistantLightFilter.m: Added.
(+[WKDistantLightFilter initialize]): added
(+[WKDistantLightFilter filterWithName:]): added
(-[WKDistantLightFilter init]): added
(-[WKDistantLightFilter outputImage]): added
* kcanvas/device/quartz/filters/WKNormalMapFilter.cikernel: Added.
* kcanvas/device/quartz/filters/WKNormalMapFilter.h: Added.
* kcanvas/device/quartz/filters/WKNormalMapFilter.m: Added.
(+[WKNormalMapFilter initialize]): added
(+[WKNormalMapFilter filterWithName:]): added
(-[WKNormalMapFilter init]): added
(-[WKNormalMapFilter xConvolveArgsWithBumpMap:]): added
(-[WKNormalMapFilter yConvolveArgsWithBumpMap:]): added
(-[WKNormalMapFilter outputImage]): added
* kcanvas/device/quartz/filters/WKPointLightFilter.cikernel: Added.
* kcanvas/device/quartz/filters/WKPointLightFilter.h: Added.
* kcanvas/device/quartz/filters/WKPointLightFilter.m: Added.
(+[WKPointLightFilter initialize]): added
(+[WKPointLightFilter filterWithName:]): added
(-[WKPointLightFilter init]): added
(-[WKPointLightFilter outputImage]): added
* kcanvas/device/quartz/filters/WKSpecularLightingFilter.cikernel: Added.
* kcanvas/device/quartz/filters/WKSpecularLightingFilter.h: Added.
* kcanvas/device/quartz/filters/WKSpecularLightingFilter.m: Added.
(+[WKSpecularLightingFilter initialize]): added
(+[WKSpecularLightingFilter filterWithName:]): added
(-[WKSpecularLightingFilter init]): added
(-[WKSpecularLightingFilter outputImage]): added
* kcanvas/device/quartz/filters/WKSpotLightFilter.cikernel: Added.
* kcanvas/device/quartz/filters/WKSpotLightFilter.h: Added.
* kcanvas/device/quartz/filters/WKSpotLightFilter.m: Added.
(+[WKSpotLightFilter initialize]): added
(+[WKSpotLightFilter filterWithName:]): added
(-[WKSpotLightFilter init]): added
(-[WKSpotLightFilter outputImage]): added
* ksvg2/scripts/make_names.pl: now creates lighting elements
* ksvg2/svg/SVGAnimatedColorImpl.cpp: Added.
(SVGAnimatedColorImpl::SVGAnimatedColorImpl): added
(SVGAnimatedColorImpl::~SVGAnimatedColorImpl): added
(SVGAnimatedColorImpl::create): added
(SVGAnimatedColorImpl::assign): added
* ksvg2/svg/SVGAnimatedColorImpl.h: Added.
* ksvg2/svg/SVGElementImpl.cpp: HTMLNames -> htmlnames
* ksvg2/svg/SVGFECompositeElementImpl.cpp:
(SVGFECompositeElementImpl::parseMappedAttribute): spelling fix
* ksvg2/svg/SVGFEDiffuseLightingElementImpl.cpp: Added.
(SVGFEDiffuseLightingElementImpl::SVGFEDiffuseLightingElementImpl):
(SVGFEDiffuseLightingElementImpl::~SVGFEDiffuseLightingElementImpl):
(SVGFEDiffuseLightingElementImpl::in1): added
(SVGFEDiffuseLightingElementImpl::diffuseConstant): added
(SVGFEDiffuseLightingElementImpl::surfaceScale): added
(SVGFEDiffuseLightingElementImpl::kernelUnitLengthX): added
(SVGFEDiffuseLightingElementImpl::kernelUnitLengthY): added
(SVGFEDiffuseLightingElementImpl::lightingColor): added
(SVGFEDiffuseLightingElementImpl::parseMappedAttribute): added
(SVGFEDiffuseLightingElementImpl::filterEffect): added
(SVGFEDiffuseLightingElementImpl::updateLights): added
* ksvg2/svg/SVGFEDiffuseLightingElementImpl.h: Added.
* ksvg2/svg/SVGFEDistantLightElementImpl.cpp: Added.
(SVGFEDistantLightElementImpl::SVGFEDistantLightElementImpl):
(SVGFEDistantLightElementImpl::~SVGFEDistantLightElementImpl):
(SVGFEDistantLightElementImpl::lightSource): added
* ksvg2/svg/SVGFEDistantLightElementImpl.h: Added.
* ksvg2/svg/SVGFELightElementImpl.cpp: Added.
(SVGFELightElementImpl::SVGFELightElementImpl): added
(SVGFELightElementImpl::~SVGFELightElementImpl): added
(SVGFELightElementImpl::azimuth): added
(SVGFELightElementImpl::elevation): added
(SVGFELightElementImpl::x): added
(SVGFELightElementImpl::y): added
(SVGFELightElementImpl::z): added
(SVGFELightElementImpl::pointsAtX): added
(SVGFELightElementImpl::pointsAtY): added
(SVGFELightElementImpl::pointsAtZ): added
(SVGFELightElementImpl::specularExponent): added
(SVGFELightElementImpl::limitingConeAngle): added
(SVGFELightElementImpl::parseMappedAttribute): added
* ksvg2/svg/SVGFELightElementImpl.h: Added.
* ksvg2/svg/SVGFEPointLightElementImpl.cpp: Added.
(SVGFEPointLightElementImpl::SVGFEPointLightElementImpl): added
(SVGFEPointLightElementImpl::~SVGFEPointLightElementImpl): added
(SVGFEPointLightElementImpl::lightSource): added
* ksvg2/svg/SVGFEPointLightElementImpl.h: Added.
* ksvg2/svg/SVGFESpecularLightingElementImpl.cpp: Added.
(SVGFESpecularLightingElementImpl::SVGFESpecularLightingElementImpl):
(SVGFESpecularLightingElementImpl::~SVGFESpecularLightingElementImpl):
(SVGFESpecularLightingElementImpl::in1): added
(SVGFESpecularLightingElementImpl::specularConstant): added
(SVGFESpecularLightingElementImpl::specularExponent): added
(SVGFESpecularLightingElementImpl::surfaceScale): added
(SVGFESpecularLightingElementImpl::kernelUnitLengthX): added
(SVGFESpecularLightingElementImpl::kernelUnitLengthY): added
(SVGFESpecularLightingElementImpl::lightingColor): added
(SVGFESpecularLightingElementImpl::parseMappedAttribute): added
(SVGFESpecularLightingElementImpl::filterEffect): added
(SVGFESpecularLightingElementImpl::updateLights): added
* ksvg2/svg/SVGFESpecularLightingElementImpl.h: Added.
* ksvg2/svg/SVGFESpotLightElementImpl.cpp: Added.
(SVGFESpotLightElementImpl::SVGFESpotLightElementImpl): added
(SVGFESpotLightElementImpl::~SVGFESpotLightElementImpl): added
(SVGFESpotLightElementImpl::lightSource): added
* ksvg2/svg/SVGFESpotLightElementImpl.h: Added.
* ksvg2/svg/SVGSVGElementImpl.cpp: HTMLNames -> htmlnames
Revision Changes Path
1.412 +226 -0 WebCore/ChangeLog
Index: ChangeLog
===================================================================
RCS file: /cvs/root/WebCore/ChangeLog,v
retrieving revision 1.411
retrieving revision 1.412
diff -u -r1.411 -r1.412
--- ChangeLog 28 Nov 2005 18:23:45 -0000 1.411
+++ ChangeLog 28 Nov 2005 23:33:46 -0000 1.412
@@ -1,3 +1,229 @@
+2005-11-28 Oliver Hunt <ojh16 at student.canterbury.ac.nz>
+
+ Reviewed by eseidel. Committed by eseidel.
+
+ Fixes 2 lighting test cases.
+
+ First-pass lighting filter implementation from Oliver.
+ Also incomplete first-pass feConvolveMatrix
+ Adding temporary QPointF, QSizeF for filter use.
+
+ * WebCore.xcodeproj/project.pbxproj: added lighting classes
+ * kcanvas/KCanvasFilters.cpp:
+ (KCanvasPoint3F::normalize): added
+ (operator<<):
+ (KCPointLightSource::externalRepresentation): added
+ (KCSpotLightSource::externalRepresentation): added
+ (KCDistantLightSource::externalRepresentation): added
+ (KCanvasFEConvolveMatrix::externalRepresentation): added
+ (KCanvasFEDiffuseLighting::externalRepresentation): added
+ * kcanvas/KCanvasFilters.h:
+ (KCanvasPoint3F::KCanvasPoint3F): added
+ (KCanvasPoint3F::x): added
+ (KCanvasPoint3F::setX): added
+ (KCanvasPoint3F::y): added
+ (KCanvasPoint3F::setY): added
+ (KCanvasPoint3F::z): added
+ (KCanvasPoint3F::setZ): added
+ (QPointF::QPointF): added
+ (QPointF::x): added
+ (QPointF::setX): added
+ (QPointF::y): added
+ (QPointF::setY): added
+ (QSizeF::QPointF): added
+ (QSizeF::width): added
+ (QSizeF::setWidth): added
+ (QSizeF::height): added
+ (QSizeF::setHeight): added
+ (KCanvasFEConvolveMatrix::kernelSize): added
+ (KCanvasFEConvolveMatrix::setKernelSize): added
+ (KCanvasFEConvolveMatrix::kernel): added
+ (KCanvasFEConvolveMatrix::setKernel): added
+ (KCanvasFEConvolveMatrix::divisor): added
+ (KCanvasFEConvolveMatrix::setDivisor): added
+ (KCanvasFEConvolveMatrix::bias): added
+ (KCanvasFEConvolveMatrix::setBias): added
+ (KCanvasFEConvolveMatrix::targetOffset): added
+ (KCanvasFEConvolveMatrix::setTargetOffset): added
+ (KCanvasFEConvolveMatrix::edgeMode): added
+ (KCanvasFEConvolveMatrix::setEdgeMode): added
+ (KCanvasFEConvolveMatrix::kernelUnitLength): added
+ (KCanvasFEConvolveMatrix::setKernelUnitLength): added
+ (KCanvasFEConvolveMatrix::preserveAlpha): added
+ (KCanvasFEConvolveMatrix::setPreserveAlpha): added
+ (KCLightSource::KCLightSource): added
+ (KCLightSource::~KCLightSource): added
+ (KCLightSource::type): added
+ (KCDistantLightSource::KCDistantLightSource): added
+ (KCDistantLightSource::azimuth): added
+ (KCDistantLightSource::elevation): added
+ (KCPointLightSource::KCPointLightSource) added:
+ (KCPointLightSource::position): added
+ (KCSpotLightSource::KCSpotLightSource): added
+ (KCSpotLightSource::position): added
+ (KCSpotLightSource::direction): added
+ (KCSpotLightSource::specularExponent): added
+ (KCSpotLightSource::limitingConeAngle): added
+ (KCanvasFEDiffuseLighting::lightingColor): added
+ (KCanvasFEDiffuseLighting::setLightingColor): added
+ (KCanvasFEDiffuseLighting::surfaceScale): added
+ (KCanvasFEDiffuseLighting::setSurfaceScale): added
+ (KCanvasFEDiffuseLighting::diffuseConstant): added
+ (KCanvasFEDiffuseLighting::setDiffuseConstant): added
+ (KCanvasFEDiffuseLighting::kernelUnitLengthX): added
+ (KCanvasFEDiffuseLighting::setKernelUnitLengthX): added
+ (KCanvasFEDiffuseLighting::kernelUnitLengthY): added
+ (KCanvasFEDiffuseLighting::setKernelUnitLengthY): added
+ (KCanvasFEDiffuseLighting::lightSource): added
+ (KCanvasFEDiffuseLighting::setLightSource): added
+ (KCanvasFESpecularLighting::lightingColor): added
+ (KCanvasFESpecularLighting::setLightingColor): added
+ (KCanvasFESpecularLighting::surfaceScale): added
+ (KCanvasFESpecularLighting::setSurfaceScale): added
+ (KCanvasFESpecularLighting::specularConstant): added
+ (KCanvasFESpecularLighting::setSpecularConstant): added
+ (KCanvasFESpecularLighting::specularExponent): added
+ (KCanvasFESpecularLighting::setSpecularExponent): added
+ (KCanvasFESpecularLighting::kernelUnitLengthX): added
+ (KCanvasFESpecularLighting::setKernelUnitLengthX): added
+ (KCanvasFESpecularLighting::kernelUnitLengthY): added
+ (KCanvasFESpecularLighting::setKernelUnitLengthY): added
+ (KCanvasFESpecularLighting::lightSource): added
+ (KCanvasFESpecularLighting::setLightSource): added
+ * kcanvas/KCanvasTreeDebug.cpp:
+ * kcanvas/device/quartz/KCanvasFilterQuartz.h:
+ * kcanvas/device/quartz/KCanvasFilterQuartz.mm:
+ (ciColor): uncommented
+ (ciVector): added
+ (KCanvasFECompositeQuartz::getCIFilter): spacing fix
+ (getPointLightVectors): added
+ (getLightVectors): added
+ (getNormalMap): added
+ (KCanvasFEDiffuseLightingQuartz::getCIFilter): added
+ (KCanvasFEGaussianBlurQuartz::getCIFilter): changed CI filter
+ (KCanvasFESpecularLightingQuartz::getCIFilter): added
+ * kcanvas/device/quartz/KRenderingDeviceQuartz.mm:
+ (KRenderingDeviceQuartz::createFilterEffect): added lighting
+ * kcanvas/device/quartz/filters/WKArithmeticFilter.cikernel: Added.
+ * kcanvas/device/quartz/filters/WKArithmeticFilter.h: Added.
+ * kcanvas/device/quartz/filters/WKArithmeticFilter.m: Added.
+ (+[WKArithmeticFilter initialize]): added
+ (+[WKArithmeticFilter filterWithName:]): added
+ (-[WKArithmeticFilter init]): added
+ (-[WKArithmeticFilter outputImage]): added
+ * kcanvas/device/quartz/filters/WKDiffuseLightingFilter.cikernel: Added.
+ * kcanvas/device/quartz/filters/WKDiffuseLightingFilter.h: Added.
+ * kcanvas/device/quartz/filters/WKDiffuseLightingFilter.m: Added.
+ (+[WKDiffuseLightingFilter initialize]): added
+ (+[WKDiffuseLightingFilter filterWithName:]): added
+ (-[WKDiffuseLightingFilter init]): added
+ (-[WKDiffuseLightingFilter outputImage]): added
+ * kcanvas/device/quartz/filters/WKDistantLightFilter.cikernel: Added.
+ * kcanvas/device/quartz/filters/WKDistantLightFilter.h: Added.
+ * kcanvas/device/quartz/filters/WKDistantLightFilter.m: Added.
+ (+[WKDistantLightFilter initialize]): added
+ (+[WKDistantLightFilter filterWithName:]): added
+ (-[WKDistantLightFilter init]): added
+ (-[WKDistantLightFilter outputImage]): added
+ * kcanvas/device/quartz/filters/WKNormalMapFilter.cikernel: Added.
+ * kcanvas/device/quartz/filters/WKNormalMapFilter.h: Added.
+ * kcanvas/device/quartz/filters/WKNormalMapFilter.m: Added.
+ (+[WKNormalMapFilter initialize]): added
+ (+[WKNormalMapFilter filterWithName:]): added
+ (-[WKNormalMapFilter init]): added
+ (-[WKNormalMapFilter xConvolveArgsWithBumpMap:]): added
+ (-[WKNormalMapFilter yConvolveArgsWithBumpMap:]): added
+ (-[WKNormalMapFilter outputImage]): added
+ * kcanvas/device/quartz/filters/WKPointLightFilter.cikernel: Added.
+ * kcanvas/device/quartz/filters/WKPointLightFilter.h: Added.
+ * kcanvas/device/quartz/filters/WKPointLightFilter.m: Added.
+ (+[WKPointLightFilter initialize]): added
+ (+[WKPointLightFilter filterWithName:]): added
+ (-[WKPointLightFilter init]): added
+ (-[WKPointLightFilter outputImage]): added
+ * kcanvas/device/quartz/filters/WKSpecularLightingFilter.cikernel: Added.
+ * kcanvas/device/quartz/filters/WKSpecularLightingFilter.h: Added.
+ * kcanvas/device/quartz/filters/WKSpecularLightingFilter.m: Added.
+ (+[WKSpecularLightingFilter initialize]): added
+ (+[WKSpecularLightingFilter filterWithName:]): added
+ (-[WKSpecularLightingFilter init]): added
+ (-[WKSpecularLightingFilter outputImage]): added
+ * kcanvas/device/quartz/filters/WKSpotLightFilter.cikernel: Added.
+ * kcanvas/device/quartz/filters/WKSpotLightFilter.h: Added.
+ * kcanvas/device/quartz/filters/WKSpotLightFilter.m: Added.
+ (+[WKSpotLightFilter initialize]): added
+ (+[WKSpotLightFilter filterWithName:]): added
+ (-[WKSpotLightFilter init]): added
+ (-[WKSpotLightFilter outputImage]): added
+ * ksvg2/scripts/make_names.pl: now creates lighting elements
+ * ksvg2/svg/SVGAnimatedColorImpl.cpp: Added.
+ (SVGAnimatedColorImpl::SVGAnimatedColorImpl): added
+ (SVGAnimatedColorImpl::~SVGAnimatedColorImpl): added
+ (SVGAnimatedColorImpl::create): added
+ (SVGAnimatedColorImpl::assign): added
+ * ksvg2/svg/SVGAnimatedColorImpl.h: Added.
+ * ksvg2/svg/SVGElementImpl.cpp: HTMLNames -> htmlnames
+ * ksvg2/svg/SVGFECompositeElementImpl.cpp:
+ (SVGFECompositeElementImpl::parseMappedAttribute): spelling fix
+ * ksvg2/svg/SVGFEDiffuseLightingElementImpl.cpp: Added.
+ (SVGFEDiffuseLightingElementImpl::SVGFEDiffuseLightingElementImpl):
+ (SVGFEDiffuseLightingElementImpl::~SVGFEDiffuseLightingElementImpl):
+ (SVGFEDiffuseLightingElementImpl::in1): added
+ (SVGFEDiffuseLightingElementImpl::diffuseConstant): added
+ (SVGFEDiffuseLightingElementImpl::surfaceScale): added
+ (SVGFEDiffuseLightingElementImpl::kernelUnitLengthX): added
+ (SVGFEDiffuseLightingElementImpl::kernelUnitLengthY): added
+ (SVGFEDiffuseLightingElementImpl::lightingColor): added
+ (SVGFEDiffuseLightingElementImpl::parseMappedAttribute): added
+ (SVGFEDiffuseLightingElementImpl::filterEffect): added
+ (SVGFEDiffuseLightingElementImpl::updateLights): added
+ * ksvg2/svg/SVGFEDiffuseLightingElementImpl.h: Added.
+ * ksvg2/svg/SVGFEDistantLightElementImpl.cpp: Added.
+ (SVGFEDistantLightElementImpl::SVGFEDistantLightElementImpl):
+ (SVGFEDistantLightElementImpl::~SVGFEDistantLightElementImpl):
+ (SVGFEDistantLightElementImpl::lightSource): added
+ * ksvg2/svg/SVGFEDistantLightElementImpl.h: Added.
+ * ksvg2/svg/SVGFELightElementImpl.cpp: Added.
+ (SVGFELightElementImpl::SVGFELightElementImpl): added
+ (SVGFELightElementImpl::~SVGFELightElementImpl): added
+ (SVGFELightElementImpl::azimuth): added
+ (SVGFELightElementImpl::elevation): added
+ (SVGFELightElementImpl::x): added
+ (SVGFELightElementImpl::y): added
+ (SVGFELightElementImpl::z): added
+ (SVGFELightElementImpl::pointsAtX): added
+ (SVGFELightElementImpl::pointsAtY): added
+ (SVGFELightElementImpl::pointsAtZ): added
+ (SVGFELightElementImpl::specularExponent): added
+ (SVGFELightElementImpl::limitingConeAngle): added
+ (SVGFELightElementImpl::parseMappedAttribute): added
+ * ksvg2/svg/SVGFELightElementImpl.h: Added.
+ * ksvg2/svg/SVGFEPointLightElementImpl.cpp: Added.
+ (SVGFEPointLightElementImpl::SVGFEPointLightElementImpl): added
+ (SVGFEPointLightElementImpl::~SVGFEPointLightElementImpl): added
+ (SVGFEPointLightElementImpl::lightSource): added
+ * ksvg2/svg/SVGFEPointLightElementImpl.h: Added.
+ * ksvg2/svg/SVGFESpecularLightingElementImpl.cpp: Added.
+ (SVGFESpecularLightingElementImpl::SVGFESpecularLightingElementImpl):
+ (SVGFESpecularLightingElementImpl::~SVGFESpecularLightingElementImpl):
+ (SVGFESpecularLightingElementImpl::in1): added
+ (SVGFESpecularLightingElementImpl::specularConstant): added
+ (SVGFESpecularLightingElementImpl::specularExponent): added
+ (SVGFESpecularLightingElementImpl::surfaceScale): added
+ (SVGFESpecularLightingElementImpl::kernelUnitLengthX): added
+ (SVGFESpecularLightingElementImpl::kernelUnitLengthY): added
+ (SVGFESpecularLightingElementImpl::lightingColor): added
+ (SVGFESpecularLightingElementImpl::parseMappedAttribute): added
+ (SVGFESpecularLightingElementImpl::filterEffect): added
+ (SVGFESpecularLightingElementImpl::updateLights): added
+ * ksvg2/svg/SVGFESpecularLightingElementImpl.h: Added.
+ * ksvg2/svg/SVGFESpotLightElementImpl.cpp: Added.
+ (SVGFESpotLightElementImpl::SVGFESpotLightElementImpl): added
+ (SVGFESpotLightElementImpl::~SVGFESpotLightElementImpl): added
+ (SVGFESpotLightElementImpl::lightSource): added
+ * ksvg2/svg/SVGFESpotLightElementImpl.h: Added.
+ * ksvg2/svg/SVGSVGElementImpl.cpp: HTMLNames -> htmlnames
+
2005-11-28 Beth Dakin <bdakin at apple.com>
Reviewed by Geoff
1.47 +148 -0 WebCore/WebCore.xcodeproj/project.pbxproj
Index: project.pbxproj
===================================================================
RCS file: /cvs/root/WebCore/WebCore.xcodeproj/project.pbxproj,v
retrieving revision 1.46
retrieving revision 1.47
diff -u -r1.46 -r1.47
--- project.pbxproj 26 Nov 2005 22:27:03 -0000 1.46
+++ project.pbxproj 28 Nov 2005 23:33:55 -0000 1.47
@@ -1541,6 +1541,41 @@
A8C0FFFD089701FC00BA5114 /* KRenderingPaintServerQuartz.mm in Sources */ = {isa = PBXBuildFile; fileRef = A8C0FB75089701F800BA5114 /* KRenderingPaintServerQuartz.mm */; };
A8C0FFFE089701FC00BA5114 /* QuartzSupport.h in Headers */ = {isa = PBXBuildFile; fileRef = A8C0FB76089701F800BA5114 /* QuartzSupport.h */; };
A8C0FFFF089701FC00BA5114 /* QuartzSupport.mm in Sources */ = {isa = PBXBuildFile; fileRef = A8C0FB77089701F800BA5114 /* QuartzSupport.mm */; };
+ A8C32935093BB732000B9CAC /* WKArithmeticFilter.cikernel in Resources */ = {isa = PBXBuildFile; fileRef = A8C32920093BB732000B9CAC /* WKArithmeticFilter.cikernel */; };
+ A8C32936093BB732000B9CAC /* WKArithmeticFilter.h in Headers */ = {isa = PBXBuildFile; fileRef = A8C32921093BB732000B9CAC /* WKArithmeticFilter.h */; };
+ A8C32937093BB732000B9CAC /* WKArithmeticFilter.m in Sources */ = {isa = PBXBuildFile; fileRef = A8C32922093BB732000B9CAC /* WKArithmeticFilter.m */; };
+ A8C32938093BB732000B9CAC /* WKDiffuseLightingFilter.cikernel in Resources */ = {isa = PBXBuildFile; fileRef = A8C32923093BB732000B9CAC /* WKDiffuseLightingFilter.cikernel */; };
+ A8C32939093BB732000B9CAC /* WKDiffuseLightingFilter.h in Headers */ = {isa = PBXBuildFile; fileRef = A8C32924093BB732000B9CAC /* WKDiffuseLightingFilter.h */; };
+ A8C3293A093BB732000B9CAC /* WKDiffuseLightingFilter.m in Sources */ = {isa = PBXBuildFile; fileRef = A8C32925093BB732000B9CAC /* WKDiffuseLightingFilter.m */; };
+ A8C3293B093BB732000B9CAC /* WKDistantLightFilter.cikernel in Resources */ = {isa = PBXBuildFile; fileRef = A8C32926093BB732000B9CAC /* WKDistantLightFilter.cikernel */; };
+ A8C3293C093BB732000B9CAC /* WKDistantLightFilter.h in Headers */ = {isa = PBXBuildFile; fileRef = A8C32927093BB732000B9CAC /* WKDistantLightFilter.h */; };
+ A8C3293D093BB732000B9CAC /* WKDistantLightFilter.m in Sources */ = {isa = PBXBuildFile; fileRef = A8C32928093BB732000B9CAC /* WKDistantLightFilter.m */; };
+ A8C3293E093BB732000B9CAC /* WKNormalMapFilter.cikernel in Resources */ = {isa = PBXBuildFile; fileRef = A8C32929093BB732000B9CAC /* WKNormalMapFilter.cikernel */; };
+ A8C3293F093BB732000B9CAC /* WKNormalMapFilter.h in Headers */ = {isa = PBXBuildFile; fileRef = A8C3292A093BB732000B9CAC /* WKNormalMapFilter.h */; };
+ A8C32940093BB732000B9CAC /* WKNormalMapFilter.m in Sources */ = {isa = PBXBuildFile; fileRef = A8C3292B093BB732000B9CAC /* WKNormalMapFilter.m */; };
+ A8C32941093BB732000B9CAC /* WKPointLightFilter.cikernel in Resources */ = {isa = PBXBuildFile; fileRef = A8C3292C093BB732000B9CAC /* WKPointLightFilter.cikernel */; };
+ A8C32942093BB732000B9CAC /* WKPointLightFilter.h in Headers */ = {isa = PBXBuildFile; fileRef = A8C3292D093BB732000B9CAC /* WKPointLightFilter.h */; };
+ A8C32943093BB732000B9CAC /* WKPointLightFilter.m in Sources */ = {isa = PBXBuildFile; fileRef = A8C3292E093BB732000B9CAC /* WKPointLightFilter.m */; };
+ A8C32944093BB732000B9CAC /* WKSpecularLightingFilter.cikernel in Resources */ = {isa = PBXBuildFile; fileRef = A8C3292F093BB732000B9CAC /* WKSpecularLightingFilter.cikernel */; };
+ A8C32945093BB732000B9CAC /* WKSpecularLightingFilter.h in Headers */ = {isa = PBXBuildFile; fileRef = A8C32930093BB732000B9CAC /* WKSpecularLightingFilter.h */; };
+ A8C32946093BB732000B9CAC /* WKSpecularLightingFilter.m in Sources */ = {isa = PBXBuildFile; fileRef = A8C32931093BB732000B9CAC /* WKSpecularLightingFilter.m */; };
+ A8C32947093BB732000B9CAC /* WKSpotLightFilter.cikernel in Resources */ = {isa = PBXBuildFile; fileRef = A8C32932093BB732000B9CAC /* WKSpotLightFilter.cikernel */; };
+ A8C32948093BB732000B9CAC /* WKSpotLightFilter.h in Headers */ = {isa = PBXBuildFile; fileRef = A8C32933093BB732000B9CAC /* WKSpotLightFilter.h */; };
+ A8C32949093BB732000B9CAC /* WKSpotLightFilter.m in Sources */ = {isa = PBXBuildFile; fileRef = A8C32934093BB732000B9CAC /* WKSpotLightFilter.m */; };
+ A8C3294C093BB78C000B9CAC /* SVGAnimatedColorImpl.h in Headers */ = {isa = PBXBuildFile; fileRef = A8C3294A093BB78C000B9CAC /* SVGAnimatedColorImpl.h */; };
+ A8C3294D093BB78C000B9CAC /* SVGAnimatedColorImpl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A8C3294B093BB78C000B9CAC /* SVGAnimatedColorImpl.cpp */; };
+ A8C32968093BB7B2000B9CAC /* SVGFELightElementImpl.h in Headers */ = {isa = PBXBuildFile; fileRef = A8C3295C093BB7B2000B9CAC /* SVGFELightElementImpl.h */; };
+ A8C32969093BB7B2000B9CAC /* SVGFELightElementImpl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A8C3295D093BB7B2000B9CAC /* SVGFELightElementImpl.cpp */; };
+ A8C3296A093BB7B2000B9CAC /* SVGFEDistantLightElementImpl.h in Headers */ = {isa = PBXBuildFile; fileRef = A8C3295E093BB7B2000B9CAC /* SVGFEDistantLightElementImpl.h */; };
+ A8C3296B093BB7B2000B9CAC /* SVGFEDistantLightElementImpl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A8C3295F093BB7B2000B9CAC /* SVGFEDistantLightElementImpl.cpp */; };
+ A8C3296C093BB7B2000B9CAC /* SVGFEDiffuseLightingElementImpl.h in Headers */ = {isa = PBXBuildFile; fileRef = A8C32960093BB7B2000B9CAC /* SVGFEDiffuseLightingElementImpl.h */; };
+ A8C3296D093BB7B2000B9CAC /* SVGFEDiffuseLightingElementImpl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A8C32961093BB7B2000B9CAC /* SVGFEDiffuseLightingElementImpl.cpp */; };
+ A8C3296E093BB7B2000B9CAC /* SVGFESpotLightElementImpl.h in Headers */ = {isa = PBXBuildFile; fileRef = A8C32962093BB7B2000B9CAC /* SVGFESpotLightElementImpl.h */; };
+ A8C3296F093BB7B2000B9CAC /* SVGFESpotLightElementImpl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A8C32963093BB7B2000B9CAC /* SVGFESpotLightElementImpl.cpp */; };
+ A8C32970093BB7B2000B9CAC /* SVGFESpecularLightingElementImpl.h in Headers */ = {isa = PBXBuildFile; fileRef = A8C32964093BB7B2000B9CAC /* SVGFESpecularLightingElementImpl.h */; };
+ A8C32971093BB7B2000B9CAC /* SVGFESpecularLightingElementImpl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A8C32965093BB7B2000B9CAC /* SVGFESpecularLightingElementImpl.cpp */; };
+ A8C32972093BB7B2000B9CAC /* SVGFEPointLightElementImpl.h in Headers */ = {isa = PBXBuildFile; fileRef = A8C32966093BB7B2000B9CAC /* SVGFEPointLightElementImpl.h */; };
+ A8C32973093BB7B2000B9CAC /* SVGFEPointLightElementImpl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A8C32967093BB7B2000B9CAC /* SVGFEPointLightElementImpl.cpp */; };
A8FD8B86087CB44C00DC3707 /* KWQWMatrix.mm in Sources */ = {isa = PBXBuildFile; fileRef = A85D7A8C0879EC64006A9172 /* KWQWMatrix.mm */; };
A8FD8B87087CB45700DC3707 /* KWQWMatrix.h in Headers */ = {isa = PBXBuildFile; fileRef = A85D7A8D0879EC64006A9172 /* KWQWMatrix.h */; };
BC179892088D975F006068A5 /* render_theme_mac.mm in Sources */ = {isa = PBXBuildFile; fileRef = BC17988F088D975F006068A5 /* render_theme_mac.mm */; };
@@ -2499,6 +2534,41 @@
A8C0FB8A089701F800BA5114 /* KCanvasResources.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = KCanvasResources.cpp; sourceTree = "<group>"; };
A8C0FB8B089701F800BA5114 /* KCanvasResources.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KCanvasResources.h; sourceTree = "<group>"; };
A8C0FB8C089701F800BA5114 /* KCanvasTypes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KCanvasTypes.h; sourceTree = "<group>"; };
+ A8C32920093BB732000B9CAC /* WKArithmeticFilter.cikernel */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = WKArithmeticFilter.cikernel; sourceTree = "<group>"; };
+ A8C32921093BB732000B9CAC /* WKArithmeticFilter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKArithmeticFilter.h; sourceTree = "<group>"; };
+ A8C32922093BB732000B9CAC /* WKArithmeticFilter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = WKArithmeticFilter.m; sourceTree = "<group>"; };
+ A8C32923093BB732000B9CAC /* WKDiffuseLightingFilter.cikernel */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = WKDiffuseLightingFilter.cikernel; sourceTree = "<group>"; };
+ A8C32924093BB732000B9CAC /* WKDiffuseLightingFilter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKDiffuseLightingFilter.h; sourceTree = "<group>"; };
+ A8C32925093BB732000B9CAC /* WKDiffuseLightingFilter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = WKDiffuseLightingFilter.m; sourceTree = "<group>"; };
+ A8C32926093BB732000B9CAC /* WKDistantLightFilter.cikernel */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = WKDistantLightFilter.cikernel; sourceTree = "<group>"; };
+ A8C32927093BB732000B9CAC /* WKDistantLightFilter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKDistantLightFilter.h; sourceTree = "<group>"; };
+ A8C32928093BB732000B9CAC /* WKDistantLightFilter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = WKDistantLightFilter.m; sourceTree = "<group>"; };
+ A8C32929093BB732000B9CAC /* WKNormalMapFilter.cikernel */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = WKNormalMapFilter.cikernel; sourceTree = "<group>"; };
+ A8C3292A093BB732000B9CAC /* WKNormalMapFilter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKNormalMapFilter.h; sourceTree = "<group>"; };
+ A8C3292B093BB732000B9CAC /* WKNormalMapFilter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = WKNormalMapFilter.m; sourceTree = "<group>"; };
+ A8C3292C093BB732000B9CAC /* WKPointLightFilter.cikernel */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = WKPointLightFilter.cikernel; sourceTree = "<group>"; };
+ A8C3292D093BB732000B9CAC /* WKPointLightFilter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKPointLightFilter.h; sourceTree = "<group>"; };
+ A8C3292E093BB732000B9CAC /* WKPointLightFilter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = WKPointLightFilter.m; sourceTree = "<group>"; };
+ A8C3292F093BB732000B9CAC /* WKSpecularLightingFilter.cikernel */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = WKSpecularLightingFilter.cikernel; sourceTree = "<group>"; };
+ A8C32930093BB732000B9CAC /* WKSpecularLightingFilter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKSpecularLightingFilter.h; sourceTree = "<group>"; };
+ A8C32931093BB732000B9CAC /* WKSpecularLightingFilter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = WKSpecularLightingFilter.m; sourceTree = "<group>"; };
+ A8C32932093BB732000B9CAC /* WKSpotLightFilter.cikernel */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = WKSpotLightFilter.cikernel; sourceTree = "<group>"; };
+ A8C32933093BB732000B9CAC /* WKSpotLightFilter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKSpotLightFilter.h; sourceTree = "<group>"; };
+ A8C32934093BB732000B9CAC /* WKSpotLightFilter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = WKSpotLightFilter.m; sourceTree = "<group>"; };
+ A8C3294A093BB78C000B9CAC /* SVGAnimatedColorImpl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGAnimatedColorImpl.h; sourceTree = "<group>"; };
+ A8C3294B093BB78C000B9CAC /* SVGAnimatedColorImpl.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGAnimatedColorImpl.cpp; sourceTree = "<group>"; };
+ A8C3295C093BB7B2000B9CAC /* SVGFELightElementImpl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGFELightElementImpl.h; sourceTree = "<group>"; };
+ A8C3295D093BB7B2000B9CAC /* SVGFELightElementImpl.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGFELightElementImpl.cpp; sourceTree = "<group>"; };
+ A8C3295E093BB7B2000B9CAC /* SVGFEDistantLightElementImpl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGFEDistantLightElementImpl.h; sourceTree = "<group>"; };
+ A8C3295F093BB7B2000B9CAC /* SVGFEDistantLightElementImpl.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGFEDistantLightElementImpl.cpp; sourceTree = "<group>"; };
+ A8C32960093BB7B2000B9CAC /* SVGFEDiffuseLightingElementImpl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGFEDiffuseLightingElementImpl.h; sourceTree = "<group>"; };
+ A8C32961093BB7B2000B9CAC /* SVGFEDiffuseLightingElementImpl.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGFEDiffuseLightingElementImpl.cpp; sourceTree = "<group>"; };
+ A8C32962093BB7B2000B9CAC /* SVGFESpotLightElementImpl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGFESpotLightElementImpl.h; sourceTree = "<group>"; };
+ A8C32963093BB7B2000B9CAC /* SVGFESpotLightElementImpl.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGFESpotLightElementImpl.cpp; sourceTree = "<group>"; };
+ A8C32964093BB7B2000B9CAC /* SVGFESpecularLightingElementImpl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGFESpecularLightingElementImpl.h; sourceTree = "<group>"; };
+ A8C32965093BB7B2000B9CAC /* SVGFESpecularLightingElementImpl.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGFESpecularLightingElementImpl.cpp; sourceTree = "<group>"; };
+ A8C32966093BB7B2000B9CAC /* SVGFEPointLightElementImpl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGFEPointLightElementImpl.h; sourceTree = "<group>"; };
+ A8C32967093BB7B2000B9CAC /* SVGFEPointLightElementImpl.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGFEPointLightElementImpl.cpp; sourceTree = "<group>"; };
A8DC63EB08E0DD2A004507F7 /* EcmaInterface.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = EcmaInterface.cpp; path = ksvg2/ecma/EcmaInterface.cpp; sourceTree = DERIVED_FILE_DIR; };
BC06F24906D18A7E004A6FA3 /* xsl_stylesheetimpl.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = xsl_stylesheetimpl.cpp; path = xsl/xsl_stylesheetimpl.cpp; sourceTree = "<group>"; };
BC06F24A06D18A7E004A6FA3 /* xsl_stylesheetimpl.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = xsl_stylesheetimpl.h; path = xsl/xsl_stylesheetimpl.h; sourceTree = "<group>"; };
@@ -3619,6 +3689,8 @@
A8C0F806089701F300BA5114 /* SVGAnimatedAngleImpl.h */,
A8C0F807089701F300BA5114 /* SVGAnimatedBooleanImpl.cpp */,
A8C0F808089701F300BA5114 /* SVGAnimatedBooleanImpl.h */,
+ A8C3294B093BB78C000B9CAC /* SVGAnimatedColorImpl.cpp */,
+ A8C3294A093BB78C000B9CAC /* SVGAnimatedColorImpl.h */,
A8C0F809089701F300BA5114 /* SVGAnimatedEnumerationImpl.cpp */,
A8C0F80A089701F300BA5114 /* SVGAnimatedEnumerationImpl.h */,
A8C0F80B089701F300BA5114 /* SVGAnimatedIntegerImpl.cpp */,
@@ -3687,6 +3759,10 @@
A8C0F84C089701F300BA5114 /* SVGFEComponentTransferElementImpl.h */,
A8C0F84D089701F300BA5114 /* SVGFECompositeElementImpl.cpp */,
A8C0F84E089701F300BA5114 /* SVGFECompositeElementImpl.h */,
+ A8C32961093BB7B2000B9CAC /* SVGFEDiffuseLightingElementImpl.cpp */,
+ A8C32960093BB7B2000B9CAC /* SVGFEDiffuseLightingElementImpl.h */,
+ A8C3295F093BB7B2000B9CAC /* SVGFEDistantLightElementImpl.cpp */,
+ A8C3295E093BB7B2000B9CAC /* SVGFEDistantLightElementImpl.h */,
A8C0F84F089701F300BA5114 /* SVGFEFloodElementImpl.cpp */,
A8C0F850089701F300BA5114 /* SVGFEFloodElementImpl.h */,
A8C0F851089701F300BA5114 /* SVGFEFuncAElementImpl.cpp */,
@@ -3701,12 +3777,20 @@
A8C0F85A089701F300BA5114 /* SVGFEGaussianBlurElementImpl.h */,
A8C0F85B089701F300BA5114 /* SVGFEImageElementImpl.cpp */,
A8C0F85C089701F300BA5114 /* SVGFEImageElementImpl.h */,
+ A8C3295D093BB7B2000B9CAC /* SVGFELightElementImpl.cpp */,
+ A8C3295C093BB7B2000B9CAC /* SVGFELightElementImpl.h */,
A8C0F85D089701F300BA5114 /* SVGFEMergeElementImpl.cpp */,
A8C0F85E089701F300BA5114 /* SVGFEMergeElementImpl.h */,
A8C0F85F089701F300BA5114 /* SVGFEMergeNodeElementImpl.cpp */,
A8C0F860089701F300BA5114 /* SVGFEMergeNodeElementImpl.h */,
A8C0F861089701F300BA5114 /* SVGFEOffsetElementImpl.cpp */,
A8C0F862089701F300BA5114 /* SVGFEOffsetElementImpl.h */,
+ A8C32967093BB7B2000B9CAC /* SVGFEPointLightElementImpl.cpp */,
+ A8C32966093BB7B2000B9CAC /* SVGFEPointLightElementImpl.h */,
+ A8C32965093BB7B2000B9CAC /* SVGFESpecularLightingElementImpl.cpp */,
+ A8C32964093BB7B2000B9CAC /* SVGFESpecularLightingElementImpl.h */,
+ A8C32963093BB7B2000B9CAC /* SVGFESpotLightElementImpl.cpp */,
+ A8C32962093BB7B2000B9CAC /* SVGFESpotLightElementImpl.h */,
A8C0F863089701F300BA5114 /* SVGFETileElementImpl.cpp */,
A8C0F864089701F300BA5114 /* SVGFETileElementImpl.h */,
A8C0F865089701F300BA5114 /* SVGFETurbulenceElementImpl.cpp */,
@@ -3906,6 +3990,7 @@
A8C0FB68089701F800BA5114 /* quartz */ = {
isa = PBXGroup;
children = (
+ A8C3291F093BB732000B9CAC /* filters */,
A8C0FB69089701F800BA5114 /* KCanvasFilterQuartz.h */,
A8C0FB6A089701F800BA5114 /* KCanvasFilterQuartz.mm */,
A8C0FB6B089701F800BA5114 /* KCanvasItemQuartz.h */,
@@ -3923,6 +4008,34 @@
path = quartz;
sourceTree = "<group>";
};
+ A8C3291F093BB732000B9CAC /* filters */ = {
+ isa = PBXGroup;
+ children = (
+ A8C32920093BB732000B9CAC /* WKArithmeticFilter.cikernel */,
+ A8C32921093BB732000B9CAC /* WKArithmeticFilter.h */,
+ A8C32922093BB732000B9CAC /* WKArithmeticFilter.m */,
+ A8C32923093BB732000B9CAC /* WKDiffuseLightingFilter.cikernel */,
+ A8C32924093BB732000B9CAC /* WKDiffuseLightingFilter.h */,
+ A8C32925093BB732000B9CAC /* WKDiffuseLightingFilter.m */,
+ A8C32926093BB732000B9CAC /* WKDistantLightFilter.cikernel */,
+ A8C32927093BB732000B9CAC /* WKDistantLightFilter.h */,
+ A8C32928093BB732000B9CAC /* WKDistantLightFilter.m */,
+ A8C32929093BB732000B9CAC /* WKNormalMapFilter.cikernel */,
+ A8C3292A093BB732000B9CAC /* WKNormalMapFilter.h */,
+ A8C3292B093BB732000B9CAC /* WKNormalMapFilter.m */,
+ A8C3292C093BB732000B9CAC /* WKPointLightFilter.cikernel */,
+ A8C3292D093BB732000B9CAC /* WKPointLightFilter.h */,
+ A8C3292E093BB732000B9CAC /* WKPointLightFilter.m */,
+ A8C3292F093BB732000B9CAC /* WKSpecularLightingFilter.cikernel */,
+ A8C32930093BB732000B9CAC /* WKSpecularLightingFilter.h */,
+ A8C32931093BB732000B9CAC /* WKSpecularLightingFilter.m */,
+ A8C32932093BB732000B9CAC /* WKSpotLightFilter.cikernel */,
+ A8C32933093BB732000B9CAC /* WKSpotLightFilter.h */,
+ A8C32934093BB732000B9CAC /* WKSpotLightFilter.m */,
+ );
+ path = filters;
+ sourceTree = "<group>";
+ };
BC06F24406D18A35004A6FA3 /* xsl */ = {
isa = PBXGroup;
children = (
@@ -5553,6 +5666,20 @@
A884285509308C1C00B6D461 /* KDOMHeaders.h in Headers */,
A890DF1F0930974800513F88 /* SVGStyledTransformableElementImpl.h in Headers */,
A890DF210930974800513F88 /* SVGStyledLocatableElementImpl.h in Headers */,
+ A8C32936093BB732000B9CAC /* WKArithmeticFilter.h in Headers */,
+ A8C32939093BB732000B9CAC /* WKDiffuseLightingFilter.h in Headers */,
+ A8C3293C093BB732000B9CAC /* WKDistantLightFilter.h in Headers */,
+ A8C3293F093BB732000B9CAC /* WKNormalMapFilter.h in Headers */,
+ A8C32942093BB732000B9CAC /* WKPointLightFilter.h in Headers */,
+ A8C32945093BB732000B9CAC /* WKSpecularLightingFilter.h in Headers */,
+ A8C32948093BB732000B9CAC /* WKSpotLightFilter.h in Headers */,
+ A8C3294C093BB78C000B9CAC /* SVGAnimatedColorImpl.h in Headers */,
+ A8C32968093BB7B2000B9CAC /* SVGFELightElementImpl.h in Headers */,
+ A8C3296A093BB7B2000B9CAC /* SVGFEDistantLightElementImpl.h in Headers */,
+ A8C3296C093BB7B2000B9CAC /* SVGFEDiffuseLightingElementImpl.h in Headers */,
+ A8C3296E093BB7B2000B9CAC /* SVGFESpotLightElementImpl.h in Headers */,
+ A8C32970093BB7B2000B9CAC /* SVGFESpecularLightingElementImpl.h in Headers */,
+ A8C32972093BB7B2000B9CAC /* SVGFEPointLightElementImpl.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -5837,6 +5964,13 @@
A8212BF108794A2300677359 /* westResizeCursor.tiff in Resources */,
A8212BF208794A2300677359 /* textAreaResizeCorner.tiff in Resources */,
A8C0FBA7089701F900BA5114 /* svg.css in Resources */,
+ A8C32935093BB732000B9CAC /* WKArithmeticFilter.cikernel in Resources */,
+ A8C32938093BB732000B9CAC /* WKDiffuseLightingFilter.cikernel in Resources */,
+ A8C3293B093BB732000B9CAC /* WKDistantLightFilter.cikernel in Resources */,
+ A8C3293E093BB732000B9CAC /* WKNormalMapFilter.cikernel in Resources */,
+ A8C32941093BB732000B9CAC /* WKPointLightFilter.cikernel in Resources */,
+ A8C32944093BB732000B9CAC /* WKSpecularLightingFilter.cikernel in Resources */,
+ A8C32947093BB732000B9CAC /* WKSpotLightFilter.cikernel in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -7318,6 +7452,20 @@
A884284E09308C1C00B6D461 /* RGBColorImpl.cpp in Sources */,
A890DF200930974800513F88 /* SVGStyledTransformableElementImpl.cpp in Sources */,
A890DF220930974800513F88 /* SVGStyledLocatableElementImpl.cpp in Sources */,
+ A8C32937093BB732000B9CAC /* WKArithmeticFilter.m in Sources */,
+ A8C3293A093BB732000B9CAC /* WKDiffuseLightingFilter.m in Sources */,
+ A8C3293D093BB732000B9CAC /* WKDistantLightFilter.m in Sources */,
+ A8C32940093BB732000B9CAC /* WKNormalMapFilter.m in Sources */,
+ A8C32943093BB732000B9CAC /* WKPointLightFilter.m in Sources */,
+ A8C32946093BB732000B9CAC /* WKSpecularLightingFilter.m in Sources */,
+ A8C32949093BB732000B9CAC /* WKSpotLightFilter.m in Sources */,
+ A8C3294D093BB78C000B9CAC /* SVGAnimatedColorImpl.cpp in Sources */,
+ A8C32969093BB7B2000B9CAC /* SVGFELightElementImpl.cpp in Sources */,
+ A8C3296B093BB7B2000B9CAC /* SVGFEDistantLightElementImpl.cpp in Sources */,
+ A8C3296D093BB7B2000B9CAC /* SVGFEDiffuseLightingElementImpl.cpp in Sources */,
+ A8C3296F093BB7B2000B9CAC /* SVGFESpotLightElementImpl.cpp in Sources */,
+ A8C32971093BB7B2000B9CAC /* SVGFESpecularLightingElementImpl.cpp in Sources */,
+ A8C32973093BB7B2000B9CAC /* SVGFEPointLightElementImpl.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
1.10 +50 -21 SVGSupport/kcanvas/KCanvasFilters.cpp
Index: KCanvasFilters.cpp
===================================================================
RCS file: /cvs/root/SVGSupport/kcanvas/KCanvasFilters.cpp,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- KCanvasFilters.cpp 22 Nov 2005 12:03:15 -0000 1.9
+++ KCanvasFilters.cpp 28 Nov 2005 23:33:58 -0000 1.10
@@ -28,6 +28,14 @@
#include "KCanvasTreeDebug.h"
#include <kxmlcore/Assertions.h>
+void KCanvasPoint3F::normalize()
+{
+ float length = sqrt(m_x * m_x + m_y * m_y + m_z * m_z);
+ m_x /= length;
+ m_y /= length;
+ m_z /= length;
+}
+
// Filters
void KCanvasFilter::addFilterEffect(KCanvasFilterEffect *effect)
@@ -92,6 +100,14 @@
m_result = result;
}
+
+static QTextStream &operator<<(QTextStream &ts, const KCanvasPoint3F p)
+{
+ ts << "x=" << p.x() << " y=" << p.y() << " z=" << p.z();
+ return ts;
+}
+
+
QTextStream &KCanvasFilterEffect::externalRepresentation(QTextStream &ts) const
{
if (!in().isEmpty())
@@ -103,30 +119,37 @@
return ts;
}
-QTextStream &KCanvasFEDistantLight::externalRepresentation(QTextStream &ts) const
+QTextStream &KCPointLightSource::externalRepresentation(QTextStream &ts) const
{
- ts << "[type=DISTANT-LIGHT] ";
- KCanvasFilterEffect::externalRepresentation(ts);
- ts << "[azimuth=" << azimuth() << "]"
- << "[elevation=" << elevation() << "]";
- return ts;
+ ts << "[type=POINT-LIGHT] ";
+ ts << "[position=\"" << position() << "\"]";
+ return ts;
}
-QTextStream &KCanvasFEPointLight::externalRepresentation(QTextStream &ts) const
+QTextStream &KCSpotLightSource::externalRepresentation(QTextStream &ts) const
{
- ts << "[type=POINT-LIGHT] ";
- KCanvasFilterEffect::externalRepresentation(ts);
- ts << "[x=" << m_x << " y=" << m_y << " z=" << m_z << "]";
+ ts << "[type=SPOT-LIGHT] ";
+ ts << "[position=\"" << position() << "\"]";
+ ts << "[direction=\"" << direction() << "\"]";
+ ts << "[specularExponent=\"" << specularExponent() << "\"]";
+ ts << "[limitingConeAngle=\"" << limitingConeAngle() << "\"]";
return ts;
}
-QTextStream &KCanvasFESpotLight::externalRepresentation(QTextStream &ts) const
+QTextStream &KCDistantLightSource::externalRepresentation(QTextStream &ts) const
{
- ts << "[type=SPOT-LIGHT] ";
- KCanvasFilterEffect::externalRepresentation(ts);
- ts << "[x=" << m_x << " y=" << m_y << " z=" << m_z << "]"
- << "[points at x=" << m_pointsAtX << " y=" << m_pointsAtY << " z=" << m_pointsAtZ << "]";
- return ts;
+ ts << "[type=DISTANT-LIGHT] ";
+ ts << "[azimuth=\"" << azimuth() << "\"]";
+ ts << "[elevation=\"" << elevation() << "\"]";
+ return ts;
+}
+
+
+
+static QTextStream &operator<<(QTextStream &ts, QPointF p)
+{
+ ts << "x=" << p.x() << " y=" << p.y();
+ return ts;
}
static QTextStream &operator<<(QTextStream &ts, KCBlendModeType t)
@@ -244,20 +267,26 @@
case EM_NONE:
ts << "NONE"; break;
}
- return ts;
+ return ts;
+}
+
+static QTextStream &operator<<(QTextStream &ts, QSize s)
+{
+ ts << "x=" << s.width() << " y=" << s.height();
+ return ts;
}
QTextStream &KCanvasFEConvolveMatrix::externalRepresentation(QTextStream &ts) const
{
ts << "[type=CONVOLVE-MATRIX] ";
KCanvasFilterEffect::externalRepresentation(ts);
- ts << " [order x= " << m_orderX << " y=" << m_orderY << "]"
+ ts << " [order " << m_kernelSize << "]"
<< " [kernel matrix=" << m_kernelMatrix << "]"
<< " [divisor=" << m_divisor << "]"
<< " [bias=" << m_bias << "]"
- << " [target x= " << m_targetX << " y=" << m_targetY << "]"
+ << " [target " << m_targetOffset << "]"
<< " [edge mode=" << m_edgeMode << "]"
- << " [kernel unit length x=" << m_kernelUnitLengthX << " y=" << m_kernelUnitLengthY << "]"
+ << " [kernel unit length " << m_kernelUnitLength << "]"
<< " [preserve alpha=" << m_preserveAlpha << "]";
return ts;
}
@@ -268,7 +297,7 @@
KCanvasFilterEffect::externalRepresentation(ts);
ts << " [surface scale=" << m_surfaceScale << "]"
<< " [diffuse constant=" << m_diffuseConstant << "]"
- << " [kernel unit length x=" << m_kernelUnitLengthX << " y=" << m_kernelUnitLengthY << "]";
+ << " [kernel unit length " << m_kernelUnitLengthX << ", " << m_kernelUnitLengthY << "]";
return ts;
}
1.12 +196 -53 SVGSupport/kcanvas/KCanvasFilters.h
Index: KCanvasFilters.h
===================================================================
RCS file: /cvs/root/SVGSupport/kcanvas/KCanvasFilters.h,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- KCanvasFilters.h 23 Nov 2005 15:14:05 -0000 1.11
+++ KCanvasFilters.h 28 Nov 2005 23:33:58 -0000 1.12
@@ -53,6 +53,61 @@
#include <qcolor.h>
#include <qstringlist.h>
+class KCanvasPoint3F {
+public:
+ KCanvasPoint3F() : m_x(0), m_y(0), m_z(0) { }
+ KCanvasPoint3F(float x, float y, float z) : m_x(x), m_y(y), m_z(z) { }
+
+ float x() const { return m_x; }
+ void setX(float x) { m_x = x; }
+
+ float y() const { return m_y; }
+ void setY(float y) { m_y = y; }
+
+ float z() const { return m_z; }
+ void setZ(float z) { m_z = z; }
+
+ void normalize();
+
+private:
+ float m_x;
+ float m_y;
+ float m_z;
+};
+
+// FIXME: QPointF and QSizeF will be removed from this file when
+// http://bugzilla.opendarwin.org/show_bug.cgi?id=4462 is resolved.
+
+class QPointF {
+public:
+ QPointF(float x, float y) : m_x(x), m_y(y) { }
+
+ float x() const { return m_x; }
+ void setX(float x) { m_x = x; }
+
+ float y() const { return m_y; }
+ void setY(float y) { m_y = y; }
+
+private:
+ float m_x;
+ float m_y;
+};
+
+class QSizeF {
+public:
+ QPointF(float width, float height) : m_width(x), m_height(y) { }
+
+ float width() const { return m_width; }
+ void setWidth(float width) { m_width = width; }
+
+ float height() const { return m_height; }
+ void setHeight(float height) { m_height = height; }
+
+private:
+ float m_width;
+ float m_height;
+};
+
class KCanvasFilterEffect;
class KRenderingDevice;
@@ -130,51 +185,6 @@
QTextStream &operator<<(QTextStream &, const KCanvasFilterEffect &);
-class KCanvasFEDistantLight : public KCanvasFilterEffect
-{
-public:
- float azimuth() const { return m_azimuth; }
- void setAzimuth(float azimuth) { m_azimuth = azimuth; }
-
- float elevation() const { return m_elevation; }
- void setElevation(float elevation) { m_elevation = elevation; }
-
- // FIXME, more here...
- QTextStream &externalRepresentation(QTextStream &) const;
-private:
- float m_azimuth;
- float m_elevation;
-};
-
-class KCanvasFEPointLight : public KCanvasFilterEffect
-{
-public:
-
- QTextStream &externalRepresentation(QTextStream &) const;
-
-private:
- float m_x;
- float m_y;
- float m_z;
-};
-
-class KCanvasFESpotLight : public KCanvasFilterEffect
-{
-public:
-
- QTextStream &externalRepresentation(QTextStream &) const;
-
-private:
- float m_x;
- float m_y;
- float m_z;
- float m_pointsAtX;
- float m_pointsAtY;
- float m_pointsAtZ;
- float m_specularExponent;
- float m_limitingConeAngle;
-};
-
typedef enum {
BM_NORMAL = 0,
BM_MULTIPLY = 1,
@@ -335,34 +345,144 @@
class KCanvasFEConvolveMatrix : public KCanvasFilterEffect
{
public:
+ QSize kernelSize() const { return m_kernelSize; }
+ void setKernelSize(QSize kernelSize) { m_kernelSize = kernelSize; }
+
+ Q3ValueList<float> kernel() const { return m_kernelMatrix; }
+ void setKernel(Q3ValueList<float> kernel) { m_kernelMatrix = kernel; }
+
+ float divisor() const { return m_divisor; }
+ void setDivisor(float divisor) { m_divisor = divisor; }
+
+ float bias() const { return m_bias; }
+ void setBias(float bias) { m_bias = bias; }
+
+ QSize targetOffset() const { return m_targetOffset; }
+ void setTargetOffset(QSize targetOffset) { m_targetOffset = targetOffset; }
+
+ KCEdgeModeType edgeMode() const { return m_edgeMode; }
+ void setEdgeMode(KCEdgeModeType edgeMode) { m_edgeMode = edgeMode; }
+
+ QPointF kernelUnitLength() const {return m_kernelUnitLength; }
+ void setKernelUnitLength(QPointF kernelUnitLength) { m_kernelUnitLength = kernelUnitLength; }
+
+ bool preserveAlpha() const { return m_preserveAlpha; }
+ void setPreserveAlpha(bool preserveAlpha) { m_preserveAlpha = preserveAlpha; }
QTextStream &externalRepresentation(QTextStream &) const;
private:
- int m_orderX;
- int m_orderY;
+ QSize m_kernelSize;
Q3ValueList<float> m_kernelMatrix; // maybe should be a real matrix?
float m_divisor;
float m_bias;
- int m_targetX;
- int m_targetY;
+ QSize m_targetOffset;
KCEdgeModeType m_edgeMode;
- float m_kernelUnitLengthX;
- float m_kernelUnitLengthY;
+ QPointF m_kernelUnitLength;
bool m_preserveAlpha;
};
+typedef enum{
+ LS_DISTANT,
+ LS_POINT,
+ LS_SPOT
+} KCLightType;
+
+//The light source for Diffuse/SpecularLighting
+class KCLightSource
+{
+public:
+ KCLightSource(KCLightType a_type) : m_type(a_type) { }
+
+ virtual ~KCLightSource() { }
+
+ KCLightType type() const { return m_type; }
+
+ virtual QTextStream &externalRepresentation(QTextStream &) const = 0;
+
+private:
+ KCLightType m_type;
+};
+
+class KCDistantLightSource : public KCLightSource
+{
+public:
+ KCDistantLightSource(float azimuth, float elevation) :
+ KCLightSource(LS_DISTANT), m_azimuth(azimuth), m_elevation(elevation) { }
+
+ float azimuth() const{ return m_azimuth; }
+ float elevation() const{ return m_elevation; }
+
+ virtual QTextStream &externalRepresentation(QTextStream &) const;
+
+private:
+ float m_azimuth;
+ float m_elevation;
+};
+
+class KCPointLightSource : public KCLightSource
+{
+public:
+ KCPointLightSource(KCanvasPoint3F& position) : KCLightSource(LS_POINT), m_position(position) { }
+
+ const KCanvasPoint3F& position() const { return m_position; }
+
+ virtual QTextStream &externalRepresentation(QTextStream &) const;
+
+private:
+ KCanvasPoint3F m_position;
+};
+
+class KCSpotLightSource : public KCLightSource
+{
+public:
+ KCSpotLightSource(KCanvasPoint3F& position, KCanvasPoint3F& direction,
+ float specularExponent, float limitingConeAngle) : KCLightSource(LS_SPOT),
+ m_position(position), m_direction(direction), m_specularExponent(specularExponent), m_limitingConeAngle(limitingConeAngle) { }
+
+ const KCanvasPoint3F& position() const { return m_position; }
+ const KCanvasPoint3F& direction() const { return m_direction; }
+ float specularExponent() const { return m_specularExponent; }
+ float limitingConeAngle() const { return m_limitingConeAngle; }
+
+ virtual QTextStream &externalRepresentation(QTextStream &) const;
+private:
+ KCanvasPoint3F m_position;
+ KCanvasPoint3F m_direction;
+ float m_specularExponent;
+ float m_limitingConeAngle;
+};
+
class KCanvasFEDiffuseLighting : public KCanvasFilterEffect
{
public:
+ QColor lightingColor() const { return m_lightingColor; }
+ void setLightingColor(const QColor &lightingColor) { m_lightingColor = lightingColor; }
+
+ float surfaceScale() const { return m_surfaceScale; }
+ void setSurfaceScale(float surfaceScale) { m_surfaceScale = surfaceScale; }
+
+ float diffuseConstant() const { return m_diffuseConstant; }
+ void setDiffuseConstant(float diffuseConstant) { m_diffuseConstant = diffuseConstant; }
+
+ float kernelUnitLengthX() const { return m_kernelUnitLengthX; }
+ void setKernelUnitLengthX(float kernelUnitLengthX) { m_kernelUnitLengthX = kernelUnitLengthX; }
+
+ float kernelUnitLengthY() const { return m_kernelUnitLengthY; }
+ void setKernelUnitLengthY(float kernelUnitLengthY) { m_kernelUnitLengthY = kernelUnitLengthY; }
+ const KCLightSource * lightSource() const { return m_lightSource; }
+ void setLightSource(KCLightSource * lightSource) { m_lightSource = lightSource; }
+
QTextStream &externalRepresentation(QTextStream &) const;
private:
+ QColor m_lightingColor;
float m_surfaceScale;
float m_diffuseConstant;
float m_kernelUnitLengthX;
float m_kernelUnitLengthY;
+ KCLightSource *m_lightSource;
};
typedef enum {
@@ -393,7 +513,6 @@
QColor floodColor() const { return m_floodColor; }
void setFloodColor(const QColor &color) { m_floodColor = color; }
-
float floodOpacity() const { return m_floodOpacity; }
void setFloodOpacity(float floodOpacity) { m_floodOpacity = floodOpacity; }
@@ -494,16 +613,40 @@
class KCanvasFESpecularLighting : public KCanvasFilterEffect
{
public:
+ QColor lightingColor() const { return m_lightingColor; }
+ void setLightingColor(const QColor &lightingColor) { m_lightingColor = lightingColor; }
+ float surfaceScale() const { return m_surfaceScale; }
+ void setSurfaceScale(float surfaceScale) { m_surfaceScale = surfaceScale; }
+
+ float specularConstant() const { return m_specularConstant; }
+ void setSpecularConstant(float specularConstant) { m_specularConstant = specularConstant; }
+
+ float specularExponent() const { return m_specularExponent; }
+ void setSpecularExponent(float specularExponent) { m_specularExponent = specularExponent; }
+
+ float kernelUnitLengthX() const { return m_kernelUnitLengthX; }
+ void setKernelUnitLengthX(float kernelUnitLengthX) { m_kernelUnitLengthX = kernelUnitLengthX; }
+
+ float kernelUnitLengthY() const { return m_kernelUnitLengthY; }
+ void setKernelUnitLengthY(float kernelUnitLengthY) { m_kernelUnitLengthY = kernelUnitLengthY; }
+
+ const KCLightSource * lightSource() const { return m_lightSource; }
+ void setLightSource(KCLightSource * lightSource) { m_lightSource = lightSource; }
+
QTextStream &externalRepresentation(QTextStream &) const;
private:
+ QColor m_lightingColor;
float m_surfaceScale;
float m_specularConstant;
float m_specularExponent;
+ float m_kernelUnitLengthX;
+ float m_kernelUnitLengthY;
+ KCLightSource *m_lightSource;
};
-class KCanvasFETile : public KCanvasFilterEffect {};
+class KCanvasFETile : public KCanvasFilterEffect { };
typedef enum {
TT_TURBULANCE = 0,
1.11 +1 -1 SVGSupport/kcanvas/KCanvasTreeDebug.cpp
Index: KCanvasTreeDebug.cpp
===================================================================
RCS file: /cvs/root/SVGSupport/kcanvas/KCanvasTreeDebug.cpp,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- KCanvasTreeDebug.cpp 27 Nov 2005 11:02:15 -0000 1.10
+++ KCanvasTreeDebug.cpp 28 Nov 2005 23:33:58 -0000 1.11
@@ -53,7 +53,7 @@
#include <kdom/DOMString.h>
#include "dom_atomicstring.h"
-#include "HTMLNames.h"
+#include "htmlnames.h"
#include <qtextstream.h>
1.8 +15 -0 SVGSupport/kcanvas/device/quartz/KCanvasFilterQuartz.h
Index: KCanvasFilterQuartz.h
===================================================================
RCS file: /cvs/root/SVGSupport/kcanvas/device/quartz/KCanvasFilterQuartz.h,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- KCanvasFilterQuartz.h 23 Nov 2005 15:14:07 -0000 1.7
+++ KCanvasFilterQuartz.h 28 Nov 2005 23:33:59 -0000 1.8
@@ -75,11 +75,21 @@
// virtual CIFilter *getCIFilter(KCanvasFilterQuartz *quartzFilter) const;
//};
+class KCanvasFEConvolveMatrixQuartz : public KCanvasFEConvolveMatrix {
+public:
+ virtual CIFilter *getCIFilter(KCanvasFilterQuartz *quartzFilter) const;
+};
+
class KCanvasFECompositeQuartz : public KCanvasFEComposite {
public:
virtual CIFilter *getCIFilter(KCanvasFilterQuartz *quartzFilter) const;
};
+class KCanvasFEDiffuseLightingQuartz : public KCanvasFEDiffuseLighting {
+public:
+ virtual CIFilter *getCIFilter(KCanvasFilterQuartz *quartzFilter) const;
+};
+
class KCanvasFEFloodQuartz : public KCanvasFEFlood {
public:
virtual CIFilter *getCIFilter(KCanvasFilterQuartz *quartzFilter) const;
@@ -105,6 +115,11 @@
virtual CIFilter *getCIFilter(KCanvasFilterQuartz *quartzFilter) const;
};
+class KCanvasFESpecularLightingQuartz : public KCanvasFESpecularLighting {
+public:
+ virtual CIFilter *getCIFilter(KCanvasFilterQuartz *quartzFilter) const;
+};
+
class KCanvasFETileQuartz : public KCanvasFETile {
public:
virtual CIFilter *getCIFilter(KCanvasFilterQuartz *quartzFilter) const;
1.17 +201 -26 SVGSupport/kcanvas/device/quartz/KCanvasFilterQuartz.mm
Index: KCanvasFilterQuartz.mm
===================================================================
RCS file: /cvs/root/SVGSupport/kcanvas/device/quartz/KCanvasFilterQuartz.mm,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- KCanvasFilterQuartz.mm 27 Nov 2005 11:02:16 -0000 1.16
+++ KCanvasFilterQuartz.mm 28 Nov 2005 23:33:59 -0000 1.17
@@ -31,6 +31,13 @@
#import "KRenderingDeviceQuartz.h"
#import "QuartzSupport.h"
#import "KWQExceptions.h"
+#import "WKDiffuseLightingFilter.h"
+#import "WKSpecularLightingFilter.h"
+#import "WKSpotLightFilter.h"
+#import "WKPointLightFilter.h"
+#import "WKDistantLightFilter.h"
+#import "WKNormalMapFilter.h"
+#import "WKArithmeticFilter.h"
#import <QuartzCore/QuartzCore.h>
@@ -40,13 +47,22 @@
static QString KCPreviousFilterOutputName = QString::fromLatin1("__previousOutput__");
-//static CIColor *ciColor(const QColor &c)
-//{
-// CGColorRef colorCG = cgColor(c);
-// CIColor *colorCI = [CIColor colorWithCGColor:colorCG];
-// CGColorRelease(colorCG);
-// return colorCI;
-//}
+static inline CIColor *ciColor(const QColor &c)
+{
+ CGColorRef colorCG = cgColor(c);
+ CIColor *colorCI = [CIColor colorWithCGColor:colorCG];
+ CGColorRelease(colorCG);
+ return colorCI;
+}
+
+static inline CIVector *ciVector(KCanvasPoint3F point) {
+ return [CIVector vectorWithX:point.x() Y:point.y() Z:point.z()];
+}
+
+static inline CIVector *ciVector(QPointF point) {
+ return [CIVector vectorWithX:point.x() Y:point.y()];
+}
+
KCanvasFilterQuartz::KCanvasFilterQuartz() : m_filterCIContext(0), m_filterCGLayer(0), m_imagesByName(0)
{
@@ -224,7 +240,6 @@
#pragma mark -
#pragma mark Filter Elements
-
#define FE_QUARTZ_SETUP_INPUT(name) \
CIImage *inputImage = quartzFilter->inputImage(this); \
FE_QUARTZ_CHECK_INPUT(inputImage) \
@@ -421,24 +436,25 @@
KWQ_BLOCK_EXCEPTIONS
switch(operation()) {
case CO_OVER:
- filter = [CIFilter filterWithName:@"CISourceOverCompositing"];
- break;
+ filter = [CIFilter filterWithName:@"CISourceOverCompositing"];
+ break;
case CO_IN:
- filter = [CIFilter filterWithName:@"CISourceInCompositing"];
- break;
+ filter = [CIFilter filterWithName:@"CISourceInCompositing"];
+ break;
case CO_OUT:
- filter = [CIFilter filterWithName:@"CISourceOutCompositing"];
- break;
+ filter = [CIFilter filterWithName:@"CISourceOutCompositing"];
+ break;
case CO_ATOP:
- filter = [CIFilter filterWithName:@"CISourceAtopCompositing"];
- break;
+ filter = [CIFilter filterWithName:@"CISourceAtopCompositing"];
+ break;
case CO_XOR:
- //FIXME: I'm not sure this is right...
- filter = [CIFilter filterWithName:@"CIExclusionBlendMode"];
+ //FIXME: I'm not sure this is right...
+ filter = [CIFilter filterWithName:@"CIExclusionBlendMode"];
+ break;
case CO_ARITHMETIC:
- NSLog(@"Warning: arithmetic compositing mode not yet supported in Quartz.");
- // this would be where we use the k values...
- return nil;
+ [WKArithmeticFilter class];
+ filter = [CIFilter filterWithName:@"WKArithmeticFilter"];
+ break;
}
[filter setDefaults];
@@ -448,10 +464,141 @@
FE_QUARTZ_CHECK_INPUT(backgroundImage);
[filter setValue:inputImage forKey:@"inputImage"];
[filter setValue:backgroundImage forKey:@"inputBackgroundImage"];
-
+ //FIXME: this seems ugly
+ if (operation() == CO_ARITHMETIC) {
+ [filter setValue:[NSNumber numberWithFloat:k1()] forKey:@"inputK1"];
+ [filter setValue:[NSNumber numberWithFloat:k2()] forKey:@"inputK2"];
+ [filter setValue:[NSNumber numberWithFloat:k3()] forKey:@"inputK3"];
+ [filter setValue:[NSNumber numberWithFloat:k4()] forKey:@"inputK4"];
+ }
FE_QUARTZ_OUTPUT_RETURN;
}
+static inline CIFilter *getPointLightVectors(CIFilter * normals, CIVector * lightPosition, float surfaceScale)
+{
+ CIFilter *filter = nil;
+ KWQ_BLOCK_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;
+ KWQ_UNBLOCK_EXCEPTIONS
+ return nil;
+}
+static CIFilter *getLightVectors(CIFilter * normals, const KCLightSource * light, float surfaceScale)
+{
+ //FIXME: there has to be a better way of making sure these get initialised
+ [WKDistantLightFilter class];
+ [WKPointLightFilter class];
+ [WKSpotLightFilter class];
+
+ CIFilter *filter = nil;
+ KWQ_BLOCK_EXCEPTIONS
+
+ switch (light->type()) {
+ case LS_DISTANT:
+ {
+ const KCDistantLightSource *dlight = static_cast<const KCDistantLightSource *>(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 = cos(azimuth)*cos(elevation);
+ float Ly = sin(azimuth)*cos(elevation);
+ float Lz = sin(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 KCPointLightSource *plight = static_cast<const KCPointLightSource *>(light);
+ return getPointLightVectors(normals, [CIVector vectorWithX:plight->position().x() Y:plight->position().y() Z:plight->position().z()], surfaceScale);
+ }
+ case LS_SPOT:
+ {
+ const KCSpotLightSource *slight = static_cast<const KCSpotLightSource *>(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;
+ }
+ }
+ KWQ_UNBLOCK_EXCEPTIONS
+ return nil;
+}
+
+
+static CIFilter *getNormalMap(CIImage *bumpMap, float scale)
+{
+ [WKNormalMapFilter class];
+ CIFilter *filter = nil;
+ KWQ_BLOCK_EXCEPTIONS
+ filter = [CIFilter filterWithName:@"WKNormalMap"];
+ [filter setDefaults];
+
+ [filter setValue:bumpMap forKey:@"inputImage"];
+ [filter setValue:[NSNumber numberWithFloat:scale] forKey:@"inputSurfaceScale"];
+ return filter;
+ KWQ_UNBLOCK_EXCEPTIONS
+ return nil;
+}
+
+CIFilter *KCanvasFEDiffuseLightingQuartz::getCIFilter(KCanvasFilterQuartz *quartzFilter) const
+{
+ const KCLightSource *light = lightSource();
+ if(!light)
+ return nil;
+
+ [WKDiffuseLightingFilter class];
+
+ CIFilter *filter = nil;
+ KWQ_BLOCK_EXCEPTIONS
+ filter = [CIFilter filterWithName:@"WKDiffuseLighting"];
+ if (!filter)
+ return nil;
+
+ [filter setDefaults];
+ CIFilter *normals = getNormalMap(quartzFilter->inputImage(this), surfaceScale());
+ if (!normals)
+ return nil;
+
+ CIFilter *lightVectors = getLightVectors(normals, light, surfaceScale());
+ if (!lightVectors)
+ return nil;
+
+ [filter setValue:[normals valueForKey:@"outputImage"] forKey:@"inputNormalMap"];
+ [filter setValue:[lightVectors valueForKey:@"outputImage"] forKey:@"inputLightVectors"];
+ [filter setValue:ciColor(lightingColor()) forKey:@"inputLightingColor"];
+ [filter setValue:[NSNumber numberWithFloat:surfaceScale()] forKey:@"inputSurfaceScale"];
+ [filter setValue:[NSNumber numberWithFloat:diffuseConstant()] forKey:@"inputDiffuseConstant"];
+ [filter setValue:[NSNumber numberWithFloat:kernelUnitLengthX()] forKey:@"inputKernelUnitLengthX"];
+ [filter setValue:[NSNumber numberWithFloat:kernelUnitLengthY()] forKey:@"inputKernelUnitLengthY"];
+
+ FE_QUARTZ_OUTPUT_RETURN;
+}
+
CIFilter *KCanvasFEFloodQuartz::getCIFilter(KCanvasFilterQuartz *quartzFilter) const
{
CIFilter *filter = nil;
@@ -505,7 +652,7 @@
CIFilter *KCanvasFEGaussianBlurQuartz::getCIFilter(KCanvasFilterQuartz *quartzFilter) const
{
- FE_QUARTZ_SETUP_INPUT(@"CIGaussianPyramid");
+ FE_QUARTZ_SETUP_INPUT(@"CIGaussianBlur");
float inputRadius = stdDeviationX();
if (inputRadius != stdDeviationY()) {
@@ -551,6 +698,37 @@
FE_QUARTZ_OUTPUT_RETURN;
}
+CIFilter *KCanvasFESpecularLightingQuartz::getCIFilter(KCanvasFilterQuartz *quartzFilter) const
+{
+ const KCLightSource *light = lightSource();
+ if(!light)
+ return nil;
+
+ [WKSpecularLightingFilter class];
+
+ CIFilter *filter = nil;
+ KWQ_BLOCK_EXCEPTIONS
+ filter = [CIFilter filterWithName:@"WKSpecularLighting"];
+ [filter setDefaults];
+ CIFilter *normals = getNormalMap(quartzFilter->inputImage(this), surfaceScale());
+ if (!normals)
+ return nil;
+ CIFilter *lightVectors = getLightVectors(normals, light, surfaceScale());
+ if (!lightVectors)
+ return nil;
+ [filter setValue:[normals valueForKey:@"outputImage"] forKey:@"inputNormalMap"];
+ [filter setValue:[lightVectors valueForKey:@"outputImage"] forKey:@"inputLightVectors"];
+ [filter setValue:ciColor(lightingColor()) forKey:@"inputLightingColor"];
+ [filter setValue:[NSNumber numberWithFloat:surfaceScale()] forKey:@"inputSurfaceScale"];
+ [filter setValue:[NSNumber numberWithFloat:specularConstant()] forKey:@"inputSpecularConstant"];
+ [filter setValue:[NSNumber numberWithFloat:specularExponent()] forKey:@"inputSpecularExponent"];
+ [filter setValue:[NSNumber numberWithFloat:kernelUnitLengthX()] forKey:@"inputKernelUnitLengthX"];
+ [filter setValue:[NSNumber numberWithFloat:kernelUnitLengthY()] forKey:@"inputKernelUnitLengthY"];
+
+ FE_QUARTZ_OUTPUT_RETURN;
+}
+
+
CIFilter *KCanvasFETileQuartz::getCIFilter(KCanvasFilterQuartz *quartzFilter) const
{
FE_QUARTZ_SETUP_INPUT(@"CIAffineTile");
@@ -558,6 +736,3 @@
FE_QUARTZ_OUTPUT_RETURN;
}
-
-
-
1.7 +7 -5 SVGSupport/kcanvas/device/quartz/KRenderingDeviceQuartz.mm
Index: KRenderingDeviceQuartz.mm
===================================================================
RCS file: /cvs/root/SVGSupport/kcanvas/device/quartz/KRenderingDeviceQuartz.mm,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- KRenderingDeviceQuartz.mm 22 Nov 2005 23:04:27 -0000 1.6
+++ KRenderingDeviceQuartz.mm 28 Nov 2005 23:33:59 -0000 1.7
@@ -292,15 +292,17 @@
{
switch(type)
{
-// case FE_DISTANT_LIGHT:
-// case FE_POINT_LIGHT:
-// case FE_SPOT_LIGHT:
+ /* Light sources are contained by the diffuse/specular light blocks
+ case FE_DISTANT_LIGHT:
+ case FE_POINT_LIGHT:
+ case FE_SPOT_LIGHT:
+ */
case FE_BLEND: return new KCanvasFEBlendQuartz();
case FE_COLOR_MATRIX: return new KCanvasFEColorMatrixQuartz();
// case FE_COMPONENT_TRANSFER:
case FE_COMPOSITE: return new KCanvasFECompositeQuartz();
// case FE_CONVOLVE_MATRIX:
-// case FE_DIFFUSE_LIGHTING:
+ case FE_DIFFUSE_LIGHTING: return new KCanvasFEDiffuseLightingQuartz();
// case FE_DISPLACEMENT_MAP:
case FE_FLOOD: return new KCanvasFEFloodQuartz();
case FE_GAUSSIAN_BLUR: return new KCanvasFEGaussianBlurQuartz();
@@ -308,7 +310,7 @@
case FE_MERGE: return new KCanvasFEMergeQuartz();
// case FE_MORPHOLOGY:
case FE_OFFSET: return new KCanvasFEOffsetQuartz();
-// case FE_SPECULAR_LIGHTING:
+ case FE_SPECULAR_LIGHTING: return new KCanvasFESpecularLightingQuartz();
case FE_TILE: return new KCanvasFETileQuartz();
// case FE_TURBULENCE:
default:
1.1 SVGSupport/kcanvas/device/quartz/filters/WKArithmeticFilter.cikernel
Index: WKArithmeticFilter.cikernel
===================================================================
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;
}
1.1 SVGSupport/kcanvas/device/quartz/filters/WKArithmeticFilter.h
Index: WKArithmeticFilter.h
===================================================================
/*
* Copyright (C) 2005 Oliver Hunt <ojh16 at student.canterbury.ac.nz>. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#import <QuartzCore/CoreImage.h>
@interface WKArithmeticFilter : CIFilter {
CIImage *inputImage;
CIImage *inputBackgroundImage;
NSNumber *inputK1;
NSNumber *inputK2;
NSNumber *inputK3;
NSNumber *inputK4;
}
@end
1.1 SVGSupport/kcanvas/device/quartz/filters/WKArithmeticFilter.m
Index: WKArithmeticFilter.m
===================================================================
/*
* Copyright (C) 2005 Oliver Hunt <ojh16 at 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 "WKArithmeticFilter.h"
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];
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
1.1 SVGSupport/kcanvas/device/quartz/filters/WKDiffuseLightingFilter.cikernel
Index: WKDiffuseLightingFilter.cikernel
===================================================================
/*
* Copyright (C) 2005 Oliver Hunt <ojh16 at 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);
vec4 res = vec4(lightingColor.r * nl, lightingColor.g * nl, lightingColor.b * nl, 1.0);
res.xyz *= l4.w;
return res;
}
1.1 SVGSupport/kcanvas/device/quartz/filters/WKDiffuseLightingFilter.h
Index: WKDiffuseLightingFilter.h
===================================================================
/*
* 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>
@interface WKDiffuseLightingFilter : CIFilter {
CISampler *inputNormalMap;
CISampler *inputLightVectors;
CIColor *inputLightingColor;
NSNumber *inputSurfaceScale;
NSNumber *inputDiffuseConstant;
NSNumber *inputKernelUnitLengthX;
NSNumber *inputKernelUnitLengthY;
}
@end
1.1 SVGSupport/kcanvas/device/quartz/filters/WKDiffuseLightingFilter.m
Index: WKDiffuseLightingFilter.m
===================================================================
/*
* 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 "WKDiffuseLightingFilter.h"
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.0 green:1.0 blue:1.0 alpha:1.0],
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];
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
1.1 SVGSupport/kcanvas/device/quartz/filters/WKDistantLightFilter.cikernel
Index: WKDistantLightFilter.cikernel
===================================================================
kernel vec4 distantLightGenerator(sampler image, vec3 direction)
{
return vec4(direction.x, direction.y, direction.z, 1.0);
}
1.1 SVGSupport/kcanvas/device/quartz/filters/WKDistantLightFilter.h
Index: WKDistantLightFilter.h
===================================================================
/*
* 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>
@interface WKDistantLightFilter : CIFilter {
CIImage * inputNormalMap;
CIVector * inputLightDirection;
}
@end
1.1 SVGSupport/kcanvas/device/quartz/filters/WKDistantLightFilter.m
Index: WKDistantLightFilter.m
===================================================================
/*
* 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 "WKDistantLightFilter.h"
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];
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
1.1 SVGSupport/kcanvas/device/quartz/filters/WKNormalMapFilter.cikernel
Index: WKNormalMapFilter.cikernel
===================================================================
/*
* Copyright (C) 2005 Oliver Hunt <ojh16 at 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);
}
1.1 SVGSupport/kcanvas/device/quartz/filters/WKNormalMapFilter.h
Index: WKNormalMapFilter.h
===================================================================
/*
* 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>
@interface WKNormalMapFilter : CIFilter {
CIImage *inputImage;
NSNumber *inputSurfaceScale;
}
@end
1.1 SVGSupport/kcanvas/device/quartz/filters/WKNormalMapFilter.m
Index: WKNormalMapFilter.m
===================================================================
/*
* 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 "WKNormalMapFilter.h"
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];
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
1.1 SVGSupport/kcanvas/device/quartz/filters/WKPointLightFilter.cikernel
Index: WKPointLightFilter.cikernel
===================================================================
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);
}
1.1 SVGSupport/kcanvas/device/quartz/filters/WKPointLightFilter.h
Index: WKPointLightFilter.h
===================================================================
/*
* 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>
@interface WKPointLightFilter : CIFilter {
CIImage *inputNormalMap;
CIVector *inputLightPosition;
NSNumber *inputSurfaceScale;
}
@end
1.1 SVGSupport/kcanvas/device/quartz/filters/WKPointLightFilter.m
Index: WKPointLightFilter.m
===================================================================
/*
* 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 "WKPointLightFilter.h"
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];
NSArray *kernels = [CIKernel kernelsWithString:code];
pointLightFilter = [[kernels objectAtIndex:0] retain];
}
return [super init];
}
- (CIImage *)outputImage
{
return [self apply:pointLightFilter, inputNormalMap, inputLightPosition, inputSurfaceScale, nil];
}
@end
1.1 SVGSupport/kcanvas/device/quartz/filters/WKSpecularLightingFilter.cikernel
Index: WKSpecularLightingFilter.cikernel
===================================================================
/*
* Copyright (C) 2005 Oliver Hunt <ojh16 at 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;
}
1.1 SVGSupport/kcanvas/device/quartz/filters/WKSpecularLightingFilter.h
Index: WKSpecularLightingFilter.h
===================================================================
/*
* 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>
@interface WKSpecularLightingFilter : CIFilter {
CISampler *inputNormalMap;
CISampler *inputLightVectors;
CIColor *inputLightingColor;
NSNumber *inputSurfaceScale;
NSNumber *inputSpecularConstant;
NSNumber *inputSpecularExponent;
NSNumber *inputKernelUnitLengthX;
NSNumber *inputKernelUnitLengthY;
}
@end
1.1 SVGSupport/kcanvas/device/quartz/filters/WKSpecularLightingFilter.m
Index: WKSpecularLightingFilter.m
===================================================================
/*
* 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 "WKSpecularLightingFilter.h"
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.0 green:1.0 blue:1.0 alpha:1.0],
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];
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
1.1 SVGSupport/kcanvas/device/quartz/filters/WKSpotLightFilter.cikernel
Index: WKSpotLightFilter.cikernel
===================================================================
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);
}
1.1 SVGSupport/kcanvas/device/quartz/filters/WKSpotLightFilter.h
Index: WKSpotLightFilter.h
===================================================================
/*
* 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>
@interface WKSpotLightFilter : CIFilter {
CIImage *inputLightVectors;
CIVector *inputLightDirection;
NSNumber *inputSpecularExponent;
NSNumber *inputLimitingConeAngle;
}
@end
1.1 SVGSupport/kcanvas/device/quartz/filters/WKSpotLightFilter.m
Index: WKSpotLightFilter.m
===================================================================
/*
* 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 "WKSpotLightFilter.h"
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];
NSArray *kernels = [CIKernel kernelsWithString:code];
spotLightFilter = [[kernels objectAtIndex:0] retain];
}
return [super init];
}
- (CIImage *)outputImage
{
float coscutoff = cos([inputLimitingConeAngle floatValue]);
if (coscutoff < 0)
coscutoff = -coscutoff;
return [self apply:spotLightFilter, inputLightVectors, inputLightDirection, inputSpecularExponent, [NSNumber numberWithFloat:coscutoff], nil];
}
@end
1.3 +0 -1 SVGSupport/ksvg2/scripts/make_names.pl
Index: make_names.pl
===================================================================
RCS file: /cvs/root/SVGSupport/ksvg2/scripts/make_names.pl,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- make_names.pl 26 Nov 2005 22:27:06 -0000 1.2
+++ make_names.pl 28 Nov 2005 23:34:05 -0000 1.3
@@ -144,7 +144,6 @@
next if /glyph/i;
next if /kern/i;
next if /motion/i;
- next if /light/i;
next if /mask/i;
next if /meta/i;
next if /mpath/i;
1.13 +1 -1 SVGSupport/ksvg2/svg/SVGElementImpl.cpp
Index: SVGElementImpl.cpp
===================================================================
RCS file: /cvs/root/SVGSupport/ksvg2/svg/SVGElementImpl.cpp,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- SVGElementImpl.cpp 26 Nov 2005 22:35:47 -0000 1.12
+++ SVGElementImpl.cpp 28 Nov 2005 23:34:05 -0000 1.13
@@ -32,7 +32,7 @@
#include "ksvg.h"
#include "SVGNames.h"
#include "EventNames.h"
-#include "HTMLNames.h"
+#include "htmlnames.h"
#include "SVGElementImpl.h"
#include "SVGSVGElementImpl.h"
#include "SVGDOMImplementationImpl.h"
1.12 +9 -1 SVGSupport/ksvg2/svg/SVGFECompositeElementImpl.cpp
Index: SVGFECompositeElementImpl.cpp
===================================================================
RCS file: /cvs/root/SVGSupport/ksvg2/svg/SVGFECompositeElementImpl.cpp,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- SVGFECompositeElementImpl.cpp 27 Nov 2005 11:02:22 -0000 1.11
+++ SVGFECompositeElementImpl.cpp 28 Nov 2005 23:34:06 -0000 1.12
@@ -111,13 +111,21 @@
_operator()->setBaseVal(SVG_FECOMPOSITE_OPERATOR_ATOP);
else if(value == "xor")
_operator()->setBaseVal(SVG_FECOMPOSITE_OPERATOR_XOR);
- else if(value == "arithmatic")
+ else if(value == "arithmetic")
_operator()->setBaseVal(SVG_FECOMPOSITE_OPERATOR_ARITHMETIC);
}
else if (attr->name() == SVGNames::inAttr)
in1()->setBaseVal(value.impl());
else if (attr->name() == SVGNames::in2Attr)
in2()->setBaseVal(value.impl());
+ else if (attr->name() == SVGNames::k1Attr)
+ k1()->setBaseVal(value.qstring().toDouble());
+ else if (attr->name() == SVGNames::k2Attr)
+ k2()->setBaseVal(value.qstring().toDouble());
+ else if (attr->name() == SVGNames::k3Attr)
+ k3()->setBaseVal(value.qstring().toDouble());
+ else if (attr->name() == SVGNames::k4Attr)
+ k4()->setBaseVal(value.qstring().toDouble());
else
SVGFilterPrimitiveStandardAttributesImpl::parseMappedAttribute(attr);
}
1.15 +1 -1 SVGSupport/ksvg2/svg/SVGSVGElementImpl.cpp
Index: SVGSVGElementImpl.cpp
===================================================================
RCS file: /cvs/root/SVGSupport/ksvg2/svg/SVGSVGElementImpl.cpp,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- SVGSVGElementImpl.cpp 27 Nov 2005 11:02:26 -0000 1.14
+++ SVGSVGElementImpl.cpp 28 Nov 2005 23:34:07 -0000 1.15
@@ -59,7 +59,7 @@
#include <q3paintdevicemetrics.h>
#include <qtextstream.h>
-#include "HTMLNames.h"
+#include "htmlnames.h"
#include "EventNames.h"
using namespace KSVG;
1.1 SVGSupport/ksvg2/svg/SVGAnimatedColorImpl.cpp
Index: SVGAnimatedColorImpl.cpp
===================================================================
/*
Copyright (C) 2004, 2005 Nikolas Zimmermann <wildfox at kde.org>
2004, 2005 Rob Buis <buis at kde.org>
2005 Oliver Hunt <ojh16 at student.canterbury.ac.nz>
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
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#include "config.h"
#include "SVGAnimatedColorImpl.h"
using namespace KSVG;
SVGAnimatedColorImpl::SVGAnimatedColorImpl(const SVGStyledElementImpl *context)
: SVGAnimatedTemplate<SVGColorImpl>(context)
{
}
SVGAnimatedColorImpl::~SVGAnimatedColorImpl()
{
}
SVGColorImpl *SVGAnimatedColorImpl::create() const
{
return new SVGColorImpl();
}
void SVGAnimatedColorImpl::assign(SVGColorImpl *src, SVGColorImpl *dst) const
{
if (!src || !dst)
return;
dst->setCssText(src->cssText());
}
1.1 SVGSupport/ksvg2/svg/SVGAnimatedColorImpl.h
Index: SVGAnimatedColorImpl.h
===================================================================
/*
Copyright (C) 2004, 2005 Nikolas Zimmermann <wildfox at kde.org>
2004, 2005 Rob Buis <buis at kde.org>
2005 Oliver Hunt <ojh16 at student.canterbury.ac.nz>
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
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef KSVG_SVGAnimatedColorImpl_H
#define KSVG_SVGAnimatedColorImpl_H
#include "SVGColorImpl.h"
#include "SVGAnimatedTemplate.h"
namespace KSVG
{
class SVGAnimatedColorImpl : public SVGAnimatedTemplate<SVGColorImpl>
{
public:
SVGAnimatedColorImpl(const SVGStyledElementImpl *context);
virtual ~SVGAnimatedColorImpl();
protected:
virtual SVGColorImpl *create() const;
virtual void assign(SVGColorImpl *src, SVGColorImpl *dst) const;
};
};
#endif
1.1 SVGSupport/ksvg2/svg/SVGFEDiffuseLightingElementImpl.cpp
Index: SVGFEDiffuseLightingElementImpl.cpp
===================================================================
/*
Copyright (C) 2005 Oliver Hunt <ojh16 at student.canterbury.ac.nz>
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
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#include "config.h"
#include <qstringlist.h>
#include <kdom/core/AttrImpl.h>
#include <kcanvas/KCanvas.h>
#include <kcanvas/KCanvasRegistry.h>
#include <kcanvas/KCanvasFilters.h>
#include <kcanvas/device/KRenderingDevice.h>
#include "ksvg.h"
#include "SVGNames.h"
#include "SVGHelper.h"
#include "SVGRenderStyle.h"
#include "SVGAnimatedColorImpl.h"
#include "SVGAnimatedNumberImpl.h"
#include "SVGAnimatedStringImpl.h"
#include "SVGFELightElementImpl.h"
#include "SVGDOMImplementationImpl.h"
#include "SVGFEDiffuseLightingElementImpl.h"
using namespace KSVG;
SVGFEDiffuseLightingElementImpl::SVGFEDiffuseLightingElementImpl(const KDOM::QualifiedName& tagName, KDOM::DocumentImpl *doc) :
SVGFilterPrimitiveStandardAttributesImpl(tagName, doc)
{
m_filterEffect = 0;
}
SVGFEDiffuseLightingElementImpl::~SVGFEDiffuseLightingElementImpl()
{
delete m_filterEffect;
}
SVGAnimatedStringImpl *SVGFEDiffuseLightingElementImpl::in1() const
{
SVGStyledElementImpl *dummy = 0;
return lazy_create<SVGAnimatedStringImpl>(m_in1, dummy);
}
SVGAnimatedNumberImpl *SVGFEDiffuseLightingElementImpl::diffuseConstant() const
{
SVGStyledElementImpl *dummy = 0;
return lazy_create<SVGAnimatedNumberImpl>(m_diffuseConstant, dummy);
}
SVGAnimatedNumberImpl *SVGFEDiffuseLightingElementImpl::surfaceScale() const
{
SVGStyledElementImpl *dummy = 0;
return lazy_create<SVGAnimatedNumberImpl>(m_surfaceScale, dummy);
}
SVGAnimatedNumberImpl *SVGFEDiffuseLightingElementImpl::kernelUnitLengthX() const
{
SVGStyledElementImpl *dummy = 0;
return lazy_create<SVGAnimatedNumberImpl>(m_kernelUnitLengthX, dummy);
}
SVGAnimatedNumberImpl *SVGFEDiffuseLightingElementImpl::kernelUnitLengthY() const
{
SVGStyledElementImpl *dummy = 0;
return lazy_create<SVGAnimatedNumberImpl>(m_kernelUnitLengthY, dummy);
}
SVGAnimatedColorImpl *SVGFEDiffuseLightingElementImpl::lightingColor() const
{
SVGStyledElementImpl *dummy = 0;
return lazy_create<SVGAnimatedColorImpl>(m_lightingColor, dummy);
}
void SVGFEDiffuseLightingElementImpl::parseMappedAttribute(KDOM::MappedAttributeImpl *attr)
{
KDOM::DOMString value(attr->value());
if (attr->name() == SVGNames::inAttr)
in1()->setBaseVal(value.impl());
else if (attr->name() == SVGNames::surfaceScaleAttr)
surfaceScale()->setBaseVal(value.qstring().toDouble());
else if (attr->name() == SVGNames::diffuseConstantAttr)
diffuseConstant()->setBaseVal(value.toInt());
else if (attr->name() == SVGNames::kernelUnitLengthAttr) {
QStringList numbers = QStringList::split(' ', value.qstring());
kernelUnitLengthX()->setBaseVal(numbers[0].toDouble());
if (numbers.count() == 1)
kernelUnitLengthY()->setBaseVal(numbers[0].toDouble());
else
kernelUnitLengthY()->setBaseVal(numbers[1].toDouble());
} else if (attr->name() == SVGNames::lighting_colorAttr)
lightingColor()->setBaseVal(new SVGColorImpl(value.impl()));
else
SVGFilterPrimitiveStandardAttributesImpl::parseMappedAttribute(attr);
}
KCanvasFEDiffuseLighting *SVGFEDiffuseLightingElementImpl::filterEffect() const
{
if (!m_filterEffect)
m_filterEffect = static_cast<KCanvasFEDiffuseLighting *>(QPainter::renderingDevice()->createFilterEffect(FE_DIFFUSE_LIGHTING));
m_filterEffect->setIn(KDOM::DOMString(in1()->baseVal()).qstring());
setStandardAttributes(m_filterEffect);
m_filterEffect->setDiffuseConstant((diffuseConstant()->baseVal()));
m_filterEffect->setSurfaceScale((surfaceScale()->baseVal()));
m_filterEffect->setKernelUnitLengthX((kernelUnitLengthX()->baseVal()));
m_filterEffect->setKernelUnitLengthY((kernelUnitLengthY()->baseVal()));
m_filterEffect->setLightingColor(lightingColor()->baseVal()->color());
updateLights();
return m_filterEffect;
}
void SVGFEDiffuseLightingElementImpl::updateLights() const
{
if (!m_filterEffect)
return;
KCLightSource *light = 0;
for (KDOM::NodeImpl *n = firstChild(); n; n = n->nextSibling()) {
if (n->hasTagName(SVGNames::feDistantLightTag)||n->hasTagName(SVGNames::fePointLightTag)||n->hasTagName(SVGNames::feSpotLightTag)) {
SVGFELightElementImpl *lightNode = static_cast<SVGFELightElementImpl *>(n);
light = lightNode->lightSource();
break;
}
}
m_filterEffect->setLightSource(light);
}
1.1 SVGSupport/ksvg2/svg/SVGFEDiffuseLightingElementImpl.h
Index: SVGFEDiffuseLightingElementImpl.h
===================================================================
/*
Copyright (C) 2004, 2005 Nikolas Zimmermann <wildfox at kde.org>
2004, 2005 Rob Buis <buis at kde.org>
2005 Oliver Hunt <ojh16 at student.canterbury.ac.nz>
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
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef KSVG_SVGFEDiffuseLightingElementImpl_H
#define KSVG_SVGFEDiffuseLightingElementImpl_H
#include "SVGFilterPrimitiveStandardAttributesImpl.h"
class KCanvasFEDiffuseLighting;
namespace KSVG
{
class SVGAnimatedNumberImpl;
class SVGAnimatedStringImpl;
class SVGAnimatedColorImpl;
class SVGFEDiffuseLightingElementImpl : public SVGFilterPrimitiveStandardAttributesImpl
{
public:
SVGFEDiffuseLightingElementImpl(const KDOM::QualifiedName& tagName, KDOM::DocumentImpl *doc);
virtual ~SVGFEDiffuseLightingElementImpl();
// 'SVGFEDiffuseLightingElement' functions
SVGAnimatedStringImpl *in1() const;
SVGAnimatedNumberImpl *diffuseConstant() const;
SVGAnimatedNumberImpl *surfaceScale() const;
SVGAnimatedNumberImpl *kernelUnitLengthX() const;
SVGAnimatedNumberImpl *kernelUnitLengthY() const;
SVGAnimatedColorImpl *lightingColor() const;
// Derived from: 'ElementImpl'
virtual void parseMappedAttribute(KDOM::MappedAttributeImpl *attr);
virtual KCanvasFEDiffuseLighting *filterEffect() const;
private:
mutable SharedPtr<SVGAnimatedStringImpl> m_in1;
mutable SharedPtr<SVGAnimatedNumberImpl> m_diffuseConstant;
mutable SharedPtr<SVGAnimatedNumberImpl> m_surfaceScale;
mutable SharedPtr<SVGAnimatedColorImpl> m_lightingColor;
mutable SharedPtr<SVGAnimatedNumberImpl> m_kernelUnitLengthX;
mutable SharedPtr<SVGAnimatedNumberImpl> m_kernelUnitLengthY;
//need other properties here...
mutable KCanvasFEDiffuseLighting *m_filterEffect;
//light management
void updateLights() const;
};
};
#endif
1.1 SVGSupport/ksvg2/svg/SVGFEDistantLightElementImpl.cpp
Index: SVGFEDistantLightElementImpl.cpp
===================================================================
#include "SVGFEDistantLightElementImpl.h"
#include "SVGAnimatedStringImpl.h"
#include "SVGAnimatedNumberImpl.h"
#include "SVGAnimatedEnumerationImpl.h"
#include "SVGDOMImplementationImpl.h"
using namespace KSVG;
SVGFEDistantLightElementImpl::SVGFEDistantLightElementImpl(const KDOM::QualifiedName& tagName, KDOM::DocumentImpl *doc) :
SVGFELightElementImpl(tagName, doc)
{
}
SVGFEDistantLightElementImpl::~SVGFEDistantLightElementImpl()
{
}
KCLightSource *SVGFEDistantLightElementImpl::lightSource() const
{
return new KCDistantLightSource(azimuth()->baseVal(), elevation()->baseVal());
}
1.1 SVGSupport/ksvg2/svg/SVGFEDistantLightElementImpl.h
Index: SVGFEDistantLightElementImpl.h
===================================================================
#ifndef KSVG_SVGFEDistantLightElementImpl_H
#define KSVG_SVGFEDistantLightElementImpl_H
#include "SVGFELightElementImpl.h"
namespace KSVG
{
class SVGFEDistantLightElementImpl : public SVGFELightElementImpl
{
public:
SVGFEDistantLightElementImpl(const KDOM::QualifiedName& tagName, KDOM::DocumentImpl *doc);
virtual ~SVGFEDistantLightElementImpl();
virtual KCLightSource *lightSource() const;
};
};
#endif
1.1 SVGSupport/ksvg2/svg/SVGFELightElementImpl.cpp
Index: SVGFELightElementImpl.cpp
===================================================================
/*
Copyright (C) 2004, 2005 Nikolas Zimmermann <wildfox at kde.org>
2004, 2005 Rob Buis <buis at kde.org>
2005 Oliver Hunt <ojh16 at student.canterbury.ac.nz>
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
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#include "config.h"
#include <qstringlist.h>
#include <kdom/core/AttrImpl.h>
#include <kcanvas/KCanvas.h>
#include <kcanvas/KCanvasRegistry.h>
#include <kcanvas/KCanvasResources.h>
#include <kcanvas/KCanvasFilters.h>
#include <kcanvas/device/KRenderingDevice.h>
#include "SVGNames.h"
#include "SVGHelper.h"
#include "SVGRenderStyle.h"
#include "SVGFELightElementImpl.h"
#include "SVGAnimatedStringImpl.h"
#include "SVGAnimatedNumberImpl.h"
#include "SVGAnimatedEnumerationImpl.h"
#include "SVGDOMImplementationImpl.h"
using namespace KSVG;
SVGFELightElementImpl::SVGFELightElementImpl(const KDOM::QualifiedName& tagName, KDOM::DocumentImpl *doc) :
SVGElementImpl(tagName, doc)
{
}
SVGFELightElementImpl::~SVGFELightElementImpl()
{
}
SVGAnimatedNumberImpl *SVGFELightElementImpl::azimuth() const
{
SVGStyledElementImpl *dummy = 0;
return lazy_create<SVGAnimatedNumberImpl>(m_azimuth, dummy);
}
SVGAnimatedNumberImpl *SVGFELightElementImpl::elevation() const
{
SVGStyledElementImpl *dummy = 0;
return lazy_create<SVGAnimatedNumberImpl>(m_elevation, dummy);
}
SVGAnimatedNumberImpl *SVGFELightElementImpl::x() const
{
SVGStyledElementImpl *dummy = 0;
return lazy_create<SVGAnimatedNumberImpl>(m_x, dummy);
}
SVGAnimatedNumberImpl *SVGFELightElementImpl::y() const
{
SVGStyledElementImpl *dummy = 0;
return lazy_create<SVGAnimatedNumberImpl>(m_y, dummy);
}
SVGAnimatedNumberImpl *SVGFELightElementImpl::z() const
{
SVGStyledElementImpl *dummy = 0;
return lazy_create<SVGAnimatedNumberImpl>(m_z, dummy);
}
SVGAnimatedNumberImpl *SVGFELightElementImpl::pointsAtX() const
{
SVGStyledElementImpl *dummy = 0;
return lazy_create<SVGAnimatedNumberImpl>(m_pointsAtX, dummy);
}
SVGAnimatedNumberImpl *SVGFELightElementImpl::pointsAtY() const
{
SVGStyledElementImpl *dummy = 0;
return lazy_create<SVGAnimatedNumberImpl>(m_pointsAtY, dummy);
}
SVGAnimatedNumberImpl *SVGFELightElementImpl::pointsAtZ() const
{
SVGStyledElementImpl *dummy = 0;
return lazy_create<SVGAnimatedNumberImpl>(m_pointsAtZ, dummy);
}
SVGAnimatedNumberImpl *SVGFELightElementImpl::specularExponent() const
{
SVGStyledElementImpl *dummy = 0;
return lazy_create<SVGAnimatedNumberImpl>(m_specularExponent, dummy);
}
SVGAnimatedNumberImpl *SVGFELightElementImpl::limitingConeAngle() const
{
SVGStyledElementImpl *dummy = 0;
return lazy_create<SVGAnimatedNumberImpl>(m_limitingConeAngle, dummy);
}
void SVGFELightElementImpl::parseMappedAttribute(KDOM::MappedAttributeImpl *attr)
{
KDOM::DOMString value(attr->value());
if (attr->name() == SVGNames::azimuthAttr)
azimuth()->setBaseVal(value.qstring().toDouble());
else if (attr->name() == SVGNames::elevationAttr)
elevation()->setBaseVal(value.qstring().toDouble());
else if (attr->name() == SVGNames::xAttr)
x()->setBaseVal(value.qstring().toDouble());
else if (attr->name() == SVGNames::yAttr)
y()->setBaseVal(value.qstring().toDouble());
else if (attr->name() == SVGNames::zAttr)
z()->setBaseVal(value.qstring().toDouble());
else if (attr->name() == SVGNames::pointsAtXAttr)
pointsAtX()->setBaseVal(value.qstring().toDouble());
else if (attr->name() == SVGNames::pointsAtYAttr)
pointsAtY()->setBaseVal(value.qstring().toDouble());
else if (attr->name() == SVGNames::pointsAtZAttr)
pointsAtZ()->setBaseVal(value.qstring().toDouble());
else if (attr->name() == SVGNames::specularExponentAttr)
specularExponent()->setBaseVal(value.qstring().toDouble());
else if (attr->name() == SVGNames::limitingConeAngleAttr)
limitingConeAngle()->setBaseVal(value.qstring().toDouble());
else
SVGElementImpl::parseMappedAttribute(attr);
}
1.1 SVGSupport/ksvg2/svg/SVGFELightElementImpl.h
Index: SVGFELightElementImpl.h
===================================================================
/*
Copyright (C) 2004, 2005 Nikolas Zimmermann <wildfox at kde.org>
2004, 2005 Rob Buis <buis at kde.org>
2005 Oliver Hunt <ojh16 at student.canterbury.ac.nz>
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
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef KSVG_SVGFELightElementImpl_H
#define KSVG_SVGFELightElementImpl_H
#include "config.h"
#include "SVGElementImpl.h"
#include "KCanvasFilters.h"
namespace KSVG
{
class SVGAnimatedNumberImpl;
class SVGAnimatedNumberListImpl;
class SVGAnimatedEnumerationImpl;
class SVGFELightElementImpl : public SVGElementImpl
{
public:
SVGFELightElementImpl(const KDOM::QualifiedName& tagName, KDOM::DocumentImpl *doc);
virtual ~SVGFELightElementImpl();
// 'SVGComponentTransferFunctionElement' functions
SVGAnimatedNumberImpl *azimuth() const;
SVGAnimatedNumberImpl *elevation() const;
SVGAnimatedNumberImpl *x() const;
SVGAnimatedNumberImpl *y() const;
SVGAnimatedNumberImpl *z() const;
SVGAnimatedNumberImpl *pointsAtX() const;
SVGAnimatedNumberImpl *pointsAtY() const;
SVGAnimatedNumberImpl *pointsAtZ() const;
SVGAnimatedNumberImpl *specularExponent() const;
SVGAnimatedNumberImpl *limitingConeAngle() const;
virtual KCLightSource *lightSource() const = 0;
// Derived from: 'ElementImpl'
virtual void parseMappedAttribute(KDOM::MappedAttributeImpl *attr);
private:
mutable SharedPtr<SVGAnimatedNumberImpl> m_azimuth;
mutable SharedPtr<SVGAnimatedNumberImpl> m_elevation;
mutable SharedPtr<SVGAnimatedNumberImpl> m_x;
mutable SharedPtr<SVGAnimatedNumberImpl> m_y;
mutable SharedPtr<SVGAnimatedNumberImpl> m_z;
mutable SharedPtr<SVGAnimatedNumberImpl> m_pointsAtX;
mutable SharedPtr<SVGAnimatedNumberImpl> m_pointsAtY;
mutable SharedPtr<SVGAnimatedNumberImpl> m_pointsAtZ;
mutable SharedPtr<SVGAnimatedNumberImpl> m_specularExponent;
mutable SharedPtr<SVGAnimatedNumberImpl> m_limitingConeAngle;
};
};
#endif
1.1 SVGSupport/ksvg2/svg/SVGFEPointLightElementImpl.cpp
Index: SVGFEPointLightElementImpl.cpp
===================================================================
#include "SVGFEPointLightElementImpl.h"
#include "SVGAnimatedStringImpl.h"
#include "SVGAnimatedNumberImpl.h"
#include "SVGAnimatedEnumerationImpl.h"
#include "SVGDOMImplementationImpl.h"
using namespace KSVG;
SVGFEPointLightElementImpl::SVGFEPointLightElementImpl(const KDOM::QualifiedName& tagName, KDOM::DocumentImpl *doc) :
SVGFELightElementImpl(tagName, doc)
{
}
SVGFEPointLightElementImpl::~SVGFEPointLightElementImpl()
{
}
KCLightSource *SVGFEPointLightElementImpl::lightSource() const
{
KCanvasPoint3F pos(x()->baseVal(), y()->baseVal(), z()->baseVal());
return new KCPointLightSource(pos);
}
1.1 SVGSupport/ksvg2/svg/SVGFEPointLightElementImpl.h
Index: SVGFEPointLightElementImpl.h
===================================================================
#ifndef KSVG_SVGFEPointLightElementImpl_H
#define KSVG_SVGFEPointLightElementImpl_H
#include "SVGFELightElementImpl.h"
namespace KSVG
{
class SVGFEPointLightElementImpl : public SVGFELightElementImpl
{
public:
SVGFEPointLightElementImpl(const KDOM::QualifiedName& tagName, KDOM::DocumentImpl *doc);
virtual ~SVGFEPointLightElementImpl();
virtual KCLightSource *lightSource() const;
};
};
#endif
1.1 SVGSupport/ksvg2/svg/SVGFESpecularLightingElementImpl.cpp
Index: SVGFESpecularLightingElementImpl.cpp
===================================================================
/*
Copyright (C) 2005 Oliver Hunt <ojh16 at student.canterbury.ac.nz>
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
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#include "config.h"
#include <qstringlist.h>
#include <kdom/core/AttrImpl.h>
#include <kcanvas/KCanvas.h>
#include <kcanvas/KCanvasRegistry.h>
#include <kcanvas/KCanvasFilters.h>
#include <kcanvas/device/KRenderingDevice.h>
#include "SVGNames.h"
#include "SVGHelper.h"
#include "SVGRenderStyle.h"
#include "SVGAnimatedColorImpl.h"
#include "SVGAnimatedNumberImpl.h"
#include "SVGAnimatedStringImpl.h"
#include "SVGFELightElementImpl.h"
#include "SVGDOMImplementationImpl.h"
#include "SVGFESpecularLightingElementImpl.h"
using namespace KSVG;
SVGFESpecularLightingElementImpl::SVGFESpecularLightingElementImpl(const KDOM::QualifiedName& tagName, KDOM::DocumentImpl *doc) :
SVGFilterPrimitiveStandardAttributesImpl(tagName, doc)
{
m_filterEffect = 0;
}
SVGFESpecularLightingElementImpl::~SVGFESpecularLightingElementImpl()
{
delete m_filterEffect;
}
SVGAnimatedStringImpl *SVGFESpecularLightingElementImpl::in1() const
{
SVGStyledElementImpl *dummy = 0;
return lazy_create<SVGAnimatedStringImpl>(m_in1, dummy);
}
SVGAnimatedNumberImpl *SVGFESpecularLightingElementImpl::specularConstant() const
{
SVGStyledElementImpl *dummy = 0;
return lazy_create<SVGAnimatedNumberImpl>(m_specularConstant, dummy);
}
SVGAnimatedNumberImpl *SVGFESpecularLightingElementImpl::specularExponent() const
{
SVGStyledElementImpl *dummy = 0;
return lazy_create<SVGAnimatedNumberImpl>(m_specularExponent, dummy);
}
SVGAnimatedNumberImpl *SVGFESpecularLightingElementImpl::surfaceScale() const
{
SVGStyledElementImpl *dummy = 0;
return lazy_create<SVGAnimatedNumberImpl>(m_surfaceScale, dummy);
}
SVGAnimatedNumberImpl *SVGFESpecularLightingElementImpl::kernelUnitLengthX() const
{
SVGStyledElementImpl *dummy = 0;
return lazy_create<SVGAnimatedNumberImpl>(m_kernelUnitLengthX, dummy);
}
SVGAnimatedNumberImpl *SVGFESpecularLightingElementImpl::kernelUnitLengthY() const
{
SVGStyledElementImpl *dummy = 0;
return lazy_create<SVGAnimatedNumberImpl>(m_kernelUnitLengthY, dummy);
}
SVGAnimatedColorImpl *SVGFESpecularLightingElementImpl::lightingColor() const
{
SVGStyledElementImpl *dummy = 0;
return lazy_create<SVGAnimatedColorImpl>(m_lightingColor, dummy);
}
void SVGFESpecularLightingElementImpl::parseMappedAttribute(KDOM::MappedAttributeImpl *attr)
{
KDOM::DOMString value(attr->value());
if (attr->name() == SVGNames::inAttr)
in1()->setBaseVal(value.impl());
else if (attr->name() == SVGNames::surfaceScaleAttr)
surfaceScale()->setBaseVal(value.qstring().toDouble());
else if (attr->name() == SVGNames::specularConstantAttr)
specularConstant()->setBaseVal(value.qstring().toDouble());
else if (attr->name() == SVGNames::specularExponentAttr)
specularExponent()->setBaseVal(value.qstring().toDouble());
else if (attr->name() == SVGNames::kernelUnitLengthAttr) {
QStringList numbers = QStringList::split(' ', value.qstring());
kernelUnitLengthX()->setBaseVal(numbers[0].toDouble());
if (numbers.count() == 1)
kernelUnitLengthY()->setBaseVal(numbers[0].toDouble());
else
kernelUnitLengthY()->setBaseVal(numbers[1].toDouble());
} else if (attr->name() == SVGNames::lighting_colorAttr)
lightingColor()->setBaseVal(new SVGColorImpl(value.impl()));
else
SVGFilterPrimitiveStandardAttributesImpl::parseMappedAttribute(attr);
}
KCanvasFESpecularLighting *SVGFESpecularLightingElementImpl::filterEffect() const
{
if (!m_filterEffect)
m_filterEffect = static_cast<KCanvasFESpecularLighting *>(QPainter::renderingDevice()->createFilterEffect(FE_SPECULAR_LIGHTING));
m_filterEffect->setIn(KDOM::DOMString(in1()->baseVal()).qstring());
setStandardAttributes(m_filterEffect);
m_filterEffect->setSpecularConstant((specularConstant()->baseVal()));
m_filterEffect->setSpecularExponent((specularExponent()->baseVal()));
m_filterEffect->setSurfaceScale((surfaceScale()->baseVal()));
m_filterEffect->setKernelUnitLengthX((kernelUnitLengthX()->baseVal()));
m_filterEffect->setKernelUnitLengthY((kernelUnitLengthY()->baseVal()));
m_filterEffect->setLightingColor(lightingColor()->baseVal()->color());
updateLights();
return m_filterEffect;
}
void SVGFESpecularLightingElementImpl::updateLights() const
{
if (!m_filterEffect)
return;
KCLightSource *light = 0;
for (KDOM::NodeImpl *n = firstChild(); n; n = n->nextSibling()) {
if (n->hasTagName(SVGNames::feDistantLightTag)||n->hasTagName(SVGNames::fePointLightTag)||n->hasTagName(SVGNames::feSpotLightTag)) {
SVGFELightElementImpl *lightNode = static_cast<SVGFELightElementImpl *>(n);
light = lightNode->lightSource();
break;
}
}
m_filterEffect->setLightSource(light);
}
1.1 SVGSupport/ksvg2/svg/SVGFESpecularLightingElementImpl.h
Index: SVGFESpecularLightingElementImpl.h
===================================================================
/*
Copyright (C) 2004, 2005 Nikolas Zimmermann <wildfox at kde.org>
2004, 2005 Rob Buis <buis at kde.org>
2005 Oliver Hunt <ojh16 at student.canterbury.ac.nz>
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
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef KSVG_SVGFESpecularLightingElementImpl_H
#define KSVG_SVGFESpecularLightingElementImpl_H
#include "SVGFilterPrimitiveStandardAttributesImpl.h"
#include "KCanvasFilters.h"
namespace KSVG
{
class SVGAnimatedNumberImpl;
class SVGAnimatedStringImpl;
class SVGAnimatedColorImpl;
class SVGFESpecularLightingElementImpl : public SVGFilterPrimitiveStandardAttributesImpl
{
public:
SVGFESpecularLightingElementImpl(const KDOM::QualifiedName& tagName, KDOM::DocumentImpl *doc);
virtual ~SVGFESpecularLightingElementImpl();
// 'SVGFEDiffuseLightingElement' functions
SVGAnimatedStringImpl *in1() const;
SVGAnimatedNumberImpl *specularConstant() const;
SVGAnimatedNumberImpl *specularExponent() const;
SVGAnimatedNumberImpl *surfaceScale() const;
SVGAnimatedNumberImpl *kernelUnitLengthX() const;
SVGAnimatedNumberImpl *kernelUnitLengthY() const;
SVGAnimatedColorImpl *lightingColor() const;
// Derived from: 'ElementImpl'
virtual void parseMappedAttribute(KDOM::MappedAttributeImpl *attr);
virtual KCanvasFESpecularLighting *filterEffect() const;
private:
mutable SharedPtr<SVGAnimatedStringImpl> m_in1;
mutable SharedPtr<SVGAnimatedNumberImpl> m_specularConstant;
mutable SharedPtr<SVGAnimatedNumberImpl> m_specularExponent;
mutable SharedPtr<SVGAnimatedNumberImpl> m_surfaceScale;
mutable SharedPtr<SVGAnimatedColorImpl> m_lightingColor;
mutable SharedPtr<SVGAnimatedNumberImpl> m_kernelUnitLengthX;
mutable SharedPtr<SVGAnimatedNumberImpl> m_kernelUnitLengthY;
//need other properties here...
mutable KCanvasFESpecularLighting *m_filterEffect;
//light management
void updateLights() const;
};
};
#endif
1.1 SVGSupport/ksvg2/svg/SVGFESpotLightElementImpl.cpp
Index: SVGFESpotLightElementImpl.cpp
===================================================================
#include "SVGFESpotLightElementImpl.h"
#include "SVGAnimatedStringImpl.h"
#include "SVGAnimatedNumberImpl.h"
#include "SVGAnimatedEnumerationImpl.h"
#include "SVGDOMImplementationImpl.h"
using namespace KSVG;
SVGFESpotLightElementImpl::SVGFESpotLightElementImpl(const KDOM::QualifiedName& tagName, KDOM::DocumentImpl *doc) :
SVGFELightElementImpl(tagName, doc)
{
}
SVGFESpotLightElementImpl::~SVGFESpotLightElementImpl()
{
}
KCLightSource *SVGFESpotLightElementImpl::lightSource() const
{
KCanvasPoint3F pos(x()->baseVal(), y()->baseVal(), z()->baseVal());
//convert lookAt to a direction
KCanvasPoint3F direction(pointsAtX()->baseVal() - pos.x(),
pointsAtY()->baseVal() - pos.y(),
pointsAtZ()->baseVal() - pos.z());
direction.normalize();
return new KCSpotLightSource(pos, direction, specularExponent()->baseVal(), limitingConeAngle()->baseVal());
}
1.1 SVGSupport/ksvg2/svg/SVGFESpotLightElementImpl.h
Index: SVGFESpotLightElementImpl.h
===================================================================
#ifndef KSVG_SVGFESpotLightElementImpl_H
#define KSVG_SVGFESpotLightElementImpl_H
#include "SVGFELightElementImpl.h"
namespace KSVG
{
class SVGFESpotLightElementImpl : public SVGFELightElementImpl
{
public:
SVGFESpotLightElementImpl(const KDOM::QualifiedName& tagName, KDOM::DocumentImpl *doc);
virtual ~SVGFESpotLightElementImpl();
virtual KCLightSource *lightSource() const;
};
};
#endif
More information about the webkit-changes
mailing list