You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Ross Burton <ro...@mail.com> on 2000/08/29 22:32:20 UTC

[C2] SVG Serializer

Hi,

I (hopefully) have just committed a new serializer, the latest libraries,
and example and support code for SVG files.

How To Use It:

The easiest way is to put jai_codec.jar from JAI (see java.sun.com) in your
classpath, uncomment the commented sections in sitemap.xmap, and build
Cocoon 2.  Look at /welcome and follow the SVG links.

Image encoders are built if the required classes are available, Sun JDKs
should build JPEGEncoder, if you have JAI installed JAIPNGEncoder and
JAIJPEGEncoder should be built.  Image encoders are referenced in
cocoon.xconf as a normal component.

Summary of New Stuff:

* Image encoder components (org.apache.cocoon.components.image.*) which take
a BufferedImage and write it out to a OutputStream.  Currently implemented
are JPEG and PNG encoders using Java Advanced Imaging, a PNG encoder using
the LGPL PngEncoder package, and a JPEG encoder using Sun's built-in codec.
* Configurable SVG serialization.  Select your output format (using a image
encoder), if the image should be transparent and if not, what colour to have
as a background.
* A nice example of a SVG.

The code is not final as the sitemap has been changing so often and I have
been so busy, you're lucky it compiles.  I'm finishing the code asap.

What Needs To Be Done:

* Docs, docs and more docs.
* Fix a bug in Cocoon/Xerces regarding files with DTDs.  I can't seem to get
SVG with attached DTDs (stored locally) to parse.
* Optimise the Image Encoders and serializer compositing.  I'm not too hot
with the Java2D library, and it shows.  If anyone is a guru with
BufferedImages and compositing, could you look at the code?
* Allow the serializer configuration to be overridden in the pipelines.
* Repackage the SVG libraries (there is four of them for some unknown
reason) - should be easy.
* Bring the configuration interface up to line with the sitemap WD.
* Ensure that the mime-type is as intelligent as possible - the encoder
knows the mime type if it is not specified in the sitemap.

I know this list of "features" is rather long but I though I'll get the code
into the tree so people can comment on it ("hey, you broke Cocoon 2!") and
see what I was doing.

There is a SVGTransformer in alpha as well (for manipulating SVG documents
in the pipeline), when Ricardo (hint hint) commits the amazing
XSP-as-a-filter code he claimed to have, I'll port it to a XSP filter.

Anyway, have fun and don't break too much,
Regards,
Ross Burton


Re: [C2] SVG Serializer

Posted by Hans Ulrich Niedermann <ni...@isd.uni-stuttgart.de>.
"Ross Burton" <ro...@mail.com> writes:

> What Needs To Be Done:

> * Fix a bug in Cocoon/Xerces regarding files with DTDs.  I can't seem to get
> SVG with attached DTDs (stored locally) to parse.

"String index out of range"? SVG DTD contains "xml:lang" attributes
which some (older?) Xerces versions do not like. The error is located
in some parsing method in StringReader.java, if I remember correctly.

Some weeks ago, I ran into this problem when XSLTing from the Apache
"document.dtd" to Docbook. I tracked it down, but some other fix was
incorporated into Xerces CVS. At that time, this fix seemed to solve
my problem, so I didn't make a deeper analysis, even if it looked
partly strange to me.

Have you tried current CVS Xerces instead of the C2-supplied jar file?

Uli

Re: [C2] SVG Serializer

Posted by Jeremy Quinn <je...@media.demon.co.uk>.
At 18:28 +0100 30/08/00, Ross Burton wrote:
>> >There is a SVGTransformer in alpha as well (for manipulating SVG
>documents
>> >in the pipeline), when Ricardo (hint hint) commits the amazing
>> >XSP-as-a-filter code he claimed to have, I'll port it to a XSP filter.
>>
>> What does an SVGTransformer do?
>>
>> Rotate paths etc.? No right?
>
>At the moment, search and replace text strings, apply CSS styles to
>specified (via id) objects, crop and scale.  I hope to be able to use XSP to
>make this a dynamic filter in the future, as it is very hacky with all of
>that in the sitemap.

This would be amazing!

One of the things I have to do by hand is to reconcile the entities of
seperate SVGs all made in Illustrator, that share names. I'll often resort
to parsing it so the entities get resolved, then assembling that. Kind of
defeats the point ... I think you were saying you were having problems with
Entities too?

It's a drag, Illustrator always seems to export with the same nameset, and
the Adobe SVG plugin is not able to include external SVGs yet.


regards Jeremy
-- 
   ___________________________________________________________________

   Jeremy Quinn                                           Karma Divers
                                                       webSpace Design
                                            HyperMedia Research Centre

   <ma...@mac.com>     		 <http://www.media.demon.co.uk>
    <phone:+44.[0].20.7737.6831>        <pa...@sms.genie.co.uk>

Re: [C2] SVG Serializer

Posted by Ross Burton <ro...@lineone.net>.
> >There is a SVGTransformer in alpha as well (for manipulating SVG
documents
> >in the pipeline), when Ricardo (hint hint) commits the amazing
> >XSP-as-a-filter code he claimed to have, I'll port it to a XSP filter.
>
> What does an SVGTransformer do?
>
> Rotate paths etc.? No right?

At the moment, search and replace text strings, apply CSS styles to
specified (via id) objects, crop and scale.  I hope to be able to use XSP to
make this a dynamic filter in the future, as it is very hacky with all of
that in the sitemap.

Ross


Re: [C2] SVG Serializer

Posted by Jeremy Quinn <je...@media.demon.co.uk>.
At 21:32 +0100 29/08/00, Ross Burton wrote:

[snip]

>* Fix a bug in Cocoon/Xerces regarding files with DTDs.  I can't seem to get
>SVG with attached DTDs (stored locally) to parse.

Ditto, I get this with C1, trying to manipulate SVGs (for SVG output)

[snip]

>There is a SVGTransformer in alpha as well (for manipulating SVG documents
>in the pipeline), when Ricardo (hint hint) commits the amazing
>XSP-as-a-filter code he claimed to have, I'll port it to a XSP filter.

What does an SVGTransformer do?

Rotate paths etc.? No right?

regards Jeremy
-- 
   ___________________________________________________________________

   Jeremy Quinn                                           Karma Divers
                                                       webSpace Design
                                            HyperMedia Research Centre

   <ma...@mac.com>     		 <http://www.media.demon.co.uk>
    <phone:+44.[0].20.7737.6831>        <pa...@sms.genie.co.uk>

Re: [C2] SVG Serializer

Posted by Ross Burton <ro...@mail.com>.
Last night (GMT) I committed a small change so that the SVG serializer uses
the Sun JPEG codec.  Not JDKs have this, so the SVG pipelines are
uncommented now.

Docs are currently being written!

Ross Burton