Pop\Image\Gd::flop PHP Метод

flop() публичный Метод

Method to flip the image over the y-axis.
public flop ( ) : Gd
Результат Gd
    public function flop()
    {
        // Create a new image output resource.
        $this->createResource();
        $this->output = imagecreatetruecolor($this->width, $this->height);
        // Calculate the new dimensions
        $curWidth = $this->width;
        $curHeight = $this->height;
        $srcX = $this->width - 1;
        // Compensate for a 1-pixel space on the flipped image
        $srcY = 0;
        $this->width = 0 - $this->width;
        // Copy newly sized image to the output resource.
        $this->copyImage($curWidth, $curHeight, $srcX, $srcY);
        $this->width = abs($this->width);
        return $this;
    }

Usage Example

Пример #1
0
 public function testDummyMethods()
 {
     $i = new Gd(__DIR__ . '/../tmp/test.jpg');
     $i->flip();
     $i->flop();
     $this->assertInstanceOf('Pop\\Image\\Gd', $i->setFilter());
     $this->assertInstanceOf('Pop\\Image\\Gd', $i->setBlur());
     $this->assertInstanceOf('Pop\\Image\\Gd', $i->setOverlay());
     $this->assertInstanceOf('Pop\\Image\\Gd', $i->hue(100));
     $this->assertInstanceOf('Pop\\Image\\Gd', $i->saturation(100));
     $this->assertInstanceOf('Pop\\Image\\Gd', $i->hsb(100, 100, 1000));
     $this->assertInstanceOf('Pop\\Image\\Gd', $i->level(0, 0, 0));
     $this->assertInstanceOf('Pop\\Image\\Gd', $i->flatten());
     $this->assertInstanceOf('Pop\\Image\\Gd', $i->paint(10));
     $this->assertInstanceOf('Pop\\Image\\Gd', $i->posterize(10));
     $this->assertInstanceOf('Pop\\Image\\Gd', $i->noise());
     $this->assertInstanceOf('Pop\\Image\\Gd', $i->diffuse(10));
     $this->assertInstanceOf('Pop\\Image\\Gd', $i->skew(new Rgb(255, 0, 0), 10, 10));
     $this->assertInstanceOf('Pop\\Image\\Gd', $i->swirl(10));
     $this->assertInstanceOf('Pop\\Image\\Gd', $i->wave(10, 10));
     $this->assertInstanceOf('Pop\\Image\\Gd', $i->setFormats());
 }