Tutorial: Adding to the Inkscape Stock Patterns

Share your Inkscape tricks and tutorials here.
User avatar
RobA
Posts: 335
Joined: Fri Aug 10, 2007 1:22 am

Tutorial: Adding to the Inkscape Stock Patterns

Postby RobA » Thu Jan 17, 2008 6:59 am

I created a tutorial that shows how to define a tiling pattern and add it to the stock pattern file (Inkscape .46 and above).

http://www.silent9.com/blog/archives/143-Creating-and-Adding-Custom-Patterns-to-Inkscape.html

-Rob A>
Last edited by RobA on Tue Apr 23, 2013 12:11 pm, edited 1 time in total.

User avatar
capnhud
Posts: 435
Joined: Mon Jun 04, 2007 8:30 pm
Location: U.S.A

Re: Tutorial: Adding to the Inkscape Stock Patterns

Postby capnhud » Fri Jan 18, 2008 2:23 am

Thanks for sharing. I noticed you could do something like this when you wanted to save gradients to be reused in inkscape or the gimp.

Ok I gave your suggestion a go, but nothing seems to show up. Does someone mind trying this out to see what is going wrong. If I leave this pattern as it originally is it works fine but when I try as the tutorial suggested it does not work. Essentially it is just as 2 x 2 pixel square with the topleft and bottomright filled with the remaining squares not filled.

Code: Select all

  <pattern
       inscape:collect="always"
       patternUnits="userSpaceOnUse"
       width="2"
       height="2"
       patternTransform="translate(0,0) scale(10,10)"
       id="Scan_line">
       inscape:stockid="Cap Scanlines"
      <path
         id="bottomleft"
         d="M 0,1 L 1,1 L 1,2 L 0,2 L 0,1 z"
         style="fill:none;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dashoffset:0;stroke-opacity:1" />
      <path
         id="topright"
         d="M 1,0 L 2,0 L 2,1 L 1,1 L 1,0 z"
         style="fill:none;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dashoffset:0;stroke-opacity:1" />
      <path
         id="topleft"
         d="M 1,1 L 2,1 L 2,2 L 1,2 L 1,1 z"
         style="fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dashoffset:0;stroke-opacity:1" />
      <path
         id="bottomright"
         d="M 0,0 L 1,0 L 1,1 L 0,1 L 0,0 z"
         style="fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dashoffset:0;stroke-opacity:1" />
    </pattern>

User avatar
RobA
Posts: 335
Joined: Fri Aug 10, 2007 1:22 am

Re: Tutorial: Adding to the Inkscape Stock Patterns

Postby RobA » Fri Jan 18, 2008 5:08 am

Tricky!

You have the line:

inscape:stockid="Cap Scanlines"

It should be inkscape (you dropped the k) and it should be one line up (as an attribute of the pattern node). Here is the fixed version:

Code: Select all

  <pattern
       inscape:collect="always"
       patternUnits="userSpaceOnUse"
       width="2"
       height="2"
       patternTransform="translate(0,0) scale(10,10)"
       id="Scan_line"
       inkscape:stockid="Cap Scanlines">
      <path
         d="M 0,1 L 1,1 L 1,2 L 0,2 L 0,1 z"
         style="fill:none;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dashoffset:0;stroke-opacity:1" />
      <path
         d="M 1,0 L 2,0 L 2,1 L 1,1 L 1,0 z"
         style="fill:none;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dashoffset:0;stroke-opacity:1" />
      <path
         d="M 1,1 L 2,1 L 2,2 L 1,2 L 1,1 z"
         style="fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dashoffset:0;stroke-opacity:1" />
      <path
         d="M 0,0 L 1,0 L 1,1 L 0,1 L 0,0 z"
         style="fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dashoffset:0;stroke-opacity:1" />
    </pattern>


As a note the scale(10,10) actually makes the pattern 20x20 rather than 2x2.

But it could be simplified to this (as a 20x20):

Code: Select all

    <pattern
      inkscape:collect="always"
       patternUnits="userSpaceOnUse"
       width="2"
       height="2"
       patternTransform="translate(0,0) scale(10,10)"
       id="Scan_line"
      inkscape:stockid="Cap Scanlines">
      <rect y="0" x="0" height="1" width="1" style="fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dashoffset:0;stroke-opacity:1" />
      <rect y="1" x="1" height="1" width="1" style="fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dashoffset:0;stroke-opacity:1" />
    </pattern>


-Rob A>

User avatar
capnhud
Posts: 435
Joined: Mon Jun 04, 2007 8:30 pm
Location: U.S.A

Re: Tutorial: Adding to the Inkscape Stock Patterns

Postby capnhud » Fri Jan 18, 2008 7:22 am

I actually thought I had everything right never even noticed the inkscape was spelled wrong. LOL. Also I was not quite sure about whether to delete the "whole" id part so I just renamed to make sure it would not clash with anything.

By the way how did you make it so that the code could be all selected?

User avatar
RobA
Posts: 335
Joined: Fri Aug 10, 2007 1:22 am

Re: Tutorial: Adding to the Inkscape Stock Patterns

Postby RobA » Fri Jan 18, 2008 11:08 am

capnhud wrote:By the way how did you make it so that the code could be all selected?


?!? Yours has a select all, too!

-Rob A>

User avatar
capnhud
Posts: 435
Joined: Mon Jun 04, 2007 8:30 pm
Location: U.S.A

Re: Tutorial: Adding to the Inkscape Stock Patterns

Postby capnhud » Fri Jan 18, 2008 9:23 pm

?!? Yours has a select all, too!


I really must learn to pay better attention to what is in a thread. :oops:


Return to “Tricks & Tutorials”