PassRefPtr<LightSource> SVGFESpotLightElement::lightSource() const { FloatPoint3D pos(x(), y(), z()); FloatPoint3D direction(pointsAtX(), pointsAtY(), pointsAtZ()); return SpotLightSource::create(pos, direction, specularExponent(), limitingConeAngle()); }
TextStream& SpotLightSource::externalRepresentation(TextStream& ts) const { ts << "[type=SPOT-LIGHT] "; ts << "[position=\"" << position() << "\"]"; ts << "[direction=\"" << direction() << "\"]"; ts << "[specularExponent=\"" << specularExponent() << "\"]"; ts << "[limitingConeAngle=\"" << limitingConeAngle() << "\"]"; return ts; }
SVGLightSource* SVGFESpotLightElement::lightSource() const { FloatPoint3D pos(x(), y(), z()); // convert lookAt to a direction FloatPoint3D direction(pointsAtX() - pos.x(), pointsAtY() - pos.y(), pointsAtZ() - pos.z()); direction.normalize(); return new SVGSpotLightSource(pos, direction, specularExponent(), limitingConeAngle()); }
PassRefPtr<FilterEffect> SVGFESpecularLightingElement::build(SVGFilterBuilder* filterBuilder) { FilterEffect* input1 = filterBuilder->getEffectById(in1()); if (!input1) return 0; RefPtr<RenderStyle> filterStyle = styleForRenderer(); Color color = filterStyle->svgStyle()->lightingColor(); return FESpecularLighting::create(input1, color, surfaceScale(), specularConstant(), specularExponent(), kernelUnitLengthX(), kernelUnitLengthY(), findLights()); }
bool SVGFESpecularLightingElement::build(SVGResourceFilter* filterResource) { FilterEffect* input1 = filterResource->builder()->getEffectById(in1()); if (!input1) return false; RefPtr<RenderStyle> filterStyle = styleForRenderer(); Color color = filterStyle->svgStyle()->lightingColor(); RefPtr<FilterEffect> effect = FESpecularLighting::create(input1, color, surfaceScale(), specularConstant(), specularExponent(), kernelUnitLengthX(), kernelUnitLengthY(), findLights()); filterResource->addFilterEffect(this, effect.release()); return true; }