4
4
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
5
5
<title>GimpMatrix</title>
6
<meta name="generator" content="DocBook XSL Stylesheets V1.73.2">
7
<link rel="start" href="index.html" title="GIMP Math Library Reference Manual">
6
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
7
<link rel="home" href="index.html" title="GIMP Math Library Reference Manual">
8
8
<link rel="up" href="libgimpmath.html" title="Part I. GIMP Math Library">
9
9
<link rel="prev" href="libgimpmath-GimpMath.html" title="GimpMath">
10
10
<link rel="next" href="libgimpmath-GimpVector.html" title="GimpVector">
11
<meta name="generator" content="GTK-Doc V1.10 (XML mode)">
11
<meta name="generator" content="GTK-Doc V1.11 (XML mode)">
12
12
<link rel="stylesheet" href="style.css" type="text/css">
13
13
<link rel="part" href="libgimpmath.html" title="Part I. GIMP Math Library">
14
14
<link rel="index" href="libgimpmath-index.html" title="Index">
26
26
<th width="100%" align="center">GIMP Math Library Reference Manual</th>
27
27
<td><a accesskey="n" href="libgimpmath-GimpVector.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
29
<tr><td colspan="5" class="shortcuts"><nobr><a href="#libgimpmath-GimpMatrix.synopsis" class="shortcut">Top</a>
31
<a href="#libgimpmath-GimpMatrix.description" class="shortcut">Description</a></nobr></td></tr>
29
<tr><td colspan="5" class="shortcuts">
30
<a href="#libgimpmath-GimpMatrix.synopsis" class="shortcut">Top</a>
32
<a href="#libgimpmath-GimpMatrix.description" class="shortcut">Description</a>
33
<div class="refentry" lang="en">
35
<div class="refentry" title="GimpMatrix">
34
36
<a name="libgimpmath-GimpMatrix"></a><div class="titlepage"></div>
35
37
<div class="refnamediv"><table width="100%"><tr>
40
42
<td valign="top" align="right"></td>
41
43
</tr></table></div>
42
<div class="refsynopsisdiv">
44
<div class="refsynopsisdiv" title="Synopsis">
43
45
<a name="libgimpmath-GimpMatrix.synopsis"></a><h2>Synopsis</h2>
44
46
<pre class="synopsis">
45
47
<a class="link" href="libgimpmath-GimpMatrix.html#GimpMatrix2" title="GimpMatrix2">GimpMatrix2</a>;
136
138
href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gdouble"
137
139
>gdouble</a> *c);
138
#define <a class="link" href="libgimpmath-GimpMatrix.html#GIMP-TYPE-MATRIX2:CAPS" title="GIMP_TYPE_MATRIX2">GIMP_TYPE_MATRIX2</a>
139
#define <a class="link" href="libgimpmath-GimpMatrix.html#GIMP-TYPE-PARAM-MATRIX2:CAPS" title="GIMP_TYPE_PARAM_MATRIX2">GIMP_TYPE_PARAM_MATRIX2</a>
140
#define <a class="link" href="libgimpmath-GimpMatrix.html#GIMP-IS-PARAM-SPEC-MATRIX2:CAPS" title="GIMP_IS_PARAM_SPEC_MATRIX2()">GIMP_IS_PARAM_SPEC_MATRIX2</a> (pspec)
140
#define <a class="link" href="libgimpmath-GimpMatrix.html#GIMP-TYPE-MATRIX2--CAPS" title="GIMP_TYPE_MATRIX2">GIMP_TYPE_MATRIX2</a>
141
#define <a class="link" href="libgimpmath-GimpMatrix.html#GIMP-TYPE-PARAM-MATRIX2--CAPS" title="GIMP_TYPE_PARAM_MATRIX2">GIMP_TYPE_PARAM_MATRIX2</a>
142
#define <a class="link" href="libgimpmath-GimpMatrix.html#GIMP-IS-PARAM-SPEC-MATRIX2--CAPS" title="GIMP_IS_PARAM_SPEC_MATRIX2()">GIMP_IS_PARAM_SPEC_MATRIX2</a> (pspec)
142
144
href="http://library.gnome.org/devel/gobject/unstable/gobject-GParamSpec.html#GParamSpec"
143
>GParamSpec</a>* <a class="link" href="libgimpmath-GimpMatrix.html#gimp-param-spec-matrix2" title="gimp_param_spec_matrix2 ()">gimp_param_spec_matrix2</a> (const <a
145
>GParamSpec</a> * <a class="link" href="libgimpmath-GimpMatrix.html#gimp-param-spec-matrix2" title="gimp_param_spec_matrix2 ()">gimp_param_spec_matrix2</a> (const <a
144
146
href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"
145
147
>gchar</a> *name,
154
156
href="http://library.gnome.org/devel/gobject/unstable/gobject-GParamSpec.html#GParamFlags"
155
157
>GParamFlags</a> flags);
156
#define <a class="link" href="libgimpmath-GimpMatrix.html#GIMP-VALUE-HOLDS-MATRIX2:CAPS" title="GIMP_VALUE_HOLDS_MATRIX2()">GIMP_VALUE_HOLDS_MATRIX2</a> (value)
158
#define <a class="link" href="libgimpmath-GimpMatrix.html#GIMP-VALUE-HOLDS-MATRIX2--CAPS" title="GIMP_VALUE_HOLDS_MATRIX2()">GIMP_VALUE_HOLDS_MATRIX2</a> (value)
159
<div class="refsect1" lang="en">
161
<div class="refsect1" title="Description">
160
162
<a name="libgimpmath-GimpMatrix.description"></a><h2>Description</h2>
162
164
When doing image manipulation you will often need 3x3 transformation
163
matrices that define translation, rotation, scaling, shearing and
164
arbitrary perspective transformations using a 3x3 matrix. Here you'll
165
find a set of utility functions to set up those matrices and to perform
165
matrices that define translation, rotation, scaling, shearing and
166
arbitrary perspective transformations using a 3x3 matrix. Here you'll
167
find a set of utility functions to set up those matrices and to perform
166
168
basic matrix manipulations and tests.
170
172
element for row r and column c of the matrix is coeff[r][c].
173
<div class="refsect1" lang="en">
175
<div class="refsect1" title="Details">
174
176
<a name="libgimpmath-GimpMatrix.details"></a><h2>Details</h2>
175
<div class="refsect2" lang="en">
177
<div class="refsect2" title="GimpMatrix2">
176
178
<a name="GimpMatrix2"></a><h3>GimpMatrix2</h3>
177
179
<pre class="programlisting">typedef struct {
178
180
gdouble coeff[2][2];
208
<div class="refsect2" lang="en">
210
<div class="refsect2" title="gimp_matrix2_identity ()">
209
211
<a name="gimp-matrix2-identity"></a><h3>gimp_matrix2_identity ()</h3>
210
212
<pre class="programlisting">void gimp_matrix2_identity (<a class="link" href="libgimpmath-GimpMatrix.html#GimpMatrix2" title="GimpMatrix2">GimpMatrix2</a> *matrix);</pre>
212
214
Sets the matrix to the identity matrix.</p>
216
217
<div class="variablelist"><table border="0">
217
218
<col align="left" valign="top">
226
<div class="refsect2" lang="en">
227
<div class="refsect2" title="gimp_matrix2_mult ()">
227
228
<a name="gimp-matrix2-mult"></a><h3>gimp_matrix2_mult ()</h3>
228
229
<pre class="programlisting">void gimp_matrix2_mult (const <a class="link" href="libgimpmath-GimpMatrix.html#GimpMatrix2" title="GimpMatrix2">GimpMatrix2</a> *matrix1,
229
230
<a class="link" href="libgimpmath-GimpMatrix.html#GimpMatrix2" title="GimpMatrix2">GimpMatrix2</a> *matrix2);</pre>
231
232
Multiplies two matrices and puts the result into the second one.</p>
235
235
<div class="variablelist"><table border="0">
236
236
<col align="left" valign="top">
252
<div class="refsect2" lang="en">
252
<div class="refsect2" title="gimp_matrix3_identity ()">
253
253
<a name="gimp-matrix3-identity"></a><h3>gimp_matrix3_identity ()</h3>
254
254
<pre class="programlisting">void gimp_matrix3_identity (<a class="link" href="libgimpmath-GimpMatrix.html#GimpMatrix3" title="GimpMatrix3">GimpMatrix3</a> *matrix);</pre>
256
256
Sets the matrix to the identity matrix.</p>
260
259
<div class="variablelist"><table border="0">
261
260
<col align="left" valign="top">
270
<div class="refsect2" lang="en">
269
<div class="refsect2" title="gimp_matrix3_mult ()">
271
270
<a name="gimp-matrix3-mult"></a><h3>gimp_matrix3_mult ()</h3>
272
271
<pre class="programlisting">void gimp_matrix3_mult (const <a class="link" href="libgimpmath-GimpMatrix.html#GimpMatrix3" title="GimpMatrix3">GimpMatrix3</a> *matrix1,
273
272
<a class="link" href="libgimpmath-GimpMatrix.html#GimpMatrix3" title="GimpMatrix3">GimpMatrix3</a> *matrix2);</pre>
275
274
Multiplies two matrices and puts the result into the second one.</p>
279
277
<div class="variablelist"><table border="0">
280
278
<col align="left" valign="top">
296
<div class="refsect2" lang="en">
294
<div class="refsect2" title="gimp_matrix3_translate ()">
297
295
<a name="gimp-matrix3-translate"></a><h3>gimp_matrix3_translate ()</h3>
298
296
<pre class="programlisting">void gimp_matrix3_translate (<a class="link" href="libgimpmath-GimpMatrix.html#GimpMatrix3" title="GimpMatrix3">GimpMatrix3</a> *matrix,
332
<div class="refsect2" lang="en">
329
<div class="refsect2" title="gimp_matrix3_scale ()">
333
330
<a name="gimp-matrix3-scale"></a><h3>gimp_matrix3_scale ()</h3>
334
331
<pre class="programlisting">void gimp_matrix3_scale (<a class="link" href="libgimpmath-GimpMatrix.html#GimpMatrix3" title="GimpMatrix3">GimpMatrix3</a> *matrix,
368
<div class="refsect2" lang="en">
364
<div class="refsect2" title="gimp_matrix3_rotate ()">
369
365
<a name="gimp-matrix3-rotate"></a><h3>gimp_matrix3_rotate ()</h3>
370
366
<pre class="programlisting">void gimp_matrix3_rotate (<a class="link" href="libgimpmath-GimpMatrix.html#GimpMatrix3" title="GimpMatrix3">GimpMatrix3</a> *matrix,
396
<div class="refsect2" lang="en">
391
<div class="refsect2" title="gimp_matrix3_xshear ()">
397
392
<a name="gimp-matrix3-xshear"></a><h3>gimp_matrix3_xshear ()</h3>
398
393
<pre class="programlisting">void gimp_matrix3_xshear (<a class="link" href="libgimpmath-GimpMatrix.html#GimpMatrix3" title="GimpMatrix3">GimpMatrix3</a> *matrix,
424
<div class="refsect2" lang="en">
418
<div class="refsect2" title="gimp_matrix3_yshear ()">
425
419
<a name="gimp-matrix3-yshear"></a><h3>gimp_matrix3_yshear ()</h3>
426
420
<pre class="programlisting">void gimp_matrix3_yshear (<a class="link" href="libgimpmath-GimpMatrix.html#GimpMatrix3" title="GimpMatrix3">GimpMatrix3</a> *matrix,
452
<div class="refsect2" lang="en">
445
<div class="refsect2" title="gimp_matrix3_affine ()">
453
446
<a name="gimp-matrix3-affine"></a><h3>gimp_matrix3_affine ()</h3>
454
447
<pre class="programlisting">void gimp_matrix3_affine (<a class="link" href="libgimpmath-GimpMatrix.html#GimpMatrix3" title="GimpMatrix3">GimpMatrix3</a> *matrix,
527
<div class="refsect2" lang="en">
519
<div class="refsect2" title="gimp_matrix3_transform_point ()">
528
520
<a name="gimp-matrix3-transform-point"></a><h3>gimp_matrix3_transform_point ()</h3>
529
521
<pre class="programlisting">void gimp_matrix3_transform_point (const <a class="link" href="libgimpmath-GimpMatrix.html#GimpMatrix3" title="GimpMatrix3">GimpMatrix3</a> *matrix,
579
<div class="refsect2" lang="en">
570
<div class="refsect2" title="gimp_matrix3_determinant ()">
580
571
<a name="gimp-matrix3-determinant"></a><h3>gimp_matrix3_determinant ()</h3>
581
572
<pre class="programlisting"><a
582
573
href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gdouble"
606
<div class="refsect2" lang="en">
596
<div class="refsect2" title="gimp_matrix3_invert ()">
607
597
<a name="gimp-matrix3-invert"></a><h3>gimp_matrix3_invert ()</h3>
608
598
<pre class="programlisting">void gimp_matrix3_invert (<a class="link" href="libgimpmath-GimpMatrix.html#GimpMatrix3" title="GimpMatrix3">GimpMatrix3</a> *matrix);</pre>
610
600
Inverts the given matrix.</p>
614
603
<div class="variablelist"><table border="0">
615
604
<col align="left" valign="top">
624
<div class="refsect2" lang="en">
613
<div class="refsect2" title="gimp_matrix3_is_identity ()">
625
614
<a name="gimp-matrix3-is-identity"></a><h3>gimp_matrix3_is_identity ()</h3>
626
615
<pre class="programlisting"><a
627
616
href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"
643
631
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
645
href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#TRUE:CAPS"
633
href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#TRUE--CAPS"
646
634
><code class="literal">TRUE</code></a> if the matrix is the identity matrix, <a
647
href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#FALSE:CAPS"
635
href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#FALSE--CAPS"
648
636
><code class="literal">FALSE</code></a> otherwise
655
<div class="refsect2" lang="en">
643
<div class="refsect2" title="gimp_matrix3_is_diagonal ()">
656
644
<a name="gimp-matrix3-is-diagonal"></a><h3>gimp_matrix3_is_diagonal ()</h3>
657
645
<pre class="programlisting"><a
658
646
href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"
674
661
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
676
href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#TRUE:CAPS"
663
href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#TRUE--CAPS"
677
664
><code class="literal">TRUE</code></a> if the matrix is diagonal, <a
678
href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#FALSE:CAPS"
665
href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#FALSE--CAPS"
679
666
><code class="literal">FALSE</code></a> otherwise
686
<div class="refsect2" lang="en">
673
<div class="refsect2" title="gimp_matrix3_is_affine ()">
687
674
<a name="gimp-matrix3-is-affine"></a><h3>gimp_matrix3_is_affine ()</h3>
688
675
<pre class="programlisting"><a
689
676
href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"
705
691
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
707
href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#TRUE:CAPS"
693
href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#TRUE--CAPS"
708
694
><code class="literal">TRUE</code></a> if the matrix defines an affine transformation,
710
href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#FALSE:CAPS"
696
href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#FALSE--CAPS"
711
697
><code class="literal">FALSE</code></a> otherwise
717
<p class="since">Since GIMP 2.4
703
<p class="since">Since GIMP 2.4</p>
721
<div class="refsect2" lang="en">
706
<div class="refsect2" title="gimp_matrix3_is_simple ()">
722
707
<a name="gimp-matrix3-is-simple"></a><h3>gimp_matrix3_is_simple ()</h3>
723
708
<pre class="programlisting"><a
724
709
href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"
741
725
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
743
href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#TRUE:CAPS"
727
href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#TRUE--CAPS"
744
728
><code class="literal">TRUE</code></a> if all entries of the upper left 2x2 matrix are
745
729
either 0 or 1, <a
746
href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#FALSE:CAPS"
730
href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#FALSE--CAPS"
747
731
><code class="literal">FALSE</code></a> otherwise
754
<div class="refsect2" lang="en">
738
<div class="refsect2" title="gimp_matrix4_to_deg ()">
755
739
<a name="gimp-matrix4-to-deg"></a><h3>gimp_matrix4_to_deg ()</h3>
756
740
<pre class="programlisting">void gimp_matrix4_to_deg (const <a class="link" href="libgimpmath-GimpMatrix.html#GimpMatrix4" title="GimpMatrix4">GimpMatrix4</a> *matrix,
798
<div class="refsect2" lang="en">
799
<a name="GIMP-TYPE-MATRIX2:CAPS"></a><h3>GIMP_TYPE_MATRIX2</h3>
781
<div class="refsect2" title="GIMP_TYPE_MATRIX2">
782
<a name="GIMP-TYPE-MATRIX2--CAPS"></a><h3>GIMP_TYPE_MATRIX2</h3>
800
783
<pre class="programlisting">#define GIMP_TYPE_MATRIX2 (gimp_matrix2_get_type ())
807
<div class="refsect2" lang="en">
808
<a name="GIMP-TYPE-PARAM-MATRIX2:CAPS"></a><h3>GIMP_TYPE_PARAM_MATRIX2</h3>
789
<div class="refsect2" title="GIMP_TYPE_PARAM_MATRIX2">
790
<a name="GIMP-TYPE-PARAM-MATRIX2--CAPS"></a><h3>GIMP_TYPE_PARAM_MATRIX2</h3>
809
791
<pre class="programlisting">#define GIMP_TYPE_PARAM_MATRIX2 (gimp_param_matrix2_get_type ())
816
<div class="refsect2" lang="en">
817
<a name="GIMP-IS-PARAM-SPEC-MATRIX2:CAPS"></a><h3>GIMP_IS_PARAM_SPEC_MATRIX2()</h3>
797
<div class="refsect2" title="GIMP_IS_PARAM_SPEC_MATRIX2()">
798
<a name="GIMP-IS-PARAM-SPEC-MATRIX2--CAPS"></a><h3>GIMP_IS_PARAM_SPEC_MATRIX2()</h3>
818
799
<pre class="programlisting">#define GIMP_IS_PARAM_SPEC_MATRIX2(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), GIMP_TYPE_PARAM_MATRIX2))
823
803
<div class="variablelist"><table border="0">
824
804
<col align="left" valign="top">
826
806
<td><p><span class="term"><em class="parameter"><code>pspec</code></em> :</span></p></td>
835
<div class="refsect2" lang="en">
813
<div class="refsect2" title="gimp_param_spec_matrix2 ()">
836
814
<a name="gimp-param-spec-matrix2"></a><h3>gimp_param_spec_matrix2 ()</h3>
837
815
<pre class="programlisting"><a
838
816
href="http://library.gnome.org/devel/gobject/unstable/gobject-GParamSpec.html#GParamSpec"
839
>GParamSpec</a>* gimp_param_spec_matrix2 (const <a
817
>GParamSpec</a> * gimp_param_spec_matrix2 (const <a
840
818
href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"
841
819
>gchar</a> *name,
855
833
href="http://library.gnome.org/devel/gobject/unstable/gobject-GParamSpec.html#g-param-spec-internal"
856
834
><code class="function">g_param_spec_internal()</code></a> for more information.</p>
860
837
<div class="variablelist"><table border="0">
861
838
<col align="left" valign="top">
900
<p class="since">Since GIMP 2.4
877
<p class="since">Since GIMP 2.4</p>
904
<div class="refsect2" lang="en">
905
<a name="GIMP-VALUE-HOLDS-MATRIX2:CAPS"></a><h3>GIMP_VALUE_HOLDS_MATRIX2()</h3>
880
<div class="refsect2" title="GIMP_VALUE_HOLDS_MATRIX2()">
881
<a name="GIMP-VALUE-HOLDS-MATRIX2--CAPS"></a><h3>GIMP_VALUE_HOLDS_MATRIX2()</h3>
906
882
<pre class="programlisting">#define GIMP_VALUE_HOLDS_MATRIX2(value) (G_TYPE_CHECK_VALUE_TYPE ((value), GIMP_TYPE_MATRIX2))
911
886
<div class="variablelist"><table border="0">
912
887
<col align="left" valign="top">
914
889
<td><p><span class="term"><em class="parameter"><code>value</code></em> :</span></p></td>
923
<div class="refsect1" lang="en">
896
<div class="refsect1" title="See Also">
924
897
<a name="libgimpmath-GimpMatrix.see-also"></a><h2>See Also</h2>
926
899
<a class="link" href="libgimpmath-GimpVector.html#GimpVector2" title="GimpVector2"><span class="type">GimpVector2</span></a>