You are here

function _textimage_rgba_to_opacity in Textimage 7.3

Convert RGBA alpha to percent opacity.

Parameters

string $rgba: RGBA hex.

Return value

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

3 calls to _textimage_rgba_to_opacity()
textimage_color_element_process in ./textimage.module
Process callback for 'textimage_color' form element.
theme_textimage_background_effect_summary in effects/textimage_background.inc
Renders 'textimage_background' image effect summary.
theme_textimage_text_effect_summary in effects/textimage_text.inc
Renders 'textimage_background' image effect summary.

File

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

Code

function _textimage_rgba_to_opacity($rgba) {
  $hex = drupal_substr($rgba, 7, 2);
  return $hex ? floor(-(hexdec($hex) - 127) / 127 * 100) : 100;
}