Skip to content

API BREAK: remove undocumented CMYK byte color format

This color format was introduced in c19a3f59 (landed in Graphviz 2.26) but then removed from documentation in 2bba2113 (landed in Graphviz 2.28). It is possible the bugs hinted at in the latter commit include the subtly incorrect casts in the implementation of this feature:

  color->u.cmyk[0] = (int) C *255;
  color->u.cmyk[1] = (int) M *255;
  color->u.cmyk[2] = (int) Y *255;
  color->u.cmyk[3] = (int) K *255;

Here, C, M, Y, and K are all values in the range [0.0, 1.0). Casts have higher precedence than multiplication, so each of these values would be cast to int (resulting in 0) before being multiplied by 255. So all components would be unconditionally set to 0. Presumably the author intended to bracket this differently, (int)(C * 255).

Merge request reports