include <libgimpcolor/gimpcmyk.h>.

2003-07-15  Sven Neumann  <sven@gimp.org>

	* libgimpcolor/gimpcolor.h: include <libgimpcolor/gimpcmyk.h>.

	* modules/Makefile.am
	* modules/colorsel_cmyk.c: added a simple CMYK color selector.
This commit is contained in:
Sven Neumann 2003-07-15 00:29:34 +00:00 committed by Sven Neumann
parent 9c7ff98375
commit 2a72abfd93
7 changed files with 336 additions and 28 deletions

View File

@ -1,3 +1,10 @@
2003-07-15 Sven Neumann <sven@gimp.org>
* libgimpcolor/gimpcolor.h: include <libgimpcolor/gimpcmyk.h>.
* modules/Makefile.am
* modules/colorsel_cmyk.c: added a simple CMYK color selector.
2003-07-15 Michael Natterer <mitch@gimp.org> 2003-07-15 Michael Natterer <mitch@gimp.org>
* app/core/gimppattern.c (gimp_pattern_load): fixed pattern depth * app/core/gimppattern.c (gimp_pattern_load): fixed pattern depth

View File

@ -26,6 +26,7 @@
#include <libgimpcolor/gimpadaptivesupersample.h> #include <libgimpcolor/gimpadaptivesupersample.h>
#include <libgimpcolor/gimpbilinear.h> #include <libgimpcolor/gimpbilinear.h>
#include <libgimpcolor/gimpcolorspace.h> #include <libgimpcolor/gimpcolorspace.h>
#include <libgimpcolor/gimpcmyk.h>
#include <libgimpcolor/gimphsv.h> #include <libgimpcolor/gimphsv.h>
#include <libgimpcolor/gimprgb.h> #include <libgimpcolor/gimprgb.h>

View File

@ -19,12 +19,17 @@ EXTRA_DIST = \
makefile.msc makefile.msc
lib_LTLIBRARIES = \ lib_LTLIBRARIES = \
libcolorsel_cmyk.la \
libcolorsel_triangle.la \ libcolorsel_triangle.la \
libcolorsel_water.la \ libcolorsel_water.la \
libcdisplay_colorblind.la \ libcdisplay_colorblind.la \
libcdisplay_gamma.la \ libcdisplay_gamma.la \
libcdisplay_highcontrast.la libcdisplay_highcontrast.la
libcolorsel_cmyk_la_SOURCES = colorsel_cmyk.c
libcolorsel_cmyk_la_LDFLAGS = -avoid-version -module $(no_undefined)
libcolorsel_cmyk_la_LIBADD = $(libgimpcolor) $(libgimpwidgets) $(GTK_LIBS)
libcolorsel_triangle_la_SOURCES = colorsel_triangle.c libcolorsel_triangle_la_SOURCES = colorsel_triangle.c
libcolorsel_triangle_la_LDFLAGS = -avoid-version -module $(no_undefined) libcolorsel_triangle_la_LDFLAGS = -avoid-version -module $(no_undefined)
libcolorsel_triangle_la_LIBADD = $(libgimpcolor) $(libgimpwidgets) $(GTK_LIBS) libcolorsel_triangle_la_LIBADD = $(libgimpcolor) $(libgimpwidgets) $(GTK_LIBS)

254
modules/colorsel_cmyk.c Normal file
View File

@ -0,0 +1,254 @@
/* CMYK GimpColorSelector
* Copyright (C) 2003 Sven Neumann <sven@gimp.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include "config.h"
#include <stdlib.h>
#include <stdio.h>
#include <gtk/gtk.h>
#include "libgimpcolor/gimpcolor.h"
#include "libgimpmath/gimpmath.h"
#include "libgimpmodule/gimpmodule.h"
#include "libgimpwidgets/gimpwidgets.h"
#include "libgimp/libgimp-intl.h"
/* definitions and variables */
#define COLORSEL_TYPE_CMYK (colorsel_cmyk_type)
#define COLORSEL_CMYK(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), COLORSEL_TYPE_CMYK, ColorselCmyk))
#define COLORSEL_CMYK_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), COLORSEL_TYPE_CMYK, ColorselCmykClass))
#define COLORSEL_IS_CMYK(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), COLORSEL_TYPE_CMYK))
#define COLORSEL_IS_CMYK_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), COLORSEL_TYPE_CMYK))
typedef struct _ColorselCmyk ColorselCmyk;
typedef struct _ColorselCmykClass ColorselCmykClass;
struct _ColorselCmyk
{
GimpColorSelector parent_instance;
GimpCMYK cmyk;
GtkAdjustment *adj[4];
};
struct _ColorselCmykClass
{
GimpColorSelectorClass parent_class;
};
static GType colorsel_cmyk_get_type (GTypeModule *module);
static void colorsel_cmyk_class_init (ColorselCmykClass *klass);
static void colorsel_cmyk_init (ColorselCmyk *cmyk);
static void colorsel_cmyk_set_color (GimpColorSelector *selector,
const GimpRGB *rgb,
const GimpHSV *hsv);
static void colorsel_cmyk_adj_update (GtkAdjustment *adj,
ColorselCmyk *module);
static const GimpModuleInfo colorsel_cmyk_info =
{
GIMP_MODULE_ABI_VERSION,
N_("CMYK color selector"),
"Sven Neumann <sven@gimp.org>",
"v0.1",
"(c) 2003, released under the GPL",
"July 2003"
};
static GType colorsel_cmyk_type = 0;
static GimpColorSelectorClass *parent_class = NULL;
G_MODULE_EXPORT const GimpModuleInfo *
gimp_module_query (GTypeModule *module)
{
return &colorsel_cmyk_info;
}
G_MODULE_EXPORT gboolean
gimp_module_register (GTypeModule *module)
{
colorsel_cmyk_get_type (module);
return TRUE;
}
static GType
colorsel_cmyk_get_type (GTypeModule *module)
{
if (! colorsel_cmyk_type)
{
static const GTypeInfo select_info =
{
sizeof (ColorselCmykClass),
(GBaseInitFunc) NULL,
(GBaseFinalizeFunc) NULL,
(GClassInitFunc) colorsel_cmyk_class_init,
NULL, /* class_finalize */
NULL, /* class_data */
sizeof (ColorselCmyk),
0, /* n_preallocs */
(GInstanceInitFunc) colorsel_cmyk_init,
};
colorsel_cmyk_type =
g_type_module_register_type (module,
GIMP_TYPE_COLOR_SELECTOR,
"ColorselCmyk",
&select_info, 0);
}
return colorsel_cmyk_type;
}
static void
colorsel_cmyk_class_init (ColorselCmykClass *klass)
{
GimpColorSelectorClass *selector_class;
selector_class = GIMP_COLOR_SELECTOR_CLASS (klass);
parent_class = g_type_class_peek_parent (klass);
selector_class->name = _("_CMYK");
selector_class->help_page = "cmyk.html";
selector_class->stock_id = GTK_STOCK_PRINT; /* FIXME */
selector_class->set_color = colorsel_cmyk_set_color;
}
static void
colorsel_cmyk_init (ColorselCmyk *module)
{
GtkWidget *table;
gint i;
static const gchar *cmyk_labels[] =
{
N_("_C"),
N_("_M"),
N_("_Y"),
N_("_K")
};
static const gchar *cmyk_tips[] =
{
N_("Cyan"),
N_("Magenta"),
N_("Yellow"),
N_("Black")
};
table = gtk_table_new (4, 4, FALSE);
gtk_table_set_row_spacings (GTK_TABLE (table), 1);
gtk_table_set_row_spacing (GTK_TABLE (table), 2, 3);
gtk_table_set_col_spacings (GTK_TABLE (table), 2);
gtk_table_set_col_spacing (GTK_TABLE (table), 0, 0);
gtk_box_pack_start (GTK_BOX (module), table, TRUE, FALSE, 0);
for (i = 0; i < 4; i++)
{
GtkObject *adj;
adj = gimp_scale_entry_new (GTK_TABLE (table), 1, i,
gettext (cmyk_labels[i]),
80, -1,
0.0,
0.0, 255.0,
1.0, 16.0,
0,
TRUE, 0.0, 0.0,
gettext (cmyk_tips[i]),
NULL);
g_signal_connect (adj, "value_changed",
G_CALLBACK (colorsel_cmyk_adj_update),
module);
module->adj[i] = GTK_ADJUSTMENT (adj);
}
gtk_widget_show (table);
}
static void
colorsel_cmyk_set_color (GimpColorSelector *selector,
const GimpRGB *rgb,
const GimpHSV *hsv)
{
ColorselCmyk *module;
guchar c, m, y, k;
module = COLORSEL_CMYK (selector);
gimp_rgb_to_cmyk (rgb, &module->cmyk);
gimp_cmyk_get_uchar (&module->cmyk, &c, &m, &y, &k);
gtk_adjustment_set_value (module->adj[0], c);
gtk_adjustment_set_value (module->adj[1], m);
gtk_adjustment_set_value (module->adj[2], y);
gtk_adjustment_set_value (module->adj[3], k);
}
static void
colorsel_cmyk_adj_update (GtkAdjustment *adj,
ColorselCmyk *module)
{
GimpColorSelector *selector;
gdouble value;
gint i;
value = adj->value / 255.0;
for (i = 0; i < 4; i++)
if (module->adj[i] == adj)
break;
switch (i)
{
case 0:
module->cmyk.c = value;
break;
case 1:
module->cmyk.m = value;
break;
case 2:
module->cmyk.y = value;
break;
case 3:
module->cmyk.k = value;
break;
default:
return;
}
selector = GIMP_COLOR_SELECTOR (module);
gimp_cmyk_to_rgb (&module->cmyk, &selector->rgb);
gimp_rgb_to_hsv (&selector->rgb, &selector->hsv);
gimp_color_selector_color_changed (selector);
}

View File

@ -1,3 +1,9 @@
2003-07-15 Sven Neumann <sven@gimp.org>
* POTFILES.in: added modules/colorsel_cmyk.c.
* de.po: updated german translation.
2003-07-14 Danilo Šegan <dsegan@gmx.net> 2003-07-14 Danilo Šegan <dsegan@gmx.net>
* sr.po, sr@Latn.po: Updated Serbian translation by Serbian team * sr.po, sr@Latn.po: Updated Serbian translation by Serbian team

View File

@ -28,5 +28,6 @@ libgimpwidgets/gimpwidgets.c
modules/cdisplay_colorblind.c modules/cdisplay_colorblind.c
modules/cdisplay_gamma.c modules/cdisplay_gamma.c
modules/cdisplay_highcontrast.c modules/cdisplay_highcontrast.c
modules/colorsel_cmyk.c
modules/colorsel_triangle.c modules/colorsel_triangle.c
modules/colorsel_water.c modules/colorsel_water.c

View File

@ -1,5 +1,5 @@
# This is the German catalog for the libgimp. # This is the German catalog for the libgimp.
# Copyright (C) 1999,2000 Free Software Foundation, Inc. # Copyright (C) 1999 - 2003 Free Software Foundation, Inc.
# #
# Daniel Egger <Daniel.Egger@suse.de> # Daniel Egger <Daniel.Egger@suse.de>
# Sven Neumann <sven@gimp.org> # Sven Neumann <sven@gimp.org>
@ -7,16 +7,16 @@
# #
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: GIMP 1.3.15\n" "Project-Id-Version: GIMP 1.3.17\n"
"POT-Creation-Date: 2003-06-26 22:14+0200\n" "POT-Creation-Date: 2003-07-15 02:16+0200\n"
"PO-Revision-Date: 2003-06-16 22:42+0200\n" "PO-Revision-Date: 2003-07-15 02:18+0200\n"
"Last-Translator: Sven Neumann <sven@gimp.org>\n" "Last-Translator: Sven Neumann <sven@gimp.org>\n"
"Language-Team: German <gnome-de@gnome.org>\n" "Language-Team: German <gnome-de@gnome.org>\n"
"MIME-Version: 1.0\n" "MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n" "Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n" "Content-Transfer-Encoding: 8bit\n"
#: libgimp/gimpbrushmenu.c:321 #: libgimp/gimpbrushmenu.c:132
msgid "Brush Selection" msgid "Brush Selection"
msgstr "Pinselauswahl" msgstr "Pinselauswahl"
@ -148,7 +148,7 @@ msgstr "Das Bild sollte vor dem Abspeichern exportiert werden, denn:"
msgid "The export conversion won't modify your original image." msgid "The export conversion won't modify your original image."
msgstr "Dieser Vorgang wird das Originalbild nicht verändern." msgstr "Dieser Vorgang wird das Originalbild nicht verändern."
#: libgimp/gimpexport.c:610 #: libgimp/gimpexport.c:611
#, c-format #, c-format
msgid "" msgid ""
"You are about to save a layer mask as %s.\n" "You are about to save a layer mask as %s.\n"
@ -157,7 +157,7 @@ msgstr ""
"Sie sichern eine Ebenenmaske als %s.\n" "Sie sichern eine Ebenenmaske als %s.\n"
"Die sichtbaren Ebenen werden dabei nicht gesichert." "Die sichtbaren Ebenen werden dabei nicht gesichert."
#: libgimp/gimpexport.c:615 #: libgimp/gimpexport.c:617
#, c-format #, c-format
msgid "" msgid ""
"You are about to save a channel (saved selection) as %s.\n" "You are about to save a channel (saved selection) as %s.\n"
@ -166,16 +166,16 @@ msgstr ""
"Sie sichern einen Kanal (gesicherte Selektion) als %s.\n" "Sie sichern einen Kanal (gesicherte Selektion) als %s.\n"
"Die sichtbaren Ebenen werden dabei nicht gesichert." "Die sichtbaren Ebenen werden dabei nicht gesichert."
#: libgimp/gimpfontmenu.c:80 #: libgimp/gimpfontmenu.c:89
msgid "Font Selection" msgid "Font Selection"
msgstr "Schriftenauswahl" msgstr "Schriftenauswahl"
#: libgimp/gimpgradientmenu.c:172 #: libgimp/gimpgradientmenu.c:102
msgid "Gradient Selection" msgid "Gradient Selection"
msgstr "Gradientenauswahl" msgstr "Gradientenauswahl"
#: libgimp/gimpmenu.c:176 libgimp/gimpmenu.c:296 libgimp/gimpmenu.c:411 #: libgimp/gimpmenu.c:93 libgimp/gimpmenu.c:217 libgimp/gimpmenu.c:334
#: libgimp/gimpmenu.c:593 #: libgimp/gimpmenu.c:517
msgid "None" msgid "None"
msgstr "Keine" msgstr "Keine"
@ -183,7 +183,7 @@ msgstr "Keine"
msgid "Preview" msgid "Preview"
msgstr "Vorschau" msgstr "Vorschau"
#: libgimp/gimpmiscui.c:529 #: libgimp/gimpmiscui.c:537
#, c-format #, c-format
msgid "" msgid ""
"No %s in gimprc:\n" "No %s in gimprc:\n"
@ -192,7 +192,7 @@ msgid ""
"to your %s file." "to your %s file."
msgstr "" msgstr ""
#: libgimp/gimppatternmenu.c:321 #: libgimp/gimppatternmenu.c:115
msgid "Pattern Selection" msgid "Pattern Selection"
msgstr "Musterauswahl" msgstr "Musterauswahl"
@ -235,9 +235,9 @@ msgstr "%1.f MB"
msgid "Loading module: '%s'\n" msgid "Loading module: '%s'\n"
msgstr "Lade Modul: '%s'\n" msgstr "Lade Modul: '%s'\n"
#: libgimpmodule/gimpmodule.c:189 libgimpmodule/gimpmodule.c:206 #: libgimpmodule/gimpmodule.c:190 libgimpmodule/gimpmodule.c:207
#: libgimpmodule/gimpmodule.c:312 libgimpmodule/gimpmodule.c:339 #: libgimpmodule/gimpmodule.c:314 libgimpmodule/gimpmodule.c:341
#: libgimpmodule/gimpmodule.c:432 #: libgimpmodule/gimpmodule.c:434
#, c-format #, c-format
msgid "" msgid ""
"Module '%s' load error:\n" "Module '%s' load error:\n"
@ -246,24 +246,24 @@ msgstr ""
"Fehler beim Laden von Modul '%s':\n" "Fehler beim Laden von Modul '%s':\n"
"%s" "%s"
#: libgimpmodule/gimpmodule.c:270 #: libgimpmodule/gimpmodule.c:271
#, c-format #, c-format
msgid "Skipping module: '%s'\n" msgid "Skipping module: '%s'\n"
msgstr "Ignoriere Modul: '%s'\n" msgstr "Ignoriere Modul: '%s'\n"
#: libgimpmodule/gimpmodule.c:406 #: libgimpmodule/gimpmodule.c:408
msgid "Module error" msgid "Module error"
msgstr "Modul Fehler" msgstr "Modul Fehler"
#: libgimpmodule/gimpmodule.c:407 #: libgimpmodule/gimpmodule.c:409
msgid "Loaded" msgid "Loaded"
msgstr "Geladen" msgstr "Geladen"
#: libgimpmodule/gimpmodule.c:408 #: libgimpmodule/gimpmodule.c:410
msgid "Load failed" msgid "Load failed"
msgstr "Laden fehlgeschlagen" msgstr "Laden fehlgeschlagen"
#: libgimpmodule/gimpmodule.c:409 #: libgimpmodule/gimpmodule.c:411
msgid "Not loaded" msgid "Not loaded"
msgstr "Nicht geladen" msgstr "Nicht geladen"
@ -477,7 +477,7 @@ msgstr "Initialisiere den Zufallsgenerator mit einer Zufallszahl"
#: modules/cdisplay_colorblind.c:122 #: modules/cdisplay_colorblind.c:122
msgid "Color deficit simulation filter (Brettel-Vienot-Mollon algorithm)" msgid "Color deficit simulation filter (Brettel-Vienot-Mollon algorithm)"
msgstr "" msgstr "Farbenblindheit Anzeigenfarbfilter (Algorithmus von Brettel-Vienot-Mollon)"
#: modules/cdisplay_colorblind.c:188 #: modules/cdisplay_colorblind.c:188
msgid "Color Deficient Vision" msgid "Color Deficient Vision"
@ -527,6 +527,46 @@ msgstr "Kontrast"
msgid "Contrast Cycles:" msgid "Contrast Cycles:"
msgstr "Kontrastverstärkung:" msgstr "Kontrastverstärkung:"
#: modules/colorsel_cmyk.c:74
msgid "CMYK color selector"
msgstr "CMYK Farbmischer"
#: modules/colorsel_cmyk.c:136
msgid "_CMYK"
msgstr "_CMYK"
#: modules/colorsel_cmyk.c:150
msgid "_C"
msgstr "_C"
#: modules/colorsel_cmyk.c:151
msgid "_M"
msgstr "_M"
#: modules/colorsel_cmyk.c:152
msgid "_Y"
msgstr "_Y"
#: modules/colorsel_cmyk.c:153
msgid "_K"
msgstr "_K"
#: modules/colorsel_cmyk.c:157
msgid "Cyan"
msgstr "Cyan"
#: modules/colorsel_cmyk.c:158
msgid "Magenta"
msgstr "Magenta"
#: modules/colorsel_cmyk.c:159
msgid "Yellow"
msgstr "Gelb (Yellow)"
#: modules/colorsel_cmyk.c:160
msgid "Black"
msgstr "Schwarz (Key)"
#: modules/colorsel_triangle.c:110 #: modules/colorsel_triangle.c:110
msgid "Painter-style triangle color selector" msgid "Painter-style triangle color selector"
msgstr "Dreiecks-Farbauswahl im Stil von Painter" msgstr "Dreiecks-Farbauswahl im Stil von Painter"
@ -546,9 +586,3 @@ msgstr "_Wasserfarbe"
#: modules/colorsel_water.c:251 #: modules/colorsel_water.c:251
msgid "Pressure" msgid "Pressure"
msgstr "Druck" msgstr "Druck"
#~ msgid "Cancel"
#~ msgstr "Abbrechen"
#~ msgid "Colorblind display filter"
#~ msgstr "Farbenblindheit Anzeigenfarbfilter"