~ubuntu-branches/ubuntu/lucid/fpc/lucid-proposed

« back to all changes in this revision

Viewing changes to fpcsrc/packages/gtk2/src/gtk+/gdk-pixbuf/gdk2pixbuf.pas

  • Committer: Bazaar Package Importer
  • Author(s): Mazen Neifer, Torsten Werner, Mazen Neifer
  • Date: 2008-10-09 23:29:00 UTC
  • mfrom: (4.1.1 sid)
  • Revision ID: james.westby@ubuntu.com-20081009232900-553f61m37jkp6upv
Tags: 2.2.2-4
[ Torsten Werner ]
* Update ABI version in fpc-depends automatically.
* Remove empty directories from binary package fpc-source.

[ Mazen Neifer ]
* Removed leading path when calling update-alternatives to remove a Linitian
  error.
* Fixed clean target.
* Improved description of packages. (Closes: #498882)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
{ GdkPixbuf library - Main header file
 
2
 
 
3
   Copyright (C) 1999 The Free Software Foundation
 
4
 
 
5
   Authors: Mark Crichton <crichton@gimp.org>
 
6
            Miguel de Icaza <miguel@gnu.org>
 
7
            Federico Mena-Quintero <federico@gimp.org>
 
8
            Havoc Pennington <hp@redhat.com>
 
9
 
 
10
   This library is free software; you can redistribute it and/or
 
11
   modify it under the terms of the GNU Lesser General Public
 
12
   License as published by the Free Software Foundation; either
 
13
   version 2 of the License, or (at your option) any later version.
 
14
 
 
15
   This library is distributed in the hope that it will be useful,
 
16
   but WITHOUT ANY WARRANTY; without even the implied warranty of
 
17
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
18
   Lesser General Public License for more details.
 
19
 
 
20
   You should have received a copy of the GNU Lesser General Public
 
21
   License along with this library; if not, write to the
 
22
   Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 
23
   Boston, MA 02111-1307, USA.
 
24
  }
 
25
unit gdk2pixbuf; // keep unit name lowercase for kylix
 
26
 
 
27
{$IFDEF FPC}
 
28
  {$mode objfpc}
 
29
{$ENDIF}
 
30
{$IFDEF VER140}
 
31
  {$DEFINE KYLIX}
 
32
{$ENDIF}
 
33
 
 
34
interface
 
35
 
 
36
uses glib2;
 
37
 
 
38
const
 
39
{$ifdef win32}
 
40
  {$define gdkpixbufwin}
 
41
  gdkpixbuflib = 'libgdk_pixbuf-2.0-0.dll';
 
42
  {$IFDEF FPC}
 
43
    {$ifndef NO_SMART_LINK}
 
44
      {$smartlink on}
 
45
    {$endif}
 
46
  {$ENDIF}
 
47
{$else}
 
48
  {$ifdef darwin}
 
49
    gdkpixbuflib = 'gdk_pixbuf-2.0.0';
 
50
    {$linklib gtk-x11-2.0}
 
51
    {$linklib gdk-x11-2.0}
 
52
    {$linklib pango-1.0.0}
 
53
    {$linklib glib-2.0.0}
 
54
    {$linklib gobject-2.0.0}
 
55
    {$linklib gdk_pixbuf-2.0.0}
 
56
    {$linklib atk-1.0.0}
 
57
  {$else}
 
58
    {$ifdef UseCustomLibs}
 
59
    gdkpixbuflib = '';
 
60
    {$else}
 
61
    gdkpixbuflib = 'libgdk_pixbuf-2.0.so';
 
62
    {$endif}
 
63
  {$endif}
 
64
{$endif}
 
65
 
 
66
{$define HasGTK2_4}
 
67
{$define HasGTK2_6}
 
68
 
 
69
{ Pointers to basic pascal types, inserted by h2pas conversion program.}
 
70
{$IFNDEF KYLIX}
 
71
  {$PACKRECORDS C}
 
72
{$ELSE}
 
73
  {$ALIGN 4}
 
74
  {$WEAKPACKAGEUNIT}
 
75
  {$WARNINGS OFF}
 
76
{$ENDIF}
 
77
 
 
78
{$IFNDEF Kylix}
 
79
var
 
80
  {$IFDEF WIN32 }
 
81
  gdk_pixbuf_major_version: guint; external gdkpixbuflib name 'gdk_pixbuf_major_version';
 
82
  gdk_pixbuf_minor_version: guint; external gdkpixbuflib name 'gdk_pixbuf_minor_version';
 
83
  gdk_pixbuf_micro_version: guint; external gdkpixbuflib name 'gdk_pixbuf_micro_version';
 
84
  gdk_pixbuf_version: PChar ; external gdkpixbuflib name 'gdk_pixbuf_version';
 
85
  {$ELSE }
 
86
  gdk_pixbuf_major_version: guint;cvar;external;
 
87
  gdk_pixbuf_minor_version: guint;cvar;external;
 
88
  gdk_pixbuf_micro_version: guint;cvar;external;
 
89
  gdk_pixbuf_version: PChar;cvar;external;
 
90
  {$ENDIF }
 
91
{$ENDIF}
 
92
 
 
93
type
 
94
  // internal type
 
95
  PGdkPixbuf = pointer;
 
96
 
 
97
  // internal type
 
98
  PGdkPixbufAnimation = pointer;
 
99
 
 
100
  // internal type
 
101
  PGdkPixbufAnimationIter = pointer;
 
102
 
 
103
 
 
104
{ Alpha compositing mode  }
 
105
   PGdkPixbufAlphaMode = ^TGdkPixbufAlphaMode;
 
106
   TGdkPixbufAlphaMode = (
 
107
     GDK_PIXBUF_ALPHA_BILEVEL,
 
108
     GDK_PIXBUF_ALPHA_FULL
 
109
   );
 
110
 
 
111
{ Color spaces; right now only RGB is supported.
 
112
   Note that these values are encoded in inline pixbufs
 
113
   as ints, so don't reorder them
 
114
  }
 
115
   PGdkColorspace = ^TGdkColorspace;
 
116
   TGdkColorspace = (GDK_COLORSPACE_RGB);
 
117
 
 
118
{ Handler that must free the pixel array  }
 
119
   TGdkPixbufDestroyNotify = procedure (pixels:Pguchar; data:gpointer); cdecl;
 
120
 
 
121
{ image data hosed  }
 
122
{ no mem to load image  }
 
123
{ bad option passed to save routine  }
 
124
{ unsupported image type (sort of an ENOSYS)  }
 
125
{ unsupported operation (load, save) for image type  }
 
126
   PGdkPixbufError = ^TGdkPixbufError;
 
127
   TGdkPixbufError = (
 
128
     GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
 
129
     GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY,
 
130
     GDK_PIXBUF_ERROR_BAD_OPTION,
 
131
     GDK_PIXBUF_ERROR_UNKNOWN_TYPE,
 
132
     GDK_PIXBUF_ERROR_UNSUPPORTED_OPERATION,
 
133
     GDK_PIXBUF_ERROR_FAILED
 
134
   );
 
135
 
 
136
{ Interpolation modes  }
 
137
   PGdkInterpType = ^TGdkInterpType;
 
138
   TGdkInterpType = (
 
139
     GDK_INTERP_NEAREST,
 
140
     GDK_INTERP_TILES,
 
141
     GDK_INTERP_BILINEAR,
 
142
     GDK_INTERP_HYPER
 
143
   );
 
144
 
 
145
function GDK_TYPE_PIXBUF : GType;
 
146
function GDK_PIXBUF(anObject : pointer) : PGdkPixbuf;
 
147
function GDK_IS_PIXBUF(anObject : pointer) : boolean;
 
148
 
 
149
function GDK_TYPE_PIXBUF_ANIMATION : GType;
 
150
function GDK_PIXBUF_ANIMATION(anObject : pointer) : PGdkPixbufAnimation;
 
151
function GDK_IS_PIXBUF_ANIMATION(anObject : pointer) : boolean;
 
152
function GDK_TYPE_PIXBUF_ANIMATION_ITER : GType;
 
153
function GDK_PIXBUF_ANIMATION_ITER(anObject : pointer) : PGdkPixbufAnimationIter;
 
154
function GDK_IS_PIXBUF_ANIMATION_ITER(anObject : pointer) : boolean;
 
155
 
 
156
function GDK_PIXBUF_ERROR : TGQuark;
 
157
function gdk_pixbuf_error_quark:TGQuark; cdecl; external gdkpixbuflib;
 
158
function gdk_pixbuf_get_type:GType; cdecl; external gdkpixbuflib;
 
159
 
 
160
 
 
161
{ Reference counting  }
 
162
{$ifndef GDK_PIXBUF_DISABLE_DEPRECATED}
 
163
function gdk_pixbuf_ref(pixbuf:PGdkPixbuf):PGdkPixbuf; cdecl; external gdkpixbuflib;
 
164
procedure gdk_pixbuf_unref(pixbuf:PGdkPixbuf); cdecl; external gdkpixbuflib;
 
165
{$endif}
 
166
 
 
167
 
 
168
{ GdkPixbuf accessors  }
 
169
function gdk_pixbuf_get_colorspace(pixbuf:PGdkPixbuf):TGdkColorspace; cdecl; external gdkpixbuflib;
 
170
function gdk_pixbuf_get_n_channels(pixbuf:PGdkPixbuf):longint; cdecl; external gdkpixbuflib;
 
171
function gdk_pixbuf_get_has_alpha(pixbuf:PGdkPixbuf):gboolean; cdecl; external gdkpixbuflib;
 
172
function gdk_pixbuf_get_bits_per_sample(pixbuf:PGdkPixbuf):longint; cdecl; external gdkpixbuflib;
 
173
function gdk_pixbuf_get_pixels(pixbuf:PGdkPixbuf):Pguchar; cdecl; external gdkpixbuflib;
 
174
function gdk_pixbuf_get_width(pixbuf:PGdkPixbuf):longint; cdecl; external gdkpixbuflib;
 
175
function gdk_pixbuf_get_height(pixbuf:PGdkPixbuf):longint; cdecl; external gdkpixbuflib;
 
176
function gdk_pixbuf_get_rowstride(pixbuf:PGdkPixbuf):longint; cdecl; external gdkpixbuflib;
 
177
 
 
178
{ Create a blank pixbuf with an optimal rowstride and a new buffer  }
 
179
function gdk_pixbuf_new(colorspace:TGdkColorspace; has_alpha:gboolean; bits_per_sample:longint; width:longint; height:longint):PGdkPixbuf; cdecl; external gdkpixbuflib;
 
180
 
 
181
{ Copy a pixbuf  }
 
182
function gdk_pixbuf_copy(pixbuf:PGdkPixbuf):PGdkPixbuf; cdecl; external gdkpixbuflib;
 
183
 
 
184
{ Create a pixbuf which points to the pixels of another pixbuf  }
 
185
function gdk_pixbuf_new_subpixbuf(src_pixbuf:PGdkPixbuf; src_x:longint; src_y:longint; width:longint; height:longint):PGdkPixbuf; cdecl; external gdkpixbuflib;
 
186
 
 
187
{ Simple loading  }
 
188
function gdk_pixbuf_new_from_file(filename:Pchar; error:PPGError):PGdkPixbuf; cdecl; external gdkpixbuflib;
 
189
function gdk_pixbuf_new_from_data(data:Pguchar; colorspace:TGdkColorspace; has_alpha:gboolean; bits_per_sample:longint; width:longint;
 
190
           height:longint; rowstride:longint; destroy_fn:TGdkPixbufDestroyNotify; destroy_fn_data:gpointer):PGdkPixbuf; cdecl; external gdkpixbuflib;
 
191
function gdk_pixbuf_new_from_xpm_data(data:PPchar):PGdkPixbuf; cdecl; external gdkpixbuflib;
 
192
function gdk_pixbuf_new_from_inline(data_length:gint; var data:guint8; copy_pixels:gboolean; error:PPGError):PGdkPixbuf; cdecl; external gdkpixbuflib;
 
193
 
 
194
{$IFDEF HasGTK2_4}
 
195
function gdk_pixbuf_new_from_file_at_size(filename:Pchar; width, height: gint;error:PPGError):PGdkPixbuf; cdecl; external gdkpixbuflib;
 
196
{$ENDIF HasGTK2_4}
 
197
{$IFDEF HasGTK2_6}
 
198
function gdk_pixbuf_new_from_file_at_scale(filename:Pchar; width, height: gint; preserve_aspect_ratio: gboolean; error:PPGError):PGdkPixbuf; cdecl; external gdkpixbuflib;
 
199
{$ENDIF HasGTK2_6}
 
200
 
 
201
{ Mutations  }
 
202
procedure gdk_pixbuf_fill(pixbuf:PGdkPixbuf; pixel:guint32); cdecl; external gdkpixbuflib;
 
203
 
 
204
{ Saving  }
 
205
{$IFNDEF KYLIX}
 
206
function gdk_pixbuf_save(pixbuf:PGdkPixbuf; filename:Pchar; _type:Pchar; error:PPGError; args:array of const):gboolean; cdecl; overload; external gdkpixbuflib;
 
207
function gdk_pixbuf_save(pixbuf:PGdkPixbuf; filename:Pchar; _type:Pchar; error:PPGError):gboolean; cdecl; overload; external gdkpixbuflib;
 
208
{$ELSE}
 
209
function gdk_pixbuf_save(pixbuf:PGdkPixbuf; filename:Pchar; _type:Pchar; error:PPGError):gboolean; varargs; cdecl; external gdkpixbuflib;
 
210
{$ENDIF}
 
211
function gdk_pixbuf_savev(pixbuf:PGdkPixbuf; filename:Pchar; _type:Pchar; option_keys:PPchar; option_values:PPchar;
 
212
           error:PPGError):gboolean; cdecl; external gdkpixbuflib;
 
213
 
 
214
{ Adding an alpha channel  }
 
215
function gdk_pixbuf_add_alpha(pixbuf:PGdkPixbuf; substitute_color:gboolean; r:guchar; g:guchar; b:guchar):PGdkPixbuf; cdecl; external gdkpixbuflib;
 
216
 
 
217
{ Copy an area of a pixbuf onto another one  }
 
218
procedure gdk_pixbuf_copy_area(src_pixbuf:PGdkPixbuf; src_x:longint; src_y:longint; width:longint; height:longint;
 
219
            dest_pixbuf:PGdkPixbuf; dest_x:longint; dest_y:longint); cdecl; external gdkpixbuflib;
 
220
 
 
221
{ Brighten/darken and optionally make it pixelated-looking  }
 
222
procedure gdk_pixbuf_saturate_and_pixelate(src:PGdkPixbuf; dest:PGdkPixbuf; saturation:gfloat; pixelate:gboolean); cdecl; external gdkpixbuflib;
 
223
 
 
224
 
 
225
{ Rendering to a drawable  }
 
226
{ Scaling  }
 
227
procedure gdk_pixbuf_scale(src:PGdkPixbuf; dest:PGdkPixbuf; dest_x:longint; dest_y:longint; dest_width:longint;
 
228
            dest_height:longint; offset_x:double; offset_y:double; scale_x:double; scale_y:double;
 
229
            interp_type:TGdkInterpType); cdecl; external gdkpixbuflib;
 
230
procedure gdk_pixbuf_composite(src:PGdkPixbuf; dest:PGdkPixbuf; dest_x:longint; dest_y:longint; dest_width:longint;
 
231
            dest_height:longint; offset_x:double; offset_y:double; scale_x:double; scale_y:double;
 
232
            interp_type:TGdkInterpType; overall_alpha:longint); cdecl; external gdkpixbuflib;
 
233
procedure gdk_pixbuf_composite_color(src:PGdkPixbuf; dest:PGdkPixbuf; dest_x:longint; dest_y:longint; dest_width:longint;
 
234
            dest_height:longint; offset_x:double; offset_y:double; scale_x:double; scale_y:double;
 
235
            interp_type:TGdkInterpType; overall_alpha:longint; check_x:longint; check_y:longint; check_size:longint;
 
236
            color1:guint32; color2:guint32); cdecl; external gdkpixbuflib;
 
237
function gdk_pixbuf_scale_simple(src:PGdkPixbuf; dest_width:longint; dest_height:longint; interp_type:TGdkInterpType):PGdkPixbuf; cdecl; external gdkpixbuflib;
 
238
function gdk_pixbuf_composite_color_simple(src:PGdkPixbuf; dest_width:longint; dest_height:longint; interp_type:TGdkInterpType; overall_alpha:longint;
 
239
           check_size:longint; color1:guint32; color2:guint32):PGdkPixbuf; cdecl; external gdkpixbuflib;
 
240
 
 
241
{ Animation support  }
 
242
function gdk_pixbuf_animation_get_type:GType; cdecl; external gdkpixbuflib;
 
243
function gdk_pixbuf_animation_new_from_file(filename:Pchar; error:PPGError):PGdkPixbufAnimation; cdecl; external gdkpixbuflib;
 
244
 
 
245
{$ifndef GDK_PIXBUF_DISABLE_DEPRECATED}
 
246
function gdk_pixbuf_animation_ref(animation:PGdkPixbufAnimation):PGdkPixbufAnimation; cdecl; external gdkpixbuflib;
 
247
procedure gdk_pixbuf_animation_unref(animation:PGdkPixbufAnimation); cdecl; external gdkpixbuflib;
 
248
{$endif}
 
249
 
 
250
function gdk_pixbuf_animation_get_width(animation:PGdkPixbufAnimation):longint; cdecl; external gdkpixbuflib;
 
251
function gdk_pixbuf_animation_get_height(animation:PGdkPixbufAnimation):longint; cdecl; external gdkpixbuflib;
 
252
function gdk_pixbuf_animation_is_static_image(animation:PGdkPixbufAnimation):gboolean; cdecl; external gdkpixbuflib;
 
253
function gdk_pixbuf_animation_get_static_image(animation:PGdkPixbufAnimation):PGdkPixbuf; cdecl; external gdkpixbuflib;
 
254
function gdk_pixbuf_animation_get_iter(animation:PGdkPixbufAnimation; var start_time:TGTimeVal):PGdkPixbufAnimationIter; cdecl; external gdkpixbuflib;
 
255
function gdk_pixbuf_animation_iter_get_type:GType; cdecl; external gdkpixbuflib;
 
256
function gdk_pixbuf_animation_iter_get_delay_time(iter:PGdkPixbufAnimationIter):longint; cdecl; external gdkpixbuflib;
 
257
function gdk_pixbuf_animation_iter_get_pixbuf(iter:PGdkPixbufAnimationIter):PGdkPixbuf; cdecl; external gdkpixbuflib;
 
258
function gdk_pixbuf_animation_iter_on_currently_loading_frame(iter:PGdkPixbufAnimationIter):gboolean; cdecl; external gdkpixbuflib;
 
259
function gdk_pixbuf_animation_iter_advance(iter:PGdkPixbufAnimationIter; var current_time:TGTimeVal):gboolean; cdecl; external gdkpixbuflib;
 
260
function gdk_pixbuf_get_option(pixbuf:PGdkPixbuf; key:Pgchar):Pgchar; cdecl; external gdkpixbuflib;
 
261
 
 
262
{$DEFINE read_interface}
 
263
{$include gdk-pixbuf-loader.inc}
 
264
{ $include gdk-pixbuf-enum-types.inc}
 
265
{$UNDEF read_interface}
 
266
 
 
267
 
 
268
implementation
 
269
 
 
270
 
 
271
{$DEFINE read_implementation}
 
272
{$include gdk-pixbuf-loader.inc}
 
273
{ $include gdk-pixbuf-enum-types.inc}
 
274
{$UNDEF read_implementation}
 
275
 
 
276
{$IFNDEF KYLIX}
 
277
{ There is a bug in the compiler. If an external variable is not used, it will
 
278
  create code, that can be relocated by the linker.
 
279
  So, use them in this hidden procedure.
 
280
}
 
281
procedure CheckUnusedVariable; [Public];
 
282
begin
 
283
  if (gdk_pixbuf_major_version=0)
 
284
  and (gdk_pixbuf_minor_version=0)
 
285
  and (gdk_pixbuf_micro_version=0)
 
286
  and (gdk_pixbuf_version=nil) then ;
 
287
end;
 
288
{$ENDIF}
 
289
 
 
290
 
 
291
function GDK_TYPE_PIXBUF : GType;
 
292
begin
 
293
  GDK_TYPE_PIXBUF:=gdk_pixbuf_get_type;
 
294
end;
 
295
 
 
296
function GDK_PIXBUF(anObject : pointer) : PGdkPixbuf;
 
297
begin
 
298
  GDK_PIXBUF:=PGdkPixbuf(G_TYPE_CHECK_INSTANCE_CAST(anObject,GDK_TYPE_PIXBUF));
 
299
end;
 
300
 
 
301
function GDK_IS_PIXBUF(anObject : pointer) : boolean;
 
302
begin
 
303
  GDK_IS_PIXBUF:=G_TYPE_CHECK_INSTANCE_TYPE(anObject,GDK_TYPE_PIXBUF);
 
304
end;
 
305
 
 
306
function GDK_TYPE_PIXBUF_ANIMATION : GType;
 
307
begin
 
308
  GDK_TYPE_PIXBUF_ANIMATION:=gdk_pixbuf_animation_get_type;
 
309
end;
 
310
 
 
311
function GDK_PIXBUF_ANIMATION(anObject : pointer) : PGdkPixbufAnimation;
 
312
begin
 
313
  GDK_PIXBUF_ANIMATION:=PGdkPixbufAnimation(G_TYPE_CHECK_INSTANCE_CAST(anObject,
 
314
                                                    GDK_TYPE_PIXBUF_ANIMATION));
 
315
end;
 
316
 
 
317
function GDK_IS_PIXBUF_ANIMATION(anObject : pointer) : boolean;
 
318
begin
 
319
  GDK_IS_PIXBUF_ANIMATION:=G_TYPE_CHECK_INSTANCE_TYPE(anObject,
 
320
                                                     GDK_TYPE_PIXBUF_ANIMATION);
 
321
end;
 
322
 
 
323
function GDK_TYPE_PIXBUF_ANIMATION_ITER : GType;
 
324
begin
 
325
  GDK_TYPE_PIXBUF_ANIMATION_ITER:=gdk_pixbuf_animation_iter_get_type;
 
326
end;
 
327
 
 
328
function GDK_PIXBUF_ANIMATION_ITER(anObject : pointer) : PGdkPixbufAnimationIter;
 
329
begin
 
330
  GDK_PIXBUF_ANIMATION_ITER:=PGdkPixbufAnimationIter(G_TYPE_CHECK_INSTANCE_CAST(
 
331
                                      anObject,GDK_TYPE_PIXBUF_ANIMATION_ITER));
 
332
end;
 
333
 
 
334
function GDK_IS_PIXBUF_ANIMATION_ITER(anObject : pointer) : boolean;
 
335
begin
 
336
  GDK_IS_PIXBUF_ANIMATION_ITER:=G_TYPE_CHECK_INSTANCE_TYPE(anObject,
 
337
                                                GDK_TYPE_PIXBUF_ANIMATION_ITER);
 
338
end;
 
339
 
 
340
function GDK_PIXBUF_ERROR : TGQuark;
 
341
begin
 
342
  GDK_PIXBUF_ERROR:=gdk_pixbuf_error_quark;
 
343
end;
 
344
 
 
345
 
 
346
end.