Example #1
0
int            getDeviceProfile      ( Display           * display,
                                       oyConfig_s        * device,
                                       int                 screen )
{
  oyProfile_s * dst_profile = 0;
  int error = 0;
  uint32_t icc_profile_flags = oyICCProfileSelectionFlagsFromOptions( 
                                  OY_CMM_STD, "//" OY_TYPE_STD "/icc_color",
                                                                 NULL, 0 );
  oyOptions_s * options = 0;

  oyDeviceUnset( device );

      /*oyOptions_SetFromText( &options,
                   "//"OY_TYPE_STD"/config/command",
                                       "list", OY_CREATE_NEW );
      oyOptions_SetFromText( &options,
                   "//"OY_TYPE_STD"/config/icc_profile.x_color_region_target",
                                       "yes", OY_CREATE_NEW );*/
  error = oyOptions_SetFromInt( &options,
                                    "//" OY_TYPE_STD "/icc_profile_flags",
                                    icc_profile_flags, 0, OY_CREATE_NEW );
  error = oyDeviceGetProfile( device, options, &dst_profile );
  oyOptions_Release( &options );

  return error;
}
Example #2
0
bool ColorContext::getDeviceProfile(oyConfig_s *device)
{
    kDebug() << device;

    oyProfile_Release(&m_dstProfile);

    oyOptions_s *options = 0;
    oyOptions_SetFromText(&options, "//"OY_TYPE_STD"/config/command", "list", OY_CREATE_NEW);
    oyOptions_SetFromText(&options,
        "//"OY_TYPE_STD"/config/icc_profile.x_color_region_target",
        "yes", OY_CREATE_NEW );
    int error = oyDeviceGetProfile(device, options, &m_dstProfile);
    oyOptions_Release(&options);

    if (m_dstProfile) {
        /* check that no sRGB is delivered */
        if (error) {
            oyProfile_s *dummyProfile = oyProfile_FromStd(oyASSUMED_WEB, icc_profile_flags, 0);
            if (oyProfile_Equal(dummyProfile, m_dstProfile)) {
                kWarning() << "Output" << m_outputName << "ignoring fallback, error" << error;
                oyProfile_Release(&m_dstProfile);
                error = 1;
            } else
                error = 0;
            oyProfile_Release(&dummyProfile);
        }
    } else {
        kWarning() << "Output" << m_outputName << ": no ICC profile found, error" << error;
        error = 1;
    }

    return error == 0;
}