move im_zone*() over to a class
This commit is contained in:
parent
85e2092cdf
commit
6031b40b8d
@ -4,7 +4,7 @@
|
||||
- fix no-pango build
|
||||
- add im_vips2dz(): run the deepzoom writer from vips7
|
||||
- vips_magickload() has an option to read all images in a sequence
|
||||
- redo im_make_xy(), im_*eye() as classes
|
||||
- redo im_make_xy(), im_*eye(), im_zone*() as classes
|
||||
|
||||
12/3/13 started 7.33.0
|
||||
- vipsthumbnail lets you specify the sharpening mask
|
||||
|
6
TODO
6
TODO
@ -1,8 +1,8 @@
|
||||
|
||||
- move im_make_xy() to deprecated, add something to make higher-dimension
|
||||
images too
|
||||
- the rest of "create" can be classed quickly
|
||||
|
||||
|
||||
|
||||
use in heart analysis
|
||||
|
||||
- look at
|
||||
|
||||
|
@ -4,14 +4,13 @@ libcreate_la_SOURCES = \
|
||||
create.c \
|
||||
eye.c \
|
||||
grey.c \
|
||||
zone.c \
|
||||
xyz.c \
|
||||
black.c \
|
||||
text.c \
|
||||
gaussnoise.c \
|
||||
im_benchmark.c \
|
||||
im_sines.c \
|
||||
im_zone.c \
|
||||
zone.c \
|
||||
other_dispatch.c
|
||||
|
||||
AM_CPPFLAGS = -I${top_srcdir}/libvips/include @VIPS_CFLAGS@ @VIPS_INCLUDES@
|
||||
|
@ -1,135 +0,0 @@
|
||||
/* square zone plate of size
|
||||
*
|
||||
* N. Dessipris 01/02/1991
|
||||
*
|
||||
* 22/7/93 JC
|
||||
* - externs removed
|
||||
* - im_outcheck() added
|
||||
* 30/8/95 JC
|
||||
* - modernized
|
||||
* - memory leaks fixed
|
||||
* - split into im_zone() and im_fzone()
|
||||
* 1/2/11
|
||||
* - gtk-doc
|
||||
*/
|
||||
|
||||
/*
|
||||
|
||||
This file is part of VIPS.
|
||||
|
||||
VIPS is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
02110-1301 USA
|
||||
|
||||
*/
|
||||
|
||||
/*
|
||||
|
||||
These files are distributed with VIPS - http://www.vips.ecs.soton.ac.uk
|
||||
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif /*HAVE_CONFIG_H*/
|
||||
#include <vips/intl.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
|
||||
#include <vips/vips.h>
|
||||
|
||||
/**
|
||||
* im_fzone:
|
||||
* @out: output image
|
||||
* @size: image size
|
||||
*
|
||||
* Create a one-band float image of size @size by @size pixels of a zone
|
||||
* plate. Pixels are in [-1, +1].
|
||||
*
|
||||
* See also: im_grey(), im_make_xy(), im_identity().
|
||||
*
|
||||
* Returns: 0 on success, -1 on error
|
||||
*/
|
||||
int
|
||||
im_fzone( IMAGE *out, int size )
|
||||
{
|
||||
int x, y;
|
||||
int i, j;
|
||||
|
||||
float *buf;
|
||||
const int size2 = size/2;
|
||||
|
||||
/* Check args.
|
||||
*/
|
||||
if( im_outcheck( out ) )
|
||||
return( -1 );
|
||||
if( size <= 0 || (size % 2) != 0 ) {
|
||||
im_error( "im_zone", "%s",
|
||||
_( "size must be even and positive" ) );
|
||||
return( -1 );
|
||||
}
|
||||
|
||||
/* Set up output out.
|
||||
*/
|
||||
im_initdesc( out, size, size, 1, IM_BBITS_FLOAT, IM_BANDFMT_FLOAT,
|
||||
IM_CODING_NONE, IM_TYPE_B_W, 1.0, 1.0, 0, 0 );
|
||||
if( im_setupout( out ) )
|
||||
return( -1 );
|
||||
|
||||
/* Create output buffer.
|
||||
*/
|
||||
if( !(buf = IM_ARRAY( out, size, float )) )
|
||||
return( -1 );
|
||||
|
||||
/* Make zone plate.
|
||||
*/
|
||||
for( y = 0, j = -size2; j < size2; j++, y++ ) {
|
||||
for( x = 0, i = -size2; i < size2; i++, x++ )
|
||||
buf[x] = cos( (IM_PI / size) * (i * i + j * j) );
|
||||
if( im_writeline( y, out, (PEL *) buf ) )
|
||||
return( -1 );
|
||||
}
|
||||
|
||||
return( 0 );
|
||||
}
|
||||
|
||||
/**
|
||||
* im_zone:
|
||||
* @out: output image
|
||||
* @size: image size
|
||||
*
|
||||
* Create a one-band uchar image of size @size by @size pixels of a zone
|
||||
* plate. Pixels are in [0, 255].
|
||||
*
|
||||
* See also: im_grey(), im_make_xy(), im_identity().
|
||||
*
|
||||
* Returns: 0 on success, -1 on error
|
||||
*/
|
||||
int
|
||||
im_zone( IMAGE *out, int size )
|
||||
{
|
||||
IMAGE *t[2];
|
||||
|
||||
/* Change range to [0,255].
|
||||
*/
|
||||
if( im_open_local_array( out, t, 2, "im_grey", "p" ) ||
|
||||
im_fzone( t[0], size ) ||
|
||||
im_lintra( 127.5, t[0], 127.5, t[1] ) ||
|
||||
im_clip2fmt( t[1], out, IM_BANDFMT_UCHAR ) )
|
||||
return( -1 );
|
||||
|
||||
return( 0 );
|
||||
}
|
@ -1575,6 +1575,40 @@ im_make_xy( IMAGE *out, const int xsize, const int ysize )
|
||||
return( 0 );
|
||||
}
|
||||
|
||||
int
|
||||
im_zone( IMAGE *out, int size )
|
||||
{
|
||||
VipsImage *t;
|
||||
|
||||
if( vips_zone( &t, size, size,
|
||||
"uchar", TRUE,
|
||||
NULL ) )
|
||||
return( -1 );
|
||||
if( vips_image_write( t, out ) ) {
|
||||
g_object_unref( t );
|
||||
return( -1 );
|
||||
}
|
||||
g_object_unref( t );
|
||||
|
||||
return( 0 );
|
||||
}
|
||||
|
||||
int
|
||||
im_fzone( IMAGE *out, int size )
|
||||
{
|
||||
VipsImage *t;
|
||||
|
||||
if( vips_zone( &t, size, size, NULL ) )
|
||||
return( -1 );
|
||||
if( vips_image_write( t, out ) ) {
|
||||
g_object_unref( t );
|
||||
return( -1 );
|
||||
}
|
||||
g_object_unref( t );
|
||||
|
||||
return( 0 );
|
||||
}
|
||||
|
||||
int
|
||||
im_text( IMAGE *out, const char *text, const char *font,
|
||||
int width, int align, int dpi )
|
||||
|
@ -60,8 +60,6 @@ int vips_zone( VipsImage **out, int width, int height, ... )
|
||||
|
||||
|
||||
|
||||
int im_zone( VipsImage *out, int size );
|
||||
int im_fzone( VipsImage *out, int size );
|
||||
int im_sines( VipsImage *out,
|
||||
int xsize, int ysize, double horfreq, double verfreq );
|
||||
|
||||
|
@ -710,9 +710,6 @@ int im_rotquad( VipsImage *in, VipsImage *out );
|
||||
int im_clip2fmt( VipsImage *in, VipsImage *out, VipsBandFormat fmt );
|
||||
int im_bandjoin( VipsImage *in1, VipsImage *in2, VipsImage *out );
|
||||
int im_gbandjoin( VipsImage **in, VipsImage *out, int n );
|
||||
int im_black( VipsImage *out, int x, int y, int bands );
|
||||
int im_make_xy( VipsImage *out, const int xsize, const int ysize );
|
||||
int im_gaussnoise( VipsImage *out, int x, int y, double mean, double sigma );
|
||||
int im_grid( VipsImage *in, VipsImage *out, int tile_height, int across, int down );
|
||||
int im_scale( VipsImage *in, VipsImage *out );
|
||||
int im_scaleps( VipsImage *in, VipsImage *out );
|
||||
@ -720,8 +717,20 @@ int im_msb( VipsImage *in, VipsImage *out );
|
||||
int im_msb_band( VipsImage *in, VipsImage *out, int band );
|
||||
int im_zoom( VipsImage *in, VipsImage *out, int xfac, int yfac );
|
||||
int im_subsample( VipsImage *in, VipsImage *out, int xshrink, int yshrink );
|
||||
|
||||
int im_gaussnoise( VipsImage *out, int x, int y, double mean, double sigma );
|
||||
int im_text( VipsImage *out, const char *text, const char *font,
|
||||
int width, int alignment, int dpi );
|
||||
int im_black( VipsImage *out, int x, int y, int bands );
|
||||
int im_make_xy( VipsImage *out, const int xsize, const int ysize );
|
||||
int im_zone( VipsImage *out, int size );
|
||||
int im_fzone( VipsImage *out, int size );
|
||||
int im_feye( VipsImage *out,
|
||||
const int xsize, const int ysize, const double factor );
|
||||
int im_eye( VipsImage *out,
|
||||
const int xsize, const int ysize, const double factor );
|
||||
int im_grey( VipsImage *out, const int xsize, const int ysize );
|
||||
int im_fgrey( VipsImage *out, const int xsize, const int ysize );
|
||||
|
||||
int im_system( VipsImage *im, const char *cmd, char **out );
|
||||
VipsImage *im_system_image( VipsImage *im,
|
||||
@ -741,13 +750,6 @@ int im_rot270( VipsImage *in, VipsImage *out );
|
||||
int im_ifthenelse( VipsImage *c, VipsImage *a, VipsImage *b, VipsImage *out );
|
||||
int im_blend( VipsImage *c, VipsImage *a, VipsImage *b, VipsImage *out );
|
||||
|
||||
int im_feye( VipsImage *out,
|
||||
const int xsize, const int ysize, const double factor );
|
||||
int im_eye( VipsImage *out,
|
||||
const int xsize, const int ysize, const double factor );
|
||||
int im_grey( VipsImage *out, const int xsize, const int ysize );
|
||||
int im_fgrey( VipsImage *out, const int xsize, const int ysize );
|
||||
|
||||
DOUBLEMASK *im_vips2mask( VipsImage *in, const char *filename );
|
||||
int im_mask2vips( DOUBLEMASK *in, VipsImage *out );
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user