diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5b7dd18..3025f83 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,6 +14,7 @@ jobs: - php: '8.0' - php: '8.1' - php: '8.2' + - php: '8.3' steps: - name: Setup PHP diff --git a/src/Connection.php b/src/Connection.php index ea38166..096a422 100644 --- a/src/Connection.php +++ b/src/Connection.php @@ -14,7 +14,7 @@ abstract class Connection extends VipsObject public function __construct(\FFI\CData $pointer) { - $this->pointer = \FFI::cast(FFI::ctypes('VipsConnection'), $pointer); + $this->pointer = FFI::vips()->cast(FFI::ctypes('VipsConnection'), $pointer); parent::__construct($pointer); } diff --git a/src/GObject.php b/src/GObject.php index 964393a..131ea20 100644 --- a/src/GObject.php +++ b/src/GObject.php @@ -74,7 +74,7 @@ abstract class GObject */ public function __construct(CData $pointer) { - $this->pointer = \FFI::cast(FFI::ctypes("GObject"), $pointer); + $this->pointer = FFI::vips()->cast(FFI::ctypes("GObject"), $pointer); } public function __destruct() @@ -135,7 +135,7 @@ private static function getMarshaler(string $name, callable $callback): ?Closure $vi = FFI::gobject()->g_value_get_object(\FFI::addr($params[0])); FFI::gobject()->g_object_ref($vi); $image = new Image($vi); - $pr = \FFI::cast( + $pr = FFI::vips()->cast( FFI::ctypes('VipsProgress'), FFI::gobject()->g_value_get_pointer(\FFI::addr($params[1])) ); diff --git a/src/GValue.php b/src/GValue.php index c310e6a..2bd657e 100644 --- a/src/GValue.php +++ b/src/GValue.php @@ -147,7 +147,7 @@ public function set($value): void $value = [$value]; } $n = count($value); - $array = \FFI::new("int[$n]"); + $array = FFI::vips()->new("int[$n]"); for ($i = 0; $i < $n; $i++) { $array[$i] = $value[$i]; } @@ -160,7 +160,7 @@ public function set($value): void $value = [$value]; } $n = count($value); - $array = \FFI::new("double[$n]"); + $array = FFI::vips()->new("double[$n]"); for ($i = 0; $i < $n; $i++) { $array[$i] = $value[$i]; } @@ -187,7 +187,7 @@ public function set($value): void # we need to set the blob to a copy of the data that vips_lib # can own and free $n = strlen($value); - $memory = \FFI::new("char[$n]", false, true); + $memory = FFI::vips()->new("char[$n]", false, true); \FFI::memcpy($memory, $value, $n); FFI::vips()-> vips_value_set_blob_free($this->pointer, $memory, $n); diff --git a/src/Image.php b/src/Image.php index 10817e6..ce0c091 100644 --- a/src/Image.php +++ b/src/Image.php @@ -500,7 +500,7 @@ class Image extends ImageAutodoc implements \ArrayAccess */ public function __construct(\FFI\CData $pointer) { - $this->pointer = \FFI::cast(FFI::ctypes("VipsImage"), $pointer); + $this->pointer = FFI::vips()->cast(FFI::ctypes("VipsImage"), $pointer); parent::__construct($pointer); } @@ -807,7 +807,7 @@ public static function newFromArray( $width = count($array[0]); $n = $width * $height; - $a = \FFI::new("double[$n]", true, true); + $a = FFI::vips()->new("double[$n]", true, true); for ($y = 0; $y < $height; $y++) { for ($x = 0; $x < $width; $x++) { $a[$x + $y * $width] = $array[$y][$x]; @@ -921,7 +921,9 @@ public function newFromImage($value): Image */ public static function findLoadSource(Source $source): ?string { - return FFI::vips()->vips_foreign_find_load_source(\FFI::cast(FFI::ctypes('VipsSource'), $source->pointer)); + return FFI::vips()->vips_foreign_find_load_source( + FFI::vips()->cast(FFI::ctypes('VipsSource'), $source->pointer) + ); } /** @@ -1016,7 +1018,7 @@ public function writeToBuffer(string $suffix, array $options = []): string */ public function writeToMemory(): string { - $p_size = \FFI::new("size_t[1]"); + $p_size = FFI::vips()->new("size_t[1]"); $pointer = FFI::vips()-> vips_image_write_to_memory($this->pointer, $p_size); @@ -1057,7 +1059,7 @@ public function writeToMemory(): string */ public function writeToArray(): array { - $p_size = \FFI::new("size_t[1]"); + $p_size = FFI::vips()->new("size_t[1]"); $pointer = FFI::vips()-> vips_image_write_to_memory($this->pointer, $p_size); @@ -1068,7 +1070,7 @@ public function writeToArray(): array // wrap pointer up as a C array of the right type $type_name = FFI::ftypes($this->format); $n = $this->width * $this->height * $this->bands; - $array = \FFI::cast("{$type_name}[$n]", $pointer); + $array = FFI::vips()->cast("{$type_name}[$n]", $pointer); // copy to PHP memory as a flat array $result = []; diff --git a/src/Interpolate.php b/src/Interpolate.php index cb5eee5..e20ba12 100644 --- a/src/Interpolate.php +++ b/src/Interpolate.php @@ -62,7 +62,7 @@ class Interpolate extends VipsObject public function __construct(\FFI\CData $pointer) { - $this->pointer = \FFI::cast(FFI::ctypes("VipsInterpolate"), $pointer); + $this->pointer = FFI::vips()->cast(FFI::ctypes("VipsInterpolate"), $pointer); parent::__construct($pointer); } diff --git a/src/Introspect.php b/src/Introspect.php index ce3208c..489364d 100644 --- a/src/Introspect.php +++ b/src/Introspect.php @@ -105,7 +105,7 @@ public function __construct($operation_name) $p_flags = FFI::vips()->new("int*[1]"); $p_n_args = FFI::vips()->new("int[1]"); $result = FFI::vips()->vips_object_get_args( - \FFI::cast(FFI::ctypes("VipsObject"), $operation->pointer), + FFI::vips()->cast(FFI::ctypes("VipsObject"), $operation->pointer), $p_names, $p_flags, $p_n_args diff --git a/src/Source.php b/src/Source.php index 60975fe..9a028a7 100644 --- a/src/Source.php +++ b/src/Source.php @@ -14,7 +14,7 @@ class Source extends Connection public function __construct(\FFI\CData $pointer) { - $this->pointer = \FFI::cast(FFI::ctypes('VipsSource'), $pointer); + $this->pointer = FFI::vips()->cast(FFI::ctypes('VipsSource'), $pointer); parent::__construct($pointer); } @@ -67,7 +67,7 @@ public static function newFromMemory(string $data): self # we need to set the memory to a copy of the data that vips_lib # can own and free $n = strlen($data); - $memory = \FFI::new("char[$n]", false, true); + $memory = FFI::vips()->new("char[$n]", false, true); \FFI::memcpy($memory, $data, $n); $pointer = FFI::vips()->vips_source_new_from_memory($memory, $n); diff --git a/src/Target.php b/src/Target.php index 9b31e61..eda298d 100644 --- a/src/Target.php +++ b/src/Target.php @@ -14,7 +14,7 @@ class Target extends Connection public function __construct(\FFI\CData $pointer) { - $this->pointer = \FFI::cast(FFI::ctypes('VipsTarget'), $pointer); + $this->pointer = FFI::vips()->cast(FFI::ctypes('VipsTarget'), $pointer); parent::__construct($pointer); } diff --git a/src/VipsObject.php b/src/VipsObject.php index 74bb83b..e0b18a5 100644 --- a/src/VipsObject.php +++ b/src/VipsObject.php @@ -68,8 +68,8 @@ abstract class VipsObject extends GObject public function __construct(\FFI\CData $pointer) { - $this->pointer = \FFI::cast(FFI::ctypes("VipsObject"), $pointer); - $this->gObject = \FFI::cast(FFI::ctypes("GObject"), $pointer); + $this->pointer = FFI::vips()->cast(FFI::ctypes("VipsObject"), $pointer); + $this->gObject = FFI::vips()->cast(FFI::ctypes("GObject"), $pointer); parent::__construct($pointer); }