Beispiel #1
0
gchar *
gimp_lcms_profile_get_label (GimpColorProfile profile)
{
  gchar *label;

  g_return_val_if_fail (profile != NULL, NULL);

  label = gimp_lcms_profile_get_description (profile);

  if (label && ! strlen (label))
    {
      g_free (label);
      label = NULL;
    }

  if (! label)
    label = gimp_lcms_profile_get_model (profile);

  if (label && ! strlen (label))
    {
      g_free (label);
      label = NULL;
    }

  if (! label)
    label = g_strdup (_("(unnamed profile)"));

  return label;
}
Beispiel #2
0
static void
cdisplay_lcms_profile_get_info (cmsHPROFILE   profile,
                                gchar       **name,
                                gchar       **info)
{
  if (profile)
    {
      *name = gimp_lcms_profile_get_description (profile);
      if (! *name)
        *name = gimp_lcms_profile_get_model (profile);

      if (! *name)
        {
          /* a color profile without a name */
          *name = g_strdup (_("(unnamed profile)"));
        }

      *info = gimp_lcms_profile_get_summary (profile);
    }
  else
    {
      *name = g_strdup (_("None"));
      *info = NULL;
    }
}
Beispiel #3
0
static GimpPDBStatusType
lcms_icc_info (GimpColorConfig *config,
               gint32           image,
               gchar          **name,
               gchar          **desc,
               gchar          **info)
{
  cmsHPROFILE  profile;
  GError      *error = NULL;

  g_return_val_if_fail (GIMP_IS_COLOR_CONFIG (config), GIMP_PDB_CALLING_ERROR);
  g_return_val_if_fail (image != -1, GIMP_PDB_CALLING_ERROR);

  profile = lcms_image_get_profile (config, image, &error);

  if (error)
    {
      g_message ("%s", error->message);
      g_clear_error (&error);
    }

  if (! profile)
    profile = gimp_lcms_create_srgb_profile ();

  if (name) *name = gimp_lcms_profile_get_model (profile);
  if (desc) *desc = gimp_lcms_profile_get_description (profile);
  if (info) *info = gimp_lcms_profile_get_summary (profile);

  cmsCloseProfile (profile);

  return GIMP_PDB_SUCCESS;
}
Beispiel #4
0
gchar *
gimp_lcms_profile_get_summary (GimpColorProfile profile)
{
  GString *string;
  gchar   *text;

  g_return_val_if_fail (profile != NULL, NULL);

  string = g_string_new (NULL);

  text = gimp_lcms_profile_get_description (profile);
  if (text)
    {
      g_string_append (string, text);
      g_free (text);
    }

  text = gimp_lcms_profile_get_model (profile);
  if (text)
    {
      if (string->len > 0)
        g_string_append (string, "\n");

      g_string_append (string, text);
    }

  text = gimp_lcms_profile_get_manufacturer (profile);
  if (text)
    {
      if (string->len > 0)
        g_string_append (string, "\n");

      g_string_append (string, text);
    }

  text = gimp_lcms_profile_get_copyright (profile);
  if (text)
    {
      if (string->len > 0)
        g_string_append (string, "\n");

      g_string_append (string, text);
    }

  return g_string_free (string, FALSE);
}
Beispiel #5
0
static GimpPDBStatusType
lcms_icc_file_info (GFile   *file,
                    gchar  **name,
                    gchar  **desc,
                    gchar  **info,
                    GError **error)
{
  cmsHPROFILE profile;

  profile = gimp_lcms_profile_open_from_file (file, error);

  if (! profile)
    return GIMP_PDB_EXECUTION_ERROR;

  *name = gimp_lcms_profile_get_model (profile);
  *desc = gimp_lcms_profile_get_description (profile);
  *info = gimp_lcms_profile_get_summary (profile);

  cmsCloseProfile (profile);

  return GIMP_PDB_SUCCESS;
}