Do you own a Debenu Quick PDF Library version 7, 8, 9, 10, 11, 12, 13 or iSEDQuickPDF license? Upgrade to Debenu Quick PDF Library 14 today!
![]() |
SetClippingPathEvenOdd |
Post Reply ![]() |
Author | |
fellafoo ![]() Team Player ![]() Joined: 21 May 22 Location: Simsbury, CT Status: Offline Points: 21 |
![]() ![]() ![]() ![]() ![]() Posted: 21 May 22 at 3:58PM |
Hello Forum Members:
Do any of you have experience with SetClippingPath/EvenOdd? I am able to create a path, set a clipping path, and draw a bitmap over it and have it clipped to the outer boundary of the path. However, I also need to handle voids. I've tried drawing the perimeter, setting the clipping path, then drawing the interior void and setting the clipping path, but the bitmap always gets clipped to the 'smaller' path. The EvenOdd options seems to make no difference. Here's the gist of my code:
Thank You, MFM
|
|
![]() |
|
kevinqpl ![]() Beginner ![]() Joined: 19 May 22 Status: Offline Points: 3 |
![]() ![]() ![]() ![]() ![]() |
Hello MFM,
I could be mistaken but I think the different clipping path modes are related to the direction of the "inner" path, in other words if the points are clockwise or anticlockwise compared to the direction of the outer curve. Although maybe it's to do with paths that overlap themselves? In any case, the following code shows how to have a void in a clipping path. The trick is to close the outer path, then move to the start of your inner path, and close that path when its done. Finally, set the clipping path depending on the direction. You can change AntiClockwise to True or False and it will have the same effect as the direction of the inner curve is changed. QP.StartPath(100, 700); QP.AddLineToPath(500, 700); QP.AddLineToPath(500, 300); QP.AddLineToPath(100, 300); QP.AddLineToPath(100, 700); QP.ClosePath; AntiClockwise := False; if (AntiClockwise) then begin QP.MovePath(120, 320); QP.AddLineToPath(480, 320); QP.AddLineToPath(300, 680); QP.ClosePath; QP.SetClippingPath; end else begin QP.MovePath(120, 320); QP.AddLineToPath(300, 680); QP.AddLineToPath(480, 320); QP.ClosePath; QP.SetClippingPathEvenOdd; end; QP.SetFillColor(1, 0, 0); QP.DrawCircle(300, 500, 250, 1); |
|
![]() |
|
fellafoo ![]() Team Player ![]() Joined: 21 May 22 Location: Simsbury, CT Status: Offline Points: 21 |
![]() ![]() ![]() ![]() ![]() |
Thanks Kevin,
I'll need to do some more experimenting. I was looking for a way to start a new path before setting the clipping path but assumed MovePath was for actually moving the path not an equivalent to MoveTo. So at least I've got that part straightened out. My point arrays / loops are closed (i.e., the first and last points are the same) so I don't think I need to call ClosePath. Section '8.5.3.3 Filling' of the PDF 1.7 document describes the Nonzero Winding Number and Even-Odd rules. The point order is considered in the first case but not the second. MFM
|
|
![]() |
|
fellafoo ![]() Team Player ![]() Joined: 21 May 22 Location: Simsbury, CT Status: Offline Points: 21 |
![]() ![]() ![]() ![]() ![]() |
I've got this working as expected now. I was starting my loop at 1 instead of 0. So this is compatible with the logic I use to create polygons and clipping regions with Windows.PolyPolygon. As in...
...and what I was hoping for.
|
|
![]() |
Post Reply ![]() |
|
Tweet
|
Forum Jump | Forum Permissions ![]() You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |
Copyright © 2017 Debenu. Debenu Quick PDF Library is a PDF SDK. All rights reserved. About — Contact — Blog — Support — Online Store