File: Gdk_PixbufLoader.cs

package info (click to toggle)
gnome-subtitles 1.8-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, sid
  • size: 103,144 kB
  • sloc: xml: 406,395; cs: 364,495; ansic: 3,104; perl: 1,477; sh: 769; python: 545; javascript: 500; makefile: 49
file content (469 lines) | stat: -rw-r--r-- 15,021 bytes parent folder | download
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
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
// This file was generated by the Gtk# code generator.
// Any changes made will be lost if regenerated.

namespace Gdk {

	using System;
	using System.Collections;
	using System.Collections.Generic;
	using System.Runtime.InteropServices;

#region Autogenerated code
	public partial class PixbufLoader : GLib.Object {

		public PixbufLoader (IntPtr raw) : base(raw) {}

		[DllImport("gdk_pixbuf-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern IntPtr gdk_pixbuf_loader_new();

		public PixbufLoader () : base (IntPtr.Zero)
		{
			if (GetType () != typeof (PixbufLoader)) {
				CreateNativeObject (new string [0], new GLib.Value[0]);
				return;
			}
			Raw = gdk_pixbuf_loader_new();
		}

		[DllImport("gdk_pixbuf-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern unsafe IntPtr gdk_pixbuf_loader_new_with_mime_type(IntPtr mime_type, out IntPtr error);

		public unsafe PixbufLoader (string mime_type) : base (IntPtr.Zero)
		{
			if (GetType () != typeof (PixbufLoader)) {
				var vals = new List<GLib.Value> ();
				var names = new List<string> ();
				CreateNativeObject (names.ToArray (), vals.ToArray ());
				return;
			}
			IntPtr native_mime_type = GLib.Marshaller.StringToPtrGStrdup (mime_type);
			IntPtr error = IntPtr.Zero;
			Raw = gdk_pixbuf_loader_new_with_mime_type(native_mime_type, out error);
			GLib.Marshaller.Free (native_mime_type);
			if (error != IntPtr.Zero) throw new GLib.GException (error);
		}

		[DllImport("gdk_pixbuf-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern unsafe IntPtr gdk_pixbuf_loader_new_with_type(IntPtr image_type, out IntPtr error);

		public static unsafe PixbufLoader NewWithType(string image_type)
		{
			IntPtr native_image_type = GLib.Marshaller.StringToPtrGStrdup (image_type);
			IntPtr error = IntPtr.Zero;
			PixbufLoader result = new PixbufLoader (gdk_pixbuf_loader_new_with_type(native_image_type, out error));
			GLib.Marshaller.Free (native_image_type);
			if (error != IntPtr.Zero) throw new GLib.GException (error);
			return result;
		}

		[GLib.Signal("size-prepared")]
		public event Gdk.SizePreparedHandler SizePrepared {
			add {
				this.AddSignalHandler ("size-prepared", value, typeof (Gdk.SizePreparedArgs));
			}
			remove {
				this.RemoveSignalHandler ("size-prepared", value);
			}
		}

		[GLib.Signal("closed")]
		public event System.EventHandler Closed {
			add {
				this.AddSignalHandler ("closed", value);
			}
			remove {
				this.RemoveSignalHandler ("closed", value);
			}
		}

		[GLib.Signal("area-updated")]
		public event Gdk.AreaUpdatedHandler AreaUpdated {
			add {
				this.AddSignalHandler ("area-updated", value, typeof (Gdk.AreaUpdatedArgs));
			}
			remove {
				this.RemoveSignalHandler ("area-updated", value);
			}
		}

		[GLib.Signal("area-prepared")]
		public event System.EventHandler AreaPrepared {
			add {
				this.AddSignalHandler ("area-prepared", value);
			}
			remove {
				this.RemoveSignalHandler ("area-prepared", value);
			}
		}

		static SizePreparedNativeDelegate SizePrepared_cb_delegate;
		static SizePreparedNativeDelegate SizePreparedVMCallback {
			get {
				if (SizePrepared_cb_delegate == null)
					SizePrepared_cb_delegate = new SizePreparedNativeDelegate (SizePrepared_cb);
				return SizePrepared_cb_delegate;
			}
		}

		static void OverrideSizePrepared (GLib.GType gtype)
		{
			OverrideSizePrepared (gtype, SizePreparedVMCallback);
		}

		static void OverrideSizePrepared (GLib.GType gtype, SizePreparedNativeDelegate callback)
		{
			unsafe {
				IntPtr* raw_ptr = (IntPtr*)(((long) gtype.GetClassPtr()) + (long) class_abi.GetFieldOffset("size_prepared"));
				*raw_ptr = Marshal.GetFunctionPointerForDelegate((Delegate) callback);
			}
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate void SizePreparedNativeDelegate (IntPtr inst, int width, int height);

		static void SizePrepared_cb (IntPtr inst, int width, int height)
		{
			try {
				PixbufLoader __obj = GLib.Object.GetObject (inst, false) as PixbufLoader;
				__obj.OnSizePrepared (width, height);
			} catch (Exception e) {
				GLib.ExceptionManager.RaiseUnhandledException (e, false);
			}
		}

		[GLib.DefaultSignalHandler(Type=typeof(Gdk.PixbufLoader), ConnectionMethod="OverrideSizePrepared")]
		protected virtual void OnSizePrepared (int width, int height)
		{
			InternalSizePrepared (width, height);
		}

		private void InternalSizePrepared (int width, int height)
		{
			SizePreparedNativeDelegate unmanaged = null;
			unsafe {
				IntPtr* raw_ptr = (IntPtr*)(((long) this.LookupGType().GetThresholdType().GetClassPtr()) + (long) class_abi.GetFieldOffset("size_prepared"));
				unmanaged = (SizePreparedNativeDelegate) Marshal.GetDelegateForFunctionPointer(*raw_ptr, typeof(SizePreparedNativeDelegate));
			}
			if (unmanaged == null) return;

			unmanaged (this.Handle, width, height);
		}

		static AreaPreparedNativeDelegate AreaPrepared_cb_delegate;
		static AreaPreparedNativeDelegate AreaPreparedVMCallback {
			get {
				if (AreaPrepared_cb_delegate == null)
					AreaPrepared_cb_delegate = new AreaPreparedNativeDelegate (AreaPrepared_cb);
				return AreaPrepared_cb_delegate;
			}
		}

		static void OverrideAreaPrepared (GLib.GType gtype)
		{
			OverrideAreaPrepared (gtype, AreaPreparedVMCallback);
		}

		static void OverrideAreaPrepared (GLib.GType gtype, AreaPreparedNativeDelegate callback)
		{
			unsafe {
				IntPtr* raw_ptr = (IntPtr*)(((long) gtype.GetClassPtr()) + (long) class_abi.GetFieldOffset("area_prepared"));
				*raw_ptr = Marshal.GetFunctionPointerForDelegate((Delegate) callback);
			}
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate void AreaPreparedNativeDelegate (IntPtr inst);

		static void AreaPrepared_cb (IntPtr inst)
		{
			try {
				PixbufLoader __obj = GLib.Object.GetObject (inst, false) as PixbufLoader;
				__obj.OnAreaPrepared ();
			} catch (Exception e) {
				GLib.ExceptionManager.RaiseUnhandledException (e, false);
			}
		}

		[GLib.DefaultSignalHandler(Type=typeof(Gdk.PixbufLoader), ConnectionMethod="OverrideAreaPrepared")]
		protected virtual void OnAreaPrepared ()
		{
			InternalAreaPrepared ();
		}

		private void InternalAreaPrepared ()
		{
			AreaPreparedNativeDelegate unmanaged = null;
			unsafe {
				IntPtr* raw_ptr = (IntPtr*)(((long) this.LookupGType().GetThresholdType().GetClassPtr()) + (long) class_abi.GetFieldOffset("area_prepared"));
				unmanaged = (AreaPreparedNativeDelegate) Marshal.GetDelegateForFunctionPointer(*raw_ptr, typeof(AreaPreparedNativeDelegate));
			}
			if (unmanaged == null) return;

			unmanaged (this.Handle);
		}

		static AreaUpdatedNativeDelegate AreaUpdated_cb_delegate;
		static AreaUpdatedNativeDelegate AreaUpdatedVMCallback {
			get {
				if (AreaUpdated_cb_delegate == null)
					AreaUpdated_cb_delegate = new AreaUpdatedNativeDelegate (AreaUpdated_cb);
				return AreaUpdated_cb_delegate;
			}
		}

		static void OverrideAreaUpdated (GLib.GType gtype)
		{
			OverrideAreaUpdated (gtype, AreaUpdatedVMCallback);
		}

		static void OverrideAreaUpdated (GLib.GType gtype, AreaUpdatedNativeDelegate callback)
		{
			unsafe {
				IntPtr* raw_ptr = (IntPtr*)(((long) gtype.GetClassPtr()) + (long) class_abi.GetFieldOffset("area_updated"));
				*raw_ptr = Marshal.GetFunctionPointerForDelegate((Delegate) callback);
			}
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate void AreaUpdatedNativeDelegate (IntPtr inst, int x, int y, int width, int height);

		static void AreaUpdated_cb (IntPtr inst, int x, int y, int width, int height)
		{
			try {
				PixbufLoader __obj = GLib.Object.GetObject (inst, false) as PixbufLoader;
				__obj.OnAreaUpdated (x, y, width, height);
			} catch (Exception e) {
				GLib.ExceptionManager.RaiseUnhandledException (e, false);
			}
		}

		[GLib.DefaultSignalHandler(Type=typeof(Gdk.PixbufLoader), ConnectionMethod="OverrideAreaUpdated")]
		protected virtual void OnAreaUpdated (int x, int y, int width, int height)
		{
			InternalAreaUpdated (x, y, width, height);
		}

		private void InternalAreaUpdated (int x, int y, int width, int height)
		{
			AreaUpdatedNativeDelegate unmanaged = null;
			unsafe {
				IntPtr* raw_ptr = (IntPtr*)(((long) this.LookupGType().GetThresholdType().GetClassPtr()) + (long) class_abi.GetFieldOffset("area_updated"));
				unmanaged = (AreaUpdatedNativeDelegate) Marshal.GetDelegateForFunctionPointer(*raw_ptr, typeof(AreaUpdatedNativeDelegate));
			}
			if (unmanaged == null) return;

			unmanaged (this.Handle, x, y, width, height);
		}

		static ClosedNativeDelegate Closed_cb_delegate;
		static ClosedNativeDelegate ClosedVMCallback {
			get {
				if (Closed_cb_delegate == null)
					Closed_cb_delegate = new ClosedNativeDelegate (Closed_cb);
				return Closed_cb_delegate;
			}
		}

		static void OverrideClosed (GLib.GType gtype)
		{
			OverrideClosed (gtype, ClosedVMCallback);
		}

		static void OverrideClosed (GLib.GType gtype, ClosedNativeDelegate callback)
		{
			unsafe {
				IntPtr* raw_ptr = (IntPtr*)(((long) gtype.GetClassPtr()) + (long) class_abi.GetFieldOffset("closed"));
				*raw_ptr = Marshal.GetFunctionPointerForDelegate((Delegate) callback);
			}
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate void ClosedNativeDelegate (IntPtr inst);

		static void Closed_cb (IntPtr inst)
		{
			try {
				PixbufLoader __obj = GLib.Object.GetObject (inst, false) as PixbufLoader;
				__obj.OnClosed ();
			} catch (Exception e) {
				GLib.ExceptionManager.RaiseUnhandledException (e, false);
			}
		}

		[GLib.DefaultSignalHandler(Type=typeof(Gdk.PixbufLoader), ConnectionMethod="OverrideClosed")]
		protected virtual void OnClosed ()
		{
			InternalClosed ();
		}

		private void InternalClosed ()
		{
			ClosedNativeDelegate unmanaged = null;
			unsafe {
				IntPtr* raw_ptr = (IntPtr*)(((long) this.LookupGType().GetThresholdType().GetClassPtr()) + (long) class_abi.GetFieldOffset("closed"));
				unmanaged = (ClosedNativeDelegate) Marshal.GetDelegateForFunctionPointer(*raw_ptr, typeof(ClosedNativeDelegate));
			}
			if (unmanaged == null) return;

			unmanaged (this.Handle);
		}


		// Internal representation of the wrapped structure ABI.
		static GLib.AbiStruct _class_abi = null;
		static public new GLib.AbiStruct class_abi {
			get {
				if (_class_abi == null)
					_class_abi = new GLib.AbiStruct (new List<GLib.AbiField>{ 
						new GLib.AbiField("size_prepared"
							, GLib.Object.class_abi.Fields
							, (uint) Marshal.SizeOf(typeof(IntPtr)) // size_prepared
							, null
							, "area_prepared"
							, (uint) Marshal.SizeOf(typeof(IntPtr))
							, 0
							),
						new GLib.AbiField("area_prepared"
							, -1
							, (uint) Marshal.SizeOf(typeof(IntPtr)) // area_prepared
							, "size_prepared"
							, "area_updated"
							, (uint) Marshal.SizeOf(typeof(IntPtr))
							, 0
							),
						new GLib.AbiField("area_updated"
							, -1
							, (uint) Marshal.SizeOf(typeof(IntPtr)) // area_updated
							, "area_prepared"
							, "closed"
							, (uint) Marshal.SizeOf(typeof(IntPtr))
							, 0
							),
						new GLib.AbiField("closed"
							, -1
							, (uint) Marshal.SizeOf(typeof(IntPtr)) // closed
							, "area_updated"
							, null
							, (uint) Marshal.SizeOf(typeof(IntPtr))
							, 0
							),
					});

				return _class_abi;
			}
		}


		// End of the ABI representation.

		[DllImport("gdk_pixbuf-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern unsafe bool gdk_pixbuf_loader_close(IntPtr raw, out IntPtr error);

		public unsafe bool Close() {
			IntPtr error = IntPtr.Zero;
			bool raw_ret = gdk_pixbuf_loader_close(Handle, out error);
			bool ret = raw_ret;
			if (error != IntPtr.Zero) throw new GLib.GException (error);
			return ret;
		}

		[DllImport("gdk_pixbuf-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern IntPtr gdk_pixbuf_loader_get_animation(IntPtr raw);

		public Gdk.PixbufAnimation Animation { 
			get {
				IntPtr raw_ret = gdk_pixbuf_loader_get_animation(Handle);
				Gdk.PixbufAnimation ret = GLib.Object.GetObject(raw_ret) as Gdk.PixbufAnimation;
				return ret;
			}
		}

		[DllImport("gdk_pixbuf-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern IntPtr gdk_pixbuf_loader_get_format(IntPtr raw);

		public Gdk.PixbufFormat Format { 
			get {
				IntPtr raw_ret = gdk_pixbuf_loader_get_format(Handle);
				Gdk.PixbufFormat ret = raw_ret == IntPtr.Zero ? null : (Gdk.PixbufFormat) GLib.Opaque.GetOpaque (raw_ret, typeof (Gdk.PixbufFormat), false);
				return ret;
			}
		}

		[DllImport("gdk_pixbuf-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern IntPtr gdk_pixbuf_loader_get_pixbuf(IntPtr raw);

		public Gdk.Pixbuf Pixbuf { 
			get {
				IntPtr raw_ret = gdk_pixbuf_loader_get_pixbuf(Handle);
				Gdk.Pixbuf ret = GLib.Object.GetObject(raw_ret) as Gdk.Pixbuf;
				return ret;
			}
		}

		[DllImport("gdk_pixbuf-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern IntPtr gdk_pixbuf_loader_get_type();

		public static new GLib.GType GType { 
			get {
				IntPtr raw_ret = gdk_pixbuf_loader_get_type();
				GLib.GType ret = new GLib.GType(raw_ret);
				return ret;
			}
		}

		[DllImport("gdk_pixbuf-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern void gdk_pixbuf_loader_set_size(IntPtr raw, int width, int height);

		public void SetSize(int width, int height) {
			gdk_pixbuf_loader_set_size(Handle, width, height);
		}

		[DllImport("gdk_pixbuf-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern unsafe bool gdk_pixbuf_loader_write(IntPtr raw, byte[] buf, UIntPtr count, out IntPtr error);

		public unsafe bool Write(byte[] buf, ulong count) {
			IntPtr error = IntPtr.Zero;
			bool raw_ret = gdk_pixbuf_loader_write(Handle, buf, new UIntPtr (count), out error);
			bool ret = raw_ret;
			if (error != IntPtr.Zero) throw new GLib.GException (error);
			return ret;
		}

		[DllImport("gdk_pixbuf-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern unsafe bool gdk_pixbuf_loader_write_bytes(IntPtr raw, IntPtr buffer, out IntPtr error);

		public unsafe bool WriteBytes(GLib.Bytes buffer) {
			IntPtr error = IntPtr.Zero;
			bool raw_ret = gdk_pixbuf_loader_write_bytes(Handle, buffer == null ? IntPtr.Zero : buffer.Handle, out error);
			bool ret = raw_ret;
			if (error != IntPtr.Zero) throw new GLib.GException (error);
			return ret;
		}


		// Internal representation of the wrapped structure ABI.
		static GLib.AbiStruct _abi_info = null;
		static public new GLib.AbiStruct abi_info {
			get {
				if (_abi_info == null)
					_abi_info = new GLib.AbiStruct (new List<GLib.AbiField>{ 
						new GLib.AbiField("priv"
							, GLib.Object.abi_info.Fields
							, (uint) Marshal.SizeOf(typeof(IntPtr)) // priv
							, null
							, null
							, (uint) Marshal.SizeOf(typeof(IntPtr))
							, 0
							),
					});

				return _abi_info;
			}
		}


		// End of the ABI representation.

#endregion
	}
}