Files
gtk/docs/reference/gtk/migrating-GtkColorButton.sgml
Stefan Kost 804a06b859 Bug 540967 – docs build slowly because of entities
* gtk/building.sgml:
	* gtk/changes-1.2.sgml:
	* gtk/changes-2.0.sgml:
	* gtk/compiling.sgml:
	* gtk/directfb.sgml:
	* gtk/glossary.xml:
	* gtk/gtk-docs.sgml:
	* gtk/gtk-query-immodules-2.0.xml:
	* gtk/gtk-update-icon-cache.xml:
	* gtk/migrating-GtkAboutDialog.sgml:
	* gtk/migrating-GtkAction.sgml:
	* gtk/migrating-GtkAssistant.sgml:
	* gtk/migrating-GtkBuilder.sgml:
	* gtk/migrating-GtkColorButton.sgml:
	* gtk/migrating-GtkComboBox.sgml:
	* gtk/migrating-GtkFileChooser.sgml:
	* gtk/migrating-GtkIconView.sgml:
	* gtk/migrating-GtkLinkButton.sgml:
	* gtk/migrating-GtkRecentChooser.sgml:
	* gtk/migrating-GtkTooltip.sgml:
	* gtk/migrating-checklist.sgml:
	* gtk/osx.sgml:
	* gtk/other_software.sgml:
	* gtk/question_index.sgml:
	* gtk/resources.sgml:
	* gtk/running.sgml:
	* gtk/text_widget.sgml:
	* gtk/tree_widget.sgml:
	* gtk/visual_index.xml:
	* gtk/windows.sgml:
	* gtk/x11.sgml:
	  Use xi:include to speed up doc-build. Remove some unused entities.


svn path=/trunk/; revision=20812
2008-07-10 03:27:56 +00:00

55 lines
2.0 KiB
XML

<?xml version="1.0"?>
<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
"http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [
]>
<chapter id="gtk-migrating-GtkColorButton">
<title>Migrating from GnomeColorPicker to GtkColorButton</title>
<para>
Since version 2.6, GTK+ provides the #GtkColorButton
widget as a replacement for the <structname>GnomeColorPicker</structname>
widget in the libgnomeui library.
</para>
<para>
Porting an application from <structname>GnomeColorPicker</structname> to
<structname>GtkColorButton</structname> is very simple.
<structname>GtkColorButton</structname> doesn't support dithering
(since it is rarely needed on modern hardware), and it doesn't have
setters and getters to set the color from floating point or integer
components. So instead of
<informalexample><programlisting>
guint red, green, blue, alpha;
/* ... */
gnome_color_picker_set_i8 (color_picker, red, green, blue, alpha);
</programlisting></informalexample>
you have to write
<informalexample><programlisting>
GdkColor color;
color.red = red &lt;&lt; 8;
color.green = green &lt;&lt; 8;
color.blue = blue &lt;&lt; 8;
gtk_color_button_set_color (color_picker, &amp;color);
gtk_color_button_set_alpha (color_picker, alpha &lt;&lt; 8);
</programlisting></informalexample>
and similarly for the setters taking other number formats. For
<function>gnome_color_picker_set_i16()</function> no conversion is needed,
for <function>gnome_color_picker_set_d()</function>, you need to convert
the color components like this:
<informalexample><programlisting>
color.red = (guint16) (red * 65535.0 + 0.5);
color.green = (guint16) (green * 65535.0 + 0.5);
color.blue = (guint16) (blue * 65535.0 + 0.5);
</programlisting></informalexample>
</para>
</chapter>
<!--
Local variables:
mode: sgml
sgml-parent-document: ("gtk-docs.sgml" "book" "part" "chapter")
End:
-->