Methods |
public
|
__construct(resource $handle)
Creates the object
Parameters
$handle |
Image handle (GD2 resource)
|
Overrides
|
#
|
public
static
|
create(int $width, int $height): TrueColorImage
Factory method that creates a true-color image object
Factory method that creates a true-color image object
|
#
|
public
|
doCreate($width, $height)
|
#
|
public
|
isTrueColor()
Returns true if the image is true-color, false otherwise
Returns true if the image is true-color, false otherwise
Implements
|
#
|
public
|
alphaBlending(bool $mode): bool
Sets alpha blending mode via imagealphablending()
Sets alpha blending mode via imagealphablending()
|
#
|
public
|
saveAlpha(bool $on): bool
Toggle if alpha channel should be saved with the image via imagesavealpha()
Toggle if alpha channel should be saved with the image via imagesavealpha()
|
#
|
public
|
allocateColorAlpha(mixed $R, int $G = null, int $B = null, int $A = null): int
Allocates a color and returns its index
Allocates a color and returns its index
This method accepts either each component as an integer value,
or an associative array that holds the color's components in keys
'red', 'green', 'blue', 'alpha'.
|
#
|
public
|
asPalette($nColors = 255, $dither = null, $matchPalette = true)
Returns a palette copy (8bit) of the image
Returns a palette copy (8bit) of the image
Parameters
$nColors |
Number of colors in the resulting image, more than 0, less or equal to 255
|
$dither |
Use dithering or not
|
$matchPalette |
Set to true to use imagecolormatch() to match the resulting palette more closely to the original image
|
Implements
|
#
|
public
|
getClosestColorAlpha(mixed $R, int $G = null, int $B = null, int $A = null): int
Returns the index of the color that best match the given color components
Returns the index of the color that best match the given color components
This method accepts either each component as an integer value,
or an associative array that holds the color's components in keys
'red', 'green', 'blue', 'alpha'.
Parameters
$R |
Red component value or an associative array
|
$G |
Green component
|
$B |
Blue component
|
$A |
Alpha component
|
Returns
|
#
|
public
|
getExactColorAlpha(mixed $R, int $G = null, int $B = null, int $A = null): int
Returns the index of the color that exactly match the given color components
Returns the index of the color that exactly match the given color components
This method accepts either each component as an integer value,
or an associative array that holds the color's components in keys
'red', 'green', 'blue', 'alpha'.
Parameters
$R |
Red component value or an associative array
|
$G |
Green component
|
$B |
Blue component
|
$A |
Alpha component
|
Returns
|
#
|
public
|
getChannels()
Retrieve an image with selected channels
Retrieve an image with selected channels
Examples:
$channels = $img->getChannels('red', 'blue');
$channels = $img->getChannels('alpha', 'green');
$channels = $img->getChannels(array('green', 'blue'));
Implements
|
#
|
public
|
copyNoAlpha()
(non-PHPdoc)
|
#
|
public
|
asTrueColor(): TrueColorImage
(non-PHPdoc)
|
#
|
public
|
asProgressive(): TrueColorImage
Calls imageinterlace() using the current handler
Calls imageinterlace() using the current handler
Returns
A copy of the image, with imageinterlace() applied
|
#
|
public
|
resizeInsideRect(
int $width,
int $height,
string $fit = 'inside',
string $scale = 'down',
mixed $alignLeft = 'center',
mixed $alignTop = 'center',
int $mergeOpacity = 100,
int|array $fillColor = null,
): TrueColorImage
Resizes the image proportionally inside the given width and height.
The returned image will have always the specified…
Resizes the image proportionally inside the given width and height.
The returned image will have always the specified width and height, and any space will be filled
with the given $fillCollor
Parameters
$width |
Exact width in pixels
|
$height |
Exact height in pixels
|
$fit |
'inside' (default), 'outside' or 'fill'
|
$scale |
'down' (default), 'up' or 'any'
|
$alignLeft |
Left position of the image over the fill space, smart coordinate
|
$alignTop |
Top position of the image over the fill space, smart coordinate
|
$mergeOpacity |
The opacity of the image over the fill space
|
$fillColor |
RGB color index or array. Background color to fill the resulting image with if it's smaller
than the given size. By default (if null), the top left pixel color will be used.
|
Returns
|
#
|