1 /* a hist operation implemented as a unary processor
2  *
3  * properties:
4  * 	- single hist to single hist
5  */
6 
7 /*
8 
9     Copyright (C) 1991-2005 The National Gallery
10 
11     This library is free software; you can redistribute it and/or
12     modify it under the terms of the GNU Lesser General Public
13     License as published by the Free Software Foundation; either
14     version 2.1 of the License, or (at your option) any later version.
15 
16     This library 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 GNU
19     Lesser General Public License for more details.
20 
21     You should have received a copy of the GNU Lesser General Public
22     License along with this library; if not, write to the Free Software
23     Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
24     02110-1301  USA
25 
26  */
27 
28 /*
29 
30     These files are distributed with VIPS - http://www.vips.ecs.soton.ac.uk
31 
32  */
33 
34 /*
35 #define DEBUG
36  */
37 
38 #ifdef HAVE_CONFIG_H
39 #include <config.h>
40 #endif /*HAVE_CONFIG_H*/
41 #include <vips/intl.h>
42 
43 #include <stdio.h>
44 #include <stdlib.h>
45 #include <math.h>
46 
47 #include <vips/vips.h>
48 #include <vips/internal.h>
49 
50 #include "phistogram.h"
51 #include "hist_unary.h"
52 
53 G_DEFINE_ABSTRACT_TYPE( VipsHistUnary, vips_hist_unary, VIPS_TYPE_HISTOGRAM );
54 
55 static int
vips_hist_unary_build(VipsObject * object)56 vips_hist_unary_build( VipsObject *object )
57 {
58 	VipsHistogram *histogram = VIPS_HISTOGRAM( object );
59 	VipsHistUnary *unary = VIPS_HIST_UNARY( object );
60 
61 	histogram->n = 1;
62 	histogram->in = (VipsImage **) vips_object_local_array( object, 1 );
63 	histogram->in[0] = unary->in;
64 
65 	if( histogram->in[0] )
66 		g_object_ref( histogram->in[0] );
67 
68 	if( VIPS_OBJECT_CLASS( vips_hist_unary_parent_class )->
69 		build( object ) )
70 		return( -1 );
71 
72 	return( 0 );
73 }
74 
75 static void
vips_hist_unary_class_init(VipsHistUnaryClass * class)76 vips_hist_unary_class_init( VipsHistUnaryClass *class )
77 {
78 	GObjectClass *gobject_class = G_OBJECT_CLASS( class );
79 	VipsObjectClass *vobject_class = VIPS_OBJECT_CLASS( class );
80 
81 	gobject_class->set_property = vips_object_set_property;
82 	gobject_class->get_property = vips_object_get_property;
83 
84 	vobject_class->nickname = "hist_unary";
85 	vobject_class->description = _( "hist_unary operations" );
86 	vobject_class->build = vips_hist_unary_build;
87 
88 	VIPS_ARG_IMAGE( class, "in", 1,
89 		_( "Input" ),
90 		_( "Input image" ),
91 		VIPS_ARGUMENT_REQUIRED_INPUT,
92 		G_STRUCT_OFFSET( VipsHistUnary, in ) );
93 
94 }
95 
96 static void
vips_hist_unary_init(VipsHistUnary * hist_unary)97 vips_hist_unary_init( VipsHistUnary *hist_unary )
98 {
99 }
100