~ubuntu-branches/ubuntu/maverick/gdk-pixbuf/maverick

« back to all changes in this revision

Viewing changes to gdk-pixbuf/io-gdip-tiff.c

  • Committer: Bazaar Package Importer
  • Author(s): Sebastien Bacher
  • Date: 2010-07-23 11:26:25 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20100723112625-owhl395g8ifk2wtn
Tags: 2.21.6-2ubuntu1
* Rebase on Debian
* debian/control, debian/gir1.0-gdkpixbuf-2.0.install, debian/rules:
  - build a gir1.0-gdkpixbuf-2.0 gir binary

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 
2
/* GdkPixbuf library - Win32 GDI+ Pixbuf Loader
 
3
 *
 
4
 * Copyright (C) 2008 Dominic Lachowicz
 
5
 * Copyright (C) 2008 Alberto Ruiz
 
6
 *
 
7
 * Authors: Dominic Lachowicz <domlachowicz@gmail.com>
 
8
 *          Alberto Ruiz <aruiz@gnome.org>
 
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  * You should have received a copy of the GNU Lesser General Public
 
19
 * License along with this library; if not, write to the
 
20
 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 
21
 * Boston, MA 02111-1307, USA.
 
22
 */
 
23
 
 
24
#include "io-gdip-utils.h"
 
25
 
 
26
static gboolean
 
27
gdk_pixbuf__gdip_image_save_TIFF_to_callback (GdkPixbufSaveFunc   save_func,
 
28
                                              gpointer            user_data,
 
29
                                              GdkPixbuf          *pixbuf,
 
30
                                              gchar             **keys,
 
31
                                              gchar             **values,
 
32
                                              GError            **error)
 
33
{
 
34
  return gdip_save_pixbuf (pixbuf, L"image/tiff", NULL, save_func, user_data, error);
 
35
}
 
36
 
 
37
static gboolean
 
38
gdk_pixbuf__gdip_image_save_TIFF (FILE         *f,
 
39
                                 GdkPixbuf     *pixbuf,
 
40
                                 gchar        **keys,
 
41
                                 gchar        **values,
 
42
                                 GError       **error)
 
43
{
 
44
  return gdk_pixbuf__gdip_image_save_TIFF_to_callback (gdip_save_to_file_callback, f, pixbuf, keys, values, error);
 
45
}
 
46
 
 
47
#ifndef INCLUDE_gdiplus
 
48
#define MODULE_ENTRY(function) G_MODULE_EXPORT void function
 
49
#else
 
50
#define MODULE_ENTRY(function) void _gdk_pixbuf__gdip_tiff_ ## function
 
51
#endif
 
52
 
 
53
MODULE_ENTRY (fill_vtable) (GdkPixbufModule *module)
 
54
{
 
55
  gdip_fill_vtable (module);
 
56
 
 
57
  module->save_to_callback = gdk_pixbuf__gdip_image_save_TIFF_to_callback;
 
58
  module->save = gdk_pixbuf__gdip_image_save_TIFF; /* for gtk < 2.14, you need to implement both. otherwise gdk-pixbuf-queryloaders fails */
 
59
}
 
60
 
 
61
MODULE_ENTRY (fill_info) (GdkPixbufFormat *info)
 
62
{
 
63
  static GdkPixbufModulePattern signature[] = {
 
64
    { "MM \x2a", "  z ", 100 }, /* TIFF */
 
65
    { "II\x2a ", "   z", 100 }, /* TIFF */
 
66
    { NULL, NULL, 0 }
 
67
  };
 
68
 
 
69
  static gchar *mime_types[] = {
 
70
    "image/tiff",
 
71
    NULL
 
72
  };
 
73
 
 
74
  static gchar *extensions[] = {
 
75
    "tiff",
 
76
    "tif",
 
77
    NULL
 
78
  };
 
79
 
 
80
  info->name        = "tiff";
 
81
  info->signature   = signature;
 
82
  info->description = "The TIFF image format";
 
83
  info->mime_types  = mime_types;
 
84
  info->extensions  = extensions;
 
85
  info->flags       = GDK_PIXBUF_FORMAT_WRITABLE | GDK_PIXBUF_FORMAT_THREADSAFE;
 
86
  info->license     = "LGPL";
 
87
}