コード例 #1
0
 private function drawGameBackground($sGameBGUrl)
 {
     $gameBGImage = new GDImage();
     try {
         // load and cache game background
         $gameBGFile = $this->loadJpegUrl($sGameBGUrl);
         $gameBGImage->loadJpeg($gameBGFile->getPath());
     } catch (Exception $e) {
         // the game background doesn't work, but we don't mind
         return;
     }
     // draw game background
     $this->copyResampled($gameBGImage, $this->getWidth() - 128, 0, 0, 0, 128, 48, 120, 45);
     $gameBGImage->destroy();
     // draw fade background over game background
     $fadeBGImage = new GDImage();
     $fadeBGImage->loadPng($this->aThemeFiles['background_fade']);
     $this->copy($fadeBGImage, $this->getWidth() - 128, 0);
     $fadeBGImage->destroy();
 }
コード例 #2
0
 private function drawIconCluster($iX, $iY, $aIconUrls, $sText)
 {
     // settings
     $iImageWidth = 116;
     $iImageHeight = 46;
     $iIconImageSize = 32;
     $iImageIconsX = 0;
     $iImageIconsY = 10;
     $sFontColorInfo1 = $this->oThemeConfig->getString('theme.text.color.info1');
     $iFontSizeNormal = $this->oThemeConfig->getInteger('theme.text.size.normal');
     $sFontFileNormal = $this->oThemeConfig->getString('theme.text.font.normal');
     $bFontAntiAlias = $this->oThemeConfig->getInteger('theme.text.anti-alias');
     $iIconSpacing = $this->oThemeConfig->getInteger('theme.image.icon.spacing');
     // new blank image
     $image = $this->createBlankImage($iImageWidth, $iImageHeight);
     // allocate color
     $iFontColor = $image->getColorHex($sFontColorInfo1, $bFontAntiAlias);
     // draw text
     $image->drawTextFT($sText, $sFontFileNormal, $iFontSizeNormal, 0, $iFontColor, 0, $iFontSizeNormal);
     // load icon frame
     $iconFrameImage = new GDImage();
     $iconFrameImage->loadPng($this->aThemeFiles["frame_icon"]);
     foreach ($aIconUrls as $sIconUrl) {
         // check for basic validity
         if (substr($sIconUrl, 0, 7) != 'http://' || substr($sIconUrl, -4) != '.jpg') {
             continue;
         }
         try {
             // load and cache icon
             $iconFile = $this->loadJpegUrl($sIconUrl);
             $iconImage = new GDImage();
             $iconImage->loadJpeg($iconFile->getPath());
         } catch (Exception $e) {
             // create placeholder
             $iconImage = $this->createPlaceholderImage($iIconImageSize, $iIconImageSize);
         }
         $image->copy($iconImage, $iImageIconsX + 2, $iImageIconsY + 2);
         $iconImage->destroy();
         // draw icon frame
         $image->copy($iconFrameImage, $iImageIconsX, $iImageIconsY);
         // move next icon to the right
         $iImageIconsX += $iIconImageSize + $iIconSpacing;
     }
     $iconFrameImage->destroy();
     // copy to main image
     $this->copy($image, $iX, $iY);
     $image->destroy();
 }