1. Go to this page and download the library: Download serafim/ffi-sdl-image library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
serafim / ffi-sdl-image example snippets
$sdl = new Serafim\SDL\SDL(version: '2.28.3');
$image = new Serafim\SDL\Image\Image(sdl: $sdl);
// If no argument is passed, the latest initialized
// version will be used.
$image = new Serafim\SDL\Image\Image(sdl: null);
// Load library from pathname (it may be relative or part of system-dependent path)
$image = new Serafim\SDL\Image\Image(library: __DIR__ . '/path/to/library.so');
// Try to automatically resolve library's pathname
$image = new Serafim\SDL\Image\Image(library: null);
// Use v2.0.5 from string
$image = new Serafim\SDL\Image\Image(version: '2.0.5');
// Use v2.6.3 from predefined versions constant
$image = new Serafim\SDL\Image\Image(version: \Serafim\SDL\Image\Version::V2_6_3);
// Use latest supported version
$image = new Serafim\SDL\Image\Image(version: \Serafim\SDL\Image\Version::LATEST);
$image = new Serafim\SDL\Image\Image(cache: new Psr16Cache(...));
$pre = new \FFI\Preprocessor\Preprocessor();
$pre->define('true', 'false'); // happy debugging!
$image = new Serafim\SDL\Image\Image(pre: $pre);
use Serafim\SDL\SDL;
use Serafim\SDL\Image\Image;
$sdl = new SDL();
$image = new Image(sdl: $sdl);
$sdl->SDL_Init(SDL::SDL_INIT_EVERYTHING);
$image->IMG_Init(Image::IMG_INIT_PNG);
$surface = $image->IMG_Load(__DIR__ . '/path/to/image.png');
$image->IMG_SaveJPG($surface, __DIR__ . '/path/to/image.jpg', quality: 80);
$image->IMG_Quit();
$sdl->SDL_Quit();
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.