You are here

function _textimage_opacity_to_alpha in Textimage 7.3

Convert percent opacity to hex alpha.

Parameters

int $value: Opacity as percentage (0 = transparent, 100 = fully opaque).

Return value

string Opacity as HEX.

1 call to _textimage_opacity_to_alpha()
textimage_color_element_validate in ./textimage.module
Validation callback for 'textimage_color' form element.

File

./textimage.module, line 1195
Textimage - Provides text to image manipulations.

Code

function _textimage_opacity_to_alpha($value) {
  return $value == NULL ? NULL : drupal_strtoupper(str_pad(dechex(-($value - 100) / 100 * 127), 2, "0", STR_PAD_LEFT));
}