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

**URL:** <https://racket.discourse.group/t/is-there-a-way-to-outline-certain-pen-strokes-used-when-drawing-a-pict/2761>\
**Category:** Questions & Answers\
**Tags:** pict\
**Created:** [March 4, 2024, 9:33pm UTC](https://racket.discourse.group/t/is-there-a-way-to-outline-certain-pen-strokes-used-when-drawing-a-pict/2761 "2024-03-04T21:33:46Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![benknoble](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/benknoble/32/16_2.png) [@benknoble](https://racket.discourse.group/u/benknoble)\
**Post date:** [March 4, 2024, 9:33pm UTC](https://racket.discourse.group/t/is-there-a-way-to-outline-certain-pen-strokes-used-when-drawing-a-pict/2761/1 "2024-03-04T21:33:46Z")

</div>

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:

```racket
(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 `convert`ing to an SVG or by drawing to a `dc%`) to outline the `circle`s 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?)

---

<div class="post-metadata">

**Author:** ![soegaard](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/soegaard/32/19_2.png) [@soegaard](https://racket.discourse.group/u/soegaard)\
**Post date:** [March 5, 2024, 1:11am UTC](https://racket.discourse.group/t/is-there-a-way-to-outline-certain-pen-strokes-used-when-drawing-a-pict/2761/2 "2024-03-05T01:11:17Z")

</div>

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

Something like this.

```scheme
#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](https://global.discourse-cdn.com/free1/uploads/racket/original/2X/c/c306c60f3f49ba2795f1fb5fdbcd8557ed81ac0f.png)

---

<div class="post-metadata">

**Author:** ![bakgatviooldoos](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/bakgatviooldoos/32/1381_2.png) [@bakgatviooldoos](https://racket.discourse.group/u/bakgatviooldoos)\
**Post date:** [March 5, 2024, 5:03pm UTC](https://racket.discourse.group/t/is-there-a-way-to-outline-certain-pen-strokes-used-when-drawing-a-pict/2761/3 "2024-03-05T17:03:27Z")

</div>

Just thinking out loud, given what @soegaard is saying; maybe something along the lines of [pict/shadow](https://docs.racket-lang.org/pict/Shadows.html)?

---

<div class="post-metadata">

**Author:** ![benknoble](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/benknoble/32/16_2.png) [@benknoble](https://racket.discourse.group/u/benknoble)\
**Post date:** [March 6, 2024, 11:10pm UTC](https://racket.discourse.group/t/is-there-a-way-to-outline-certain-pen-strokes-used-when-drawing-a-pict/2761/4 "2024-03-06T23:10:53Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![benknoble](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/benknoble/32/16_2.png) [@benknoble](https://racket.discourse.group/u/benknoble)\
**Post date:** [March 15, 2024, 2:38pm UTC](https://racket.discourse.group/t/is-there-a-way-to-outline-certain-pen-strokes-used-when-drawing-a-pict/2761/5 "2024-03-15T14:38:37Z")

</div>

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