*image_view,
*component_view;
+ char
+ *p;
+
CCObject
*object;
size;
ssize_t
+ first,
+ last,
n,
+ step,
y;
/*
component_image->colormap[i].alpha=object[i].color.alpha;
}
}
+ artifact=GetImageArtifact(image,"connected-components:keep");
+ if (artifact != (const char *) NULL)
+ {
+ /*
+ Keep these objects (make others transparent).
+ */
+ for (i=0; i < (ssize_t) component_image->colors; i++)
+ object[i].census=0;
+ for (p=(char *) artifact; *p != '\0';)
+ {
+ while ((isspace((int) ((unsigned char) *p)) != 0) || (*p == ','))
+ p++;
+ first=strtol(p,&p,10);
+ if (first < 0)
+ first+=(long) component_image->colors;
+ last=first;
+ while (isspace((int) ((unsigned char) *p)) != 0)
+ p++;
+ if (*p == '-')
+ {
+ last=strtol(p+1,&p,10);
+ if (last < 0)
+ last+=(long) component_image->colors;
+ }
+ for (step=first > last ? -1 : 1; first != (last+step); first+=step)
+ object[first].census++;
+ }
+ for (i=0; i < (ssize_t) component_image->colors; i++)
+ {
+ if (object[i].census != 0)
+ continue;
+ component_image->alpha_trait=BlendPixelTrait;
+ component_image->colormap[i].alpha=TransparentAlpha;
+ }
+ }
artifact=GetImageArtifact(image,"connected-components:remove");
if (artifact != (const char *) NULL)
{
- char
- *p;
-
- long
- first,
- last,
- step;
-
/*
Remove these objects (make them transparent).
*/