Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

The Contraption Bazaar Sticky

A topic by Internet Janitor created Feb 28, 2023 Views: 18,653 Replies: 176
Viewing posts 41 to 42 of 42 · Previous page · First page
(6 edits) (+3)

Another contraption! This one creates a pair of (configurable) canvases to magnify certain parts of your card. You can drag both of them around as you see fit.
Resize it to an area you'd like to use it on, then drag the small dashed square around to use the magnifying lens. This can help mobile users or people who are visually impaired see small components in your decks.


%%WGT0{"w":[{"name":"Magnifying Field","type":"contraption","size":[408,272],"pos":[39,43],"show":"transparent","def":"Magnifying Field","widgets":{"z":{"size":[116,116]},"l":{"size":[60,60],"pos":[122,3],"pattern":0},"zoom":{"size":[32,13],"pos":[368,-19]},"scale":{"size":[33,13],"pos":[322,-19],"value":"60"}}}],"d":{"Magnifying Field":{"name":"Magnifying Field","size":[162,106],"resizable":1,"margin":[0,0,0,0],"description":"Resizable contraption that displays large, zoomed in view within a square lens.","version":1,"script":"on set_scale x do scale.text:x end\non get_scale do scale.text end\non set_zoom x do zoom.text:x end\non get_zoom do zoom.text end\n\non view do\n card.show:\"transparent\"\n l.size:scale.text,scale.text\n l.clear[]\n l.pattern:23\n l.brush:0\n l.box[0,0 l.size]\n l.pattern:0\n z.scale:zoom.text\n z.size:(l.size-2)*zoom.text\n z.pos:3,3\n l.pos:(z.size[0]+6),3\nend\n\non secure x do\n mx:card.size-x.size\n if x.pos[0]<0 x.pos:0,x.pos[1] end\n if x.pos[1]<0 x.pos:x.pos[0],0 end\n if x.pos[0]>mx[0] x.pos:mx[0],x.pos[1] end\n if x.pos[1]>mx[1] x.pos:x.pos[0],mx[1] end\nend","attributes":{"name":["scale","zoom"],"label":["scale","zoom"],"type":["number","number"]},"widgets":{"z":{"type":"canvas","size":[96,96],"pos":[3,3],"volatile":1,"script":"on click pos do\n \nend\n\non drag pos do\n secure[me]\nend\n\non release pos do\n \nend","draggable":1,"scale":2},"l":{"type":"canvas","size":[50,50],"pos":[102,3],"locked":1,"volatile":1,"script":"on click pos do\n \nend\n\non drag pos do\n secure[me]\n z.clear[]\n z.paste[app.render[deck.card].copy[card.pos+me.pos+1 me.size-2]]\nend\n\non release pos do\n \nend","pattern":23,"show":"transparent","border":0,"draggable":1,"scale":1},"zoom":{"type":"field","size":[13,13],"pos":[146,-19],"locked":1,"show":"none","value":"2"},"scale":{"type":"field","size":[13,13],"pos":[128,-19],"locked":1,"show":"none","value":"50"}}}}}
(42 edits) (+1)

TODO tutorial deck

patternshop

a compositing tool for cards and ps canvases as layers

reload if the video is not playing

direct download of deck: https://codeberg.org/woodring/decker.patternshop/raw/branch/main/patternshop.deck

project and readme, which is pasted below: https://codeberg.org/woodring/decker.patternshop/src/branch/main

see https://codeberg.org/woodring for more decker things

synopsis

It’s a module and several contraptions that emulate layered drawing in other drawing tools. Or, it can be thought of as “Decker mega-underpaint mode.”

teaser video apng

  1. make at least three cards

  2. put the patternshop contraption on each of those cards.

  3. switch to interactive mode.

  4. press 0 (zero) on each of the cards to activate the contraption.

  5. draw on the first card in interactive mode.

  6. switch to the second card. what was drawn on the first card appears there.

  7. draw on the second card.

  8. switch to the third card. what was drawn on the second will be under the first.

  9. et voila, layered drawing!

Why is this important? Imagine:

  • card1 has a rough sketch.

  • card2 shows card1, to trace over card1’s sketch.

  • card1 is deactivated, automatically removing the sketch, without having to manually erase it from card2.

  • card3 shows the outline of card2, to add shading without worrying about staying exactly in the lines.

layered drawing - how it works

patternshop is a contraption that combines multiple images into one. In another PS or other drawing programs, it’s what’s called layering. In graphics, it’s what we call compositing or image composition.

Another analogy is that it’s like old school cel drawing, for animation, where the scene is composed of several stacked layers of transparent celluloid.

The mode of operation is to draw on the patternshop canvas, which is a transparent drawing surface, in front of the card background. All of the active patternshop drawing surfaces are combined together - in a stack. Then, the combined stack is copied onto each card background of each card that patternshop is on. This provides the combined result on each layer - i.e., card.

Images are combined in card order. To change it so a drawing appears under another, reorder the cards in the Decker menu, i.e. File->Cards. Later cards in the stack appear under the ones in front of it. For n layers, make n+1 cards with patternshop on it. The final card will show everything together, by itself.

IMPORTANT: Drawing on patternshop requires interactive mode - not drawing mode. Decker drawing mode only works on cards. To use the Decker drawing tools, draw on a card then use the patternshop swap function to move the image to the patternshop contraption. Alternatively, use ps_layercake contraption to copy it.

When drawing on a card, with an image on the patternshop canvas, it will be under the canvas - which is what might be wanted for more accurate underpainting. Drawing on patternshop only supports the freehand pencil with custom brushes and patterns.

But, what makes patternshop different is that allows for drawing on the canvas and simultaneously seeing the card background underneath - to trace over it. It’s like Decker’s built-in underpainting, but with patternshop there’s an arbitrary number of underpainting layers.

Note: the only composite mode that patternshop supports is under. To achieve over, move the card to the front of the card stack. The other compositing modes that Decker likely aren’t used in practice by most people and are not included.

usage notes

  • To save your work, save the deck. Everything is retained between sessions.

  • Reordering cards to change layer combining order is immediate, after closing the card order dialog.

  • The starting visibility of patternshop and ps_layercake is transparent for the canvas to provide tracing over the card background, by default. They can both toggle between “solid”, “transparent”, “invert”, and “none”.

  • Everything is hotkey driven - for two reasons: (1) save screen real estate, but more importantly (2) when drawing, especially with a tablet, it is common to have a hand hovering over hotkeys or program the tablet for the hotkeys. It starts with a toolbar that can be hidden with q after learning the hotkeys.

    • Buttons for 4, Z, and X only work with hotkeys. They are visually present to show what they hotkey is.
  • As noted earlier, there’s a second contraption, ps_layercake, which is an advanced rubberband/select box that knows how to work with patternshop contraptions and cards.

  • The patternshop and ps_layercake contraptions can be used in any Decker project, as long as the ps module is copied over, too. They will not work without it.

  • Switching to a card will composite (combine) all layers if there is an activate patternshop on a card. It only updates “on view”; i.e., changing cards or having an animated widget on that card. But, having an animated widget on a patternshop card will slow Web Decker down quite significantly. While drawing, I do not suggest having animated widgets on the cards.

controls for patternshop

patternshop home row

1: toggle canvas visibility between “solid”, “transparent”, “invert” and “none”. starts in “transparent”. “solid” will hide the card background and “none” will hide the canvas.

2: toggle to the last brush used. starts with brush “1”.

3: toggle to pattern 0 and back to the last pattern used.

4: eyedropper tool that picks a pattern under the cursor. picks from the canvas first and the card second. does not change the pattern if it is pattern 0.

5: goto a card named palette. to be used in concert with 4, w, e, and ps_layercake’s custom brush function - to store patterns and brushes on a card, like a real-world palette. the palette card can contain whatever you wish - as long as it has a patternshop contraption on it. pressing 5 when on the palette card returns you to the previous card.

after learning the hotkeys or needing to temporarily move it

q: hide the toolbar

palette support

w: copy the brush from the palette card.

e: copy the pattern from the palette card

off patternshop home row

6: swap the image between the canvas and the card. to use Decker drawing tools - draw on the card and then swap it to the canvas.

7: erase the canvas.

8: set the brush. it will ask to provide a brush number or custom brush name. 2 swaps between two brushes.

9: set the pattern. it will ask to provide a pattern number in. for quicker pattern changing, use 4 and 5 with 3.

0: activate/deactivate the patternshop on this card. once activated, it will show all other active patternshops combined in card order. to remove a layer, deactivate it with 0. IMPORTANT activating a pattershop will ERASE any existing card background image.

undo and redo

z: infinite undo for canvases - up to available memory. no effect for cards. TODO need to put an undo limiter in to not accidentally run out of memory.

x: redo after undo. drawing after redoing will clear the redo stack.

ps_layercake support

r: make a ps_layercake at 100,100

ps_layercake hotkey to support patternshop

y: remove all layercake instances from the card. IMPORTANT: if there is more than one on a card, it will remove ALL of them.

controls for ps_layercake

ps_layercake is a select/rubberband box companion for patternshop. It can copy and move selections around the canvas and card background, more selectively than the patternshop swap (6) function.

It works in interactive mode, like patternshop. The upper-left box moves it and the lower-right box resizes it. All of the other controls are hotkey driven, like the rest of patternshop.

Also, it can be copy and pasted to any other card, just like any other contraption, moving the copied image between cards.

layercake to-and-from the card background

c: copy card background into layercake.

v: paste layercake onto card background.

n: merge card background into layercake. this is different than c, because it treats pattern 0 as transparent.

m: merge layercake onto card background. like n, this is different than v, because it also treats pattern 0 as transparent.

layercake to-and-from the canvas

d, f, h, j: copy, paste, merge into, merge onto for the canvas layer, instead of the card background.

other functions

t: toggle layercake visibility between “solid”, “transparent”, “invert” and “none”.

g: erase the layercake image contents.

b: save the layercake image contents as a custom brush. it will ask for a name.

y: remove all layercake instances from the card. IMPORTANT if there is more than one on a card, it will remove ALL of them.

on patternshop to support layercake

r: make a ps_layercake at 100,100

(2 edits)

I’ve made several updates. In particular, added over and under composite modes, along with several other things.

It probably operates more like people expect, now.

I plan on merging a lot of the functionality into the canvas target and layer widgets, to reduce the number of contraptions. Card target and layer contraptions will mostly remain the same. While the cards seem relatively limited compared to the canvases, they both serve a purpose: 1. being able to composite with the existing Decker drawing tools, and 2. a composited background for a canvas layer to trace over or underpaint.

(+1)

it’s already gone through a big revamp for usability as I tested it under “real” conditions.

it’s been massively simplified to three contraptions; card, canvas, and layercake.

(3 edits) (+1)

Video and tutorial card are still on their way.

I’ve made a couple of more usability passes as I’ve been trying to use it for real (the actual reason this exists).

off the top of my head:

  • wipe (clear) button
  • +/- buttons for incrementing and decrementing the brush and pattern on canvas layers
  • other things that I don’t remember

I’ve done a pretty simple sketch of a face and torso where I sketch the rough on one layer, switch to another to outline the face by overpainting, and then switch to a third to add shading by underpainting. It works pretty well.

There will be a learning curve - but (not that this excuses it) most drawing programs with layering, that I know of, have a steep learning curve.

What needs to be added - but the last two, I don’t know if I’ll get to it. It works for my needs and the amount of work to make them functional is way over my annoyance threshold.

  • the tutorial
  • DONE ~don’t allow C to be activated if there are no active layers~
  • DONE ~a “logical lock” - once switched to layer mode, make it ask more when switching to composite mode and vice versa - to protect drawings from being wiped.~
  • (maybe, but I probably won’t) a grid widget for globally reordering layers (an overview of the composite)
  • (maybe) a couple of levels of undo
(+2)

I'm really curious about this one! I think I'll need the tutorial card to really get my head around it, but I'm definitely interested in checking it out when that's ready.

(+1)

I’ll try to get it out soon - I’d like to have your feedback, in particular - as I thought this might be useful for you. Thanks for your interest.

(+1)

Another big usability refactor. It’s down to two widgets. patternshop and ps_layercake. Will be working on the tutorial, now.

(1 edit) (+1)

Also, the README is simplified a lot. Maybe it’s actually readable for some now, before I get the tutorial deck done. (I tend to write too much - my ADHD brain’s tendency to info dump.)

(2 edits) (+1)

teaser for the tutorial deck

–removed– needs to be redone

(+1)

As an aside - I only just now noticed there was a WigglyPaint retrospective.

Related to that - in my attempts for making this easier to use:

  1. make compositing order implicit based on the card order, since there’s already the ability to reorder cards

  2. make the background automatically the composite target

  3. probably all that is wanted is underpaint/masking, so I’ll probably remove operator selection. or make it less up front and center

  4. I like the palette/swatch selection. so make it go directly to a “physical palette” where you can select the pattern visually with a select tool. apply your patterns in swatches like paint. kind of like how layercake can be used now to lift brushes off the palette.

this will remove all of the buttons and probably all that’s needed is a few hot keys to operate the layercake tool.

(+1)

Yeah - this is going to way simplify everything… sorry for the delay. It will be a much better, though.

(+1)

OK - it’s been redone. Hopefully this is the last one for a while.

  • no more layer buttons; order is implicit on card order

  • no more operation buttons; probably the only thing that is wanted is underpaint. over is achieved by reordering the cards.

  • everything has a hotkey and the buttons show what they are. they can be hidden.

  • UNDO! (infinite right now, but I should limit it - otherwise, you can run out of memory)

  • support for the palette card: a goto/return button, an eyedropper, copy brush and pattern from palette

  • probably a few other things

(1 edit) (+1)

Updated teaser:

reload if the video is not playing

Viewing posts 41 to 42 of 42 · Previous page · First page