# How to draw a dashed outline

**URL:** <https://forums.solar2d.com/t/how-to-draw-a-dashed-outline/324098>\
**Category:** Advanced Graphics\
**Created:** [March 30, 2014, 8:01pm UTC](https://forums.solar2d.com/t/how-to-draw-a-dashed-outline/324098 "2014-03-30T20:01:45Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![horacebury](https://forums.solar2d.com/letter_avatar_proxy/v4/letter/h/e0b2c6/32.png) [@horacebury](https://forums.solar2d.com/u/horacebury)\
**Post date:** [March 30, 2014, 8:01pm UTC](https://forums.solar2d.com/t/how-to-draw-a-dashed-outline/324098/1 "2014-03-30T20:01:45Z")

</div>

I’d like to generate a dotted, dashed or otherwise incomplete stroke, but other than using .stroke.effect = “generator.marchingAnts” I just can’t see how to do it.

Can anyone tell me if there is an effect for this, please?

---

<div class="post-metadata">

**Author:** ![rob](https://forums.solar2d.com/user_avatar/forums.solar2d.com/rob/32/4_2.png) [@rob](https://forums.solar2d.com/u/rob)\
**Post date:** [March 30, 2014, 8:14pm UTC](https://forums.solar2d.com/t/how-to-draw-a-dashed-outline/324098/2 "2014-03-30T20:14:19Z")

</div>

Have you tried using an image for the stroke?

---

<div class="post-metadata">

**Author:** ![Icy\_Spark](https://forums.solar2d.com/letter_avatar_proxy/v4/letter/i/dc4da7/32.png) [@Icy\_Spark](https://forums.solar2d.com/u/Icy_Spark)\
**Post date:** [March 30, 2014, 9:18pm UTC](https://forums.solar2d.com/t/how-to-draw-a-dashed-outline/324098/3 "2014-03-30T21:18:31Z")

</div>

Use an image like this one:

[http://www.zingerbug.com/Backgrounds/background\_images/black\_and\_white\_diagonal\_stripes\_seamless\_background\_pattern.jpg](http://www.zingerbug.com/Backgrounds/background_images/black_and_white_diagonal_stripes_seamless_background_pattern.jpg)

Add it behind your main image just slightly bigger depending on stroke width.

You can easily create your own with different thickness of black and white to get the look you want.

I tried using this as a stroke image but didn’t get expected results. &nbsp;Maybe it can be modified to work

Hope that helps

---

<div class="post-metadata">

**Author:** ![horacebury](https://forums.solar2d.com/letter_avatar_proxy/v4/letter/h/e0b2c6/32.png) [@horacebury](https://forums.solar2d.com/u/horacebury)\
**Post date:** [March 31, 2014, 7:36am UTC](https://forums.solar2d.com/t/how-to-draw-a-dashed-outline/324098/4 "2014-03-31T07:36:46Z")

</div>

It would appear that while the marching ants/diagonal line image option is good, if the outline image has a diagonal line in it that line becomes either solid or invisible. This is why I’m looking for a way to have a dashed effect on the outline, similar to the marquee seen when selecting areas in PhotoShop.

---

<div class="post-metadata">

**Author:** ![rob](https://forums.solar2d.com/user_avatar/forums.solar2d.com/rob/32/4_2.png) [@rob](https://forums.solar2d.com/u/rob)\
**Post date:** [March 30, 2014, 8:14pm UTC](https://forums.solar2d.com/t/how-to-draw-a-dashed-outline/324098/5 "2014-03-30T20:14:19Z")

</div>

Have you tried using an image for the stroke?

---

<div class="post-metadata">

**Author:** ![Icy\_Spark](https://forums.solar2d.com/letter_avatar_proxy/v4/letter/i/dc4da7/32.png) [@Icy\_Spark](https://forums.solar2d.com/u/Icy_Spark)\
**Post date:** [March 30, 2014, 9:18pm UTC](https://forums.solar2d.com/t/how-to-draw-a-dashed-outline/324098/6 "2014-03-30T21:18:31Z")

</div>

Use an image like this one:

[http://www.zingerbug.com/Backgrounds/background\_images/black\_and\_white\_diagonal\_stripes\_seamless\_background\_pattern.jpg](http://www.zingerbug.com/Backgrounds/background_images/black_and_white_diagonal_stripes_seamless_background_pattern.jpg)

Add it behind your main image just slightly bigger depending on stroke width.

You can easily create your own with different thickness of black and white to get the look you want.

I tried using this as a stroke image but didn’t get expected results. &nbsp;Maybe it can be modified to work

Hope that helps

---

<div class="post-metadata">

**Author:** ![horacebury](https://forums.solar2d.com/letter_avatar_proxy/v4/letter/h/e0b2c6/32.png) [@horacebury](https://forums.solar2d.com/u/horacebury)\
**Post date:** [March 31, 2014, 7:36am UTC](https://forums.solar2d.com/t/how-to-draw-a-dashed-outline/324098/7 "2014-03-31T07:36:46Z")

</div>

It would appear that while the marching ants/diagonal line image option is good, if the outline image has a diagonal line in it that line becomes either solid or invisible. This is why I’m looking for a way to have a dashed effect on the outline, similar to the marquee seen when selecting areas in PhotoShop.
