00001 <?php 00009 /*************************************************************************** 00010 This program is free software; you can redistribute it and/or 00011 modify it under the terms of the GNU General Public License 00012 as published by the Free Software Foundation; either version 2 00013 of the License, or (at your option) any later version. 00014 00015 This program is distributed in the hope that it will be useful, 00016 but WITHOUT ANY WARRANTY; without even the implied warranty of 00017 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00018 GNU General Public License for more details. 00019 00020 You should have received a copy of the GNU General Public License 00021 along with this program; if not, write to the Free Software 00022 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00023 ***************************************************************************/ 00024 00025 function ImageColorAllocateHEX ( $im, $s ) 00026 { 00027 $s = str_replace('#', '', $s ); 00028 $bg_dec = hexdec( $s ); 00029 return imagecolorallocate ( $im, 00030 ($bg_dec & 0xFF0000) >> 16, 00031 ($bg_dec & 0x00FF00) >> 8, 00032 ($bg_dec & 0x0000FF) 00033 ); 00034 } 00035 00036 $strColor = $_GET['color']; 00037 $img = imagecreatefrompng( 'img/karteimg.png' ); 00038 $colorcode = ImageColorAllocateHEX ( $img, $strColor ); 00039 // FIXME: Bildfarbe setzen (müsste bessere Variante geben, aber imagefill ging nicht, wegen Transparenz) 00040 for ( $x = 0; $x < 9; $x++ ) 00041 { 00042 for ( $y = 0; $y < 9; $y++ ) 00043 { 00044 $getColor = imagecolorat( $img, $x, $y ); 00045 if ( ( $getColor != 0 ) && ( $getColor != 1 ) ) 00046 { 00047 imagesetpixel( $img, $x, $y, $colorcode ); 00048 } 00049 } 00050 } 00051 00052 header( "Content-type: image/png" ); 00053 imagepng ( $img ); 00054 imagedestroy ( $img );