Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Next revision Both sides next revision
ivac2:firdef_map_pattern [2015/04/11 01:23]
filip.jonckers
ivac2:firdef_map_pattern [2015/06/07 23:08]
splendor.bouman
Line 1: Line 1:
-[[ivac2:​firdef_toc|Back]] +====== ​Stroke ​Pattern attribute ======
- +
-====== Pattern attribute ======+
  
 To draw a line pattern (dotted or dashed), use the pattern attribute to define the line pattern. To draw a line pattern (dotted or dashed), use the pattern attribute to define the line pattern.
Line 11: Line 9:
 |pattern="​1,​2"​ | A setting that will result in a dotted line where the dashes are 1 pixel in size and the spaces are 2 pixels. | |pattern="​1,​2"​ | A setting that will result in a dotted line where the dashes are 1 pixel in size and the spaces are 2 pixels. |
 |pattern="​2,​3"​ | Another dashed line but with small dashes. | |pattern="​2,​3"​ | Another dashed line but with small dashes. |
 +|pattern="​5,​5,​2,​2"​ | A setting where the first dash is five pixels, then a space of five pixels, then a dash of two pixels, then a space of two pixels, then the sequence starts again. |
  
-context.setLineDash([5,​5,​2,​2]) 
-A setting where the first dash is five pixels, then a space of five pixels, then a dash of two pixels, then a space of two pixels, then the sequence starts again. 
  
 +<code XML>
 +  <lines stroke_pattern="​8,​4">​
 +      <point lon="​E0042957"​ lat="​N0511059"/>​
 +      <point lon="​E0044324"​ lat="​N0510755"/>​
 +  </​lines>​
 +</​code>​
  
  
 +A few examples of what is possible...
  
  
-The pattern argument is a 16-bit series of 0s and 1s, and it's repeated as necessary to //stipple// a given line. A 1 indicates that drawing occurs, and 0 that it does not, on a pixel-by-pixel basis, beginning with the low-order bits of the pattern.+{{ :​ivac2:​firdef:​pattern_example.png |}}
  
-<code XML> 
-  <line stipple="​16135">​ 
-      <point lon="​E0042957"​ lat="​N0511059"/>​ 
-      <point lon="​E0044324"​ lat="​N0510755"/>​ 
-  </​line>​ 
-</​code>​ 
  
-where  16135 =  0011111100000111 in binary+----
  
-With the preceding example and the pattern 16135 (which translates to 0011111100000111 in binary), a line would be drawn with 3 pixels on, then 5 off, 6 on, and 2 off. (If this seems backward, remember that the low-order bits are used first.) If factor had been 2, the pattern would have been elongated6 pixels on, 10 off, 12 on, and 4 off.+[[ivac2:firdef|Back]]