@param string $themeName
@param int    $screenshotNumber

@return BinaryFileResponse
962207
public function streamScreenshotAction($themeName, $screenshotNumber)
    {
        $screenshotPath = $this->getScreenshotPath($this->getTheme($themeName), $screenshotNumber);

        try {
            return new BinaryFileResponse($screenshotPath);
        } catch (FileNotFoundException $exception) {
            throw new NotFoundHttpException(sprintf('Screenshot "%s" does not exist', $screenshotPath), $exception);
        }
    }
294493
public function find($themeName)
    {
        foreach ($this->getDirectories() as $directory) {
            if (! str_contains($directory, $themeName)) {
                continue;
            }

            return $this->getThemeInfoForPath($directory);
        }

        throw new ThemeNotFoundException($themeName);
    }
499331
public void takeScreenshot(String filename) throws IOException {
		File screenshot = ((TakesScreenshot) driver)
				.getScreenshotAs(OutputType.FILE);
		FileUtils.copyFile(screenshot, new File(filename));
	}
127116
public function getThemeBootstrapVersion($themeName = null)
    {
        if (null === $themeName) {
            if (null !== $this->bootstrapVersion) {
                return $this->bootstrapVersion;
            }

            $themeName = $this->getActiveThemeBackend()->getThemeName();
        }

        $this->bootstrapVersion = $this->container->getParameter('red_kite_cms.bootstrap_version');

        if ( ! $this->container->hasParameter('red_kite_labs_theme_engine.bootstrap_themes')) {
            return $this->bootstrapVersion;
        }

        $themes = $this->container->getParameter('red_kite_labs_theme_engine.bootstrap_themes');
        if (array_key_exists($themeName, $themes)) {
            $this->bootstrapVersion = $themes[$themeName];
        }

        return $this->bootstrapVersion;
    }
837211
public function getFormatScheme($slideNumber, $storageName = '')
    {


        //Build URI to get format scheme
        $strURI = Product::$baseProductUri . '/slides/' . $this->getFileName() . '/slides/' . $slideNumber . '/theme/formatScheme';
        if ($storageName != '') {
            $strURI .= '?storage=' . $storageName;
        }
        $signedURI = Utils::sign($strURI);

        $responseStream = Utils::processCommand($signedURI, 'GET', '', '');

        $json = json_decode($responseStream);

        return $json->FormatScheme;
    }
467774
public function exists($themeName)
    {
        foreach ($this->themes as $theme) {
            if ($theme->name == $themeName) {
                return true;
            }

        }
        return false;
    }
1084484
public function generateExtension($namespace, $dir, $themeName, array $templates)
    {
        $themeBasename = str_replace('Bundle', '', $themeName);
        $extensionAlias = Container::underscore($themeBasename);

        $templateFiles = array_map(function ($template) { return basename($template["name"], '.html.twig'); }, $templates);

        $parameters = array(
            'namespace' => $namespace,
            'bundle_basename' => $themeBasename,
            'theme_files' => array($extensionAlias),
            'template_files' => $templateFiles,
            "extension_alias" => $extensionAlias,
        );

        $this->setSkeletonDirs($this->themeSkeletonDir);
        $extensionFile = str_replace('Bundle', '', $themeBasename) . 'Extension.php';
        $this->renderFile('Extension.php', $dir . '/' . $extensionFile, $parameters);
        $message = sprintf('The extension file <info>%s</info> has been generated into <info>%s</info>', $extensionFile, $dir);

        return $message;
    }
65678
public function takeScreenshot($name = NULL) {
    $file_name = sys_get_temp_dir() . DIRECTORY_SEPARATOR . $name;
    $message = "Screenshot created in @file_name";
    $this->createScreenshot($file_name, $message, FALSE);
  }
319842
protected function resolveHelpMessageThumbnail($nodeTypeName, $configurationThumbnail)
    {
        if ($nodeTypeName !== null) {
            $thumbnailUrl = '';
            if (isset($configurationThumbnail)) {
                $thumbnailUrl = $configurationThumbnail;
                if (strpos($thumbnailUrl, 'resource://') === 0) {
                    $thumbnailUrl = $this->resourceManager->getPublicPackageResourceUriByPath($thumbnailUrl);
                }
            } else {
                # look in well know location
                $splitPrefix = $this->splitIdentifier($nodeTypeName);
                $relativePathAndFilename = 'NodeTypes/Thumbnails/' . $splitPrefix['id'] . '.png';
                $resourcePath = 'resource://' . $splitPrefix['packageKey'] . '/Public/' . $relativePathAndFilename;
                if (file_exists($resourcePath)) {
                    $thumbnailUrl = $this->resourceManager->getPublicPackageResourceUriByPath($resourcePath);
                }
            }
            return $thumbnailUrl;
        }
    }
1227681
public static Bitmap createScreenshot(Context context) {
        if (!hasScreenshotPermission(context)) {
            LogUtils.log(ScreenshotUtils.class, Log.ERROR, "Screenshot permission denied.");
            return null;
        }

        final WindowManager windowManager =
                (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);

        final Bitmap bitmap = SurfaceControlCompatUtils.screenshot(0, 0);

        // Bail if we couldn't take the screenshot.
        if (bitmap == null) {
            LogUtils.log(ScreenshotUtils.class, Log.ERROR, "Failed to take screenshot.");
            return null;
        }

        final int width = bitmap.getWidth();
        final int height = bitmap.getHeight();
        final int rotation = windowManager.getDefaultDisplay().getRotation();

        final int outWidth;
        final int outHeight;
        final float rotationDegrees;

        switch (rotation) {
            case Surface.ROTATION_90:
                outWidth = height;
                outHeight = width;
                rotationDegrees = 90;
                break;
            case Surface.ROTATION_180:
                outWidth = width;
                outHeight = height;
                rotationDegrees = 180;
                break;
            case Surface.ROTATION_270:
                outWidth = height;
                outHeight = width;
                rotationDegrees = 270;
                break;
            default:
                return bitmap;
        }

        // Rotate the screenshot to match the screen orientation.
        final Bitmap rotatedBitmap =
                Bitmap.createBitmap(outWidth, outHeight, Bitmap.Config.RGB_565);
        final Canvas c = new Canvas(rotatedBitmap);

        c.translate(outWidth / 2.0f, outHeight / 2.0f);
        c.rotate(-rotationDegrees);
        c.translate(-width / 2.0f, -height / 2.0f);
        c.drawBitmap(bitmap, 0, 0, null);

        bitmap.recycle();

        return rotatedBitmap;
    }
466131
private function saveScreenshot(array $feedbackObject) {
		//Get save path from config
		$savepath = ROOT . DS . 'files' . DS . 'img' . DS . 'screenshots' . DS;

		//Serialize and save the object to a store in the Cake's tmp dir.
		if (!file_exists($savepath)) {
			if (!mkdir($savepath)) {
				//Throw error, directory is requird
				throw new NotFoundException('Could not create directory to save screenshots in. Please provide write rights to webserver user on directory: ' . $savepath);
			}
		}

		$screenshotname = $this->generateScreenshotName();

		if (file_put_contents($savepath . $screenshotname, base64_decode($feedbackObject['screenshot']))) {
			//Return the screenshotname
			return $screenshotname;
		}

		return null;
	}
536304
public function anyMatch($propertyName, $propertyValues) {
		if ($propertyValues === null || empty($propertyValues) || $propertyValues[0] === null) {
			return $this;
		}

		$queryString = null;
		$lastElemtentKey = count($propertyValues) - 1;
		foreach($propertyValues as $key => $propertyValue) {
			$parameterName = ':' . md5($propertyName . '#' . count($this->where) . $key);
			$this->parameterMap[$parameterName] = $propertyValue;

			if ($key === 0) {
				$queryString .= '(';
			}
			if ($key !== $lastElemtentKey) {
				$queryString .= sprintf("(`%s`) = %s OR ", $propertyName, $parameterName);
			} else {
				$queryString .= sprintf("(`%s`) = %s )", $propertyName, $parameterName);
			}
		}

		$this->where[] = $queryString;

		return $this;
	}
854589
public function getTheme($themeName)
    {
        if (empty($themeName)) {
            throw new \InvalidArgumentException('The theme name must not be empty.');
        } elseif (!$this->hasTheme($themeName)) {
            throw new \LogicException(sprintf('Unable to retrieve definition for theme "%s".', $themeName));
        }

        if (!isset($this->instances[$themeName])) {
            $theme = $this->themeFactory->create($themeName, $this->themeDefinitions[$themeName]);
            $this->instances[$themeName] = $this->mergePageTemplates($theme);
        }

        return $this->instances[$themeName];
    }
887593
public static function fromFilename($filename, $backgroundColor = null)
    {
        $image = imagecreatefromstring(file_get_contents($filename));
        $palette = self::fromGD($image, $backgroundColor);
        imagedestroy($image);

        return $palette;
    }
691691
public function downloadAction($filename)
    {
        $pathname = $this->getArchiver()->buildPathname($filename);

        if (!is_readable($pathname)) {
            throw $this->createNotFoundException(sprintf('Image archive "%s" is not readable.', $pathname));
        }

        return new BinaryFileResponse($pathname);
    }
1029319
public static function collect(string $className, $objectAnnotation = null, string $propertyName = "", string $methodName = "", $propertyValue = null)
    {
        if ($objectAnnotation instanceof Process) {

            $num       = $objectAnnotation->getNum();
            $name      = $objectAnnotation->getName();
            $boot      = $objectAnnotation->isBoot();
            $inout     = $objectAnnotation->isInout();
            $pipe      = $objectAnnotation->isPipe();
            $coroutine = $objectAnnotation->isCoroutine();
            $name      = empty($name) ? $className : $name;

            self::$processes[$name] = [
                'name'  => $name,
                'num'   => $num,
                'boot'  => $boot,
                'pipe'  => $pipe,
                'inout' => $inout,
                'co'    => $coroutine,
                'class' => $className,
            ];

            return;
        }
    }
560148
public function delegateAction($templateKey, $mediaTypeName)
    {
        $mediaTypeManager = $this->get('phlexible_media_type.media_type_manager');
        $templateManager = $this->get('phlexible_media_template.template_manager');
        $delegateService = $this->get('phlexible_media_cache.image_delegate.service');

        $template = $templateManager->find($templateKey);

        $mediaType = $mediaTypeManager->find(strtolower($mediaTypeName));
        $filePath = $delegateService->getClean($template, $mediaType);
        $fileSize = filesize($filePath);
        $mimeType = 'image/gif';

        $response = new BinaryFileResponse($filePath, 200, array('Content-Type' => $mimeType));

        return $response;
    }