Skip to content

Commit 83fe8e0

Browse files
committed
fix: Do not use Vips Prefix
1 parent cdfb09e commit 83fe8e0

File tree

12 files changed

+74
-74
lines changed

12 files changed

+74
-74
lines changed

examples/generate_phpdoc.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@
3232
GValue.array_double_type: 'float[]|float',
3333
GValue.array_image_type: 'Image[]|Image',
3434
GValue.blob_type: 'string',
35-
GValue.source_type: 'VipsSource',
36-
GValue.target_type: 'VipsTarget'
35+
GValue.source_type: 'Source',
36+
GValue.target_type: 'Target'
3737
}
3838

3939
# php result type names are different, annoyingly, and very restricted
@@ -51,8 +51,8 @@
5151
GValue.array_double_type: 'array',
5252
GValue.array_image_type: 'array',
5353
GValue.blob_type: 'string',
54-
GValue.source_type: 'VipsSource',
55-
GValue.target_type: 'VipsTarget'
54+
GValue.source_type: 'Source',
55+
GValue.target_type: 'Target'
5656
}
5757

5858
# values for VipsArgumentFlags

examples/streaming-bench.php

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33

44
use Jcupitt\Vips\Config;
55
use Jcupitt\Vips\Image;
6-
use Jcupitt\Vips\VipsSource;
7-
use Jcupitt\Vips\VipsSourceResource;
8-
use Jcupitt\Vips\VipsTarget;
9-
use Jcupitt\Vips\VipsTargetResource;
6+
use Jcupitt\Vips\Source;
7+
use Jcupitt\Vips\SourceResource;
8+
use Jcupitt\Vips\Target;
9+
use Jcupitt\Vips\TargetResource;
1010

1111
require dirname(__DIR__) . '/vendor/autoload.php';
1212

@@ -24,8 +24,8 @@
2424
$start = microtime(true);
2525

2626
for ($i = 0; $i < $iterations; $i++) {
27-
$source = new VipsSourceResource(fopen($sourceFile, 'rb'));
28-
$target = new VipsTargetResource(fopen($targetFile, 'wb+'));
27+
$source = new SourceResource(fopen($sourceFile, 'rb'));
28+
$target = new TargetResource(fopen($targetFile, 'wb+'));
2929
$image = Image::newFromSource($source, '', $sourceOptions);
3030
$image = $image->resize($targetWidth / $image->width);
3131
$image->writeToTarget(
@@ -42,8 +42,8 @@
4242
$start = microtime(true);
4343

4444
for ($i = 0; $i < $iterations; $i++) {
45-
$source = VipsSource::newFromFile($sourceFile);
46-
$target = VipsTarget::newToFile($targetFile);
45+
$source = Source::newFromFile($sourceFile);
46+
$target = Target::newToFile($targetFile);
4747
$image = Image::newFromSource($source, '', $sourceOptions);
4848
$image = $image->resize($targetWidth / $image->width);
4949
$image->writeToTarget(
@@ -60,8 +60,8 @@
6060
$start = microtime(true);
6161

6262
for ($i = 0; $i < $iterations; $i++) {
63-
$source = new VipsSourceResource(fopen($sourceFile, 'rb'));
64-
$target = new VipsTargetResource(fopen($targetFile, 'wb+'));
63+
$source = new SourceResource(fopen($sourceFile, 'rb'));
64+
$target = new TargetResource(fopen($targetFile, 'wb+'));
6565
$image = Image::thumbnail_source($source, $targetWidth);
6666
$image->writeToTarget(
6767
$target,
@@ -77,8 +77,8 @@
7777
$start = microtime(true);
7878

7979
for ($i = 0; $i < $iterations; $i++) {
80-
$source = VipsSource::newFromFile($sourceFile);
81-
$target = VipsTarget::newToFile($targetFile);
80+
$source = Source::newFromFile($sourceFile);
81+
$target = Target::newToFile($targetFile);
8282
$image = Image::thumbnail_source($source, $targetWidth);
8383
$image->writeToTarget(
8484
$target,

examples/streaming.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
require dirname(__DIR__) . '/vendor/autoload.php';
55

66
use Jcupitt\Vips;
7-
use Jcupitt\Vips\VipsSource;
7+
use Jcupitt\Vips\Source;
88

9-
$source = VipsSource::newFromFile(dirname(__DIR__) . '/tests/images/img_0076.jpg');
10-
$target = Vips\VipsTarget::newToFile(dirname(__DIR__) . "/tests/images/target.jpg");
9+
$source = Source::newFromFile(dirname(__DIR__) . '/tests/images/img_0076.jpg');
10+
$target = Vips\Target::newToFile(dirname(__DIR__) . "/tests/images/target.jpg");
1111
$image = Vips\Image::newFromSource($source);
1212
$image->writeToTarget($target, '.jpg[Q=95]');

src/Image.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -906,18 +906,18 @@ public function newFromImage($value): Image
906906
* example 'VipsForeignLoadJpegSource'. You can use this to work out what
907907
* options to pass to newFromSource().
908908
*
909-
* @param VipsSource $source The source to test
909+
* @param Source $source The source to test
910910
* @return string|null The name of the load operation, or null.
911911
*/
912-
public static function findLoadSource(VipsSource $source): ?string
912+
public static function findLoadSource(Source $source): ?string
913913
{
914914
return FFI::vips()->vips_foreign_find_load_source(\FFI::cast(FFI::ctypes('VipsSource'), $source->pointer));
915915
}
916916

917917
/**
918918
* @throws Exception
919919
*/
920-
public static function newFromSource(VipsSource $source, string $string_options = '', array $options = []): self
920+
public static function newFromSource(Source $source, string $string_options = '', array $options = []): self
921921
{
922922
$loader = self::findLoadSource($source);
923923
if ($loader === null) {
@@ -1075,7 +1075,7 @@ public function writeToArray(): array
10751075
/**
10761076
* @throws Exception
10771077
*/
1078-
public function writeToTarget(VipsTarget $target, string $suffix, array $options = []): void
1078+
public function writeToTarget(Target $target, string $suffix, array $options = []): void
10791079
{
10801080
$filename = Utils::filenameGetFilename($suffix);
10811081
$string_options = Utils::filenameGetOptions($suffix);

src/ImageAutodoc.php

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -171,11 +171,11 @@
171171
* @throws Exception
172172
* @method static Image csvload(string $filename, array $options = []) Load csv.
173173
* @throws Exception
174-
* @method static Image csvload_source(VipsSource $source, array $options = []) Load csv.
174+
* @method static Image csvload_source(Source $source, array $options = []) Load csv.
175175
* @throws Exception
176176
* @method void csvsave(string $filename, array $options = []) Save image to csv.
177177
* @throws Exception
178-
* @method void csvsave_target(VipsTarget $target, array $options = []) Save image to csv.
178+
* @method void csvsave_target(Target $target, array $options = []) Save image to csv.
179179
* @throws Exception
180180
* @method Image dE00(Image $right, array $options = []) Calculate dE00.
181181
* @throws Exception
@@ -227,7 +227,7 @@
227227
* @throws Exception
228228
* @method static Image fitsload(string $filename, array $options = []) Load a FITS image.
229229
* @throws Exception
230-
* @method static Image fitsload_source(VipsSource $source, array $options = []) Load FITS from a source.
230+
* @method static Image fitsload_source(Source $source, array $options = []) Load FITS from a source.
231231
* @throws Exception
232232
* @method void fitssave(string $filename, array $options = []) Save image to fits file.
233233
* @throws Exception
@@ -258,7 +258,7 @@
258258
* @throws Exception
259259
* @method static Image gifload_buffer(string $buffer, array $options = []) Load GIF with libnsgif.
260260
* @throws Exception
261-
* @method static Image gifload_source(VipsSource $source, array $options = []) Load gif from source.
261+
* @method static Image gifload_source(Source $source, array $options = []) Load gif from source.
262262
* @throws Exception
263263
* @method Image globalbalance(array $options = []) Global balance an image mosaic.
264264
* @throws Exception
@@ -273,13 +273,13 @@
273273
* @throws Exception
274274
* @method static Image heifload_buffer(string $buffer, array $options = []) Load a HEIF image.
275275
* @throws Exception
276-
* @method static Image heifload_source(VipsSource $source, array $options = []) Load a HEIF image.
276+
* @method static Image heifload_source(Source $source, array $options = []) Load a HEIF image.
277277
* @throws Exception
278278
* @method void heifsave(string $filename, array $options = []) Save image in HEIF format.
279279
* @throws Exception
280280
* @method string heifsave_buffer(array $options = []) Save image in HEIF format.
281281
* @throws Exception
282-
* @method void heifsave_target(VipsTarget $target, array $options = []) Save image in HEIF format.
282+
* @method void heifsave_target(Target $target, array $options = []) Save image in HEIF format.
283283
* @throws Exception
284284
* @method Image hist_cum(array $options = []) Form cumulative histogram.
285285
* @throws Exception
@@ -330,27 +330,27 @@
330330
* @throws Exception
331331
* @method static Image jpegload_buffer(string $buffer, array $options = []) Load jpeg from buffer.
332332
* @throws Exception
333-
* @method static Image jpegload_source(VipsSource $source, array $options = []) Load image from jpeg source.
333+
* @method static Image jpegload_source(Source $source, array $options = []) Load image from jpeg source.
334334
* @throws Exception
335335
* @method void jpegsave(string $filename, array $options = []) Save image to jpeg file.
336336
* @throws Exception
337337
* @method string jpegsave_buffer(array $options = []) Save image to jpeg buffer.
338338
* @throws Exception
339339
* @method void jpegsave_mime(array $options = []) Save image to jpeg mime.
340340
* @throws Exception
341-
* @method void jpegsave_target(VipsTarget $target, array $options = []) Save image to jpeg target.
341+
* @method void jpegsave_target(Target $target, array $options = []) Save image to jpeg target.
342342
* @throws Exception
343343
* @method static Image jxlload(string $filename, array $options = []) Load JPEG-XL image.
344344
* @throws Exception
345345
* @method static Image jxlload_buffer(string $buffer, array $options = []) Load JPEG-XL image.
346346
* @throws Exception
347-
* @method static Image jxlload_source(VipsSource $source, array $options = []) Load JPEG-XL image.
347+
* @method static Image jxlload_source(Source $source, array $options = []) Load JPEG-XL image.
348348
* @throws Exception
349349
* @method void jxlsave(string $filename, array $options = []) Save image in JPEG-XL format.
350350
* @throws Exception
351351
* @method string jxlsave_buffer(array $options = []) Save image in JPEG-XL format.
352352
* @throws Exception
353-
* @method void jxlsave_target(VipsTarget $target, array $options = []) Save image in JPEG-XL format.
353+
* @method void jxlsave_target(Target $target, array $options = []) Save image in JPEG-XL format.
354354
* @throws Exception
355355
* @method Image labelregions(array $options = []) Label regions in an image.
356356
* @throws Exception
@@ -409,13 +409,13 @@
409409
* @throws Exception
410410
* @method static Image matrixload(string $filename, array $options = []) Load matrix.
411411
* @throws Exception
412-
* @method static Image matrixload_source(VipsSource $source, array $options = []) Load matrix.
412+
* @method static Image matrixload_source(Source $source, array $options = []) Load matrix.
413413
* @throws Exception
414414
* @method void matrixprint(array $options = []) Print matrix.
415415
* @throws Exception
416416
* @method void matrixsave(string $filename, array $options = []) Save image to matrix.
417417
* @throws Exception
418-
* @method void matrixsave_target(VipsTarget $target, array $options = []) Save image to matrix.
418+
* @method void matrixsave_target(Target $target, array $options = []) Save image to matrix.
419419
* @throws Exception
420420
* @method float max(array $options = []) Find image maximum.
421421
* @throws Exception
@@ -441,13 +441,13 @@
441441
* @throws Exception
442442
* @method static Image openslideload(string $filename, array $options = []) Load file with OpenSlide.
443443
* @throws Exception
444-
* @method static Image openslideload_source(VipsSource $source, array $options = []) Load source with OpenSlide.
444+
* @method static Image openslideload_source(Source $source, array $options = []) Load source with OpenSlide.
445445
* @throws Exception
446446
* @method static Image pdfload(string $filename, array $options = []) Load PDF from file.
447447
* @throws Exception
448448
* @method static Image pdfload_buffer(string $buffer, array $options = []) Load PDF from buffer.
449449
* @throws Exception
450-
* @method static Image pdfload_source(VipsSource $source, array $options = []) Load PDF from source.
450+
* @method static Image pdfload_source(Source $source, array $options = []) Load PDF from source.
451451
* @throws Exception
452452
* @method integer percent(float $percent, array $options = []) Find threshold for percent of pixels.
453453
* @throws Exception
@@ -459,21 +459,21 @@
459459
* @throws Exception
460460
* @method static Image pngload_buffer(string $buffer, array $options = []) Load png from buffer.
461461
* @throws Exception
462-
* @method static Image pngload_source(VipsSource $source, array $options = []) Load png from source.
462+
* @method static Image pngload_source(Source $source, array $options = []) Load png from source.
463463
* @throws Exception
464464
* @method void pngsave(string $filename, array $options = []) Save image to png file.
465465
* @throws Exception
466466
* @method string pngsave_buffer(array $options = []) Save image to png buffer.
467467
* @throws Exception
468-
* @method void pngsave_target(VipsTarget $target, array $options = []) Save image to target as PNG.
468+
* @method void pngsave_target(Target $target, array $options = []) Save image to target as PNG.
469469
* @throws Exception
470470
* @method static Image ppmload(string $filename, array $options = []) Load ppm from file.
471471
* @throws Exception
472-
* @method static Image ppmload_source(VipsSource $source, array $options = []) Load ppm base class.
472+
* @method static Image ppmload_source(Source $source, array $options = []) Load ppm base class.
473473
* @throws Exception
474474
* @method void ppmsave(string $filename, array $options = []) Save image to ppm file.
475475
* @throws Exception
476-
* @method void ppmsave_target(VipsTarget $target, array $options = []) Save to ppm.
476+
* @method void ppmsave_target(Target $target, array $options = []) Save to ppm.
477477
* @throws Exception
478478
* @method Image premultiply(array $options = []) Premultiply image alpha.
479479
* @throws Exception
@@ -499,13 +499,13 @@
499499
* @throws Exception
500500
* @method static Image radload_buffer(string $buffer, array $options = []) Load rad from buffer.
501501
* @throws Exception
502-
* @method static Image radload_source(VipsSource $source, array $options = []) Load rad from source.
502+
* @method static Image radload_source(Source $source, array $options = []) Load rad from source.
503503
* @throws Exception
504504
* @method void radsave(string $filename, array $options = []) Save image to Radiance file.
505505
* @throws Exception
506506
* @method string radsave_buffer(array $options = []) Save image to Radiance buffer.
507507
* @throws Exception
508-
* @method void radsave_target(VipsTarget $target, array $options = []) Save image to Radiance target.
508+
* @method void radsave_target(Target $target, array $options = []) Save image to Radiance target.
509509
* @throws Exception
510510
* @method Image rank(integer $width, integer $height, integer $index, array $options = []) Rank filter.
511511
* @throws Exception
@@ -593,7 +593,7 @@
593593
* @throws Exception
594594
* @method static Image svgload_buffer(string $buffer, array $options = []) Load SVG with rsvg.
595595
* @throws Exception
596-
* @method static Image svgload_source(VipsSource $source, array $options = []) Load svg from source.
596+
* @method static Image svgload_source(Source $source, array $options = []) Load svg from source.
597597
* @throws Exception
598598
* @method static Image switch(Image[]|Image $tests, array $options = []) Find the index of the first non-zero pixel in tests.
599599
* @throws Exception
@@ -607,13 +607,13 @@
607607
* @throws Exception
608608
* @method Image thumbnail_image(integer $width, array $options = []) Generate thumbnail from image.
609609
* @throws Exception
610-
* @method static Image thumbnail_source(VipsSource $source, integer $width, array $options = []) Generate thumbnail from source.
610+
* @method static Image thumbnail_source(Source $source, integer $width, array $options = []) Generate thumbnail from source.
611611
* @throws Exception
612612
* @method static Image tiffload(string $filename, array $options = []) Load tiff from file.
613613
* @throws Exception
614614
* @method static Image tiffload_buffer(string $buffer, array $options = []) Load tiff from buffer.
615615
* @throws Exception
616-
* @method static Image tiffload_source(VipsSource $source, array $options = []) Load tiff from source.
616+
* @method static Image tiffload_source(Source $source, array $options = []) Load tiff from source.
617617
* @throws Exception
618618
* @method void tiffsave(string $filename, array $options = []) Save image to tiff file.
619619
* @throws Exception
@@ -629,23 +629,23 @@
629629
* @throws Exception
630630
* @method static Image vipsload(string $filename, array $options = []) Load vips from file.
631631
* @throws Exception
632-
* @method static Image vipsload_source(VipsSource $source, array $options = []) Load vips from source.
632+
* @method static Image vipsload_source(Source $source, array $options = []) Load vips from source.
633633
* @throws Exception
634634
* @method void vipssave(string $filename, array $options = []) Save image to file in vips format.
635635
* @throws Exception
636-
* @method void vipssave_target(VipsTarget $target, array $options = []) Save image to target in vips format.
636+
* @method void vipssave_target(Target $target, array $options = []) Save image to target in vips format.
637637
* @throws Exception
638638
* @method static Image webpload(string $filename, array $options = []) Load webp from file.
639639
* @throws Exception
640640
* @method static Image webpload_buffer(string $buffer, array $options = []) Load webp from buffer.
641641
* @throws Exception
642-
* @method static Image webpload_source(VipsSource $source, array $options = []) Load webp from source.
642+
* @method static Image webpload_source(Source $source, array $options = []) Load webp from source.
643643
* @throws Exception
644644
* @method void webpsave(string $filename, array $options = []) Save image to webp file.
645645
* @throws Exception
646646
* @method string webpsave_buffer(array $options = []) Save image to webp buffer.
647647
* @throws Exception
648-
* @method void webpsave_target(VipsTarget $target, array $options = []) Save image to webp target.
648+
* @method void webpsave_target(Target $target, array $options = []) Save image to webp target.
649649
* @throws Exception
650650
* @method static Image worley(integer $width, integer $height, array $options = []) Make a worley noise image.
651651
* @throws Exception
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
namespace Jcupitt\Vips;
44

5-
class VipsSource extends Connection
5+
class Source extends Connection
66
{
77
/**
88
* A pointer to the underlying VipsSource. This is the same as the
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
use Closure;
66

7-
class VipsSourceCustom extends VipsSource
7+
class SourceCustom extends Source
88
{
99
/**
1010
* A pointer to the underlying VipsSourceCustom. This is the same as the
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
use Closure;
66

7-
class VipsSourceResource extends VipsSourceCustom
7+
class SourceResource extends SourceCustom
88
{
99
/**
1010
* @var resource
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
namespace Jcupitt\Vips;
44

5-
class VipsTarget extends Connection
5+
class Target extends Connection
66
{
77
/**
88
* A pointer to the underlying VipsTarget. This is the same as the
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
use Closure;
66

7-
class VipsTargetCustom extends VipsTarget
7+
class TargetCustom extends Target
88
{
99
/**
1010
* A pointer to the underlying VipsTargetCustom. This is the same as the
@@ -86,8 +86,8 @@ public function onEnd(Closure $callback): void
8686

8787
/**
8888
* Attach a finish handler.
89-
* For libvips 8.13 and later, this method is deprecated in favour of @see VipsTargetCustom::onEnd()
90-
* @throws Exception
89+
* For libvips 8.13 and later, this method is deprecated in favour of @throws Exception
90+
* @see TargetCustom::onEnd()
9191
*/
9292
public function onFinish(Closure $callback): void
9393
{

0 commit comments

Comments
 (0)