Re: Polygon fill algo?
Super helpful, Mark. Thank you. I can better understand how the existing modes work, but I need something a little different. Imagine if we had a mode where each successive set of points is rendered so it completely paints over anything rendered before it, vertices and all - e.g.: |--->---| |...| |...|--->---| ^...|...| |...|...| |-- |...v |...| |---| set the fillmode to layered --? -- Richard Gaskin Fourth World Systems Mark Waddingham wrote: On 2021-02-16 05:55, Richard Gaskin via use-livecode wrote: My expectation was almost beyond anything reasonable, but it would seem useful if there was some way to make it happen: imagine if each segment within a list of discontiguous points was rendered as though it's a separate object, back to front. It's not going to kill me to use separate graphics to hide the portions of the vertices I need covered, but it sure would have been nifty if I'd found a way to have a single poly object render as though it were many. So the even-odd fill rule will not give you what you want - overlapping regions alternate. The non-zero fill rule can give you what you want - but you need to make sure that all your sub-polygons go 'in the same direction'. (NB: Fixed width font ASCII art follows): These two overlapping rects both go clock-wise so everything is filled. |--->---| |...| |...|--->---| ^...|...|...| |...|...|...| |-- |---|...v |...| |---| The left rect goes anti-clockwise and the right rect goes clockwise: |---<---| |...| |...|--->---| v...| |...| |...| |...| |-- |---|...v |...| |---| Notionally: - the non-zero winding rule works by starting on the left of each scanline and scanning to the right - there is a winding counter which starts at 0. - at any pixel, if the winding counter is non-zero the pixel is filled. - if an edge is crossed which goes 'down', the winding counter is decreased - if an edge is crossed which goes 'up', the winding counter is increased Hope this helps! Warmest Regards, Mark. ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Polygon fill algo?
On 2021-02-16 05:55, Richard Gaskin via use-livecode wrote: My expectation was almost beyond anything reasonable, but it would seem useful if there was some way to make it happen: imagine if each segment within a list of discontiguous points was rendered as though it's a separate object, back to front. It's not going to kill me to use separate graphics to hide the portions of the vertices I need covered, but it sure would have been nifty if I'd found a way to have a single poly object render as though it were many. So the even-odd fill rule will not give you what you want - overlapping regions alternate. The non-zero fill rule can give you what you want - but you need to make sure that all your sub-polygons go 'in the same direction'. (NB: Fixed width font ASCII art follows): These two overlapping rects both go clock-wise so everything is filled. |--->---| |...| |...|--->---| ^...|...|...| |...|...|...| |-- |---|...v |...| |---| The left rect goes anti-clockwise and the right rect goes clockwise: |---<---| |...| |...|--->---| v...| |...| |...| |...| |-- |---|...v |...| |---| Notionally: - the non-zero winding rule works by starting on the left of each scanline and scanning to the right - there is a winding counter which starts at 0. - at any pixel, if the winding counter is non-zero the pixel is filled. - if an edge is crossed which goes 'down', the winding counter is decreased - if an edge is crossed which goes 'up', the winding counter is increased Hope this helps! Warmest Regards, Mark. -- Mark Waddingham ~ m...@livecode.com ~ http://www.livecode.com/ LiveCode: Everyone can create apps ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Polygon fill algo?
Bernd Niggemann wrote: > > Richard wrote > > a way to coerce discontiguous polygon regions to always be filled? > > I assume you have set the opaque of the polygon graphic to true? Yep. My expectation was almost beyond anything reasonable, but it would seem useful if there was some way to make it happen: imagine if each segment within a list of discontiguous points was rendered as though it's a separate object, back to front. It's not going to kill me to use separate graphics to hide the portions of the vertices I need covered, but it sure would have been nifty if I'd found a way to have a single poly object render as though it were many. -- Richard Gaskin Fourth World Systems ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Polygon fill algo?
>Richard wrote >a way to coerce discontiguous polygon regions to always be filled? I assume you have set the opaque of the polygon graphic to true? Without "opaque" I do not get any filling, with "opaque" true it always fills Kind regards Bernd ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Polygon fill algo?
Thanks, Monte. I checked it out, but unfortunately none of the options handle my specific use case in the way I want (which is arguably an unrealistic expectation, given that I need to have the fill region paint over some vertices). I also discovered what may be a bug, or at least a curiosity: after playing with the nonzero and evenodd options, I tried to restore the default with: set the fillrule of the selobj to none And got: Message execution error: Error description: Property: invalid enumeration value Hint: Apparently "none" must be quoted. Has it always been that way? I've seen a couple other cases in recent years where keywords I could have sworn I'd used unquoted now throw errors until I quote them. What rule can help us know when keywords must be quoted? It also occurs to me: if there's no hint, adding "Hint:" looks like a bug, even though it may not be (doesn't seem to be in this case). Maybe I'll see if I can get some time to patch that... -- Richard Gaskin Fourth World Systems Monte Goulding wrote: > > Hi Richard > > Have you checked out the `fillRule` property docs? > > Cheers > > Monte > >> On 15 Feb 2021, at 9:25 am, Richard Gaskin via use-livecode wrote: >> >> I was hoping to use a single polygon draw a box, using the old trick of making discontiguous regions by adding a blank line between lists of points. >> >> The results draws the lines as I expected, but the fill is unpredictable, at least for me. Apparently the fill rules for a polygon cause it to not fill some regions, even when discontiguous. >> >> I guess I'll have to use separate objects, but I was wondering if anyone has a description of the polyfill rule(s), or better, a way to coerce discontiguous polygon regions to always be filled. >> >> -- >> Richard Gaskin >> Fourth World Systems ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Polygon fill algo?
Hi Richard Have you checked out the `fillRule` property docs? Cheers Monte > On 15 Feb 2021, at 9:25 am, Richard Gaskin via use-livecode > wrote: > > I was hoping to use a single polygon draw a box, using the old trick of > making discontiguous regions by adding a blank line between lists of points. > > The results draws the lines as I expected, but the fill is unpredictable, at > least for me. Apparently the fill rules for a polygon cause it to not fill > some regions, even when discontiguous. > > I guess I'll have to use separate objects, but I was wondering if anyone has > a description of the polyfill rule(s), or better, a way to coerce > discontiguous polygon regions to always be filled. > > -- > Richard Gaskin > Fourth World Systems > > ___ > use-livecode mailing list > use-livecode@lists.runrev.com > Please visit this url to subscribe, unsubscribe and manage your subscription > preferences: > http://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode