Bug 32199 - feSpecularLighting is not implemented
Summary: feSpecularLighting is not implemented
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: SVG (show other bugs)
Version: 525.x (Safari 3.1)
Hardware: PC OS X 10.5
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on: 32197
Blocks: 68469 26389
  Show dependency treegraph
 
Reported: 2009-12-06 12:24 PST by Dirk Schulze
Modified: 2014-05-12 05:54 PDT (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dirk Schulze 2009-12-06 12:24:21 PST
feSpecularLighting is not implemented
Comment 1 Zoltan Herczeg 2010-04-29 06:27:58 PDT
It seems to me it is still an unimplemented feature, and I think of pick up this task for myself. I am new on svg part of WebKit, and I want to make sure my approach is reasonable:

 - from an <feSpecularLighting ...> tag a FESpecularLighting object is created
   it contains one light source (It is unclear for me that multiple light
   sources are allowed or not)
 - I have to implement its "void apply(Filter*)" function
 - SVGFESpecularLightingElement is used only for visiting the nodes

Besides, why the filters are spread across multiple directories in WebKit?
 platform/graphics/filters, svg/graphics/filters ?

Ok the task itself (based on GaussianBlur):

void FESpecularLighting::apply(Filter*)
{
    m_in->apply(filter);
    if (!m_in->resultImage())
        return;

    if (!getEffectContext())
        return;

    setIsAlphaImage(m_in->isAlphaImage());

    IntRect effectDrawingRect = calculateDrawingIntRect(m_in->scaledSubRegion());
    RefPtr<ImageData> srcImageData(m_in->resultImage()->getPremultipliedImageData(effectDrawingRect));
    CanvasPixelArray* srcPixelArray(srcImageData->data());

    // Do the effect here
    // http://www.w3.org/TR/SVG/filters.html#feSpecularLighting

    resultImage()->putPremultipliedImageData(srcImageData.get(), imageRect, IntPoint());
}

Is this ok?
Comment 2 Dirk Schulze 2010-04-29 09:44:30 PDT
At first, there are two lighting filter effects, feSpecularLighting and feDiffuseLighting. Both can be combined with one of three light sources: feDistantLight, fePointLight, feSpotLight. To combine the lighting effect with a light source, just add the light source as a child to the lighting effect. There should be just one light source per lighting effect. For more detailed information, look at:

http://www.w3.org/TR/SVG/filters.html

For the implementation, you 'just' need to write the apply function, thats correct. Some, not _that_ svg specific, effects are in platform/graphics/filters. The may or may not be used by CSS in the feature to implement CSS filter effects.
Comment 3 Zoltan Herczeg 2010-04-30 00:54:31 PDT
One more question: FESpecularLighting has a virtual function called "uniteEffectRect", which looks renamed to "uniteChildEffectSubregions", isn't it?
Comment 4 Nikolas Zimmermann 2010-05-07 06:41:07 PDT
Dirk, can you comment on Zoltans question?
Comment 5 Dirk Schulze 2010-05-07 08:25:30 PDT
(In reply to comment #3)
> One more question: FESpecularLighting has a virtual function called
> "uniteEffectRect", which looks renamed to "uniteChildEffectSubregions", isn't
> it?

FESpecularLighting should look simiular to FEDiffuseLighting. It's a mistake, if it doesn't look the same.
Comment 6 Zoltan Herczeg 2010-05-12 06:08:25 PDT
Patch for #32197 (https://bugs.webkit.org/show_bug.cgi?id=32197) also resolved this bug.