From dbf70e9b1d317093e3614dc544ebe03964dd25e1 Mon Sep 17 00:00:00 2001 From: Ryan Oldenburg Date: Wed, 15 Jun 2022 22:27:04 -0500 Subject: [PATCH] add tests for masking with gaps --- tests/paths/maskStrokeRectMask.png | Bin 0 -> 221 bytes tests/paths/rectMaskStroke.png | Bin 0 -> 400 bytes tests/test_paths.nim | 28 ++++++++++++++++++++++++++++ 3 files changed, 28 insertions(+) create mode 100644 tests/paths/maskStrokeRectMask.png create mode 100644 tests/paths/rectMaskStroke.png diff --git a/tests/paths/maskStrokeRectMask.png b/tests/paths/maskStrokeRectMask.png new file mode 100644 index 0000000000000000000000000000000000000000..1c7405786a3beae3ab6a8b698f6f8d037776b5f1 GIT binary patch literal 221 zcmeAS@N?(olHy`uVBq!ia0vp^DIm-NBp57ZhoUAzAVswJ-bEI3~od5B)uas9Xkbz6`wi%iuqlZI$>&E%5Ixu z6FYY@EmhrR~q|Tvj0xKwB&wX!IHc?y#J@J-uHECTIISU6HlI(7nqTq yv~EFt`P}yUv6!@&;m z>yx!D9dZvyeNSfl6uRPRuJ)ea3a%3*9Ftf&1y$TgVWfFaxGu5&xJ3Wm=a$Ee&E5w` zH=Pk!?*ECoNk$-Lu0EP!L5_LJcb*xQmxXgQu&X%Q~loCIDk`iq8N5 literal 0 HcmV?d00001 diff --git a/tests/test_paths.nim b/tests/test_paths.nim index 2261d24..edd4faa 100644 --- a/tests/test_paths.nim +++ b/tests/test_paths.nim @@ -451,6 +451,24 @@ block: ) image.writeFile("tests/paths/rectMaskAA.png") +block: + let image = newImage(100, 100) + image.fillPath( + "M 10 10 H 60 V 60 H 10 z", + rgbx(255, 0, 0, 255) + ) + + let paint = newPaint(SolidPaint) + paint.color = color(0, 1, 0, 1) + paint.blendMode = MaskBlend + + image.strokePath( + "M 30 30 H 50 V 50 H 30 z", + paint, + strokeWidth = 10 + ) + image.writeFile("tests/paths/rectMaskStroke.png") + block: let mask = newMask(100, 100) mask.fillPath("M 10 10 H 60 V 60 H 10 z") @@ -478,6 +496,16 @@ block: mask.fillPath("M 30.1 30.1 H 80.1 V 80.1 H 30.1 z", blendMode = MaskBlend) writeFile("tests/paths/maskRectMaskAA.png", mask.encodePng()) +block: + let mask = newMask(100, 100) + mask.fillPath("M 10 10 H 60 V 60 H 10 z") + mask.strokePath( + "M 30 30 H 50 V 50 H 30 z", + strokeWidth = 10, + blendMode = MaskBlend + ) + writeFile("tests/paths/maskStrokeRectMask.png", mask.encodePng()) + block: var surface = newImage(256, 256)