File: libgimpbase-gimpunit.html

package info (click to toggle)
gimp 2.2.6-1sarge4
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 97,088 kB
  • ctags: 43,756
  • sloc: ansic: 525,782; xml: 36,543; lisp: 9,851; sh: 9,007; makefile: 7,974; python: 2,622; perl: 2,589; yacc: 520; lex: 334
file content (167 lines) | stat: -rw-r--r-- 19,005 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>gimpunit</title><meta name="generator" content="DocBook XSL Stylesheets V1.66.1"><link rel="start" href="index.html" title="GIMP Base Library Reference Manual"><link rel="up" href="libgimpbase.html" title="PartI.GIMP Base Library"><link rel="prev" href="libgimpbase-gimpsignal.html" title="gimpsignal"><link rel="next" href="libgimpbase-gimputils.html" title="gimputils"><meta name="generator" content="GTK-Doc V1.3 (XML mode)"><link rel="stylesheet" href="style.css" type="text/css"><link rel="part" href="libgimpbase.html" title="PartI.GIMP Base Library"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><table class="navigation" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2"><tr valign="middle"><td><a accesskey="p" href="libgimpbase-gimpsignal.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td><td><a accesskey="u" href="libgimpbase.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td><td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td><th width="100%" align="center">GIMP Base Library Reference Manual</th><td><a accesskey="n" href="libgimpbase-gimputils.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td></tr></table><div class="refentry" lang="en"><a name="libgimpbase-gimpunit"></a><div class="titlepage"></div><div class="refnamediv"><table width="100%"><tr><td valign="top"><h2><span class="refentrytitle">gimpunit</span></h2><p>gimpunit &#8212; Provides a collection of predefined units and functions for creating
user-defined units.</p></td><td valign="top" align="right"></td></tr></table></div><div class="refsynopsisdiv"><h2>Synopsis</h2><pre class="synopsis">



enum        <a href="libgimpbase-gimpunit.html#GimpUnit">GimpUnit</a>;
gint        <a href="libgimpbase-gimpunit.html#gimp-unit-get-number-of-units">gimp_unit_get_number_of_units</a>   (void);
gint        <a href="libgimpbase-gimpunit.html#gimp-unit-get-number-of-built-in-units">gimp_unit_get_number_of_built_in_units</a>
                                            (void);
<a href="libgimpbase-gimpunit.html#GimpUnit">GimpUnit</a>    <a href="libgimpbase-gimpunit.html#gimp-unit-new">gimp_unit_new</a>                   (gchar *identifier,
                                             gdouble factor,
                                             gint digits,
                                             gchar *symbol,
                                             gchar *abbreviation,
                                             gchar *singular,
                                             gchar *plural);
gboolean    <a href="libgimpbase-gimpunit.html#gimp-unit-get-deletion-flag">gimp_unit_get_deletion_flag</a>     (<a href="libgimpbase-gimpunit.html#GimpUnit">GimpUnit</a> unit);
void        <a href="libgimpbase-gimpunit.html#gimp-unit-set-deletion-flag">gimp_unit_set_deletion_flag</a>     (<a href="libgimpbase-gimpunit.html#GimpUnit">GimpUnit</a> unit,
                                             gboolean deletion_flag);
gdouble     <a href="libgimpbase-gimpunit.html#gimp-unit-get-factor">gimp_unit_get_factor</a>            (<a href="libgimpbase-gimpunit.html#GimpUnit">GimpUnit</a> unit);
gint        <a href="libgimpbase-gimpunit.html#gimp-unit-get-digits">gimp_unit_get_digits</a>            (<a href="libgimpbase-gimpunit.html#GimpUnit">GimpUnit</a> unit);
const gchar* <a href="libgimpbase-gimpunit.html#gimp-unit-get-identifier">gimp_unit_get_identifier</a>       (<a href="libgimpbase-gimpunit.html#GimpUnit">GimpUnit</a> unit);
const gchar* <a href="libgimpbase-gimpunit.html#gimp-unit-get-symbol">gimp_unit_get_symbol</a>           (<a href="libgimpbase-gimpunit.html#GimpUnit">GimpUnit</a> unit);
const gchar* <a href="libgimpbase-gimpunit.html#gimp-unit-get-abbreviation">gimp_unit_get_abbreviation</a>     (<a href="libgimpbase-gimpunit.html#GimpUnit">GimpUnit</a> unit);
const gchar* <a href="libgimpbase-gimpunit.html#gimp-unit-get-singular">gimp_unit_get_singular</a>         (<a href="libgimpbase-gimpunit.html#GimpUnit">GimpUnit</a> unit);
const gchar* <a href="libgimpbase-gimpunit.html#gimp-unit-get-plural">gimp_unit_get_plural</a>           (<a href="libgimpbase-gimpunit.html#GimpUnit">GimpUnit</a> unit);
#define     <a href="libgimpbase-gimpunit.html#GIMP-TYPE-UNIT:CAPS">GIMP_TYPE_UNIT</a>
#define     <a href="libgimpbase-gimpunit.html#GIMP-VALUE-HOLDS-UNIT:CAPS">GIMP_VALUE_HOLDS_UNIT</a>           (value)

</pre></div><div class="refsect1" lang="en"><a name="id2550950"></a><h2>Description</h2><p>
Provides a collection of predefined units and functions for creating
user-defined units.

</p></div><div class="refsect1" lang="en"><a name="id2550961"></a><h2>Details</h2><div class="refsect2" lang="en"><a name="id2550966"></a><h3><a name="GimpUnit"></a>enum GimpUnit</h3><a class="indexterm" name="id2550975"></a><pre class="programlisting">typedef enum /*&lt; skip &gt;*/
{
  GIMP_UNIT_PIXEL   = 0,

  GIMP_UNIT_INCH    = 1,
  GIMP_UNIT_MM      = 2,
  GIMP_UNIT_POINT   = 3,
  GIMP_UNIT_PICA    = 4,

  GIMP_UNIT_END     = 5,

  GIMP_UNIT_PERCENT = 65536 /*&lt; pdb-skip &gt;*/
} GimpUnit;
</pre><p>

</p></div><hr><div class="refsect2" lang="en"><a name="id2550988"></a><h3><a name="gimp-unit-get-number-of-units"></a>gimp_unit_get_number_of_units ()</h3><a class="indexterm" name="id2550997"></a><pre class="programlisting">gint        gimp_unit_get_number_of_units   (void);</pre><p>
Returns the number of units which are known to the <a href="libgimpbase-gimpunit.html#GimpUnit"><span class="type">GimpUnit</span></a> system.</p><p>

</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>:</span></td><td> The number of defined units.
</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2567994"></a><h3><a name="gimp-unit-get-number-of-built-in-units"></a>gimp_unit_get_number_of_built_in_units ()</h3><a class="indexterm" name="id2568002"></a><pre class="programlisting">gint        gimp_unit_get_number_of_built_in_units
                                            (void);</pre><p>
Returns the number of <a href="libgimpbase-gimpunit.html#GimpUnit"><span class="type">GimpUnit</span></a>'s which are hardcoded in the unit system
(UNIT_INCH, UNIT_MM, UNIT_POINT, UNIT_PICA and the two "pseudo unit"
 UNIT_PIXEL).</p><p>

</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>:</span></td><td> The number of built-in units.
</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2568043"></a><h3><a name="gimp-unit-new"></a>gimp_unit_new ()</h3><a class="indexterm" name="id2568051"></a><pre class="programlisting"><a href="libgimpbase-gimpunit.html#GimpUnit">GimpUnit</a>    gimp_unit_new                   (gchar *identifier,
                                             gdouble factor,
                                             gint digits,
                                             gchar *symbol,
                                             gchar *abbreviation,
                                             gchar *singular,
                                             gchar *plural);</pre><p>
Returns the integer ID of the new <a href="libgimpbase-gimpunit.html#GimpUnit"><span class="type">GimpUnit</span></a>.
</p><p>
Note that a new unit is always created with it's deletion flag
set to <tt class="literal">TRUE</tt>. You will have to set it to <tt class="literal">FALSE</tt> with
<a href="libgimpbase-gimpunit.html#gimp-unit-set-deletion-flag"><tt class="function">gimp_unit_set_deletion_flag()</tt></a> to make the unit definition persistent.</p><p>

</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>identifier</tt></i>:</span></td><td> The unit's identifier string.
</td></tr><tr><td><span class="term"><i class="parameter"><tt>factor</tt></i>:</span></td><td> The unit's factor (how many units are in one inch).
</td></tr><tr><td><span class="term"><i class="parameter"><tt>digits</tt></i>:</span></td><td> The unit's suggested number of digits (see <a href="libgimpbase-gimpunit.html#gimp-unit-get-digits"><tt class="function">gimp_unit_get_digits()</tt></a>).
</td></tr><tr><td><span class="term"><i class="parameter"><tt>symbol</tt></i>:</span></td><td> The symbol of the unit (e.g. "''" for inch).
</td></tr><tr><td><span class="term"><i class="parameter"><tt>abbreviation</tt></i>:</span></td><td> The abbreviation of the unit.
</td></tr><tr><td><span class="term"><i class="parameter"><tt>singular</tt></i>:</span></td><td> The singular form of the unit.
</td></tr><tr><td><span class="term"><i class="parameter"><tt>plural</tt></i>:</span></td><td> The plural form of the unit.
</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>:</span></td><td> The ID of the new unit.
</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2569164"></a><h3><a name="gimp-unit-get-deletion-flag"></a>gimp_unit_get_deletion_flag ()</h3><a class="indexterm" name="id2569173"></a><pre class="programlisting">gboolean    gimp_unit_get_deletion_flag     (<a href="libgimpbase-gimpunit.html#GimpUnit">GimpUnit</a> unit);</pre><p>
</p><p>

</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>unit</tt></i>:</span></td><td> The unit you want to know the <i class="parameter"><tt>deletion_flag</tt></i> of.
</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>:</span></td><td> The unit's <i class="parameter"><tt>deletion_flag</tt></i>.
</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2569226"></a><h3><a name="gimp-unit-set-deletion-flag"></a>gimp_unit_set_deletion_flag ()</h3><a class="indexterm" name="id2569235"></a><pre class="programlisting">void        gimp_unit_set_deletion_flag     (<a href="libgimpbase-gimpunit.html#GimpUnit">GimpUnit</a> unit,
                                             gboolean deletion_flag);</pre><p>
Sets a <a href="libgimpbase-gimpunit.html#GimpUnit"><span class="type">GimpUnit</span></a>'s <i class="parameter"><tt>deletion_flag</tt></i>. If the <i class="parameter"><tt>deletion_flag</tt></i> of a unit is
<tt class="literal">TRUE</tt> when GIMP exits, this unit will not be saved in the users's
"unitrc" file.
</p><p>
Trying to change the <i class="parameter"><tt>deletion_flag</tt></i> of a built-in unit will be silently
ignored.</p><p>

</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>unit</tt></i>:</span></td><td> The unit you want to set the <i class="parameter"><tt>deletion_flag</tt></i> for.
</td></tr><tr><td><span class="term"><i class="parameter"><tt>deletion_flag</tt></i>:</span></td><td> The new deletion_flag.
</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2569318"></a><h3><a name="gimp-unit-get-factor"></a>gimp_unit_get_factor ()</h3><a class="indexterm" name="id2569327"></a><pre class="programlisting">gdouble     gimp_unit_get_factor            (<a href="libgimpbase-gimpunit.html#GimpUnit">GimpUnit</a> unit);</pre><p>
A <a href="libgimpbase-gimpunit.html#GimpUnit"><span class="type">GimpUnit</span></a>'s <i class="parameter"><tt>factor</tt></i> is defined to be:
</p><p>
distance_in_units == (<i class="parameter"><tt>factor</tt></i> * distance_in_inches)
</p><p>
Returns 0 for <i class="parameter"><tt>unit</tt></i> == GIMP_UNIT_PIXEL.</p><p>

</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>unit</tt></i>:</span></td><td> The unit you want to know the factor of.
</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>:</span></td><td> The unit's factor.
</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2569397"></a><h3><a name="gimp-unit-get-digits"></a>gimp_unit_get_digits ()</h3><a class="indexterm" name="id2569406"></a><pre class="programlisting">gint        gimp_unit_get_digits            (<a href="libgimpbase-gimpunit.html#GimpUnit">GimpUnit</a> unit);</pre><p>
Returns the number of digits an entry field should provide to get
approximately the same accuracy as an inch input field with two digits.
</p><p>
Returns 0 for <i class="parameter"><tt>unit</tt></i> == GIMP_UNIT_PIXEL.</p><p>

</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>unit</tt></i>:</span></td><td> The unit you want to know the digits.
</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>:</span></td><td> The suggested number of digits.
</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2587232"></a><h3><a name="gimp-unit-get-identifier"></a>gimp_unit_get_identifier ()</h3><a class="indexterm" name="id2587241"></a><pre class="programlisting">const gchar* gimp_unit_get_identifier       (<a href="libgimpbase-gimpunit.html#GimpUnit">GimpUnit</a> unit);</pre><p>
This is an unstranslated string and must not be changed or freed.</p><p>

</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>unit</tt></i>:</span></td><td> The unit you want to know the identifier of.
</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>:</span></td><td> The unit's identifier.
</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2587291"></a><h3><a name="gimp-unit-get-symbol"></a>gimp_unit_get_symbol ()</h3><a class="indexterm" name="id2587299"></a><pre class="programlisting">const gchar* gimp_unit_get_symbol           (<a href="libgimpbase-gimpunit.html#GimpUnit">GimpUnit</a> unit);</pre><p>
This is e.g. "''" for UNIT_INCH.
</p><p>
NOTE: This string must not be changed or freed.</p><p>

</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>unit</tt></i>:</span></td><td> The unit you want to know the symbol of.
</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>:</span></td><td> The unit's symbol.
</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2587353"></a><h3><a name="gimp-unit-get-abbreviation"></a>gimp_unit_get_abbreviation ()</h3><a class="indexterm" name="id2587362"></a><pre class="programlisting">const gchar* gimp_unit_get_abbreviation     (<a href="libgimpbase-gimpunit.html#GimpUnit">GimpUnit</a> unit);</pre><p>
For built-in units, this function returns the translated abbreviation
of the unit.
</p><p>
NOTE: This string must not be changed or freed.</p><p>

</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>unit</tt></i>:</span></td><td> The unit you want to know the abbreviation of.
</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>:</span></td><td> The unit's abbreviation.
</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2587417"></a><h3><a name="gimp-unit-get-singular"></a>gimp_unit_get_singular ()</h3><a class="indexterm" name="id2587426"></a><pre class="programlisting">const gchar* gimp_unit_get_singular         (<a href="libgimpbase-gimpunit.html#GimpUnit">GimpUnit</a> unit);</pre><p>
For built-in units, this function returns the translated singular form
of the unit's name.
</p><p>
NOTE: This string must not be changed or freed.</p><p>

</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>unit</tt></i>:</span></td><td> The unit you want to know the singular form of.
</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>:</span></td><td> The unit's singular form.
</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2587481"></a><h3><a name="gimp-unit-get-plural"></a>gimp_unit_get_plural ()</h3><a class="indexterm" name="id2587489"></a><pre class="programlisting">const gchar* gimp_unit_get_plural           (<a href="libgimpbase-gimpunit.html#GimpUnit">GimpUnit</a> unit);</pre><p>
For built-in units, this function returns the translated plural form
of the unit's name.
</p><p>
NOTE: This string must not be changed or freed.</p><p>

</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>unit</tt></i>:</span></td><td> The unit you want to know the plural form of.
</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>:</span></td><td> The unit's plural form.
</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2554617"></a><h3><a name="GIMP-TYPE-UNIT:CAPS"></a>GIMP_TYPE_UNIT</h3><a class="indexterm" name="id2548872"></a><pre class="programlisting">#define GIMP_TYPE_UNIT               (gimp_unit_get_type ())
</pre><p>
<a href="libgimpbase-gimpunit.html#GIMP-TYPE-UNIT:CAPS"><span class="type">GIMP_TYPE_UNIT</span></a> is a <span class="type">GType</span> derived from <span class="type">G_TYPE_INT</span>.
</p></div><hr><div class="refsect2" lang="en"><a name="id2587526"></a><h3><a name="GIMP-VALUE-HOLDS-UNIT:CAPS"></a>GIMP_VALUE_HOLDS_UNIT()</h3><a class="indexterm" name="id2587534"></a><pre class="programlisting">#define GIMP_VALUE_HOLDS_UNIT(value) (G_TYPE_CHECK_VALUE_TYPE ((value), GIMP_TYPE_UNIT))
</pre><p>

</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>value</tt></i>:</span></td><td>


</td></tr></tbody></table></div></div></div><div class="refsect1" lang="en"><a name="id2587560"></a><h2>See Also</h2><p>
<a
href="../libgimpwidgets/GimpUnitMenu.html"
><span class="type">GimpUnitMenu</span></a>
</p><p>
<a
href="../libgimpwidgets/GimpSizeEntry.html"
><span class="type">GimpSizeEntry</span></a>
</p></div></div><table class="navigation" width="100%" summary="Navigation footer" cellpadding="2" cellspacing="0"><tr valign="middle"><td align="left"><a accesskey="p" href="libgimpbase-gimpsignal.html"><b>&lt;&lt;gimpsignal</b></a></td><td align="right"><a accesskey="n" href="libgimpbase-gimputils.html"><b>gimputils&gt;&gt;</b></a></td></tr></table></body></html>