| 1 | <?php |
|---|
| 2 | /* |
|---|
| 3 | * Copyright(c) 2000-2007 LOCKON CO.,LTD. All Rights Reserved. |
|---|
| 4 | * |
|---|
| 5 | * http://www.lockon.co.jp/ |
|---|
| 6 | */ |
|---|
| 7 | // 円の中心点と直径から弧の終端座標を算出する。 |
|---|
| 8 | /* |
|---|
| 9 | $cx : 中心点X座標 |
|---|
| 10 | $cy : 中心点Y座標 |
|---|
| 11 | $r : 半径 |
|---|
| 12 | $e : 角度 |
|---|
| 13 | */ |
|---|
| 14 | function lfGetArcPos($cx, $cy, $cw, $ch, $e) { |
|---|
| 15 | // 三角関数用の角度を求める |
|---|
| 16 | $s = 90 - $e; |
|---|
| 17 | $r = $cw / 2; |
|---|
| 18 | // 位置を求める |
|---|
| 19 | $x = $cx + ($r * cos(deg2rad($s))); |
|---|
| 20 | $y = $cy - (($r * sin(deg2rad($s))) * ($ch / $cw)); |
|---|
| 21 | return array(round($x), round($y)); |
|---|
| 22 | } |
|---|
| 23 | |
|---|
| 24 | /* 画像にテキストを描画する */ |
|---|
| 25 | function lfImageText($dst_image, $text, $font_size, $left, $top, $font, $arrRGB) { |
|---|
| 26 | $color = ImageColorAllocate($dst_image, $arrRGB[0], $arrRGB[1], $arrRGB[2]); |
|---|
| 27 | $text = mb_convert_encoding($text, "UTF-8", CHAR_CODE); |
|---|
| 28 | // 表示角度 |
|---|
| 29 | $angle = 0; |
|---|
| 30 | // テキスト描画 |
|---|
| 31 | ImageTTFText($dst_image, $font_size, $angle, $left, $top, $color, $font, $text); |
|---|
| 32 | } |
|---|
| 33 | |
|---|
| 34 | // 表示色の取得 |
|---|
| 35 | function lfGetImageColor($image, $array) { |
|---|
| 36 | if(count($array) != 3) { |
|---|
| 37 | return NULL; |
|---|
| 38 | } |
|---|
| 39 | $ret = imagecolorallocate($image, $array[0], $array[1], $array[2]); |
|---|
| 40 | return $ret; |
|---|
| 41 | } |
|---|
| 42 | |
|---|
| 43 | // 影用表示色の取得 |
|---|
| 44 | function lfGetImageDarkColor($image, $array) { |
|---|
| 45 | if(count($array) != 3) { |
|---|
| 46 | return NULL; |
|---|
| 47 | } |
|---|
| 48 | $i = 0; |
|---|
| 49 | foreach($array as $val) { |
|---|
| 50 | $dark[$i] = $val - 45; |
|---|
| 51 | if($dark[$i] < 0) { |
|---|
| 52 | $dark[$i] = 0; |
|---|
| 53 | } |
|---|
| 54 | $i++; |
|---|
| 55 | } |
|---|
| 56 | $ret = imagecolorallocate($image, $dark[0], $dark[1], $dark[2]); |
|---|
| 57 | return $ret; |
|---|
| 58 | } |
|---|
| 59 | ?> |
|---|