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
  
class GDK2.PixbufLoader; 
inherit G.Object; 
 
//! Application-driven progressive image loading. 
 
signal area_prepared; 
signal area_updated; 
signal closed; 
signal size_prepared; 
 
 
%{ 
#include <gdk-pixbuf/gdk-pixbuf.h> 
%} 
 
void create(); 
//! 
 
/* 
  Note: not a gobject 
+GDK2.PixbufFormat get_format(); 
*/ 
 
void set_size(int width, int height); 
//! Causes the image to be scaled while it is loaded. Attempts to set 
//! the desired image size are ignored after the emission of the 
//! size-prepared signal. (once loading start) 
 
bool write(string|Stdio.Buffer data) 
//! This will cause a pixbuf loader to parse the more data for 
//! an image. It will return TRUE if the data was loaded successfully, 
//! and FALSE if an error occurred. In the latter case, the loader 
//! will be closed, and will not accept further writes. 
{ 
  guchar *data; 
  gsize count; 
 
 if( TYPEOF(Pike_sp[-1]) == PIKE_T_STRING ) 
 { 
   data = Pike_sp[-1].u.string->str; 
   count = Pike_sp[-1].u.string->len; 
  } 
  else if( TYPEOF(Pike_sp[-1]) == PIKE_T_OBJECT ) 
  { 
    int shft; 
    if(!get_memory_object_memory( Pike_sp[-1].u.object,(void**)&data,&count,&shft )) 
      Pike_error("Not a memory buffer object\n"); 
  } 
  else 
  { 
      Pike_error("Illegal argument\n"); 
  } 
 push_int( !!gdk_pixbuf_loader_write( GDK_PIXBUF_LOADER(THIS->obj), data, count, 
                                      NULL) ); 
} 
 
?GDK2.Pixbuf get_pixbuf(); 
//! Queries the GdkPixbuf that a pixbuf loader is currently 
//! creating. In general it only makes sense to call this function 
//! after the "area-prepared" signal has been emitted by the loader; 
//! this means that enough data has been read to know the size of the 
//! image that will be allocated. 
//! 
//! If the loader has not received 
//! enough data via @[write](), then this function 
//! returns NULL. The returned pixbuf will be the same in all future 
//! calls to the loader, so you can just keep it around. Additionally, 
//! if the loader is an animation, it will return the "static image" 
//! of the animation (see @[GDK2.PixbufAnimation.get_static_image]). 
 
?GDK2.PixbufAnimation get_animation(); 
//! Queries the GDK2.PixbufAnimation that a pixbuf loader is currently 
//! creating. In general it only makes sense to call this function 
//! after the "area-prepared" signal has been emitted by the 
//! loader. If the loader doesn't have enough bytes yet (hasn't 
//! emitted the "area-prepared" signal) this function will return 
//! NULL. 
 
bool close(null); 
//! informs a pixbuf loader that no further writes with write() will 
//! occur, so that it can free its internal loading structures. Also, 
//! tries to parse any data that hasn't yet been parsed; if the 
//! remaining data is partial or corrupt, FALSE will be returned.