Is there a way to outline certain pen strokes used when drawing a `pict`?

I have some picts that I'm hoping to make useful on both light and dark backgrounds. One way I envisioned to do so was to outline black pen strokes with white strokes, so that on either kind of background one of the stroke colors would stand out.

Since some of these picts are being drawn from scratch, I can in theory adjust the drawing for those myself (even by dropping to the dc level if I have to).

Some of these picts, however, composite existing picts that I do not wish to modify extensively now. Hence the titular question: is there a way I can modify an existing pict to cause it to be drawn by a pen where the black border strokes have a "white outline"?

Here's a simple example:

(require pict qi)

(define (target)
  (~> (20 40)
      (>< (circle #:border-width 5))
      cc-superimpose))

Is there something I can do to the body of target (or to the place that (target) is eventually converted to some other representation, whether that's an by converting to an SVG or by drawing to a dc%) to outline the circles in white that is not circle-specific? Or am I stuck with needing to modify all my picts individually with what they need? (What would I do in the case of pin-arrow-line, where I don't see an obvious way to make this change happen to the arrow line?)

Draw the pict twice. First with a wide, black pen. Second with a narrow, white pen.

Something like this.

#lang racket
(require pict (only-in metapict penwidth brushcolor color draw))

(define background (filled-rectangle 100 100
                                     #:color "gray"
                                     #:draw-border? #f))
(define a-pict (circle 50))

(define (fancy-border p)
  (draw (penwidth 7 (color "black" p))
        (penwidth 3 (color "white" p))))

(draw background
      (fancy-border a-pict))

image

Just thinking out loud, given what @soegaard is saying; maybe something along the lines of pict/shadow?

Thanks both to @soegaard and @bakgatviooldoos ; I’ll let you know how both options work for me when I get time.

Using shadow with #:shadow-color "white" should be enough for now, thanks all!

1 Like