Thanks Stam and Roger,
Roger, if you want to understand what is going on then this link is from where I got the idea how to do it
http://www.imageprocessingplace.com/dow ... m/ray.html
In this particular implementation the algorithm scans the maskData of an image with transparencies. That is the step where you take the snapshot from the group that provides the transparencies around the opaque graphics. In an image with transparencies the maskData gives you byteToNum = 0 for transparent and 255 for opaque for all pixels. Only those 2 values are provided by the maskData. This information is used in the tracing algorithm.
That code was a pain to write and is a pain to understand...
I also made a version for color where you extract the colors of an image to turn the image into graphics that you can colorize (I limit it to max 12 colors).
It was fun to take an algorithm and turn it into actual code though.
Kind regards
Bernd
The Incredible SuperCard Shrink Tool
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
Re: The Incredible SuperCard Shrink Tool
Dear Bernd, that's a really interesting link and i'm in awe that you turned this into such well functioning LC code!bn wrote: ↑Tue Nov 23, 2021 8:29 amRoger, if you want to understand what is going on then this link is from where I got the idea how to do it
http://www.imageprocessingplace.com/dow ... m/ray.html
Having read this, your code makes a bit more sense and i'll try to digest your code in full when i get some time (the most precious commodity!)
Thank you for sharing this,
Stam
-
- VIP Livecode Opensource Backer
- Posts: 114
- Joined: Fri Apr 28, 2006 12:10 am
- Location: Seattle
Re: The Incredible SuperCard Shrink Tool
Bernd,
I just had to take a moment to tell you how impressed I am with your TraceOutlineOfGraphics stack. As near as I can tell at this early stage, you not only have managed to create a tool that mimics the old SuperCard Shrink tool, but also have provided me a treasure trove of LC scripting lessons. Thank you for contributing so much to me and this community. Can't wait to find time to dive into this deeper.
Also to the mothership: This should be added to the tool pallet! In the meantime I will use Bernd's stack as a plugin.
Rectangle with only 2 rounded corners ....Pshaw, absolutely no problem!!
Roger
I just had to take a moment to tell you how impressed I am with your TraceOutlineOfGraphics stack. As near as I can tell at this early stage, you not only have managed to create a tool that mimics the old SuperCard Shrink tool, but also have provided me a treasure trove of LC scripting lessons. Thank you for contributing so much to me and this community. Can't wait to find time to dive into this deeper.
Also to the mothership: This should be added to the tool pallet! In the meantime I will use Bernd's stack as a plugin.
Rectangle with only 2 rounded corners ....Pshaw, absolutely no problem!!
Roger
-
- VIP Livecode Opensource Backer
- Posts: 29
- Joined: Tue Jun 27, 2006 8:35 pm
- Location: Bellingham, WA USA
- Contact:
Re: The Incredible SuperCard Shrink Tool
Bernd,
I'm with Roger and stam on this one. Your "TraceOutlineOfGraphics.livecode" stack is just too cool!
--Scott
I'm with Roger and stam on this one. Your "TraceOutlineOfGraphics.livecode" stack is just too cool!
--Scott
Elementary Software
...now with 20% less chalk dust!
...now with 20% less chalk dust!
-
- VIP Livecode Opensource Backer
- Posts: 114
- Joined: Fri Apr 28, 2006 12:10 am
- Location: Seattle
Re: The Incredible SuperCard Shrink Tool
In case there is anyone left here that wants to continue playing, consider another approach to the Incredible SuperCard Shrink Tool:
The points of a polygon that has been tightly shrunk to fit (think superimposed) around an assembly of other overlapping polygons are all contained in a subset of the points of the original assembled polygons. for example, consider 2 overlapping polygons Poly1 and Poly2 . The desired polygon Poly3 which superimposes the outer edge of the assembled Poly1 and Poly2 will have tPoints3 where
tPoints3 = tPoints1 + tPoints2 - Poly1 points that lie within Poly2 - Poly2 points that lie within Poly1
So far I have not found a reliable repeatable way to peel away the “inside" points and stitch together the remaining points that would define Poly3. The Peeling away part would be easy if the "within" function were not restricted to rectangles. Major bummer!! Perhaps the Bernd method might be used somehow leaving only only the stitching together part???
Any ideas?
Roger
The points of a polygon that has been tightly shrunk to fit (think superimposed) around an assembly of other overlapping polygons are all contained in a subset of the points of the original assembled polygons. for example, consider 2 overlapping polygons Poly1 and Poly2 . The desired polygon Poly3 which superimposes the outer edge of the assembled Poly1 and Poly2 will have tPoints3 where
tPoints3 = tPoints1 + tPoints2 - Poly1 points that lie within Poly2 - Poly2 points that lie within Poly1
So far I have not found a reliable repeatable way to peel away the “inside" points and stitch together the remaining points that would define Poly3. The Peeling away part would be easy if the "within" function were not restricted to rectangles. Major bummer!! Perhaps the Bernd method might be used somehow leaving only only the stitching together part???
Any ideas?
Roger