You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-dev@xmlgraphics.apache.org by Thierry Kormann <Th...@sophia.inria.fr> on 2000/11/09 17:47:45 UTC
clip-path on mask and filter
Hi,
A question about clip-path and mask and filter.
In SVG we can specify a clip path on mask and filter. I think I can do it for
mask (as mask creates a GVT tree - then I can apply a clip on it).
My questions are:
a. With : new ConcreteMaskRable(filter, maskNode, maskRegion);
Do ConcreteMaskRable consider the clipping area of maskNode?
b. How can I set a clipping area on a GraphicsNodeRable.
I have done a piece of code that could give us an idea.
---
On SVGFilterElementBridge.java
public Filter createFilter(...) {
// ...
GraphicsNodeRable sourceGraphic
= gnrFactory.createGraphicsNodeRable(filteredNode);
// Set the clip of the filter element
Shape filterElementClipPath =
CSSUtilities.convertClipPath(filterElement,
filteredNode,
bridgeContext);
if (filterElementClipPath != null) {
//sourceGraphic.setClippingArea(filterElementClipPath);
}
---
Can we imagine to add a setClippingArea method on GraphicsNodeRable?
Thierry.
--
Thierry Kormann
email: Thierry.Kormann@sophia.inria.fr http://www.inria.fr/koala/tkormann/
Koala/Dyade/Bull @ INRIA - Sophia Antipolis
[Comit] ClipRable [Was: clip-path on mask and filter]
Posted by Thomas E Deweese <th...@kodak.com>.
>>>>> "TK" == Thierry Kormann <Th...@sophia.inria.fr> writes:
>> I'll let you know when I have the ClipRable written (very closely
>> related to MaskRable).
TK> OK, thanks.
I've written the Rable I didn't mess with the Bridges (so right
now no one in the tree is using it, but I tested it with my test app).
The following has been committed:
---------------------------------
1) Added ConcreateClipRable for clipping on Filters
2) Added the ability to set the min x/y when constructing a
concreteBufferedImageCachableRed.
3) PadRed now checks that it's hints aren't null before adding them
4) ConcreateGraphicsNodeRable now uses #2 rather than creating an
anonymous inner class.
5) Added a small test app for the ClipRable (ClipTest).
CVS: ----------------------------------------------------------------------
CVS: Enter Log. Lines beginning with `CVS:' are removed automatically
CVS:
CVS: Committing in .
CVS:
CVS: Modified Files:
CVS: xml-batik/sources/org/apache/batik/refimpl/gvt/filter/ConcreteBufferedI\
mageCachableRed.java
CVS: xml-batik/sources/org/apache/batik/refimpl/gvt/filter/ConcreteGraphicsN\
odeRable.java
CVS: xml-batik/sources/org/apache/batik/refimpl/gvt/filter/PadRed.java
CVS: Added Files:
CVS: xml-batik/sources/org/apache/batik/refimpl/gvt/filter/ConcreteClipRable\
.java
CVS: xml-batik/sources/org/apache/batik/test/refimpl/gvt/ClipTest.java
CVS: ----------------------------------------------------------------------
clip-path on mask and filter
Posted by Thomas E Deweese <th...@kodak.com>.
>>>>> "TK" == Thierry Kormann <Th...@sophia.inria.fr> writes:
TK> Hi, A question about clip-path and mask and filter.
TK> In SVG we can specify a clip path on mask and filter. I think I
TK> can do it for mask (as mask creates a GVT tree - then I can apply
TK> a clip on it).
TK> My questions are:
TK> a. With : new ConcreteMaskRable(filter, maskNode, maskRegion); Do
TK> ConcreteMaskRable consider the clipping area of maskNode?
Yes, I believe so. It requests the node as a GraphicsNodeRable
and then converts it to a mask, then applies it. Since
GraphicsNodeRable clips it's drawing the the clippath this should
respect the clipping path.
TK> b. How can I set a clipping area on a GraphicsNodeRable. I have
TK> done a piece of code that could give us an idea.
The given example won't work since this clips the input to the
filter, what you really want to do is clip the output of the filter.
I'll write a new Filter ClipRable:
public Filter createFilter(...) {
// ...
GraphicsNodeRable sourceGraphic
= gnrFactory.createGraphicsNodeRable(filteredNode);
// Set the clip of the filter element
Shape filterElementClipPath =
CSSUtilities.convertClipPath(filterElement,
filteredNode,
bridgeContext);
Filter ret = ...;
if (filterElementClipPath != null) {
ret = new ClipRable(ret, filterElementClipPath);
}
// ...
return ret
}
TK> Can we imagine to add a setClippingArea method on
TK> GraphicsNodeRable?
I think the above is better. It will also give us the easy
ability to do anti-aliased clip-paths for GraphicsNodeRable, which we
want to do (perhaps only when high-quality rendering is selected).
I'll let you know when I have the ClipRable written (very closely
related to MaskRable).