0x00, "G" => 0x00, "B" => 0x00, "A" => 0x00 ) ) { $colFill = imageColorExactAlpha( $srcImage, $rgbFill[ "R" ], $rgbFill[ "G" ], $rgbFill[ "B" ], $rgbFill[ "A" ] ); imageFilledRectangle( $srcImage, $intX, $intY, $intX + $intWidth - 1, $intY + $intHeight - 1, $colFill ); } function imageDrawMoonPhase( &$srcImage, $intX, $intY, $intSize = 16, $rgbBlack = array( "R" => 0x00, "G" => 0x00, "B" => 0x00, "A" => 0x00 ), $rgbWhite = array( "R" => 0xFF, "G" => 0xFF, "B" => 0xFF, "A" => 0x00 ) ) { $colBlack = imageColorExactAlpha( $srcImage, $rgbBlack[ "R" ], $rgbBlack[ "G" ], $rgbBlack[ "B" ], $rgbBlack[ "A" ] ); $colWhite = imageColorExactAlpha( $srcImage, $rgbWhite[ "R" ], $rgbWhite[ "G" ], $rgbWhite[ "B" ], $rgbWhite[ "A" ] ); $dateToday = mktime(); $dateFullMoon = mktime( 2, 22, 0, 8, 30, 2004 ); $intMoonPeriod = 29 * 86400 + 12 * 3600 + 44.0496 * 60; $intMoonPhase = ( $dateToday - $dateFullMoon ) % $intMoonPeriod; $fltPercent = $intMoonPhase / $intMoonPeriod; $intPercent = round( 200 * $fltPercent ); $colLeft = ( $fltPercent >= 0.5 ) ? $colBlack : $colWhite; $colRight = ( $fltPercent >= 0.5 ) ? $colWhite : $colBlack; if ( $intPercent > 100 ) { $intPercent = $intPercent - 100; } $intSize += 2; $fltHalf = 0.5 * $intSize - 0.5; for ( $i = 1; $i < $intSize - 1; $i++ ) { $intYPos = $intY + $i - 1; $intWidth = 2.0 * sqrt( $fltHalf * $fltHalf - ( $i - $fltHalf ) * ( $i - $fltHalf ) ); $intStart = $intX + $fltHalf - 0.5 * $intWidth; if ( $intPercent < 100 ) { $intLeft = $intWidth * ( ( 100 - $intPercent ) / 100 ); imageLine( $srcImage, $intStart, $intYPos, $intStart + $intLeft - 1, $intYPos, $colLeft ); } else { $intLeft = 0; } if ( $intPercent > 0 ) { $intRight = $intWidth * ( $intPercent / 100 ); imageLine( $srcImage, $intStart + $intLeft, $intYPos, $intStart + $intLeft + $intRight - 1, $intYPos, $colRight ); } } } function imageDrawBorder( &$srcImage, $intXBorder = 8, $intYBorder = 8, $rgbBorder = array( "R" => 0x00, "G" => 0x00, "B" => 0x00 ), $intXOffset = 0, $intYOffset = 0 ) { $intWidth = imageSX( $srcImage ) - 1; $intHeight = imageSY( $srcImage ) - 1; $colDraw = imageColorExactAlpha( $srcImage, $rgbBorder[ "R" ], $rgbBorder[ "G" ], $rgbBorder[ "B" ], $rgbBorder[ "A" ] ); if ( $intXBorder > 0 ) { imageFilledRectangle( $srcImage, 0, $intYBorder + $intYOffset, $intXBorder + $intXOffset - 1, $intHeight + $intYOffset - $intYBorder, $colDraw ); imageFilledRectangle( $srcImage, $intWidth - $intXBorder + $intXOffset + 1, $intYBorder + $intYOffset, $intWidth, $intHeight + $intYOffset - $intYBorder, $colDraw ); } if ( $intYBorder > 0 ) { imageFilledRectangle( $srcImage, 0, 0, $intWidth, $intYBorder + $intYOffset - 1, $colDraw ); imageFilledRectangle( $srcImage, 0, $intHeight + $intYOffset - $intYBorder + 1, $intWidth, $intHeight, $colDraw ); } } function imageDrawShadow( &$srcImage, $intBorder, $rgbShadow = array( "R" => 0x00, "G" => 0x00, "B" => 0x00 ), $rgbBack = array( "R" => 0xFF, "G" => 0xFF, "B" => 0xFF ) ) { $intWidth = imageSX( $srcImage ) - 1; $intHeight = imageSY( $srcImage ) - 1; $arrGamma = array(); for ( $i = 0; $i < $intBorder; $i++ ) { $arrGamma[ $i ] = 127.9 * pow( ( $i + 1 ) / $intBorder, 0.7 ); } $colDraw = imageColorExactAlpha( $srcImage, $rgbBack[ "R" ], $rgbBack[ "G" ], $rgbBack[ "B" ], 0 ); imageFilledRectangle( $srcImage, $intWidth - $intBorder, 0, $intWidth, $intHeight, $colDraw ); imageFilledRectangle( $srcImage, 0, $intHeight - $intBorder, $intWidth, $intHeight, $colDraw ); for ( $i = 0; $i < $intBorder; $i++ ) { $colDraw = imageColorExactAlpha( $srcImage, $rgbShadow[ "R" ], $rgbShadow[ "G" ], $rgbShadow[ "B" ], $arrGamma[ $i ] ); imageLine( $srcImage, $intWidth - $intBorder + $i, $i + 1, $intWidth - $intBorder + $i, $intHeight - $intBorder + $i, $colDraw ); imageLine( $srcImage, $i + 1, $intHeight - $intBorder + $i, $intWidth - $intBorder + $i - 1, $intHeight - $intBorder + $i, $colDraw ); } } function imageDrawPointGrid( &$srcImage, $intXSize = 8, $intYSize = 8, $rgbPoint = array( "R" => 0x00, "G" => 0x00, "B" => 0x00, "A" => 0xD0 ), $intXOffset = 0, $intYOffset = 0 ) { $intWidth = imageSX( $srcImage ) / $intXSize; $intHeight = imageSY( $srcImage ) / $intYSize; $colDraw = imageColorExactAlpha( $srcImage, $rgbPoint[ "R" ], $rgbPoint[ "G" ], $rgbPoint[ "B" ], $rgbPoint[ "A" ] ); for ( $y = 0; $y < $intHeight; $y++ ) { for ( $x = 0; $x < $intWidth; $x++ ) { imageSetPixel( $srcImage, $x * $intXSize + $intXOffset, $y * $intYSize + $intYOffset, $colDraw ); } } } function imageDrawInvPointGrid( &$srcImage, $intXSize = 8, $intYSize = 8, $intXOffset = 0, $intYOffset = 0 ) { $intWidth = imageSX( $srcImage ) / $intXSize; $intHeight = imageSY( $srcImage ) / $intYSize; for ( $y = 0; $y < $intHeight; $y++ ) { for ( $x = 0; $x < $intWidth; $x++ ) { $rgbCol = imageColorAt( $srcImage, $x * $intXSize + $intXOffset, $y * $intYSize + $intYOffset ); $red = 255 - ( $rgbCol >> 16 ) & 0xFF; $green = 255 - ( $rgbCol >> 8 ) & 0xFF; $blue = 255 - $rgbCol & 0xFF; imageSetPixel( $srcImage, $x * $intXSize + $intXOffset, $y * $intYSize + $intYOffset, ( $red << 16 ) | ( $green << 8 ) | $blue ); } } } function imageDrawLineGrid( &$srcImage, $intXSize = 8, $intYSize = 8, $rgbLine = array( "R" => 0x00, "G" => 0x00, "B" => 0x00, "A" => 0xD0 ), $intXOffset = 0, $intYOffset = 0 ) { $intWidth = imageSX( $srcImage ) / $intXSize; $intHeight = imageSY( $srcImage ) / $intYSize; $colDraw = imageColorExactAlpha( $srcImage, $rgbLine[ "R" ], $rgbLine[ "G" ], $rgbLine[ "B" ], $rgbLine[ "A" ] ); for ( $x = 0; $x < $intWidth; $x++ ) { imageLine( $srcImage, $x * $intXSize + $intXOffset, 0, $x * $intXSize + $intXOffset, $intHeight * $intYSize, $colDraw ); } for ( $y = 0; $y < $intHeight; $y++ ) { imageLine( $srcImage, 0, $y * $intYSize + $intYOffset, $intWidth * $intXSize, $y * $intYSize + $intYOffset, $colDraw ); } } function imageDrawInnerShadow( &$srcImage, $intBorder = 8, $rgbShadow = array( "R" => 0x00, "G" => 0x00, "B" => 0x00 ) ) { $intWidth = imageSX( $srcImage ); $intHeight = imageSY( $srcImage ); $arrGamma = array(); for ( $i = 0; $i < $intBorder; $i++ ) { $arrGamma[ $i ] = 127.0 * pow( ( $i + 1 ) / $intBorder, 0.7 ); } for ( $i = 0; $i < $intBorder; $i++ ) { $colDraw = imageColorExactAlpha( $srcImage, $rgbShadow[ "R" ], $rgbShadow[ "G" ], $rgbShadow[ "B" ], $arrGamma[ $i ] ); imageLine( $srcImage, $i, $i, $intWidth - 1, $i, $colDraw ); imageLine( $srcImage, $i, $i + 1, $i, $intHeight - 1, $colDraw ); } } function imageDrawInnerGlow( &$srcImage, $intBorder = 8, $rgbGlow = array( "R" => 0xFF, "G" => 0xFF, "B" => 0xFF ) ) { $intWidth = imageSX( $srcImage ); $intHeight = imageSY( $srcImage ); $arrGamma = array(); for ( $i = 0; $i < $intBorder; $i++ ) { $arrGamma[ $i ] = 127.0 * pow( ( $i + 1 ) / $intBorder, 0.7 ); } for ( $i = 0; $i < $intBorder; $i++ ) { $colDraw = imageColorExactAlpha( $srcImage, $rgbGlow[ "R" ], $rgbGlow[ "G" ], $rgbGlow[ "B" ], $arrGamma[ $i ] ); imageLine( $srcImage, $i, $i, $intWidth - $i - 1, $i, $colDraw ); imageLine( $srcImage, $i, $i + 1, $i, $intHeight - $i - 1, $colDraw ); imageLine( $srcImage, $intWidth - $i - 1, $i + 1, $intWidth - $i - 1, $intHeight - $i - 1, $colDraw ); imageLine( $srcImage, $i + 1, $intHeight - $i - 1, $intWidth - $i - 2, $intHeight - $i - 1, $colDraw ); } } function imageDrawText( &$srcImage, $intFontSize, $intAngle, $intXPos, $intYPos, $rgbText = array( "R" => 0xFF, "G" => 0xFF, "B" => 0xFF, "A" => 0x00 ), $strFontName, $strText ) { $intWidth = imageSX( $srcImage ); $intHeight = imageSY( $srcImage ); $strPath = "_fonts/"; $colDraw = imageColorExactAlpha( $srcImage, $rgbText[ "R" ], $rgbText[ "G" ], $rgbText[ "B" ], $rgbText[ "A" ] ); imageTTFText( $srcImage, $intFontSize, $intAngle, $intXPos, $intYPos, $colDraw, $strPath.$strFontName, $strText ); } ?>