Commit 45ba3683 authored by eseidel's avatar eseidel

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


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@11320 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 26696ffe
2005-11-28 Oliver Hunt <ojh16@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@apple.com>
Reviewed by Geoff
This diff is collapsed.
......@@ -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 @@ void KCanvasFilterEffect::setResult(const QString &result)
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 @@ QTextStream &KCanvasFilterEffect::externalRepresentation(QTextStream &ts) const
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 @@ static QTextStream &operator<<(QTextStream &ts, KCEdgeModeType t)
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 @@ QTextStream &KCanvasFEDiffuseLighting::externalRepresentation(QTextStream &ts) c
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;
}
......
......@@ -53,6 +53,61 @@ typedef enum
#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 @@ private:
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 @@ typedef enum {
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;