| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151 |
- <?php
- use Mike42\GfxPhp\Image;
- /**
- * @BeforeMethods({"init"})
- * @Revs(1000)
- */
- class ConvertRasterImageBenchmark
- {
- private static $bw100;
- private static $gray100;
- private static $indexed100;
- private static $rgb100;
- public function init()
- {
- self::$rgb100 = Image::fromFile(__DIR__ . "/../../resources/pngsuite/z09n2c08.png");
- self::$bw100 = self::$rgb100 -> toBlackAndWhite();
- self::$indexed100 = self::$rgb100 -> toIndexed();
- self::$gray100 = self::$rgb100 -> toGrayscale();
- }
- /**
- * @Subject
- */
- public function convertBwToBw()
- {
- self::$bw100->toBlackAndWhite();
- }
- /**
- * @Subject
- */
- public function convertBwToGray()
- {
- self::$bw100->toGrayscale();
- }
- /**
- * @Subject
- */
- public function convertBwToIndexed()
- {
- self::$bw100->toIndexed();
- }
- /**
- * @Subject
- */
- public function convertBwToRgb()
- {
- self::$bw100->toRgb();
- }
- /**
- * @Subject
- */
- public function convertGrayToBw()
- {
- self::$gray100->toBlackAndWhite();
- }
- /**
- * @Subject
- */
- public function convertGrayToGray()
- {
- self::$gray100->toGrayscale();
- }
- /**
- * @Subject
- */
- public function convertGrayToIndexed()
- {
- self::$gray100->toIndexed();
- }
- /**
- * @Subject
- */
- public function convertGrayToRgb()
- {
- self::$gray100->toRgb();
- }
- /**
- * @Subject
- */
- public function convertIndexedToBw()
- {
- self::$indexed100->toBlackAndWhite();
- }
- /**
- * @Subject
- */
- public function convertIndexedToGray()
- {
- self::$indexed100->toGrayscale();
- }
- /**
- * @Subject
- */
- public function convertIndexedToIndexed()
- {
- self::$indexed100->toIndexed();
- }
- /**
- * @Subject
- */
- public function convertIndexedToRgb()
- {
- self::$indexed100->toRgb();
- }
- /**
- * @Subject
- */
- public function convertRgbToBw()
- {
- self::$rgb100->toBlackAndWhite();
- }
- /**
- * @Subject
- */
- public function convertRgbToGray()
- {
- self::$rgb100->toGrayscale();
- }
- /**
- * @Subject
- */
- public function convertRgbToIndexed()
- {
- self::$rgb100->toIndexed();
- }
- /**
- * @Subject
- */
- public function convertRgbToRgb()
- {
- self::$rgb100->toRgb();
- }
- }
|