/** * Important! * Make sure the cache directory is writable */ public static function buildCache() { static::markTime('before_build_cache'); $mask = new Mask(); for ($a = 1; $a <= Enum::QRSPEC_VERSION_MAX; $a++) { $frame = Specifications::newFrame($a); $cache_dir = static::getCacheDir(); $fileName = $cache_dir . 'frame_' . $a . '.png'; Image::png(static::binarize($frame), $fileName, 1, 0); $width = count($frame); $bitMask = array_fill(0, $width, array_fill(0, $width, 0)); for ($maskNo = 0; $maskNo < 8; $maskNo++) { $mask->makeMaskNo($maskNo, $width, $frame, $bitMask, true); } } static::markTime('after_build_cache'); }