<?xml version="1.0"?>
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
               "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [
<!ENTITY % local.common.attrib "xmlns:xi  CDATA  #FIXED 'http://www.w3.org/2003/XInclude'">
<!ENTITY version SYSTEM "version.xml">
]>
<refentry id="gdk4-RGBA-Colors">
<refmeta>
<refentrytitle role="top_of_page" id="gdk4-RGBA-Colors.top_of_page">RGBA Colors</refentrytitle>
<manvolnum>3</manvolnum>
<refmiscinfo>GDK4 Library</refmiscinfo>
</refmeta>
<refnamediv>
<refname>RGBA Colors</refname>
<refpurpose>RGBA colors</refpurpose>
</refnamediv>

<refsect1 id="gdk4-RGBA-Colors.functions" role="functions_proto">
<title role="functions_proto.title">Functions</title>
<informaltable pgwide="1" frame="none">
<tgroup cols="2">
<colspec colname="functions_proto_type" colwidth="150px"/>
<colspec colname="functions_proto_name"/>
<tbody>
<row><entry role="function_type"><link linkend="GdkRGBA"><returnvalue>GdkRGBA</returnvalue></link>&#160;*
</entry><entry role="function_name"><link linkend="gdk-rgba-copy">gdk_rgba_copy</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="void"><returnvalue>void</returnvalue></link>
</entry><entry role="function_name"><link linkend="gdk-rgba-free">gdk_rgba_free</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="gboolean"><returnvalue>gboolean</returnvalue></link>
</entry><entry role="function_name"><link linkend="gdk-rgba-is-clear">gdk_rgba_is_clear</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="gboolean"><returnvalue>gboolean</returnvalue></link>
</entry><entry role="function_name"><link linkend="gdk-rgba-is-opaque">gdk_rgba_is_opaque</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="gboolean"><returnvalue>gboolean</returnvalue></link>
</entry><entry role="function_name"><link linkend="gdk-rgba-parse">gdk_rgba_parse</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="gboolean"><returnvalue>gboolean</returnvalue></link>
</entry><entry role="function_name"><link linkend="gdk-rgba-equal">gdk_rgba_equal</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="guint"><returnvalue>guint</returnvalue></link>
</entry><entry role="function_name"><link linkend="gdk-rgba-hash">gdk_rgba_hash</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="char"><returnvalue>char</returnvalue></link>&#160;*
</entry><entry role="function_name"><link linkend="gdk-rgba-to-string">gdk_rgba_to_string</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>

</tbody>
</tgroup>
</informaltable>
</refsect1>
<anchor id="GdkRGBA"/><refsect1 id="gdk4-RGBA-Colors.other" role="other_proto">
<title role="other_proto.title">Types and Values</title>
<informaltable pgwide="1" frame="none">
<tgroup cols="2">
<colspec colname="other_proto_type" colwidth="150px"/>
<colspec colname="other_proto_name"/>
<tbody>
<row><entry role="datatype_keyword"></entry><entry role="function_name"><link linkend="GdkRGBA-struct">GdkRGBA</link></entry></row>

</tbody>
</tgroup>
</informaltable>
</refsect1>
<refsect1 id="gdk4-RGBA-Colors.object-hierarchy" role="object_hierarchy">
<title role="object_hierarchy.title">Object Hierarchy</title>
<screen>    <link linkend="GBoxed">GBoxed</link>
    <phrase role="lineart">&#9584;&#9472;&#9472;</phrase> GdkRGBA
</screen>
</refsect1>

<refsect1 id="gdk4-RGBA-Colors.includes"><title>Includes</title><synopsis>#include &lt;gdk/gdk.h&gt;
</synopsis></refsect1>

<refsect1 id="gdk4-RGBA-Colors.description" role="desc">
<title role="desc.title">Description</title>
<para><link linkend="GdkRGBA"><type>GdkRGBA</type></link> is a convenient way to pass rgba colors around.
It’s based on cairo’s way to deal with colors and mirrors its behavior.
All values are in the range from 0.0 to 1.0 inclusive. So the color
(0.0, 0.0, 0.0, 0.0) represents transparent black and
(1.0, 1.0, 1.0, 1.0) is opaque white. Other values will be clamped
to this range when drawing.</para>

</refsect1>
<refsect1 id="gdk4-RGBA-Colors.functions_details" role="details">
<title role="details.title">Functions</title>
<refsect2 id="gdk-rgba-copy" role="function">
<title>gdk_rgba_copy&#160;()</title>
<indexterm zone="gdk-rgba-copy"><primary>gdk_rgba_copy</primary></indexterm>
<programlisting language="C"><link linkend="GdkRGBA"><returnvalue>GdkRGBA</returnvalue></link>&#160;*
gdk_rgba_copy (<parameter>const <link linkend="GdkRGBA"><type>GdkRGBA</type></link> *rgba</parameter>);</programlisting>
<para>Makes a copy of a <link linkend="GdkRGBA"><type>GdkRGBA</type></link>.</para>
<para>The result must be freed through <link linkend="gdk-rgba-free"><function>gdk_rgba_free()</function></link>.</para>
<refsect3 id="gdk-rgba-copy.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>rgba</para></entry>
<entry role="parameter_description"><para>a <link linkend="GdkRGBA"><type>GdkRGBA</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="gdk-rgba-copy.returns" role="returns">
<title>Returns</title>
<para> A newly allocated <link linkend="GdkRGBA"><type>GdkRGBA</type></link>, with the same contents as <parameter>rgba</parameter>
</para>
</refsect3></refsect2>
<refsect2 id="gdk-rgba-free" role="function">
<title>gdk_rgba_free&#160;()</title>
<indexterm zone="gdk-rgba-free"><primary>gdk_rgba_free</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
gdk_rgba_free (<parameter><link linkend="GdkRGBA"><type>GdkRGBA</type></link> *rgba</parameter>);</programlisting>
<para>Frees a <link linkend="GdkRGBA"><type>GdkRGBA</type></link> created with <link linkend="gdk-rgba-copy"><function>gdk_rgba_copy()</function></link></para>
<refsect3 id="gdk-rgba-free.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>rgba</para></entry>
<entry role="parameter_description"><para>a <link linkend="GdkRGBA"><type>GdkRGBA</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3></refsect2>
<refsect2 id="gdk-rgba-is-clear" role="function">
<title>gdk_rgba_is_clear&#160;()</title>
<indexterm zone="gdk-rgba-is-clear"><primary>gdk_rgba_is_clear</primary></indexterm>
<programlisting language="C"><link linkend="gboolean"><returnvalue>gboolean</returnvalue></link>
gdk_rgba_is_clear (<parameter>const <link linkend="GdkRGBA"><type>GdkRGBA</type></link> *rgba</parameter>);</programlisting>
<para>Checks if an <parameter>rgba</parameter>
 value is transparent. That is, drawing with the value
would not produce any change.</para>
<refsect3 id="gdk-rgba-is-clear.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>rgba</para></entry>
<entry role="parameter_description"><para>a <link linkend="GdkRGBA"><type>GdkRGBA</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="gdk-rgba-is-clear.returns" role="returns">
<title>Returns</title>
<para> <link linkend="TRUE:CAPS"><literal>TRUE</literal></link> if the <parameter>rgba</parameter>
is clear</para>
</refsect3></refsect2>
<refsect2 id="gdk-rgba-is-opaque" role="function">
<title>gdk_rgba_is_opaque&#160;()</title>
<indexterm zone="gdk-rgba-is-opaque"><primary>gdk_rgba_is_opaque</primary></indexterm>
<programlisting language="C"><link linkend="gboolean"><returnvalue>gboolean</returnvalue></link>
gdk_rgba_is_opaque (<parameter>const <link linkend="GdkRGBA"><type>GdkRGBA</type></link> *rgba</parameter>);</programlisting>
<para>Checks if an <parameter>rgba</parameter>
 value is opaque. That is, drawing with the value
will not retain any results from previous contents.</para>
<refsect3 id="gdk-rgba-is-opaque.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>rgba</para></entry>
<entry role="parameter_description"><para>a <link linkend="GdkRGBA"><type>GdkRGBA</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="gdk-rgba-is-opaque.returns" role="returns">
<title>Returns</title>
<para> <link linkend="TRUE:CAPS"><literal>TRUE</literal></link> if the <parameter>rgba</parameter>
is opaque</para>
</refsect3></refsect2>
<refsect2 id="gdk-rgba-parse" role="function">
<title>gdk_rgba_parse&#160;()</title>
<indexterm zone="gdk-rgba-parse"><primary>gdk_rgba_parse</primary></indexterm>
<programlisting language="C"><link linkend="gboolean"><returnvalue>gboolean</returnvalue></link>
gdk_rgba_parse (<parameter><link linkend="GdkRGBA"><type>GdkRGBA</type></link> *rgba</parameter>,
                <parameter>const <link linkend="char"><type>char</type></link> *spec</parameter>);</programlisting>
<para>Parses a textual representation of a color, filling in
the <parameter>red</parameter>
, <parameter>green</parameter>
, <parameter>blue</parameter>
 and <parameter>alpha</parameter>
 fields of the <parameter>rgba</parameter>
 <link linkend="GdkRGBA"><type>GdkRGBA</type></link>.</para>
<para>The string can be either one of:</para>
<itemizedlist>
<listitem><para>A standard name (Taken from the X11 rgb.txt file).</para></listitem>
<listitem><para>A hexadecimal value in the form “#rgb”, “#rrggbb”,
“#rrrgggbbb” or ”#rrrrggggbbbb”</para></listitem>
<listitem><para>A hexadecimal value in the form “#rgba”, “#rrggbbaa”,
or ”#rrrrggggbbbbaaaa”</para></listitem>
<listitem><para>A RGB color in the form “rgb(r,g,b)” (In this case the color will
have full opacity)</para></listitem>
<listitem>
<para>A RGBA color in the form “rgba(r,g,b,a)”</para>
</listitem>
</itemizedlist>
<para>Where “r”, “g”, “b” and “a” are respectively the red, green, blue and
alpha color values. In the last two cases, “r”, “g”, and “b” are either
integers in the range 0 to 255 or percentage values in the range 0% to
100%, and a is a floating point value in the range 0 to 1.</para>
<refsect3 id="gdk-rgba-parse.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>rgba</para></entry>
<entry role="parameter_description"><para>the <link linkend="GdkRGBA"><type>GdkRGBA</type></link> to fill in</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>spec</para></entry>
<entry role="parameter_description"><para>the string specifying the color</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="gdk-rgba-parse.returns" role="returns">
<title>Returns</title>
<para> <link linkend="TRUE:CAPS"><literal>TRUE</literal></link> if the parsing succeeded</para>
</refsect3></refsect2>
<refsect2 id="gdk-rgba-equal" role="function">
<title>gdk_rgba_equal&#160;()</title>
<indexterm zone="gdk-rgba-equal"><primary>gdk_rgba_equal</primary></indexterm>
<programlisting language="C"><link linkend="gboolean"><returnvalue>gboolean</returnvalue></link>
gdk_rgba_equal (<parameter><link linkend="gconstpointer"><type>gconstpointer</type></link> p1</parameter>,
                <parameter><link linkend="gconstpointer"><type>gconstpointer</type></link> p2</parameter>);</programlisting>
<para>Compares two RGBA colors.</para>
<refsect3 id="gdk-rgba-equal.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>p1</para></entry>
<entry role="parameter_description"><para>a <link linkend="GdkRGBA"><type>GdkRGBA</type></link> pointer. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>type</acronym> GdkRGBA]</emphasis></entry></row>
<row><entry role="parameter_name"><para>p2</para></entry>
<entry role="parameter_description"><para>another <link linkend="GdkRGBA"><type>GdkRGBA</type></link> pointer. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>type</acronym> GdkRGBA]</emphasis></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="gdk-rgba-equal.returns" role="returns">
<title>Returns</title>
<para> <link linkend="TRUE:CAPS"><literal>TRUE</literal></link> if the two colors compare equal</para>
</refsect3></refsect2>
<refsect2 id="gdk-rgba-hash" role="function">
<title>gdk_rgba_hash&#160;()</title>
<indexterm zone="gdk-rgba-hash"><primary>gdk_rgba_hash</primary></indexterm>
<programlisting language="C"><link linkend="guint"><returnvalue>guint</returnvalue></link>
gdk_rgba_hash (<parameter><link linkend="gconstpointer"><type>gconstpointer</type></link> p</parameter>);</programlisting>
<para>A hash function suitable for using for a hash
table that stores <link linkend="GdkRGBAs"><type>GdkRGBAs</type></link>.</para>
<refsect3 id="gdk-rgba-hash.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>p</para></entry>
<entry role="parameter_description"><para>a <link linkend="GdkRGBA"><type>GdkRGBA</type></link> pointer. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>type</acronym> GdkRGBA]</emphasis></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="gdk-rgba-hash.returns" role="returns">
<title>Returns</title>
<para> The hash value for <parameter>p</parameter>
</para>
</refsect3></refsect2>
<refsect2 id="gdk-rgba-to-string" role="function">
<title>gdk_rgba_to_string&#160;()</title>
<indexterm zone="gdk-rgba-to-string"><primary>gdk_rgba_to_string</primary></indexterm>
<programlisting language="C"><link linkend="char"><returnvalue>char</returnvalue></link>&#160;*
gdk_rgba_to_string (<parameter>const <link linkend="GdkRGBA"><type>GdkRGBA</type></link> *rgba</parameter>);</programlisting>
<para>Returns a textual specification of <parameter>rgba</parameter>
 in the form
<literal>rgb(r,g,b)</literal> or
<literal>rgba(r,g,b,a)</literal>,
where “r”, “g”, “b” and “a” represent the red, green,
blue and alpha values respectively. “r”, “g”, and “b” are
represented as integers in the range 0 to 255, and “a”
is represented as a floating point value in the range 0 to 1.</para>
<para>These string forms are string forms that are supported by
the CSS3 colors module, and can be parsed by <link linkend="gdk-rgba-parse"><function>gdk_rgba_parse()</function></link>.</para>
<para>Note that this string representation may lose some
precision, since “r”, “g” and “b” are represented as 8-bit
integers. If this is a concern, you should use a
different representation.</para>
<refsect3 id="gdk-rgba-to-string.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>rgba</para></entry>
<entry role="parameter_description"><para>a <link linkend="GdkRGBA"><type>GdkRGBA</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="gdk-rgba-to-string.returns" role="returns">
<title>Returns</title>
<para> A newly allocated text string</para>
</refsect3></refsect2>

</refsect1>
<refsect1 id="gdk4-RGBA-Colors.other_details" role="details">
<title role="details.title">Types and Values</title>
<refsect2 id="GdkRGBA-struct" role="struct">
<title>GdkRGBA</title>
<indexterm zone="GdkRGBA-struct"><primary>GdkRGBA</primary></indexterm>
<programlisting language="C">typedef struct {
  float red;
  float green;
  float blue;
  float alpha;
} GdkRGBA;
</programlisting>
<para>A <link linkend="GdkRGBA"><type>GdkRGBA</type></link> is used to represent a (possibly translucent)
color, in a way that is compatible with cairo’s notion of color.</para>
<refsect3 id="GdkRGBA.members" role="struct_members">
<title>Members</title>
<informaltable role="struct_members_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="struct_members_name" colwidth="300px"/>
<colspec colname="struct_members_description"/>
<colspec colname="struct_members_annotations" colwidth="200px"/>
<tbody>
<row role="member"><entry role="struct_member_name"><para><link linkend="float"><type>float</type></link>&#160;<structfield id="GdkRGBA-struct.red">red</structfield>;</para></entry>
<entry role="struct_member_description"><para>The intensity of the red channel from 0.0 to 1.0 inclusive</para></entry>
<entry role="struct_member_annotations"></entry>
</row>
<row role="member"><entry role="struct_member_name"><para><link linkend="float"><type>float</type></link>&#160;<structfield id="GdkRGBA-struct.green">green</structfield>;</para></entry>
<entry role="struct_member_description"><para>The intensity of the green channel from 0.0 to 1.0 inclusive</para></entry>
<entry role="struct_member_annotations"></entry>
</row>
<row role="member"><entry role="struct_member_name"><para><link linkend="float"><type>float</type></link>&#160;<structfield id="GdkRGBA-struct.blue">blue</structfield>;</para></entry>
<entry role="struct_member_description"><para>The intensity of the blue channel from 0.0 to 1.0 inclusive</para></entry>
<entry role="struct_member_annotations"></entry>
</row>
<row role="member"><entry role="struct_member_name"><para><link linkend="float"><type>float</type></link>&#160;<structfield id="GdkRGBA-struct.alpha">alpha</structfield>;</para></entry>
<entry role="struct_member_description"><para>The opacity of the color from 0.0 for completely translucent to
1.0 for opaque</para></entry>
<entry role="struct_member_annotations"></entry>
</row>
</tbody></tgroup></informaltable>
</refsect3>
</refsect2>

</refsect1>

</refentry>
