final fixups

This commit is contained in:
John Cupitt 2016-07-24 14:47:22 +01:00
parent 6db9a2fdf9
commit 2dc43198e4
9 changed files with 109 additions and 68 deletions

2
TODO
View File

@ -1,5 +1,3 @@
- add tests for perlin and worley noise generators
- add more webp tests to py suite
- try moving some more of the CLI tests to py

View File

@ -22,6 +22,8 @@ import re
import logging
#logging.basicConfig(level = logging.DEBUG)
import gi
gi.require_version('Vips', '8.0')
from gi.repository import Vips, GObject
vips_type_image = GObject.GType.from_name("VipsImage")

View File

@ -12,6 +12,8 @@ import re
import logging
#logging.basicConfig(level = logging.DEBUG)
import gi
gi.require_version('Vips', '8.0')
from gi.repository import Vips, GObject
vips_type_image = GObject.GType.from_name("VipsImage")

View File

@ -1,7 +1,3 @@
// headers for vips operations
// Fri Feb 12 20:04:03 GMT 2016
// this file is generated automatically, do not edit!
static void system( char * cmd_format , VOption *options = 0 );
VImage add( VImage right , VOption *options = 0 );
VImage subtract( VImage right , VOption *options = 0 );
@ -103,13 +99,15 @@ VImage invertlut( VOption *options = 0 );
static VImage tonelut( VOption *options = 0 );
static VImage identity( VOption *options = 0 );
static VImage fractsurf( int width , int height , double fractal_dimension , VOption *options = 0 );
static VImage radload( char * filename , VOption *options = 0 );
static VImage ppmload( char * filename , VOption *options = 0 );
static VImage worley( int width , int height , VOption *options = 0 );
static VImage perlin( int width , int height , VOption *options = 0 );
static VImage csvload( char * filename , VOption *options = 0 );
static VImage matrixload( char * filename , VOption *options = 0 );
static VImage analyzeload( char * filename , VOption *options = 0 );
static VImage rawload( char * filename , int width , int height , int bands , VOption *options = 0 );
static VImage vipsload( char * filename , VOption *options = 0 );
static VImage analyzeload( char * filename , VOption *options = 0 );
static VImage ppmload( char * filename , VOption *options = 0 );
static VImage radload( char * filename , VOption *options = 0 );
static VImage pdfload( char * filename , VOption *options = 0 );
static VImage pdfload_buffer( VipsBlob * buffer , VOption *options = 0 );
static VImage svgload( char * filename , VOption *options = 0 );
@ -130,15 +128,15 @@ static VImage magickload( char * filename , VOption *options = 0 );
static VImage magickload_buffer( VipsBlob * buffer , VOption *options = 0 );
static VImage fitsload( char * filename , VOption *options = 0 );
static VImage openexrload( char * filename , VOption *options = 0 );
void radsave( char * filename , VOption *options = 0 );
VipsBlob * radsave_buffer( VOption *options = 0 );
void ppmsave( char * filename , VOption *options = 0 );
void csvsave( char * filename , VOption *options = 0 );
void matrixsave( char * filename , VOption *options = 0 );
void matrixprint( VOption *options = 0 );
void rawsave( char * filename , VOption *options = 0 );
void rawsave_fd( int fd , VOption *options = 0 );
void vipssave( char * filename , VOption *options = 0 );
void ppmsave( char * filename , VOption *options = 0 );
void radsave( char * filename , VOption *options = 0 );
VipsBlob * radsave_buffer( VOption *options = 0 );
void dzsave( char * filename , VOption *options = 0 );
void pngsave( char * filename , VOption *options = 0 );
VipsBlob * pngsave_buffer( VOption *options = 0 );

View File

@ -1,7 +1,3 @@
// bodies for vips operations
// Fri Feb 12 20:03:53 GMT 2016
// this file is generated automatically, do not edit!
void VImage::system( char * cmd_format , VOption *options )
{
call( "system" ,
@ -1321,26 +1317,28 @@ VImage VImage::fractsurf( int width , int height , double fractal_dimension , VO
return( out );
}
VImage VImage::radload( char * filename , VOption *options )
VImage VImage::worley( int width , int height , VOption *options )
{
VImage out;
call( "radload" ,
call( "worley" ,
(options ? options : VImage::option()) ->
set( "filename", filename ) ->
set( "out", &out ) );
set( "out", &out ) ->
set( "width", width ) ->
set( "height", height ) );
return( out );
}
VImage VImage::ppmload( char * filename , VOption *options )
VImage VImage::perlin( int width , int height , VOption *options )
{
VImage out;
call( "ppmload" ,
call( "perlin" ,
(options ? options : VImage::option()) ->
set( "filename", filename ) ->
set( "out", &out ) );
set( "out", &out ) ->
set( "width", width ) ->
set( "height", height ) );
return( out );
}
@ -1369,18 +1367,6 @@ VImage VImage::matrixload( char * filename , VOption *options )
return( out );
}
VImage VImage::analyzeload( char * filename , VOption *options )
{
VImage out;
call( "analyzeload" ,
(options ? options : VImage::option()) ->
set( "filename", filename ) ->
set( "out", &out ) );
return( out );
}
VImage VImage::rawload( char * filename , int width , int height , int bands , VOption *options )
{
VImage out;
@ -1408,6 +1394,42 @@ VImage VImage::vipsload( char * filename , VOption *options )
return( out );
}
VImage VImage::analyzeload( char * filename , VOption *options )
{
VImage out;
call( "analyzeload" ,
(options ? options : VImage::option()) ->
set( "filename", filename ) ->
set( "out", &out ) );
return( out );
}
VImage VImage::ppmload( char * filename , VOption *options )
{
VImage out;
call( "ppmload" ,
(options ? options : VImage::option()) ->
set( "filename", filename ) ->
set( "out", &out ) );
return( out );
}
VImage VImage::radload( char * filename , VOption *options )
{
VImage out;
call( "radload" ,
(options ? options : VImage::option()) ->
set( "filename", filename ) ->
set( "out", &out ) );
return( out );
}
VImage VImage::pdfload( char * filename , VOption *options )
{
VImage out;
@ -1648,34 +1670,6 @@ VImage VImage::openexrload( char * filename , VOption *options )
return( out );
}
void VImage::radsave( char * filename , VOption *options )
{
call( "radsave" ,
(options ? options : VImage::option()) ->
set( "in", *this ) ->
set( "filename", filename ) );
}
VipsBlob * VImage::radsave_buffer( VOption *options )
{
VipsBlob * buffer;
call( "radsave_buffer" ,
(options ? options : VImage::option()) ->
set( "in", *this ) ->
set( "buffer", &buffer ) );
return( buffer );
}
void VImage::ppmsave( char * filename , VOption *options )
{
call( "ppmsave" ,
(options ? options : VImage::option()) ->
set( "in", *this ) ->
set( "filename", filename ) );
}
void VImage::csvsave( char * filename , VOption *options )
{
call( "csvsave" ,
@ -1723,6 +1717,34 @@ void VImage::vipssave( char * filename , VOption *options )
set( "filename", filename ) );
}
void VImage::ppmsave( char * filename , VOption *options )
{
call( "ppmsave" ,
(options ? options : VImage::option()) ->
set( "in", *this ) ->
set( "filename", filename ) );
}
void VImage::radsave( char * filename , VOption *options )
{
call( "radsave" ,
(options ? options : VImage::option()) ->
set( "in", *this ) ->
set( "filename", filename ) );
}
VipsBlob * VImage::radsave_buffer( VOption *options )
{
VipsBlob * buffer;
call( "radsave_buffer" ,
(options ? options : VImage::option()) ->
set( "in", *this ) ->
set( "buffer", &buffer ) );
return( buffer );
}
void VImage::dzsave( char * filename , VOption *options )
{
call( "dzsave" ,

View File

@ -140,16 +140,17 @@ vips_perlin_create_cells( VipsPerlin *perlin,
/* When we calculate the seed for this cell, we wrap
* around so that our output will tesselate.
*/
if( cx >= perlin->cells_across )
cx = 0;
seed = vips_perlin_seed_add( seed, cx );
if( cy >= perlin->cells_down )
cy = 0;
seed = vips_perlin_seed_add( seed, cy );
if( cx >= perlin->cells_across )
cx = 0;
seed = vips_perlin_seed_add( seed, cx );
seed = vips_perlin_random( seed );
angle = seed & 0xff;
angle = (seed ^ (seed >> 8) ^ (seed >> 16)) & 0xff;
gx[ci] = vips_perlin_cos[angle];
gy[ci] = vips_perlin_sin[angle];

View File

@ -5,6 +5,8 @@ import sys
import logging
#logging.basicConfig(level = logging.DEBUG)
import gi
gi.require_version('Vips', '8.0')
from gi.repository import Vips, GObject
# Search for all VipsOperation which don't have an input image object ... these

View File

@ -1093,6 +1093,8 @@ class_methods = [
"mask_fractal",
"tonelut",
"identity",
"perlin",
"worley",
"fractsurf",
"radload",
"ppmload",

View File

@ -441,5 +441,19 @@ class TestCreate(unittest.TestCase):
self.assertEqual(im.bands, 1)
self.assertEqual(im.format, Vips.BandFormat.FLOAT)
def test_worley(self):
im = Vips.Image.worley(512, 512)
self.assertEqual(im.width, 512)
self.assertEqual(im.height, 512)
self.assertEqual(im.bands, 1)
self.assertEqual(im.format, Vips.BandFormat.INT)
def test_perlin(self):
im = Vips.Image.perlin(512, 512)
self.assertEqual(im.width, 512)
self.assertEqual(im.height, 512)
self.assertEqual(im.bands, 1)
self.assertEqual(im.format, Vips.BandFormat.FLOAT)
if __name__ == '__main__':
unittest.main()