summaryrefslogtreecommitdiff
path: root/docs/reference/pygtk-gdkimage.xml
blob: 81b111cb8dc524416a30614349bf7c71bbdb46c9 (plain)
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
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
<?xml version="1.0" standalone="no"?>
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
    "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd">

<refentry id="class-gdkimage">
  <refnamediv>
    <refname>gtk.gdk.Image</refname>
    <refpurpose>an area for bit-mapped graphics stored on the X Windows
client.</refpurpose>
  </refnamediv>

  <refsect1>
    <title>Synopsis</title>

    <classsynopsis language="python">
      <ooclass><classname>gtk.gdk.Image</classname></ooclass>
      <ooclass><classname><link
linkend="class-gobject">gobject.GObject</link></classname></ooclass>
      <constructorsynopsis language="python">
	<methodname><link
linkend="constructor-gdkimage">gtk.gdk.Image</link></methodname>
	<methodparam><parameter
		       role="keyword">type</parameter></methodparam>
	<methodparam><parameter
		       role="keyword">visual</parameter></methodparam>
	<methodparam><parameter
		       role="keyword">width</parameter></methodparam>
	<methodparam><parameter
		       role="keyword">height</parameter></methodparam>
      </constructorsynopsis>
      <methodsynopsis language="python">
	<methodname><link
linkend="method-gdkimage--put-pixel">put_pixel</link></methodname>
	<methodparam><parameter role="keyword">x</parameter></methodparam>
	<methodparam><parameter role="keyword">y</parameter></methodparam>
	<methodparam><parameter
		       role="keyword">pixel</parameter></methodparam>
      </methodsynopsis>
      <methodsynopsis language="python">
	<methodname><link
linkend="method-gdkimage--get-pixel">get_pixel</link></methodname>
	<methodparam><parameter role="keyword">x</parameter></methodparam>
	<methodparam><parameter role="keyword">y</parameter></methodparam>
      </methodsynopsis>
      <methodsynopsis language="python">
	<methodname><link
linkend="method-gdkimage--set-colormap">set_colormap</link></methodname>
	<methodparam><parameter
		       role="keyword">colormap</parameter></methodparam>
      </methodsynopsis>
      <methodsynopsis language="python">
	<methodname><link
linkend="method-gdkimage--get-colormap">get_colormap</link></methodname>
	<methodparam></methodparam>  </methodsynopsis>
    </classsynopsis>

  </refsect1>

  <refsect1>
    <title>Ancestry</title>

<synopsis>+-- <link linkend="class-gobject">gobject.GObject</link>
  +-- <link linkend="class-gdkimage">gtk.gdk.Image</link>
</synopsis>

  </refsect1>

  <refsect1>
    <title>Description</title>

    <para>The <link
linkend="class-gdkimage"><classname>gtk.gdk.Image</classname></link> type
represents an area for drawing graphics. It has now been superseded to a
large extent by the much more flexible RGB methods (see <link
linkend="class-gdkdrawable"><classname>gtk.gdk.Drawable</classname></link>).</para>

  </refsect1>

  <refsect1 id="constructor-gdkimage">
    <title>Constructor</title>

    <programlisting><constructorsynopsis language="python">
	<methodname>gtk.gdk.Image</methodname>
	<methodparam><parameter
		       role="keyword">type</parameter></methodparam>
	<methodparam><parameter
		       role="keyword">visual</parameter></methodparam>
	<methodparam><parameter
		       role="keyword">width</parameter></methodparam>
	<methodparam><parameter
		       role="keyword">height</parameter></methodparam>
      </constructorsynopsis></programlisting>
    <variablelist>
      <varlistentry>
	<term><parameter role="keyword">type</parameter>&nbsp;:</term>
	<listitem><simpara>a <link
linkend="class-gdkimage"><classname>gtk.gdk.Image</classname></link>
type</simpara></listitem>
      </varlistentry>
      <varlistentry>
	<term><parameter role="keyword">visual</parameter>&nbsp;:</term>
	<listitem><simpara>a <link
linkend="class-gdkvisual"><classname>gtk.gdk.Visual</classname></link></simpara></listitem>
      </varlistentry>
      <varlistentry>
	<term><parameter role="keyword">width</parameter>&nbsp;:</term>
	<listitem><simpara>the width in pixels of the
image</simpara></listitem>
      </varlistentry>
      <varlistentry>
	<term><parameter role="keyword">height</parameter>&nbsp;:</term>
	<listitem><simpara>the height in pixels of the
image</simpara></listitem>
      </varlistentry>
      <varlistentry>
	<term><emphasis>Returns</emphasis>&nbsp;:</term>
	<listitem><simpara>a new <link
linkend="class-gdkimage"><classname>gtk.gdk.Image</classname></link>
object</simpara></listitem>
      </varlistentry>
    </variablelist>

    <para>Creates a new <link
linkend="class-gdkimage"><classname>gtk.gdk.Image</classname></link> object
of the specified <parameter>type</parameter>, <parameter>width</parameter>
and <parameter>height</parameter> and using the <link
linkend="class-gdkvisual"><classname>gtk.gdk.Visual</classname></link>
specified by <parameter>visual</parameter>. The value of
<parameter>type</parameter> must be one of:</para>

    <variablelist>
      <varlistentry>
	<term><literal>gtk.gdk.IMAGE_NORMAL</literal></term>
	<listitem>
	  <simpara>The original X image type, which is quite slow since the
image has to be transferred from the client to the server to display
it.</simpara>
	</listitem>
      </varlistentry>
      <varlistentry>
	<term><literal>gtk.gdk.IMAGE_SHARED</literal></term>
	<listitem>
	  <simpara>A faster image type, which uses shared memory to transfer
the image data between client and server. However this will only be
available if client and server are on the same machine and the shared memory
extension is supported by the server.</simpara>
	</listitem>
      </varlistentry>
      <varlistentry>
	<term><literal>gtk.gdk.IMAGE_FASTEST</literal></term>
	<listitem>
	  <simpara>Specifies that gtk.gdk.IMAGE_SHARED should be tried
first, and if that fails then gtk.gdk.IMAGE_NORMAL will be used.</simpara>
	</listitem>
      </varlistentry>
    </variablelist>

    <para>Usually using <literal>gtk.gdk.IMAGE_FASTEST</literal> is the best
choice.</para>

  </refsect1>

  <refsect1>
    <title>Methods</title>

    <refsect2 id="method-gdkimage--put-pixel">
      <title>gtk.gdk.Image.put_pixel</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>put_pixel</methodname>
	  <methodparam><parameter role="keyword">x</parameter></methodparam>
	  <methodparam><parameter role="keyword">y</parameter></methodparam>
	  <methodparam><parameter
			 role="keyword">pixel</parameter></methodparam>
	</methodsynopsis></programlisting>
      <variablelist>
	<varlistentry>
	  <term><parameter role="keyword">x</parameter>&nbsp;:</term>
	  <listitem><simpara>the x coordinate of the pixel to
set.</simpara></listitem>
	</varlistentry>
	<varlistentry>
	  <term><parameter role="keyword">y</parameter>&nbsp;:</term>
	  <listitem><simpara>the y coordinate of the pixel to
set.</simpara></listitem>
	</varlistentry>
	<varlistentry>
	  <term><parameter role="keyword">pixel</parameter>&nbsp;:</term>
	  <listitem><simpara>the pixel value to set.</simpara></listitem>
	</varlistentry>
      </variablelist>

      <para>The <methodname>put_pixel</methodname>() method sets the value
of the pixel in the image at the location specified by
<parameter>x</parameter> and <parameter>y</parameter> to the value specified
by <parameter>pixel</parameter>.</para>

    </refsect2>

    <refsect2 id="method-gdkimage--get-pixel">
      <title>gtk.gdk.Image.get_pixel</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>get_pixel</methodname>
	  <methodparam><parameter role="keyword">x</parameter></methodparam>
	  <methodparam><parameter role="keyword">y</parameter></methodparam>
	</methodsynopsis></programlisting>
      <variablelist>
	<varlistentry>
	  <term><parameter role="keyword">x</parameter>&nbsp;:</term>
	  <listitem><simpara>the x coordinate of the pixel to
get.</simpara></listitem>
	</varlistentry>
	<varlistentry>
	  <term><parameter role="keyword">y</parameter>&nbsp;:</term>
	  <listitem><simpara>the y coordinate of the pixel to
get.</simpara></listitem>
	</varlistentry>
	<varlistentry>
	  <term><emphasis>Returns</emphasis>&nbsp;:</term>
	  <listitem><simpara>the pixel value at the image
location</simpara></listitem>
	</varlistentry>
      </variablelist>

      <para>The <methodname>get_pixel</methodname>() method returns the
value of the pixel at the image location specified by
<parameter>x</parameter> and <parameter>y</parameter>.</para>

    </refsect2>

    <refsect2 id="method-gdkimage--set-colormap">
      <title>gtk.gdk.Image.set_colormap</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>set_colormap</methodname>
	  <methodparam><parameter
			 role="keyword">colormap</parameter></methodparam>
	</methodsynopsis></programlisting>
      <variablelist>
	<varlistentry>
	  <term><parameter role="keyword">colormap</parameter>&nbsp;:</term>
	  <listitem><simpara>a <link
linkend="class-gdkcolormap"><classname>gtk.gdk.Colormap</classname></link></simpara></listitem>
	</varlistentry>
      </variablelist>

      <para>The <methodname>set_colormap</methodname>() method sets the
colormap for the image to the specified <parameter>colormap</parameter>.
Normally there's no need to use this method since images are created with
the correct colormap if you get the image from a drawable. If you create the
image from scratch, use the colormap of the drawable you intend to render
the image to.</para>

    </refsect2>

    <refsect2 id="method-gdkimage--get-colormap">
      <title>gtk.gdk.Image.get_colormap</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>get_colormap</methodname>
	  <methodparam></methodparam>  </methodsynopsis></programlisting>
      <variablelist>
	<varlistentry>
	  <term><emphasis>Returns</emphasis>&nbsp;:</term>
	  <listitem><simpara>the colormap for the image</simpara></listitem>
	</varlistentry>
      </variablelist>

      <para>The <methodname>get_colormap</methodname>() method returns the
colormap for a given image, if it exists. An image will have a colormap if
the drawable from which it was created has a colormap, or if a colormap was
set explicitly with the <link
linkend="method-gdkimage--set-colormap"><methodname>set_colormap</methodname>()</link> 
method.</para>

    </refsect2>

  </refsect1>

</refentry>