Skip to content

Commit

Permalink
Added a new CIF operator "not-interact" which is complementary to
Browse files Browse the repository at this point in the history
"interact", because it was trivially easy to implement and saves
processing vs. doing the same thing with two templayers and an
"and-not" operator.
  • Loading branch information
RTimothyEdwards committed Feb 5, 2025
1 parent 21b810b commit a5653c8
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
7 changes: 7 additions & 0 deletions cif/CIFgen.c
Original file line number Diff line number Diff line change
Expand Up @@ -4752,6 +4752,13 @@ cifInteractingRegions(
}
}

/* op->co_client is an invert bit indicating the rule is "not-interact",
* so invert the sense of "interacts". Then the non-interacting regions
* will be kept and the interacting regions will be discarded.
*/
if (op->co_client == (ClientData)1)
interacts = (interacts) ? FALSE : TRUE;

/* Clear the tiles that were processed in this set, first copying them */
/* to the destination if this region was found to be interacting with */
/* op->co_paintMask (op->co_cifMask) */
Expand Down
6 changes: 6 additions & 0 deletions cif/CIFtech.c
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ cifTechFreeStyle(void)
case CIFOP_BBOX:
case CIFOP_MAXRECT:
case CIFOP_BOUNDARY:
case CIFOP_INTERACT:
/* These options use co_client to hold a single */
/* integer value, so it is not allocated. */
break;
Expand Down Expand Up @@ -1096,6 +1097,11 @@ CIFTechLine(
newOp->co_opcode = CIFOP_BRIDGELIM;
else if (strcmp(argv[0], "interact") == 0)
newOp->co_opcode = CIFOP_INTERACT;
else if (strcmp(argv[0], "not-interact") == 0)
{
newOp->co_opcode = CIFOP_INTERACT;
newOp->co_client = (ClientData)1;
}
else
{
TechError("Unknown statement \"%s\".\n", argv[0]);
Expand Down

0 comments on commit a5653c8

Please sign in to comment.