Inkcards
Basic description
Inkcards is an extension to create cards using layers, I say cards, but could be any tiles, like tokens, origami instructions, etc. The basic idea is you activate only the layers used by a specific card and save the information of which layers are visible for this card. By reusing the layers, it's much easier to customize your deck than copy/paste elements. With it, you can make modifications to the list/deck of cards by adding/removing cards, activating/deactivating the layers to show a specific card, or reordering the card list. It could be used to create video games?, but the main idea is that once your cards are designed, you can tile them on a different document size in order to print them, read this thread to know what I'm talking about. Rachel summarize her learning from the thread in a video which was also greatly inspired by this video from the Dinning Table (probably more pertinent).
Design evolution
For this my design is being updated for 1.0. I think of placing the cards in a card sized rect
in which you draw the cards. From an extension, you manage the deck content by adding/removing cards which are using the visible layers perhaps under a "cards
" named layer? Adding a card imply adding a <g>
of multiple <use>
of all layers used by this card in defs
. Then adding another <use>
of the <g>
(card) entry just made in <defs>
, inside the document's viewBox
, more than one <use>
if your deck has more than one instance of a card. This <use>
of the card would be in a "page X
" layer (where X is the floor of the card number divided by the number of card that fit in a page).
Extensions needed
- For this I think I should use an extension to initialize an Inkcards document by adding a
"Inkcards:cards"
namedrect
outside theviewBox
. Thatrect
would be the size of a card. Knowing the card size, in this extension I could reserve the place to tile the cards? - If the user adjust the size of the card
rect
, he could use an extension (a secondinx
) to recalculate the tiles position in the document. Perhaps instead of arect
, it could be acircle
and the extension could adjust the tiling to imbricate them with an optimize option, else it would align them. - One extension to be able to move the card document (set
inkscape:groupmode="layer"
) andsodipodi:insensitive="false"
. It would automatically set it back on the next use of the extension. - An extension should save one SVG for every page layers and convert that into a single PDF using image magick convert.
Summary of an inkcards SVG
I wrote it as ideas where popping in my mind, so is useful documentation:
<svg viewBox="0 0 279.4 215.9" width="11in" height="8.5in">
<defs>
<g id="card1" inkscape:groupmode="inkcards:card" inkcards:name="fireball" inkcards:nbCopy="2">
<use xlink:href="#layer1"/>
<use xlink:href="#layer2"/>
<use xlink:href="#layer3"/>
</g>
<g id="card2" inkscape:groupmode="inkcards:card" inkcards:name="dragon">
<use xlink:href="#layer1"/>
<!-- ... -->
</g>
<!-- ... -->
</defs>
<g inkscape:groupmode="layer" inkscape:label="Base card layers">
<g inkscape:groupmode="inkcards:cardFramingSize" sodipodi:insensitive="true">
<rect id="inkcards:cards" x="-100" y="0" width="80" height="80"/>
</g>
<g id="layer1" inkscape:groupmode="layer" inkscape:label="background1">
<!-- ... Generic background for all cards content ... -->
</g>
<g id="layer2" inkscape:groupmode="layer" inkscape:label="spell">
<!-- ... Specific elements to all spell cards ... -->
</g>
<g id="layer3" inkscape:groupmode="layer" inkscape:label="fireball">
<!-- ... Fireball card specific content ... -->
</g>
<!-- ... -->
</g>
<g inkscape:groupmode="layer" inkscape:label="pages">
<g inkscape:groupmode="layer" inkscape:label="page1">
<use xlink:href="#card1" x="20" y="20"/>
<use xlink:href="#card1" x="120" y="20"/>
<use xlink:href="#card2" x="220" y="20"/>
<!-- ... -->
</g>
<g inkscape:groupmode="layer" inkscape:label="page2">
<!-- ... -->
</g>
<!-- ... -->
</g>
</svg>
Questions
- I use the
inkscape:groupmode="inkcards:card"
, is it something I can do for an inkscape extension or it's reserved for internal use ? - The
inkscape:groupmode="inkcards:cardFramingSize"
is a way I think of having sort a dual document, the user could manage/resize it with an extension, perhaps be able to set it to layer for the resizing and the next time he uses any inkcards extension hisinkscape:groupmode
get back toinkcards:cardFramingSize
so he could not play with it like he want, as it would move the cards. I also thought of using a group so that the cards layers are at origin, just moved by an underlying group. - Is there a way to add a layer content, but not for other (sub)layers ? The problem is that layers are a tree and if i add a branch, all sub-branches are added. One way I thought to get around this is for a parent layer, have the content in a content sublayer which as all, but the sublayers, so that if I
<use>
it, it does not<use>
all the sublayers. Perhaps inkscape could have an optional mode to separate the content from layers in a special layer withinkscape:groupmode="layer-content"
? - More will be added ...
Exemple
You can see an svg example of what inkcards could generate.