A module for generating sprites from a sprite sheet.
This module let you cut images from a sprite sheet or use another format
such as a PNG or JPG as the source.
The cutting rules are the size of the sprite sheet (x,y,w,h) as well
as the size of each image to be created.
The background color of the images can be specified.
The method of cut can be specified.
INSTALLATION
To Install this module in your site,
php bin/KeyMacro.php install
Usage
KeyMacro allows you to cut images from a sprite sheet.
You can use images like PNG, GIF, JPG and more,
with or without background color.
You can also use different slicing rules (width and height)
and you can also control the background color of the generated images.
This allows you to easily generate sprites for games or applications.
A sprite sheet consist of a number of images,
each image is a square with a given width and height,
that are aligned horizontally and vertically.
The following example shows how to use this module.
setSize(400,250);
$sprite->setBackgroundColor('red');
// Setup the sprite sheet
$sprite->setSorting(KSPRITE_SORT_REGULAR);
$sprite->setSortingHint('H');
$sprite->setSortingRule(0,1);
$sprite->setSortingRule(1,0);
// Optionally, you can set the width and height of each image
$sprite->setSortingRuleWidth(100);
$sprite->setSortingRuleHeight(100);
// Print the sprite sheet
$sprite->generate();
?>
/*
┌───────────────────────────────────────────────┐
│ Sprite Sheet: │
│ Sprite1.png a77f14ba26 benanb
https://www.restaurantepranzo.com/profi ... ub/profile
https://de.mpesthetique.com/profile/ode ... sa/profile
https://www.storiesondata.com/profile/m ... ta/profile
https://www.geckoeco.com/profile/feltan ... ck/profile
https://www.jaisanbrows.com/profile/fre ... ss/profile