creating.sgml 2.43 KB
Newer Older
1
<!-- ##### SECTION Title ##### -->
2
Image Data in Memory
3 4

<!-- ##### SECTION Short_Description ##### -->
5
Creating a pixbuf from image data that is already in memory.
6 7

<!-- ##### SECTION Long_Description ##### -->
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
  <para>
    The most basic way to create a pixbuf is to wrap an existing pixel
    buffer with a #GdkPixbuf structure.  You can use the
    gdk_pixbuf_new_from_data() function to do this You need to specify
    the destroy notification function that will be called when the
    data buffer needs to be freed; this will happen when a #GdkPixbuf
    is finalized by the reference counting functions If you have a
    chunk of static data compiled into your application, you can pass
    in #NULL as the destroy notification function so that the data
    will not be freed.
  </para>

  <para>
    The gdk_pixbuf_new() function can be used as a convenience to
    create a pixbuf with an empty buffer.  This is equivalent to
    allocating a data buffer using malloc() and then wrapping it with
    gdk_pixbuf_new_from_data().  The gdk_pixbuf_new() function will
    compute an optimal rowstride so that rendering can be performed
    with an efficient algorithm.
  </para>

  <para>
    As a special case, you can use the gdk_pixbuf_new_from_xpm_data()
    function to create a pixbuf from inline XPM image data.
  </para>

  <para>
    You can also copy an existing pixbuf with the gdk_pixbuf_copy()
    function.  This is not the same as just doing a gdk_pixbuf_ref()
    on the old pixbuf; the copy function will actually duplicate the
    pixel data in memory and create a new #GdkPixbuf structure for it.
  </para>
40

41
<!-- ##### SECTION See_Also ##### -->
42 43 44
  <para>
    gdk_pixbuf_finalize().
  </para>
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
<!-- ##### FUNCTION gdk_pixbuf_new ##### -->
<para>

</para>

@colorspace: 
@has_alpha: 
@bits_per_sample: 
@width: 
@height: 
@Returns: 


<!-- ##### FUNCTION gdk_pixbuf_new_from_data ##### -->
<para>

</para>

@data: 
@colorspace: 
@has_alpha: 
@bits_per_sample: 
@width: 
@height: 
@rowstride: 
@destroy_fn: 
@destroy_fn_data: 
@Returns: 


<!-- ##### FUNCTION gdk_pixbuf_new_from_xpm_data ##### -->
<para>

</para>

@data: 
@Returns: 


85 86 87 88 89 90 91 92 93 94 95 96 97
<!-- ##### FUNCTION gdk_pixbuf_new_subpixbuf ##### -->
<para>

</para>

@src_pixbuf: 
@src_x: 
@src_y: 
@width: 
@height: 
@Returns: 


98 99 100 101 102 103
<!-- ##### FUNCTION gdk_pixbuf_copy ##### -->
<para>

</para>

@pixbuf: 
104 105 106 107 108 109
@Returns: <!--
Local variables:
mode: sgml
sgml-parent-document: ("../gdk-pixbuf.sgml" "book" "refsect2" "")
End:
-->
110 111