Bug 32199
Summary: | feSpecularLighting is not implemented | ||
---|---|---|---|
Product: | WebKit | Reporter: | Dirk Schulze <krit> |
Component: | SVG | Assignee: | Nobody <webkit-unassigned> |
Status: | RESOLVED FIXED | ||
Severity: | Normal | CC: | jeffschiller, zherczeg, zimmermann |
Priority: | P2 | ||
Version: | 525.x (Safari 3.1) | ||
Hardware: | PC | ||
OS: | OS X 10.5 | ||
Bug Depends on: | 32197 | ||
Bug Blocks: | 68469, 26389 |
Dirk Schulze
feSpecularLighting is not implemented
Attachments | ||
---|---|---|
Add attachment proposed patch, testcase, etc. |
Zoltan Herczeg
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?
Dirk Schulze
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.
Zoltan Herczeg
One more question: FESpecularLighting has a virtual function called "uniteEffectRect", which looks renamed to "uniteChildEffectSubregions", isn't it?
Nikolas Zimmermann
Dirk, can you comment on Zoltans question?
Dirk Schulze
(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.
Zoltan Herczeg
Patch for #32197 (https://bugs.webkit.org/show_bug.cgi?id=32197) also resolved this bug.