Loading ...
Sorry, an error occurred while loading the content.

How to use inches in polylines, etc.

Expand Messages
  • pete_forman
    I m working on a converter from a legacy vector format that uses inches and points for its measurements. I ve been able to do the svg, rect, and text tags as
    Message 1 of 6 , Jun 25, 2002
    • 0 Attachment
      I'm working on a converter from a legacy vector format that uses
      inches and points for its measurements. I've been able to do the
      svg, rect, and text tags as these all accept absolute units. What
      should I do about polylines, etc. which expect coordinates in user
      space? Do I need to write some script to query the user agent and
      set the scale accordingly?
      --
      Pete Forman -./\.- Disclaimer: This post is originated
      WesternGeco -./\.- by myself and does not represent
      pete.forman@... -./\.- opinion of Schlumberger, Baker
      http://petef.port5.com -./\.- Hughes or their divisions.
    • Chris Lilley
      On Tuesday, June 25, 2002, 10:42:23 PM, pete_forman wrote: p I m working on a converter from a legacy vector format that uses p inches and points for its
      Message 2 of 6 , Jun 26, 2002
      • 0 Attachment
        On Tuesday, June 25, 2002, 10:42:23 PM, pete_forman wrote:

        p> I'm working on a converter from a legacy vector format that uses
        p> inches and points for its measurements. I've been able to do the
        p> svg, rect, and text tags as these all accept absolute units. What
        p> should I do about polylines, etc. which expect coordinates in user
        p> space? Do I need to write some script to query the user agent and
        p> set the scale accordingly?

        No, SVG already does that for you. Just set width, height and viewbox
        appropriately. For example

        <svg width="10in" height="7.25in" viewBox="0 0 10 7.25">

        Now you have a coordinate space which is set in inches, and you can
        omit units in the actual file. Although I would suggest

        <svg width="10in" height="7.25in" viewBox="0 0 10000 7250">

        so the user units are 1/1000 of an inch, so you can use integer
        coordinates everywhere to save space. Pick whatever resolution you
        need, here.

        --
        Chris mailto:chris@...
      • Doug Schepers
        Hi- I ve got a single SVG image embedded twice in the same page. I m trying to send each a separate set of data, like so:
        Message 3 of 6 , Jun 26, 2002
        • 0 Attachment
          Hi-

          I've got a single SVG image embedded twice in the same page. I'm trying to
          send each <embed> a separate set of data, like so:

          <embed src='myImage.svg' width='400' height='300' type='image/svg+xml'>
          <br />
          <embed src='myImage.svg' width='400' height='300' type='image/svg+xml'>
          [...]
          document.embeds[0].window.setValue('green', 5);
          document.embeds[1].window.setValue('yellow', 25);

          Currently, both calls are going to the same <embed>, the second one. How can
          I differentiate between the two of them?

          Thanks-
          -Doug
          ---
          Outgoing mail is certified Virus Free.
          Checked by AVG anti-virus system (http://www.grisoft.com).
          Version: 6.0.371 / Virus Database: 206 - Release Date: 6/13/2002
        • pete_forman
          ... I had tried that approach but the content renders at about 10% of the desired size (in Batik and ASV). I could get it to look right on my screen by
          Message 4 of 6 , Jun 26, 2002
          • 0 Attachment
            --- In svg-developers@y..., Chris Lilley <chris@w...> wrote:
            > [...] Although I would suggest
            >
            > <svg width="10in" height="7.25in" viewBox="0 0 10000 7250">
            >
            > so the user units are 1/1000 of an inch, so you can use integer
            > coordinates everywhere to save space. Pick whatever resolution you
            > need, here.

            I had tried that approach but the content renders at about 10% of the
            desired size (in Batik and ASV). I could get it to look right on my
            screen by assuming 96 dpi but that does not seem robust to me.
            --
            Pete Forman -./\.- Disclaimer: This post is originated
            WesternGeco -./\.- by myself and does not represent
            pete.forman@... -./\.- opinion of Schlumberger, Baker
            http://petef.port5.com -./\.- Hughes or their divisions.
          • Chris Lilley
            On Wednesday, June 26, 2002, 5:58:22 PM, pete_forman wrote: ... p I had tried that approach but the content renders at about 10% of the p desired size (in
            Message 5 of 6 , Jun 27, 2002
            • 0 Attachment
              On Wednesday, June 26, 2002, 5:58:22 PM, pete_forman wrote:

              p> --- In svg-developers@y..., Chris Lilley <chris@w...> wrote:
              >> [...] Although I would suggest
              >>
              >> <svg width="10in" height="7.25in" viewBox="0 0 10000 7250">
              >>
              >> so the user units are 1/1000 of an inch, so you can use integer
              >> coordinates everywhere to save space. Pick whatever resolution you
              >> need, here.

              p> I had tried that approach but the content renders at about 10% of the
              p> desired size (in Batik and ASV). I could get it to look right on my
              p> screen by assuming 96 dpi but that does not seem robust to me.

              I am unable to replicate your result. I get it rendering at 100% of
              the desired size in ASV 3.0 and Batik 1.5beta3.

              <svg width="5in" height="3.5in" viewBox="0 0 5000 3500">
              <rect fill="black" x="1000" y="500" width="3000" height="2500"/>
              </svg>

              5 x 3.5 inches at 96 dpi is 480 x 366 pixels which is exactly the
              size that Batik renders at. I checked by exporting the render as a PNG
              - it has exactly the right dimensions. ASV displays the same size.

              --
              Chris mailto:chris@...
            • pete_forman
              ... This is what I m having the problem with.
              Message 6 of 6 , Jul 1, 2002
              • 0 Attachment
                --- In svg-developers@y..., Chris Lilley <chris@w...> wrote:
                > <svg width="5in" height="3.5in" viewBox="0 0 5000 3500">
                > <rect fill="black" x="1000" y="500" width="3000" height="2500"/>
                > </svg>

                This is what I'm having the problem with.

                <svg width="5in" height="3.5in" viewBox="0 0 5000 3500">
                <rect fill="black" x="1in" y="0.5in" width="3in" height="2.5in"/>
                </svg>

                Not to worry, if I stick to user space coordinates then all is
                rendered okay.
                --
                Pete Forman -./\.- Disclaimer: This post is originated
                WesternGeco -./\.- by myself and does not represent
                pete.forman@... -./\.- opinion of Schlumberger, Baker
                http://petef.port5.com -./\.- Hughes or their divisions.
              Your message has been successfully submitted and would be delivered to recipients shortly.