4 Replies Latest reply on Aug 29, 2009 10:07 PM by complexity

    Can flash detect the edges of transparent artwork?

    complexity Level 1

      Hi all,

       

      Does anyone know is their a way programmically in flash to detect the edges of imported artwork (artwork that has transparent background)? I am hoping to build something that detects the edges (or boundaries) of artwork and then place other objects around those boundaries. (so they dont touch too much or overlap).

       

      Anyone got any ideas or know if there is a term for this, has scripts been created before?

       

      Any help would be great

        • 1. Re: Can flash detect the edges of transparent artwork?
          dalcde Level 1

          Add them into a MC and use the simple hitTest :

           

          MC1.hitTest(MC2)

          • 2. Re: Can flash detect the edges of transparent artwork?
            Rothrock Level 5

            You don't mean the part where it goes from "not the artwork" to "transparent part of the artwork," right? You mean the edge where it goes from "transparent part of the artwork" to "non-transparent parts of the artwork"?

             

            The first Flash knows because it is just the width and height offset by the x and y. So that is totally easy.

             

            The second is much harder. Fortunately we can see further if we stand on the shoulders of giants.

             

            http://www.sakri.net/blog/2009/05/28/detecting-edge-pixels-with-marching-squares-algorithm /

            • 3. Re: Can flash detect the edges of transparent artwork?
              complexity Level 1

              Hi Rothrock yeah you were on the money thats the sort of things I was looking for! Thanks for the help, now to try and build a system to randomly place the other assets around each other using something like that!

               

              I guess you could say what I am aiming to build is a non overlaping random placement (edge to edge) artwork generator/pattern maker.

               

              Do you know if any other other there already exist?

              • 4. Re: Can flash detect the edges of transparent artwork?
                Rothrock Level 5

                No I know of nothing like that. I know that it is a commonly ask question. And I have never heard of anyone actually finishing such a thing.

                 

                Here is my take on it.

                 

                If the artwork is truly random and can have all, some, or none of the complexities that are possible in a two dimensional setting then the problem is intractably hard. There are just too many possibilities. And I would say that it really comes down to trying to pass the Turing test.

                 

                If the artwork isn't truly random in all its glory, then there is some unifying, underlying concept to what is going on and a less random randomness is needed. In those cases you get better design and visual results by placing some rules and constraints upon the system.

                 

                If the artwork itself is actually predefined and known, then all you have to do is precompute the possible permutations and design a system that accounts for that.

                 

                My guess as people work on trying to make such a thing (which seemed like such a cool thing to do) they figure out that it isn't really that cool and it looks really ugly. They then get more into their specific problem and see the hidden structure and organization and discover the "rules" that they need to make what they really wanted all along.

                 

                Or maybe I'm just cracked....?