Skip to content

Commit

Permalink
OcdFileImport: Reliably detect Registration black
Browse files Browse the repository at this point in the history
Mapper is unable to detect Registration black in absence of spot
colors. This patch fixes the defect, loosens the name matching criterion
and aligns the matching criteria along the supported OCD format
versions.
  • Loading branch information
lpechacek committed Jun 28, 2024
1 parent 7036522 commit c8a7ea3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 11 deletions.
12 changes: 6 additions & 6 deletions src/fileformats/ocd_file_import.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -503,12 +503,12 @@ void OcdFileImport::importColors(const OcdFile<Ocd::FormatV8>& file)
}
color->setKnockout(color_info.overprint != 0);

if ((i == 0 && color->isBlack() && color->getName() == QLatin1String("Registration black"))
|| (!components.empty() && components.size() == num_separations
&& color_info.cmyk.cyan == 200
if ((color->isBlack() && color->getName().startsWith(QLatin1String("Registration black")))
|| (color_info.cmyk.cyan == 200
&& color_info.cmyk.magenta == 200
&& color_info.cmyk.yellow == 200
&& color_info.cmyk.black == 200
&& components.size() == num_separations
&& std::all_of(color_info.separations, color_info.separations + num_separations,
[](const auto& s) { return s == 200; }) ) )
{
Expand Down Expand Up @@ -710,12 +710,12 @@ void OcdFileImport::importColor(const QString& param_string)
if (!number_ok)
return;

if ((cmyk.isBlack() && name == QLatin1String("Registration black"))
|| (!components.empty() && components.size() == spot_colors.size()
&& qFuzzyCompare(cmyk.c, 1)
if ((cmyk.isBlack() && name.startsWith(QLatin1String("Registration black")))
|| (qFuzzyCompare(cmyk.c, 1)
&& qFuzzyCompare(cmyk.m, 1)
&& qFuzzyCompare(cmyk.y, 1)
&& qFuzzyCompare(cmyk.k, 1)
&& components.size() == spot_colors.size()
&& std::all_of(begin(components), end(components),
[](const auto& c) { return qFuzzyCompare(c.factor, 1); }) ) )
{
Expand Down
5 changes: 0 additions & 5 deletions test/file_format_t.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1412,11 +1412,6 @@ void FileFormatTest::colorTest()
// the target file format.
for (auto i = 0; i < original->getNumColorPrios(); ++i)
{
// >>>>>>>>> Temporary handling of OCD defects
if (*format_id == 'O' && i == 0 && original->getColorByPrio(0)->getName() != copy->getColorByPrio(0)->getName())
QEXPECT_FAIL("", "Registration black is not properly detected in absence of spot colors", Continue);
// <<<<<<<<< Temporary handling of OCD defects

// Gratiously handle missing v8 features (opacity, limited name
// length, CMYK color resolution).
auto* color_in_original = original->getColorByPrio(i);
Expand Down

0 comments on commit c8a7ea3

Please sign in to comment.