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 Thomas E Deweese <th...@kodak.com> on 2001/03/19 17:00:23 UTC

Is there a way to preserve an image element's aspect ratio withou t modifying Batik?

>>>>> "AS" == Adrian Sampaleanu <Ad...@mgisoft.com> writes:

AS> Hello all, We are trying to create svg files that act as templates
AS> to be rendered by a server. In some cases, we have image elements
AS> that refer to our own bitmap format that stores multiple
AS> resolutions. We create our own RasterRable type in the
AS> SVGImageElementBridge and, when asked during rendering, provide a
AS> buffer such that there is the least amount of scaling. This part
AS> works reasonably well, but...

    Glad to hear it...

AS>   Since the svg files are supposed to act as templates, we would
AS> like to define a viewport within the SVG canvas that specifies the
AS> maximum bounding box that an arbitrary bitmap (regular or our
AS> multires format) would fill (or be centered in) while preserving
AS> its aspect ratio. Obviously we could handle the case for our
AS> format, but we would like to solve this problem for any bitmap
AS> format in a uniform manner.

AS>   It would be nice if the aspect ratio of an image element was not
AS> necessarily determined by the width and height attributes and a
AS> bitmap was scaled up to the enclosing reference rectangle (width x
AS> height). 

    I'm really not following you here, if the aspect ratio isn't
defined by width and height what is it defined by?  

    Even if I can magically get the new number for the aspect ratio,
this is underspecified, how does this affect the mapping of the image
to a particular box?  (how/where do I crop the edges if the aspect
ratio doesn't match the images?) 

    It sounds like you want to crop/pad the image???

    I suggest you send an example or something...

AS> From the SVG spec (sec. 7.8, paragraph 2 and 4) it seems that
AS> image elements should support the preserveAspectRatio attribute to
AS> do exactly this, taking into account the meet or slice
AS> parameters. Batik (at least rc5) doesn't seem to behave this way -
AS> will the final do so?

    Our intent is to be a fully compliant static SVG viewer for the
1.0 release.  If you believe you have found a bug please submit a bug
report (with a sample SVG file that reproduces it, please).

AS>   If the preserveAspectRatio attribute will not apply to image
AS> elements which reference bitmaps, one possibility for us would be
AS> to surround the image element with an svg block whose viewBox
AS> attribute's width and height are set to match the bitmap's actual
AS> size for flat files, after the image is loaded and these values
AS> are known. The preserveAspectRatio attribute for this svg element
AS> would then allow us to maintain aspect ration within the
AS> surrounding viewport. The placeholder width and height attributes
AS> for the bitmap would have to be modified as well since these are
AS> required for an image element. All of this seems a bit too much
AS> trouble to achieve what we want, though.

AS>   The preferred solution would require no modification to the DOM
AS> other than substituting a different URI for the image element. Is
AS> there any way to achieve this?

    Can you send an example of what you want?

AS> We welcome any advice or clarification,

    Likewise. :)


---------------------------------------------------------------------
To unsubscribe, e-mail: batik-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-dev-help@xml.apache.org


Re: Batik Charts

Posted by Vincent Hardy <vh...@eng.sun.com>.
John,

Thanks for your email and your interest in Batik. Yes, I think this 
would be interested for Batik. As you suggest, it might better fit
into a sub-project or sub-module. There have been talks of having 
a 'contrib' sub-directory in the batik distribution where I think
the XSL transformations you are talking about could fit well.

Regards.
V.

John Morrison wrote:
> 
> Hi All.
> 
> I've just started to evaluate Batik as part of the Cocoon distribution.  As
> part of that evaluation I have to dynamically generate charts and graphs
> from an xml feed which, in turn, was generated from a SQL query.
> 
> I have created a xslt document to transform xml data into a simple line
> chart.  I also have to generate 'proof of concept' pie, bar and column
> charts.  I _don't_ believe that I'm the only person who will need to
> generate these.  Would people consider creating a (sub) project of Batik
> whose aim is to publish a dtd/schemaX for chart/graph data and several
> xslt(s) which output svg?  I and the company I work for are willing to
> donate all work done in this area as a start...
> 
> Any comments welcome.
> 
> John Morrison.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-dev-unsubscribe@xml.apache.org
> For additional commands, e-mail: batik-dev-help@xml.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: batik-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-dev-help@xml.apache.org


Batik Charts

Posted by John Morrison <jo...@ntlworld.com>.
Hi All.

I've just started to evaluate Batik as part of the Cocoon distribution.  As
part of that evaluation I have to dynamically generate charts and graphs
from an xml feed which, in turn, was generated from a SQL query.

I have created a xslt document to transform xml data into a simple line
chart.  I also have to generate 'proof of concept' pie, bar and column
charts.  I _don't_ believe that I'm the only person who will need to
generate these.  Would people consider creating a (sub) project of Batik
whose aim is to publish a dtd/schemaX for chart/graph data and several
xslt(s) which output svg?  I and the company I work for are willing to
donate all work done in this area as a start...

Any comments welcome.

John Morrison.


---------------------------------------------------------------------
To unsubscribe, e-mail: batik-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-dev-help@xml.apache.org