Compound Path - determine  winding rules

I have a compound path, and i need to parse all points, for export to CANVAS HTML , for this I wrote this script:
But the problem is how to detect the holes. I find information, and i think that i need the fill rule or clockwise fill, but in the reference doesn't exist.
Somebody can help me. Thanks
Compound Path fill rules:  http://forums.adobe.com/message/4507598?tstart=0#4507598
Nonzero winding fill rule
Uses mathematical equations to determine if a point is outside or inside a shape. Illustrator uses the nonzero winding rule as the default rule.
Even-odd fill rule
Uses mathematical equations to determine if a point is outside or inside a shape. This rule is the more predictable rule because every other region within an even‑odd compound path is a hole, regardless of path direction. Some applications, such as Adobe Photoshop, use the even‑odd rule by default, so compound paths imported from these applications will use the even‑odd rule.
http://help.adobe.com/en_US/illustrator/cs/using/WS714a382cdf7d304e7e07d0100196cbc5f-6462a .html#WS714a382cdf7d304e7e07d0100196cbc5f-644ea
http://www.fireworkszone.com/tuts/476/fill_rules.pdf
/*bool*/ Polygon.prototype.collideShapes = function(/*Polygon*/ _poly)
// Ret. TRUE if the shapes intersect
// slow method
try {
     this.intersectPath(_poly);
     app.activeDocument.undo();
     return(true);
catch(ex)
     return(false);
var selection = app.activeDocument.selection;
var a= selection[0]
var b= selection[1]
//alert( a.collideShapes(b))
function inArray(agulla, paller){
    var length = paller.length;
    for(var i = 0; i < length; i++) {
        if(paller[i] == agulla) return true;
    return false;
var item  = app.activeDocument.selection;
var items = item[0].releaseCompoundPath();
var restantes = items;
var groups={}
var i = items.length;
//          while( i-- )
for (var i=0;i< items.length;i++)
                    a = items[i];
                    try{
                    $.writeln( items[i].LocalDisplaySetting          )
                    }catch(e){$.writeln( e)}
for (var s=0;s< restantes.length;s++){
var b = restantes[s]
if(a!=b){
if(inArray(b, restantes)== true){
try{
if(a.collideShapes(b)){
if(typeof groups[i]== "undefined"){
groups[i]=[]
groups[i].push(i)
groups[i].push(s)
restantes[i]= "void";
items[i]= "void";
restantes[s]= "void";
items[s]= "void";
catch(e){}
app.activeDocument.undo();
for (var t=0;t< restantes.length;t++){
if(restantes[t]!= "void")
$.writeln ( "_" + t +",");
for(var g  in groups){
var group = groups[g]
$.writeln ("var compoundPath = new CompoundPath( _" + group.join(", _") +").fillColor = 'red';");

I just want all inner shape and overlapping shape areas to be considered the composite fill of the compound shape - so in my example above, the three red rectangles lacking a centerpoint I want to contribute to compound path's composite fill, instead of knocking it out.
BTW, that example up there has a big outer stroke, no fill. Maybe confusing, but that's how I'm currently using the shape (to mask the outsides of 3 different designs).

Similar Messages

  • General path, winding rules

    Hi,
    i don't understand what does exactly do generalpath and the winding rules associated, any help would save my day,
    thanks,
    ed

    i'd preferred not, but you are the only one who
    answered, ...Is it only my-not so-perfect English or is this a rather rude statement?
    any idea where i can find some help ??In the API docs?http://java.sun.com/j2se/1.4.2/docs/api/java/awt/geom/GeneralPath.html

  • Compound Path fill rules

    I rarely want my Compound Paths to have voids where overlapping takes place, but sometimes (and it seems random) I get voids anyway.
    The Attribute Panel options don't seem to do anything.
    Am I stuck having to apply Pathfinder effects to solve this?

    I just want all inner shape and overlapping shape areas to be considered the composite fill of the compound shape - so in my example above, the three red rectangles lacking a centerpoint I want to contribute to compound path's composite fill, instead of knocking it out.
    BTW, that example up there has a big outer stroke, no fill. Maybe confusing, but that's how I'm currently using the shape (to mask the outsides of 3 different designs).

  • Compound path inside/outside test

    Is there an API for testing if a point is inside or outside of a specific compound path? I've found stuff for the length/area, but not inside outside. I supposed I could implement it myself but that kind of code tends to have a lot of fiddly <= vs < sensitivity when implementing the winding rule, and I'd rather not re-invent the wheel when illustrator is obviously already able to do this test. (Plus I could take advantage of whatever acceleration code illustrator already has for this test.)
    If there's a individual path inside outside test, I don't mind tallying things up for the components of the compound path, but I didn't even find that. I'm probably just missing something obvious.
    Thanks,
    PS (I'm still back using CS2 since that's the suite I have and I'm unable to shell out the big bucks to upgrade.)

    Well, I think the problem with that is that the hit test will also report a "hit" when you're on things like control points outside of the fill region. Now you could say "well then check the hit type and don't report a hit if it's over a control point" but then you're just in trouble because you might be over an internal control point.
    So I don't think it can reliably be used for that.
    I guess you might be able to make it work by manually making sure no control points are visible, and that fill is on, and then use the hit test lib. I'll look into it, but my gut feeling is that this is going to have issues. Interesting though. Thanks for the suggestion!
    -Kurt

  • Compound paths lose colour

    A strange thing happened just now that I don’t recall having seen before.
    I have a number of simple objects, all the same fill colour, no stroke and none of them overlapping.
    When I make them into a compound path they sometimes lose all their colour.
    I have checked winding order, even/odd fill and that sort of thing but since none of the objects overlap, that shouldn’t make any difference anyway.
    This doesn’t happen every time, so does anyone know what could be causing it?

    I got before and resolved by cleaning up the original selection. Cleared stray points and duplicate overlapping objects.
    In screenshot below I duplicated the cyan square and filled with none, did a compound path of 4 objects and lost the fill of cyan.
    Also if you ever open a file and get a missing plugin that could happen.

  • Help needed to make a compound path of text in rectangle

    Hello, I hope some one will really solve my problem.
    Im trying to make a compound path (text inside a rectangle). I had done this previously with success but now the whole shape and text is showing same color. Although text should be transparent! And now due to the similarity in colors i cannot see any font.
    I don't know why this is happening?
    I made outlines of text, ungrouped it, released their compound paths, placed all fonts and rectangle in seperated layer and then made it a compound  path.
    Please let me know if im following all the steps.
    Also, please forgive my bad English as im not native.

    adobied,
    As you know now, Larry answered the Compound question while you were still typing.
    We do have quite a few cross postings in this busy forum, especially at this time of day with natives present both over there and over here.
    You can use Opacity Masks for a whole range of purposes, and they can act as (inverted) Clipping Masks, and also for partial/varying transparency.
    In this case, the suggested use corresponds to an inverted Clipping Mask.
    I quite understand your wish to have the Compound under control, and I believe that is sorted with the advice from Larry.

  • Can't release compound path

    I drew some simple paths in Photoshop with the pen tool, then exported the paths to Illustrator. All the paths came into illustrator as compound paths, though they look like simple paths in illustrator. Because they are compound paths, I can't join the ends of the paths to the ends of other paths.
    Whe I select one of these paths:
    Object>Compound Path>Release is greyed out and unavailable.
    "Release Compound Shape" in the Pathfinde palette menu is also greyed out and unavailable.
    Is there any way to make these paths back into simple paths without redrawing them?
    I'm using CS6 versions of both Photoshop and Illustrator.

    Okay, here's the screen shot.

  • How to release Compound Path in Adobe illustrator javascript

    Hi,
      How to release Comound path with java script

    Thanks For answer
    Actually i want to take .PNG image for compound path Items.
    But when i release compound path Items then it is break in small small object.
    When i save compound path items separately it saved as a blank image...
    What am i do now.

  • [AI CS4 Mac] How to create a Compound Path?

    Hi Folks,
    I'm trying to create a compound path in AI CS4 for Mac, but I have not been successful. One would think this would be easy, so maybe I'm missing the obvious solution...
    What is best way to create a compound path using the SDK? I just need to make a compound path out of two non-overlapping rectangles so that I can create a clipping mask. Nothing tricky.
    The SDK is not clear about the best way to go about creating a compound path, but I figured that programmitically selecting the two rectanlges and then using the built in "adobe_makeCompound" action would work, but it doesn't.
    err = sAIActionManager->PlayActionEvent("adobe_makeCompound", kDialogNone, NULL);
    When the above code is called while I'm debugging, I get a dialog box that reads: The object "Make Compound Path" is not currently available.
    If I click the "Stop" button while debugging, the value of err is 1346458189 which is 'PARM'. So, maybe I need to set a parameter? The crazy thing is that there appears to be no parameters needed for the "adobe_makeCompound" action event. When I created the action manually, the resulting .aia file (see its contents below) has a parameterCount == 0. I've tried passing a parameter block without adding any parameters to it (instead of NULL), but still no joy.
    /version 2
    /name [ 5
              5365742031
    /isOpen 1
    /actionCount 1
    /action-1 {
              /name [ 12
                        436f6d706f756e6450617468
              /keyIndex 0
              /colorIndex 0
              /isOpen 0
              /eventCount 1
              /event-1 {
                        /internalName (adobe_makeCompound)
                        /localizedName [ 18
                                  4d616b6520436f6d706f756e642050617468
                        /isOpen 0
                        /isOn 1
                        /hasDialog 0
                        /parameterCount 0
    Any help or suggestions on how to create a compound path would be greatly appreciated!
    Thanks in advance!
    -- Jim

    Actually, here's a more useful variation
    // rectangle1 & rectangle2 are the AIArtHandles for your existing paths
    AIArtHandle compound = 0;
    sArt->NewArt(kCompoundPathArt, kPlaceAbove, rectangle1, &compound);
    sArt->sReorderArt(rectangle1, kPlaceInsideOnTop, compound);
    sArt->sReorderArt(rectangle2, kPlaceInsideOnTop, compound);
    // this will create the compound right next to wherever rectangle1 is, much simpler and more likely what you want

  • Compound path selection in Photoshop CC

    Hi
    I have a compound path (item silhouette together with inner hole). But for some reason am not able to make selection with the hole excluded from outer path selection any more as I was able to do in previous versions of Photoshop (photoshop selects outer path only). Please let me know if it's still possible to do.

    Now it's OK. nvm

  • Compound path (or similar) but without "holes"

    Hi guys
    I'm designing a logo in which I use the letter C but I would like to "extend" the upper part of it with an extra "curl".
    So I expanded the C (text to outlines) and added a line which should be the extension. Now I would like them to be one item together. I tried compound path but that makes the overcrossing parts of the letter "blank". How do I solve this?
    See print screens below.
    Thanks!
    Bob

    Hi John Mensinger,
    Indeed, it worked!! Thanks! I forgot to use the Pathfinder! I should learn to use it more
    Thanks!!!
    Bob

  • Can someone explain to me what are the benefits of compound path when it comes to text?  I can understand one or two lines but a whole paragraph?

    Every year we do a fundraiser to help my job, but my co-worker is getting frustrated.  We receive outside files laid out in Illustrator, but the person who does the file sets all of the text using compound path. These aren't one or two lines of text to be manipulated but whole paragraphs of text.  This person does this every year, and it is time consuming if my co-worker can't manipulate a paragraph without going to each individual layer that has a letter. Is there a way to make these compound paths merge as one without altering the document i.e. make some element disappear. Any kind of help is appreciated.

    ikaika,
    As I (mis)understand it, you should simply ask this outside person to keep all text as Live Type, using a font that you have on your machines (in the exact same version) so there will be no font substitution issue(s).
    That way, you could get the job done without silly waste of time.
    Failing to comply would seem quite uncooperative.
    I presume there is no copyright question onvolved in this.

  • Compound path envelope disort - urgent - please help!

    So, I really need to do a "car of the year" type of badge in illustrator.
    I have the flags vector (grouped) and the hallow circle created whith the shape builder tool as a compound path. (see image).
    And now, the obvoius problem. The only thing I could think of to achieve this result wast the envelope disort tool - make with top object. But then, ctrl-alt-c, bag!, error:
    Now, obviously I understand why I get the error, my "hallow circle" is a compound path, but how do I convert it into a compatible shape?
    Or is it an other way to get the same effect? I've tried the warp option but it just doesn't have a circle, just arch and it doesn't suit my needs. It looks crapy with warp.
    Please help me! I've tryed everyting I could've think of, even importing photoshop paths... how can I make this badge work? I just couln't find a way to transform the compound path into an admitted shape. And my client really needs this badge for a franchise event at the end of the month.
    This is where I got by using the warp tool but it looks bad, I want lager flags and I can't do that whitout screwing the arch meshed into a crappy circle... plese help me

    Art brushes won't repeat.
    Look for the element that's not allowed, because brushes are an ideal way to do this.
    Look for gradients, pixel art or type.
    Try this art:
    http://www.adobe.com/cfusion/exchange/index.cfm?event=extensionDetail&extid=1045620

  • Live trace, gradients and compounding paths

    I have a complex shape, and I want to have a copy behind of it that is filled.. the shape itself is a combination of stokes and fills, so a straight-out fill doesn't look good at all.. I can get it all colored the same way using live paint groups to only fill in the areas that are completely surrounded.  The problem with that, though, is a gradient will apply separately to each object, but if I make a compound path it fills in some bits of the strokes the protrude as lines into the outside (it's a ironwork sort of pattern).
    The only way i can think to do this automatically would be to color all the selections the same and then rasterize it and then live trace it so it's one object and then apply the gradient to that, but I feel there's probably a more straightforward way.  Not sure I explained that properly, if something's unclear I'll be happy to elaborate

    "The problem with that, though, is a gradient will apply separately to each object..."
    Once you get to this point, you can grab the gradient tool from the tool panel and drag across all of the filled shapes. This will make one uniform gradient seen through the many pieces of the selection.
    Give that a try, let us know how it goes.

  • How to create multiple gradients in a compound path?

    Hi, I am trying to color a compound path with multiple colors? Kinda similar to the effect here
    I tried using the blend tool and replace the spline but it does not give the desired effect.
    Any tips as to how to approach this?
    I have made the G by creating a compound path.
    Thank you!

    namk,
    You may:
    1) Create a simple stroke/nofill path, with a stroke at least as wide as the semicircular end parts, which follows and fully covers the G shape of the compound path;
    2) Ctrl/Cmd+X+B to bring it to the back, then give it the desired gradient along the stroke/path;
    3) Select all and Object>Clipping Mask>Make.
    If you wish to get the stroke back on top, you may:
    4) Click the compund path with the Direct Selection Tool and reapply its stroke with the original weight.

Maybe you are looking for

  • While creating the Data source for Sql server am getting this error?

    Hi i new to Power BI sites and office 365, For my first step  1. i have successful creaeted Gateway in Office 365 2.Now i have creating  the Data source for that gateway using Sql server R2 3.While Creating the Data source using the Corresponding gat

  • Native Monitor DPI?

    I just got the Apple 30" display and can't seem to find the native dpi of the monitor. I'm not talking about the resolution. I"m fairly new to Mac and my old monitors running in Windows was at 96 dpi. I'm trying to find out so I can set Photoshop up

  • Keeps requesting appleID password

    I have ios 8 on a 5S - about once a day my phone will crash and then ask repeatedly for appleID passwords this happened in a major way about 5 days ago meaning ALL my IOS devices (4 of them, one belonging to my wife) started asking for appleID passwo

  • Mountain lion download fails after 53mb

    Download for Mountain Lion fails after 53MB, any idea why?

  • Error -3212? Help!

    I can't connect to i-tunes I keep getting this error, (-3212) can anyone help?