4
>GnomeCanvasPixbuf</TITLE
7
CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+
10
TITLE="The gdk-pixbuf Library"
11
HREF="index.html"><LINK
16
TITLE="GdkPixbufLoader"
17
HREF="gdkpixbufloader.html"><LINK
19
TITLE="gdk-pixbuf Xlib initialization"
20
HREF="gdk-pixbuf-gdk-pixbuf-xlib-init.html"></HEAD
55
HREF="gdkpixbufloader.html"
60
><<< Previous Page</B
109
HREF="gdk-pixbuf-gdk-pixbuf-xlib-init.html"
114
>Next Page >>></B
123
NAME="GNOMECANVASPIXBUF">GnomeCanvasPixbuf</H1
131
>GnomeCanvasPixbuf -- Canvas item to display GdkPixbuf images.</DIV
133
CLASS="REFSYNOPSISDIV"
146
> #include <gdk-pixbuf/gdk-pixbuf.h>
150
HREF="gnomecanvaspixbuf.html#GNOME-CANVAS-PIXBUF-CAPS"
151
>GNOME_CANVAS_PIXBUF</A
164
>Object Hierarchy</H2
176
+----GnomeCanvasPixbuf</PRE
198
HREF="gnomecanvaspixbuf.html#GNOMECANVASPIXBUF--PIXBUF"
200
>" gpointer : Read / Write
202
HREF="gnomecanvaspixbuf.html#GNOMECANVASPIXBUF--WIDTH"
204
>" gdouble : Read / Write
206
HREF="gnomecanvaspixbuf.html#GNOMECANVASPIXBUF--WIDTH-SET"
208
>" gboolean : Read / Write
210
HREF="gnomecanvaspixbuf.html#GNOMECANVASPIXBUF--WIDTH-IN-PIXELS"
212
>" gboolean : Read / Write
214
HREF="gnomecanvaspixbuf.html#GNOMECANVASPIXBUF--HEIGHT"
216
>" gdouble : Read / Write
218
HREF="gnomecanvaspixbuf.html#GNOMECANVASPIXBUF--HEIGHT-SET"
220
>" gboolean : Read / Write
222
HREF="gnomecanvaspixbuf.html#GNOMECANVASPIXBUF--HEIGHT-IN-PIXELS"
224
>" gboolean : Read / Write
226
HREF="gnomecanvaspixbuf.html#GNOMECANVASPIXBUF--X"
228
>" gdouble : Read / Write
230
HREF="gnomecanvaspixbuf.html#GNOMECANVASPIXBUF--X-IN-PIXELS"
232
>" gboolean : Read / Write
234
HREF="gnomecanvaspixbuf.html#GNOMECANVASPIXBUF--Y"
236
>" gdouble : Read / Write
238
HREF="gnomecanvaspixbuf.html#GNOMECANVASPIXBUF--Y-IN-PIXELS"
240
>" gboolean : Read / Write</PRE
253
> This canvas item displays GdkPixbuf images. It handles full
254
affine transformations in both GDK and antialiased modes, and also
256
HREF="http://www.w3.org"
260
HREF="http://www.w3.org/Graphics/SVG/"
264
translation semantics for absolute pixel values.
267
> GdkPixbuf structures may be shared among different pixbuf canvas
268
items; the pixbuf item uses GdkPixbuf's reference counting
277
>Custom Scaling and Translation</H3
279
> In addition to the normal affine transformations supported by
281
HREF="gnomecanvaspixbuf.html"
282
>GnomeCanvasPixbuf</A
283
> item supports independent
284
object arguments for scaling and translation. This is useful
285
for explicitly setting a size to which the pixbuf's image will
286
be scaled, and for specifying translation offsets that take
287
place in the item's local coordinate system.
290
> By default, the pixbuf canvas item will attain the size in units
291
of the GdkPixbuf it contains. If a <A
292
HREF="gnomecanvaspixbuf.html"
293
>GnomeCanvasPixbuf</A
295
configured to use a GdkPixbuf that has a size of 300 by 200
296
pixels, then the pixbuf item will automatically obtain a size of
297
300 by 200 units in the item's local coordinate system. If the
298
item is transformed with a scaling transformation of (0.5, 2.0),
299
then the final image size will be of 150 by 400 pixels.
302
> To set custom width and height values, you must set the <A
303
HREF="gnomecanvaspixbuf.html#GNOMECANVASPIXBUF--WIDTH-SET"
306
HREF="gnomecanvaspixbuf.html#GNOMECANVASPIXBUF--HEIGHT-SET"
312
>, and then set the <A
313
HREF="gnomecanvaspixbuf.html#GNOMECANVASPIXBUF--WIDTH"
316
HREF="gnomecanvaspixbuf.html#GNOMECANVASPIXBUF--HEIGHT"
319
the desired values. The former two arguments control whether
320
the latter two are used when computing the final image's size;
324
> by default so that the pixbuf item will
325
attain a size in units equal to the size in pixels of the
326
GdkPixbuf that the item contains.
329
> The custom translation offsets are controlled by the <A
330
HREF="gnomecanvaspixbuf.html#GNOMECANVASPIXBUF--X"
333
HREF="gnomecanvaspixbuf.html#GNOMECANVASPIXBUF--Y"
335
> arguments. The logical
336
upper-left vertex of the image will be translated by the
337
specified distance, aligned with the item's local coordinate
347
>Absolute Pixel Scaling and Translation</H3
350
HREF="http://www.w3.org/Graphics/SVG/"
354
> specification (SVG) of the <A
355
HREF="http://www.w3.org"
357
>World Wide Web Consortium</A
359
allows images to be translated and scaled by absolute pixel
360
values that are independent of an item's normal affine
364
> Normally, the pixbuf item's translation and scaling arguments
365
are interpreted in units, so they will be modified by the item's
366
affine transformation. The <A
367
HREF="gnomecanvaspixbuf.html#GNOMECANVASPIXBUF--WIDTH-IN-PIXELS"
371
HREF="gnomecanvaspixbuf.html#GNOMECANVASPIXBUF--HEIGHT-IN-PIXELS"
375
HREF="gnomecanvaspixbuf.html#GNOMECANVASPIXBUF--X-IN-PIXELS"
379
HREF="gnomecanvaspixbuf.html#GNOMECANVASPIXBUF--Y-IN-PIXELS"
382
object arguments can be used to modify this behavior. If one of
383
these arguments is <TT
386
>, then the corresponding scaling or
387
translation value will not be affected lengthwise by the pixbuf
388
item's affine transformation.
391
> For example, consider a pixbuf item whose size is (300, 200).
392
If the item is modified with a scaling transformation of (0.5,
394
HREF="gnomecanvaspixbuf.html#GNOMECANVASPIXBUF--WIDTH-IN-PIXELS"
400
>, then the item will appear to be (300, 400)
401
pixels in size. This means that in this case the item's affine
402
transformation only applies to the height value, while the width
403
value is kept in absolute pixels.
406
> Likewise, consider a pixbuf item whose (<A
407
HREF="gnomecanvaspixbuf.html#GNOMECANVASPIXBUF--X"
410
HREF="gnomecanvaspixbuf.html#GNOMECANVASPIXBUF--Y"
412
>) arguments are set to
413
(30, 40). If the item is then modified by the same scaling
414
transformation of (0.5, 2.0) but the <A
415
HREF="gnomecanvaspixbuf.html#GNOMECANVASPIXBUF--Y-IN-PIXELS"
418
argument is set to <TT
421
>, then the image's upper-left corner
422
will appear to be at position (15, 40). In this case, the
423
affine transformation is applied only to the x offset, while the
424
y offset is kept in absolute pixels.
427
> In short, these arguments control whether a particular dimension
428
of a pixbuf item is scaled or not in the normal way by the
429
item's affine transformation.
438
>Resource Management</H3
440
> When you set the GdkPixbuf structure that a <A
441
HREF="gnomecanvaspixbuf.html"
442
>GnomeCanvasPixbuf</A
444
item will use by setting the <A
445
HREF="gnomecanvaspixbuf.html#GNOMECANVASPIXBUF--PIXBUF"
448
reference count will be added to that GdkPixbuf structure.
449
When the pixbuf item no longer needs the GdkPixbuf structure,
450
such as when the item is destroyed or when a new pixbuf
451
structure is passed to it, then the old GdkPixbuf structure
452
will be automatically unreferenced.
455
> This means that if an application just needs to load a pixbuf
456
image and set it into a pixbuf canvas item, it can do the
457
following to ‘forget’ about the pixbuf structure:
467
CLASS="PROGRAMLISTING"
469
GnomeCanvasItem *item;
471
pixbuf = gdk_pixbuf_new_from_file ("foo.png");
472
g_assert (pixbuf != NULL);
474
item = gnome_canvas_item_new (gnome_canvas_root (my_canvas),
475
gnome_canvas_pixbuf_get_type(),
478
gdk_pixbuf_unref (pixbuf);
486
> After this happens, the reference count of the pixbuf structure
488
HREF="gdk-pixbuf-file-loading.html#GDK-PIXBUF-NEW-FROM-FILE"
489
>gdk_pixbuf_new_from_file</A
490
>() function creates it
491
with a reference count of 1, then setting the <A
492
HREF="gnomecanvaspixbuf.html#GNOMECANVASPIXBUF--PIXBUF"
496
HREF="gnomecanvaspixbuf.html"
497
>GnomeCanvasPixbuf</A
498
> item increases it to 2, and then it is
499
decremented to 1 by the call to <A
500
HREF="gdk-pixbuf-refcounting.html#GDK-PIXBUF-UNREF"
503
canvas item is destroyed, it will automatically unreference the
504
pixbuf structure again, causing its reference count to drop to
505
zero and thus be freed.
523
NAME="GNOME-CANVAS-PIXBUF-CAPS"
525
>GNOME_CANVAS_PIXBUF()</H3
534
CLASS="PROGRAMLISTING"
535
>#define GNOME_CANVAS_PIXBUF(obj)</PRE
540
> Casts a GtkOjbect to a <A
541
HREF="gnomecanvaspixbuf.html"
542
>GnomeCanvasPixbuf</A
546
CLASS="INFORMALTABLE"
597
NAME="GNOMECANVASPIXBUF--PIXBUF"
602
>" (gpointer : Read / Write)</DT
605
> Contains a pointer to a GdkPixbuf structure that will be used by
606
the pixbuf canvas item as an image source. When a pixbuf is set
607
its reference count is incremented; if the pixbuf item kept a
608
pointer to another GdkPixbuf structure, the reference count of
609
this structure will be decremented. Also, the GdkPixbuf's
610
reference count will automatically be decremented when the
612
HREF="gnomecanvaspixbuf.html"
613
>GnomeCanvasPixbuf</A
614
> item is destroyed. When a pixbuf is queried, a
615
reference count will not be added to the return value; you must do
616
this yourself if you intend to keep the pixbuf structure around.
621
NAME="GNOMECANVASPIXBUF--WIDTH"
626
>" (gdouble : Read / Write)</DT
629
> Indicates the width the pixbuf will be scaled to. This argument
630
will only be used if the <A
631
HREF="gnomecanvaspixbuf.html#GNOMECANVASPIXBUF--WIDTH-SET"
638
HREF="gnomecanvaspixbuf.html#GNOMECANVASPIXBUF--WIDTH-IN-PIXELS"
644
>, the width will be taken to be in canvas units,
645
and thus will be scaled along with the canvas item's affine
646
transformation. If width_in_pixels is <TT
650
taken to be in pixels, and will visually remain a constant size
651
even if the item's affine transformation changes.
656
NAME="GNOMECANVASPIXBUF--WIDTH-SET"
661
>" (gboolean : Read / Write)</DT
664
> Determines whether the <A
665
HREF="gnomecanvaspixbuf.html#GNOMECANVASPIXBUF--WIDTH"
668
into account when scaling the pixbuf item. If this argument is
672
>, then the width value of the pixbuf will be used instead.
681
NAME="GNOMECANVASPIXBUF--WIDTH-IN-PIXELS"
686
>" (gboolean : Read / Write)</DT
689
> If this argument is <TT
692
>, then the width of the pixbuf will be
693
considered to be in pixels, that is, it will not be visually
694
scaled even if the item's affine transformation changes. If this
698
>, then the width of the pixbuf will be considered to be
699
in canvas units, and so will be scaled normally by affine
700
transformations. The default is <TT
708
NAME="GNOMECANVASPIXBUF--HEIGHT"
713
>" (gdouble : Read / Write)</DT
716
> Indicates the height the pixbuf will be scaled to. This argument
717
will only be used if the <A
718
HREF="gnomecanvaspixbuf.html#GNOMECANVASPIXBUF--HEIGHT-SET"
724
>. Works in the same way as the <A
725
HREF="gnomecanvaspixbuf.html#GNOMECANVASPIXBUF--WIDTH"
732
NAME="GNOMECANVASPIXBUF--HEIGHT-SET"
737
>" (gboolean : Read / Write)</DT
740
> Determines whether the <A
741
HREF="gnomecanvaspixbuf.html#GNOMECANVASPIXBUF--HEIGHT"
744
taken into account when scaling the pixbuf item. Works in the
746
HREF="gnomecanvaspixbuf.html#GNOMECANVASPIXBUF--WIDTH-SET"
757
NAME="GNOMECANVASPIXBUF--HEIGHT-IN-PIXELS"
761
>height-in-pixels</TT
762
>" (gboolean : Read / Write)</DT
765
> Works in the same way as the <A
766
HREF="gnomecanvaspixbuf.html#GNOMECANVASPIXBUF--WIDTH-IN-PIXELS"
769
argument. The default is <TT
777
NAME="GNOMECANVASPIXBUF--X"
782
>" (gdouble : Read / Write)</DT
785
> Indicates the horizontal translation offset of the pixbuf item's
786
image. This offset may not actually appear horizontal, since it
787
will be affected by the item's affine transformation. The default
793
NAME="GNOMECANVASPIXBUF--X-IN-PIXELS"
798
>" (gboolean : Read / Write)</DT
801
> If this argument is <TT
804
>, the pixbuf's translation with respect
805
to its logical origin in item-relative coordinates will be in
806
pixels, that is, the visible offset will not change even if the
807
item's affine transformation changes. If it is <TT
811
pixbuf's translation will be taken to be in canvas units, and thus
812
will change along with the item's affine transformation. The
821
NAME="GNOMECANVASPIXBUF--Y"
826
>" (gdouble : Read / Write)</DT
829
> Indicates the vertical translation offset of the pixbuf item's
830
image. Works in the same way as the <A
831
HREF="gnomecanvaspixbuf.html#GNOMECANVASPIXBUF--X"
833
> argument. The default is
839
NAME="GNOMECANVASPIXBUF--Y-IN-PIXELS"
844
>" (gboolean : Read / Write)</DT
847
> Works in the same way as the <A
848
HREF="gnomecanvaspixbuf.html#GNOMECANVASPIXBUF--X-IN-PIXELS"
851
argument, but controls whether the <A
852
HREF="gnomecanvaspixbuf.html#GNOMECANVASPIXBUF--Y"
854
> translation offset is
855
scaled or not. The default is <TT
872
> GnomeCanvas, GdkPixbuf
878
CLEAR="all"><BR><TABLE
890
HREF="gdkpixbufloader.html"
895
><<< Previous Page</B
944
HREF="gdk-pixbuf-gdk-pixbuf-xlib-init.html"
949
>Next Page >>></B
975
> Xlib initialization</B
b'\\ No newline at end of file'