~ubuntu-branches/ubuntu/saucy/vips/saucy

« back to all changes in this revision

Viewing changes to libvips/deprecated/radiance.c

  • Committer: Package Import Robot
  • Author(s): Jay Berkenbilt
  • Date: 2012-03-18 16:54:58 UTC
  • mfrom: (1.1.17) (30.1.7 sid)
  • Revision ID: package-import@ubuntu.com-20120318165458-6okio21v96g3bd7t
Tags: 7.28.2-1
New upstream release

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* Read Radiance (.hdr) files 
 
2
 *
 
3
 * 20/12/11
 
4
 *      - just a compat stub
 
5
 */
 
6
 
 
7
/*
 
8
 
 
9
    This file is part of VIPS.
 
10
    
 
11
    VIPS is free software; you can redistribute it and/or modify
 
12
    it under the terms of the GNU Lesser General Public License as published by
 
13
    the Free Software Foundation; either version 2 of the License, or
 
14
    (at your option) any later version.
 
15
 
 
16
    This program is distributed in the hope that it will be useful,
 
17
    but WITHOUT ANY WARRANTY; without even the implied warranty of
 
18
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
19
    GNU Lesser General Public License for more details.
 
20
 
 
21
    You should have received a copy of the GNU Lesser General Public License
 
22
    along with this program; if not, write to the Free Software
 
23
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
24
 
 
25
 */
 
26
 
 
27
/*
 
28
 
 
29
    These files are distributed with VIPS - http://www.vips.ecs.soton.ac.uk
 
30
 
 
31
 */
 
32
 
 
33
#ifdef HAVE_CONFIG_H
 
34
#include <config.h>
 
35
#endif /*HAVE_CONFIG_H*/
 
36
#include <vips/intl.h>
 
37
 
 
38
#include <vips/vips.h>
 
39
 
 
40
int
 
41
im_rad2vips( const char *filename, IMAGE *out )
 
42
{
 
43
        VipsImage *t;
 
44
 
 
45
        if( vips_radload( filename, &t, NULL ) )
 
46
                return( -1 );
 
47
        if( vips_image_write( t, out ) ) {
 
48
                g_object_unref( t );
 
49
                return( -1 );
 
50
        }
 
51
        g_object_unref( t );
 
52
 
 
53
        return( 0 );
 
54
}
 
55
 
 
56
static int
 
57
israd( const char *filename )
 
58
{
 
59
        return( vips_foreign_is_a( "radload", filename ) );
 
60
}
 
61
 
 
62
int
 
63
im_vips2rad( IMAGE *in, const char *filename )
 
64
{
 
65
        return( vips_radsave( in, filename, NULL ) ); 
 
66
}
 
67
 
 
68
static const char *rad_suffs[] = { ".hdr", NULL };
 
69
 
 
70
typedef VipsFormat VipsFormatRad;
 
71
typedef VipsFormatClass VipsFormatRadClass;
 
72
 
 
73
static void
 
74
vips_format_rad_class_init( VipsFormatRadClass *class )
 
75
{
 
76
        VipsObjectClass *object_class = (VipsObjectClass *) class;
 
77
        VipsFormatClass *format_class = (VipsFormatClass *) class;
 
78
 
 
79
        object_class->nickname = "rad";
 
80
        object_class->description = _( "Radiance" );
 
81
 
 
82
        format_class->is_a = israd;
 
83
        format_class->load = im_rad2vips;
 
84
        format_class->save = im_vips2rad;
 
85
        format_class->suffs = rad_suffs;
 
86
}
 
87
 
 
88
static void
 
89
vips_format_rad_init( VipsFormatRad *object )
 
90
{
 
91
}
 
92
 
 
93
G_DEFINE_TYPE( VipsFormatRad, vips_format_rad, VIPS_TYPE_FORMAT );
 
94