Filling with a pattern

View: New views
7 Messages — Rating Filter:   Alert me  

Filling with a pattern

by Paulo Ortolan :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi, all

    I have a polygon object that will be showed to showed on the screen. A have another object defined on <g></g> that is small and I wish this to be the pattern to fill that polygon object. How can I do this? Is this possible?

Paulo



      ____________________________________________________________________________________
Veja quais são os assuntos do momento no Yahoo! +Buscados
http://br.maisbuscados.yahoo.com

[Non-text portions of this message have been removed]


Re: Filling with a pattern

by Erik Dahlstrom :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Tue, 03 Nov 2009 14:22:46 +0100, Paulo Ortolan <phortolan@...>  
wrote:

> Hi, all
>
>     I have a polygon object that will be showed to showed on the screen.  
> A have another object defined on <g></g> that is small and I wish this  
> to be the pattern to fill that polygon object. How can I do this? Is  
> this possible?

Yes, that can be done with a <pattern> element.

See http://www.w3.org/TR/SVG11/pservers.html#Patterns for details or just  
go for the example  
http://www.w3.org/TR/SVG11/images/pservers/pattern01.svg.

Cheers
/Erik

--
Erik Dahlstrom, Core Technology Developer, Opera Software
Co-Chair, W3C SVG Working Group
Personal blog: http://my.opera.com/macdev_ed

Opera 10.1 doesn't like listing attributes of ersatz SVG nodes

by ddailey :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi folks,

 I've been interested in creating a sort of "proof of concept" for a <replicate> tag for SVG version N (for some N>1.2,) -- something that does for space what <animate> does for time (hence subtending and extending such things, real and imagined, as <gradient>, <pattern>, <contour>, <doodle>, <fractal> and possibly diffusion filters) . Accordingly, I've been fidding with proto-markup and javascript to see if I can describe what I mean by <replicate> a bit more precisely.

Alas, the following (as simple as I could make it) works everywhere (FF, Safari, Chrome, and IE/ASV) except for Opera....
It isn't clear to me that this is a bug in Opera, but maybe a bug in the spec? Does the spec tell us how the browser should behave in the context of a made-up nodeName?

cheers
David

<svg xmlns="http://www.w3.org/2000/svg" width="100%"
xmlns:xlink="http://www.w3.org/1999/xlink" onload="startup(evt)"
>
<script><![CDATA[
xmlns="http://www.w3.org/2000/svg"
xlink="http://www.w3.org/1999/xlink"
root=document.documentElement

function startup(evt){
 var R=document.getElementsByTagName("replicate")
 R0=R.item(0)
 var P=R0.parentNode
 alert(P.nodeName)   //properly finds node name = "text"
 alert("R0.attributes.length="+R0.attributes.length)
 //above yields 5 in FF, IE and Opera
 //below fails in Opera
 alert("R0.attributes.item(0).nodeValue:"+R0.attributes.item(0).nodeValue)
}
//]]>
</script>
<text font-size="12"  x="50" y="500" fill="red" >
<replicate id="F" attributeName="y" repeatCount="6" from="10" to="350" />
Some representative text to be replicated</text>
</svg>

[Non-text portions of this message have been removed]


Parent Message unknown Re: Opera 10.1 doesn't like listing attributes of ersatz SVG nodes

by Ken Stacey :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi David,

I can't explain why Opera would report the correct number of attributes
but fail on nodeValue.  I suspect that it is a namespace issue.

The spec, http://www.w3.org/TR/SVG11/extend.html#PrivateData says
"SVG allows inclusion of elements from foreign namespaces anywhere with
the SVG content. In general, the SVG user agent will include the unknown
elements in the DOM but will otherwise ignore unknown elements."

There is an example there, but no reference to "Namespaces in XML"
http://www.w3.org/TR/REC-xml-names/

I namespaced your <replicate> element below and used
getElementsByTagNameNS - it then works on Opera (and the others).

<svg xmlns="http://www.w3.org/2000/svg" width="100%"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:dd="http://www.someurl.net/ddns" onload="startup(evt)">
<script><![CDATA[
xmlns="http://www.w3.org/2000/svg"
xlink="http://www.w3.org/1999/xlink"
ddns="http://www.someurl.net/ddns"
root=document.documentElement

function startup(evt){
  var R=document.getElementsByTagNameNS(ddns, "replicate")
  R0=R.item(0)
  var P=R0.parentNode
  alert(P.nodeName)   //properly finds node name = "text"
  alert("R0.attributes.length="+R0.attributes.length)
  //above yields 5 in FF, IE and Opera
  //below fails in Opera
  alert("R0.attributes.item(0).nodeValue:"+R0.attributes.item(0).nodeValue)
}
//]]>
</script>
<text font-size="12"  x="50" y="500" fill="red" >
<dd:replicate id="F" attributeName="y" repeatCount="6" from="10" to="350" />
Some representative text to be replicated</text>
</svg>

Ken


Re: Re: Opera 10.1 doesn't like listing attributes of ersatz SVG nodes

by Erik Dahlstrom :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Thu, 19 Nov 2009 03:57:12 +0100, Ken Stacey <ken@...> wrote:

> Hi David,
>
> I can't explain why Opera would report the correct number of attributes
> but fail on nodeValue.  I suspect that it is a namespace issue.

I can confirm that's a bug in Opera 10.

> The spec, http://www.w3.org/TR/SVG11/extend.html#PrivateData says
> "SVG allows inclusion of elements from foreign namespaces anywhere with
> the SVG content. In general, the SVG user agent will include the unknown
> elements in the DOM but will otherwise ignore unknown elements."
>
> There is an example there, but no reference to "Namespaces in XML"
> http://www.w3.org/TR/REC-xml-names/
>
> I namespaced your <replicate> element below and used
> getElementsByTagNameNS - it then works on Opera (and the others).

FWIW, it is also better practice to namespace the replicate element since  
if a future SVG spec decides to introduce the <replicate> element, then  
any existing content that used <replicate> in the SVG namespace would  
likely break. Also see  
http://www.w3.org/TR/SVGTiny12/conform.html#ConformingSVGExtensions

Cheers
/Erik

--
Erik Dahlstrom, Core Technology Developer, Opera Software
Co-Chair, W3C SVG Working Group
Personal blog: http://my.opera.com/macdev_ed

Re: Re: Opera 10.1 doesn't like listing attributes of ersatz SVG nodes

by ddailey :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Erik,

Thanks to you and to Ken Stacey for helping me out with this.

I suspected that namespaces might have something to do with it, and never really had the fun of playing with new namespaces before.

I will have to submit here or somewhere new versions of the code for <replicate> (with and without namespace declarations) since the pattern of behaviors observed across browsers, once I start using my <replicate>s to actually paste and transform nodes across browsers is most interesting: I can make both IE/ASV and Firefox crash (in an infinite loop they seem to hallucinate) while Opera does some funky things and Webkit seems to grossly misbehave (but in yet a new and interesting way).

Question: in ordinary SVG is there any reason to assume that all your <animate> and <animateStuff> tags that share a common parentNode will necessarily be adjacent in the DOM? That is, for example, is <text><animate1 />here is plaintext<animate2 /></text> allowed? As an author, I wouldn't do it, but somehow, I suspect the spec allows it; why shouldn't it?.

I suppose it should be allowed, but that makes the implementers have to work a wee bit harder doesn't it? (in the sense that it requires one more loop to check for all children, -- not a big deal but a bit of a hit in terms of computational complexity and a bit more of a hit in terms of complexity for the human programmers.)

cheers
David
  ----- Original Message -----
  From: Erik Dahlstrom
  To: svg-developers@...
  Sent: Thursday, November 19, 2009 2:57 AM
  Subject: Re: [svg-developers] Re: Opera 10.1 doesn't like listing attributes of ersatz SVG nodes


   
  On Thu, 19 Nov 2009 03:57:12 +0100, Ken Stacey <ken@...> wrote:

  > Hi David,
  >
  > I can't explain why Opera would report the correct number of attributes
  > but fail on nodeValue. I suspect that it is a namespace issue.

  I can confirm that's a bug in Opera 10.

  > The spec, http://www.w3.org/TR/SVG11/extend.html#PrivateData says
  > "SVG allows inclusion of elements from foreign namespaces anywhere with
  > the SVG content. In general, the SVG user agent will include the unknown
  > elements in the DOM but will otherwise ignore unknown elements."
  >
  > There is an example there, but no reference to "Namespaces in XML"
  > http://www.w3.org/TR/REC-xml-names/
  >
  > I namespaced your <replicate> element below and used
  > getElementsByTagNameNS - it then works on Opera (and the others).

  FWIW, it is also better practice to namespace the replicate element since
  if a future SVG spec decides to introduce the <replicate> element, then
  any existing content that used <replicate> in the SVG namespace would
  likely break. Also see
  http://www.w3.org/TR/SVGTiny12/conform.html#ConformingSVGExtensions

  Cheers
  /Erik

  --
  Erik Dahlstrom, Core Technology Developer, Opera Software
  Co-Chair, W3C SVG Working Group
  Personal blog: http://my.opera.com/macdev_ed


 

[Non-text portions of this message have been removed]


Reporting a bug for Firefox, Opera and IE --[was RE: Re: Opera 10.1 doesn't like listing attributes of ersatz SVG nodes]

by Dailey, David P. :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Since Erik D. and I have already been talking about this, I will report on my new and more adventurous experiments:



1.       At http://srufaculty.sru.edu/david.dailey/svg/experiments/replicate.svg IE/ASV, Firefox, Chrome and Safari all behave as I would expect: they create copies of the nodes having <replicate> tags in side them. Opera 10.01 though is unhappy, and Erik confirms that this is a bug.

2.       At http://srufaculty.sru.edu/david.dailey/svg/experiments/replicateNS.svg I created an artificial namespace to handle the strange non-SVG tag, both because a) the simpler experiments (discussed earlier in the thread) worked and because of the sage advice that this might be a better idea in the long run for testing of features that sometime might come to be. However, just nastiness ensues:

a.       IE/ASV crashes (somehow thinking it is in an infinite loop) – I filed a bug report with Microsoft

b.      Firefox crashes (somehow thinking it is in an infinite loop) – I couldn’t figure out how to file a bug report

c.       Opera draws the content on the screen but it is garbled and partly hidden – looks like a bug to me

d.      Chrome and Safari behave the way I would expect.
I thought it was pretty cool to write code that crashed both Firefox and IE in one fell swoop!

Cheers
David
From: svg-developers@... [mailto:svg-developers@...] On Behalf Of ddailey
Sent: Thursday, November 19, 2009 10:48 PM
To: svg-developers@...
Subject: Re: [svg-developers] Re: Opera 10.1 doesn't like listing attributes of ersatz SVG nodes



Hi Erik,

Thanks to you and to Ken Stacey for helping me out with this.

I suspected that namespaces might have something to do with it, and never really had the fun of playing with new namespaces before.

I will have to submit here or somewhere new versions of the code for <replicate> (with and without namespace declarations) since the pattern of behaviors observed across browsers, once I start using my <replicate>s to actually paste and transform nodes across browsers is most interesting: I can make both IE/ASV and Firefox crash (in an infinite loop they seem to hallucinate) while Opera does some funky things and Webkit seems to grossly misbehave (but in yet a new and interesting way).

Question: in ordinary SVG is there any reason to assume that all your <animate> and <animateStuff> tags that share a common parentNode will necessarily be adjacent in the DOM? That is, for example, is <text><animate1 />here is plaintext<animate2 /></text> allowed? As an author, I wouldn't do it, but somehow, I suspect the spec allows it; why shouldn't it?.

I suppose it should be allowed, but that makes the implementers have to work a wee bit harder doesn't it? (in the sense that it requires one more loop to check for all children, -- not a big deal but a bit of a hit in terms of computational complexity and a bit more of a hit in terms of complexity for the human programmers.)

cheers
David
----- Original Message -----
From: Erik Dahlstrom
To: svg-developers@...<mailto:svg-developers%40yahoogroups.com>
Sent: Thursday, November 19, 2009 2:57 AM
Subject: Re: [svg-developers] Re: Opera 10.1 doesn't like listing attributes of ersatz SVG nodes

On Thu, 19 Nov 2009 03:57:12 +0100, Ken Stacey <ken@...<mailto:ken%40svgmaker.com>> wrote:

> Hi David,
>
> I can't explain why Opera would report the correct number of attributes
> but fail on nodeValue. I suspect that it is a namespace issue.

I can confirm that's a bug in Opera 10.

> The spec, http://www.w3.org/TR/SVG11/extend.html#PrivateData says
> "SVG allows inclusion of elements from foreign namespaces anywhere with
> the SVG content. In general, the SVG user agent will include the unknown
> elements in the DOM but will otherwise ignore unknown elements."
>
> There is an example there, but no reference to "Namespaces in XML"
> http://www.w3.org/TR/REC-xml-names/
>
> I namespaced your <replicate> element below and used
> getElementsByTagNameNS - it then works on Opera (and the others).

FWIW, it is also better practice to namespace the replicate element since
if a future SVG spec decides to introduce the <replicate> element, then
any existing content that used <replicate> in the SVG namespace would
likely break. Also see
http://www.w3.org/TR/SVGTiny12/conform.html#ConformingSVGExtensions

Cheers
/Erik

--
Erik Dahlstrom, Core Technology Developer, Opera Software
Co-Chair, W3C SVG Working Group
Personal blog: http://my.opera.com/macdev_ed

[Non-text portions of this message have been removed]



[Non-text portions of this message have been removed]