You are here

protected function GDOperationTrait::allocateColorFromRgba in Image Effects 8.2

Same name and namespace in other branches
  1. 8.3 src/Plugin/ImageToolkit/Operation/gd/GDOperationTrait.php \Drupal\image_effects\Plugin\ImageToolkit\Operation\gd\GDOperationTrait::allocateColorFromRgba()
  2. 8 src/Plugin/ImageToolkit/Operation/gd/GDOperationTrait.php \Drupal\image_effects\Plugin\ImageToolkit\Operation\gd\GDOperationTrait::allocateColorFromRgba()

Allocates a GD color from an RGBA hexadecimal.

Parameters

string $rgba_hex: A string specifing an RGBA color in the format '#RRGGBBAA'.

Return value

int A GD color index.

4 calls to GDOperationTrait::allocateColorFromRgba()
DrawEllipse::execute in src/Plugin/ImageToolkit/Operation/gd/DrawEllipse.php
Performs the actual manipulation on the image.
DrawLine::execute in src/Plugin/ImageToolkit/Operation/gd/DrawLine.php
Performs the actual manipulation on the image.
DrawRectangle::execute in src/Plugin/ImageToolkit/Operation/gd/DrawRectangle.php
Performs the actual manipulation on the image.
TextOverlay::execute in src/Plugin/ImageToolkit/Operation/gd/TextOverlay.php
Performs the actual manipulation on the image.

File

src/Plugin/ImageToolkit/Operation/gd/GDOperationTrait.php, line 27

Class

GDOperationTrait
Trait for GD image toolkit operations.

Namespace

Drupal\image_effects\Plugin\ImageToolkit\Operation\gd

Code

protected function allocateColorFromRgba($rgba_hex) {
  list($r, $g, $b, $alpha) = array_values($this
    ->hexToRgba($rgba_hex));
  return imagecolorallocatealpha($this
    ->getToolkit()
    ->getResource(), $r, $g, $b, $alpha);
}