imagecolorallocatealpha
Intervention/image
Supported Versions: PHP 4 >= 4.3.2, PHP 5, PHP 7, PHP 8
Allocate a color for an image
imagecolorallocatealpha
(
GdImage $image
,
int $red
,
int $green
,
int $blue
,
int $alpha
):
int
|
false
if (
is_null
(
$matte
)) {
$matte
=
imagecolorallocatealpha
(
$resource
,
255
,
255
,
255
,
127
);
} else {
$matte
=
$image
->
getDriver
()->
parseColor
(
$matte
)->
getInt
();
}
src/Intervention/Image/Gd/Commands/LimitColorsCommand.php
$transparent
=
imagecolorallocatealpha
(
$canvas
->
getCore
(),
255
,
255
,
255
,
127
);
imagealphablending
(
$canvas
->
getCore
(),
false
);
// do not blend / just overwrite
imagefilledrectangle
(
$canvas
->
getCore
(),
$dst_x
,
$dst_y
,
$dst_x
+
$src_w
-
1
,
$dst_y
+
$src_h
-
1
,
$transparent
);
src/Intervention/Image/Gd/Commands/ResizeCanvasCommand.php
if (
$transIndex
!= -
1
) {
$rgba
=
imagecolorsforindex
(
$modified
,
$transIndex
);
$transColor
=
imagecolorallocatealpha
(
$modified
,
$rgba
[
'red'
],
$rgba
[
'green'
],
$rgba
[
'blue'
],
127
);
imagefill
(
$modified
,
0
,
0
,
$transColor
);
imagecolortransparent
(
$modified
,
$transColor
);
} else {
src/Intervention/Image/Gd/Commands/ResizeCommand.php
imagealphablending
(
$canvas
,
false
);
$transparent
=
imagecolorallocatealpha
(
$canvas
,
255
,
255
,
255
,
127
);
imagefilledrectangle
(
$canvas
,
0
,
0
,
$width
,
$height
,
$transparent
);
imagecolortransparent
(
$canvas
,
$transparent
);
imagealphablending
(
$canvas
,
true
);
src/Intervention/Image/Gd/Decoder.php
$clone
=
imagecreatetruecolor
(
$width
,
$height
);
imagealphablending
(
$clone
,
false
);
imagesavealpha
(
$clone
,
true
);
$transparency
=
imagecolorallocatealpha
(
$clone
,
0
,
0
,
0
,
127
);
imagefill
(
$clone
,
0
,
0
,
$transparency
);
imagecopy
(
$clone
,
$core
,
0
,
0
,
0
,
0
,
$width
,
$height
);
src/Intervention/Image/Gd/Driver.php