10-19-2017, 05:54 PM
Just keeping notes of image layers...
BASE - a flat white area of the griff, underneath the rest. So if some body part fails to load, there won't be weird transparent bits.
and then...
legs
wingnear
wingfar
midwingfar
midwingnear
hind
fore
crest
horns
beak
strings
eyes
and finally SHADE - the layer of shading. Always the last to be rendered so it appears on top.
In the DB, only colour values are stored. Name and then col. So... legscol, wingnearcol, wingfarcol...
They should always be in this format: rgba(255, 255, 255,1) where the 255s are the RGB colour values. 1 is alpha channel, for opacity. For body parts we always want this to be 1. Perhaps some markings could be fainter, like 0.6... but think about those later.
In the image generation script, first get the image parts from the folder, then the associated colour value from DB.
Something like:
to construct all the layers
("type" is the proper name for breed, and "level" means age; egg/chick/juv/adult, numbers from 0 to 3)
And after that, another chunk of code that goes through each part and applies the colour (---col) value. Before final merge etc.
BASE - a flat white area of the griff, underneath the rest. So if some body part fails to load, there won't be weird transparent bits.
and then...
legs
wingnear
wingfar
midwingfar
midwingnear
hind
fore
crest
horns
beak
strings
eyes
and finally SHADE - the layer of shading. Always the last to be rendered so it appears on top.
In the DB, only colour values are stored. Name and then col. So... legscol, wingnearcol, wingfarcol...
They should always be in this format: rgba(255, 255, 255,1) where the 255s are the RGB colour values. 1 is alpha channel, for opacity. For body parts we always want this to be 1. Perhaps some markings could be fainter, like 0.6... but think about those later.
In the image generation script, first get the image parts from the folder, then the associated colour value from DB.
Something like:
Code:
$images = array(
'picuploads/griffimages/' . $pet['type'] . $pet['gender'] . $pet['level'] . '/BASE.png',
'picuploads/griffimages/' . $pet['type'] . $pet['gender'] . $pet['level'] . '/legs.png',
'picuploads/griffimages/' . $pet['type'] . $pet['gender'] . $pet['level'] . '/wingnear.png',
...to construct all the layers
("type" is the proper name for breed, and "level" means age; egg/chick/juv/adult, numbers from 0 to 3)
And after that, another chunk of code that goes through each part and applies the colour (---col) value. Before final merge etc.
Code:
$composed_image->colorizeImage(new \ImagickPixel($pet['color']), new \ImagickPixel("rgba(128,128,128,1"));
$composed_image->tintImage(new \ImagickPixel($pet['color']), new \ImagickPixel("rgba(128,128,128,1"));
...
