$edge_rad ) ? 100 : $opaci; imagecopymerge( $image, $dot, $xpos, $ypos, 0, 0, 1, 1, $opaci ); } } } imagedestroy( $dot ); } // merges two images together function &merge( $image, $merge_img, $x_left = 0, $y_top = 0, $merge_opacity = 70, $trans_colour = 'FF0000' ) { $width = imagesx( $image ); $height = imagesy( $image ); $xx = ( $x_left < 0 ) ? $width + $x_left : $x_left; $yy = ( $y_top < 0 ) ? $height + $y_top : $y_top; $tr = Image::hex2rgb( substr( $trans_colour, 0, 2 ) ); $tg = Image::hex2rgb( substr( $trans_colour, 2, 2 ) ); $tb = Image::hex2rgb( substr( $trans_colour, 4, 2 ) ); $mw = imagesx( $merge_img ); $mh = imagesy( $merge_img ); for( $ypo = 0; $ypo < $mh; $ypo++ ) { for( $xpo = 0; $xpo < $mw; $xpo++ ) { $indx_ref = imagecolorat( $merge_img, $xpo, $ypo ); $indx_rgb = imagecolorsforindex( $merge_img, $indx_ref ); if ( ( $indx_rgb['red'] == $tr ) && ( $indx_rgb['green'] == $tg ) && ( $indx_rgb['blue'] == $tb ) ) { // transparent colour, so ignore merging this pixel } else { imagecopymerge( $image, $merge_img, $xx + $xpo, $yy + $ypo, $xpo, $ypo, 1, 1, $merge_opacity ); } } } imagedestroy( $merge_img ); } // draw text, with a drop-shadow at specified offset function &draw_shadowed_text( $image, $font, $text, $x = 0, $y = 0, $size = 12, $color = 'FFFFFF', $shadow_color = '000000', $offset = 1 ) { $cr = hexdec( substr( $color, 0, 2 ) ); $cg = hexdec( substr( $color, 2, 2 ) ); $cb = hexdec( substr( $color, 4, 2 ) ); $color = imagecolorallocate( $image, $cr, $cg, $cb ); $sr = hexdec( substr( $shadow_color, 0, 2 ) ); $sg = hexdec( substr( $shadow_color, 2, 2 ) ); $sb = hexdec( substr( $shadow_color, 4, 2 ) ); $shadow_color = imagecolorallocate( $image, $sr, $sg, $sb ); Image::text( $image, $size, $x + $offset, $y + $offset, $shadow_color, $font, $text ); Image::text( $image, $size, $x, $y, $color, $font, $text ); // imagettftext( $image, $size, 0, $x + $offset, $y + $offset, $shadow_color, $font, $text ); // imagettftext( $image, $size, 0, $x, $y, $color, $font, $text ); } // draw outlined text function &draw_outlined_text( $image, $font, $text, $x = 0, $y = 0, $size = 12, $color = 'FFFFFF', $outline_color = '000000', $offset = 1 ) { $cr = hexdec( substr( $color, 0, 2 ) ); $cg = hexdec( substr( $color, 2, 2 ) ); $cb = hexdec( substr( $color, 4, 2 ) ); $color = imagecolorallocate( $image, $cr, $cg, $cb ); $or = hexdec( substr( $outline_color, 0, 2 ) ); $og = hexdec( substr( $outline_color, 2, 2 ) ); $ob = hexdec( substr( $outline_color, 4, 2 ) ); $outline_color = imagecolorallocate( $image, $or, $og, $ob ); imagettftext( $image, $size, 0, $x + $offset, $y + $offset, $outline_color, $font, $text ); imagettftext( $image, $size, 0, $x - $offset, $y - $offset, $outline_color, $font, $text ); imagettftext( $image, $size, 0, $x + $offset, $y - $offset, $outline_color, $font, $text ); imagettftext( $image, $size, 0, $x - $offset, $y + $offset, $outline_color, $font, $text ); imagettftext( $image, $size, 0, $x, $y, $color, $font, $text ); } // convert a hex value to its decimal equivalent function &hex2rgb( $hex_value ) { $decval = hexdec($hex_value); return $decval; } function &text( $image, $size, $x, $y, $color, $font, $text ) { // do char conversion here $newText = $text; imagettftext( $image, $size, 0, $x, $y, $color, $font, $newText ); } } ?>