Inverts the image.

@param bool $vertical If true invert vertical; if false invert horizontal

@return Eden\Image\Index
774883
public function invert($vertical = false)
    {
        //Argument 1 must be a boolean
        Argument::i()->test(1, 'bool');

        //get the source width and height
        $orgWidth = imagesx($this->resource);
        $orgHeight = imagesy($this->resource);

        $invert = imagecreatetruecolor($orgWidth, $orgHeight);

        if ($vertical) {
            imagecopyresampled(
                $invert,
                $this->resource,
                0,
                0,
                0,
                $orgHeight-1,
                $orgWidth,
                $orgHeight,
                $orgWidth,
                0-$orgHeight
            );
        } else {
            imagecopyresampled(
                $invert,
                $this->resource,
                0,
                0,
                $orgWidth-1,
                0,
                $orgWidth,
                $orgHeight,
                0-$orgWidth,
                $orgHeight
            );
        }

        //destroy the original resource
        imagedestroy($this->resource);

        //assign the new resource
        $this->resource = $invert;

        return $this;
    }
1302353
public function setImagedescription($v)
    {
        if ($v !== null) {
            $v = (string) $v;
        }

        if ($this->imagedescription !== $v) {
            $this->imagedescription = $v;
            $this->modifiedColumns[MediaTableMap::COL_IMAGEDESCRIPTION] = true;
        }

        return $this;
    }
1321964
public function rect(): Image
    {
        return self::runCmplx(function ($image) {
            return $image->complex(OperationComplex::RECT);
        }, $this);
    }
982591
public function setPosition($v)
    {
        if ($v !== null) {
            $v = (int) $v;
        }

        if ($this->position !== $v) {
            $this->position = $v;
            $this->modifiedColumns[LineageTableMap::COL_POSITION] = true;
        }

        return $this;
    }
997208
public function setPosition( $horizontal, $vertical )
	{
		if( in_array( $horizontal, array( 'left', 'center', 'right' ) ) )
			$this->positionH	= $horizontal;
		else
			throw new InvalidArgumentException( 'Horizontal Position "'.$horizontal.'" must be on of (left, center, right).' );
		if( in_array( $vertical, array( 'top', 'middle', 'bottom' ) ) )
			$this->positionV	= $vertical;
		else
			throw new InvalidArgumentException( 'Vertical Position "'.$horizontal.'" must be on of (top, middle, bottom).' );
	}
965139
private function invertTransparency($value, $originalMax, $invert = true)
		# Purpose:  This does two things:
		#       1) Convert the range from 0-127 to 0-100
		#       2) Inverts value to 100 is not transparent while 0 is fully
		#          transparent (like Photoshop)
	{
		// *** Test max range
		if ($value > $originalMax)
		{
			$value = $originalMax;
		}

		// *** Test min range
		if ($value < 0)
		{
			$value = 0;
		}

		if ($invert)
		{
			return $originalMax - (($value / 100) * $originalMax);
		}
		else
		{
			return ($value / 100) * $originalMax;
		}
	}
355617
public function flip($type)
    {
        // Initial positioning
        $x = 0;
        $y = 0;

        // Save original dimensions
        $width = $this->width;
        $height = $this->height;

        switch ($type) {
            case self::IMG_FLIP_BOTH:
                $x = $this->width - 1;
                $y = $this->height - 1;

                $width = -$this->width;
                $height = -$this->height;
            break;

            case self::IMG_FLIP_HORIZONTAL:
                $x = $this->width - 1;
                $width = -$this->width;
            break;

            case self::IMG_FLIP_VERTICAL:
                $y = $this->height - 1;
                $height = -$this->height;
            break;

            default:
                throw new UnexpectedValueException("Invalid flip type's value supplied");
        }

        // Done. Now create a new image
        $image = imagecreatetruecolor($this->width, $this->height);
        $this->preserveTransparency($image);

        imagecopyresampled($image, $this->image, 0, 0, $x, $y, $this->width, $this->height, $width, $height);

        // Override with new one
        $this->setImage($image);

        return $this;
    }
1183352
public function flip($mode='v'){
		if ( $this->test() )
		{
			if ( class_exists('\\Imagick') )
			{
				if ( $mode == 'v' )
				{
					if ( !$this->img->flipImage() ){
						$this->error = \defined('BBN_THERE_HAS_BEEN_A_PROBLEM') ?
							BBN_THERE_HAS_BEEN_A_PROBLEM : 'There has been a problem';
					}
				}
				else if ( !$this->img->flopImage() ){
					$this->error = \defined('BBN_THERE_HAS_BEEN_A_PROBLEM') ?
						BBN_THERE_HAS_BEEN_A_PROBLEM : 'There has been a problem';
				}
			}
			else
			{
				$w = imagesx($this->img);
				$h = imagesy($this->img);
				if ( $mode == 'v' ){
					imageflip($this->img, IMG_FLIP_VERTICAL);
				}
				else{
					imageflip($this->img, IMG_FLIP_HORIZONTAL);
				}
			}
		}
		return $this;
	}
1283029
public function setPageImageFree($v)
    {
        if ($v !== null) {
            $v = (string) $v;
        }

        if ($this->page_image_free !== $v) {
            $this->page_image_free = $v;
            $this->modifiedColumns[PageTableMap::COL_PAGE_IMAGE_FREE] = true;
        }

        return $this;
    }
1131430
public function flip($direction = Image::FLIP_HORIZONTAL): Image
	{
		$this->processor->flip($direction);

		return $this;
	}
385172
public function setHeight($v)
    {
        if ($v !== null) {
            $v = (int) $v;
        }

        if ($this->height !== $v) {
            $this->height = $v;
            $this->modifiedColumns[MediaTableMap::COL_HEIGHT] = true;
        }

        return $this;
    }
95063
public function setVertical($pValue = PHPExcel_Style_Alignment::VERTICAL_BOTTOM) {
		if ($pValue == '') {
			$pValue = PHPExcel_Style_Alignment::VERTICAL_BOTTOM;
		}

		if ($this->_isSupervisor) {
			$styleArray = $this->getStyleArray(array('vertical' => $pValue));
			$this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
		} else {
			$this->_vertical = $pValue;
		}
		return $this;
	}
375140
public function searchByReverseImage($inputs)
    {
        $searchResult = $this->getRequest()->request(
            'POST',
            $this->getRequestUrl('searches'),
            $this->getSearchQuery([self::REVERSED_IMAGES => $inputs])
        );

        return $this->getInputsFromSearchResult($searchResult);
    }
855148
public function visible($index = false, $view = true)
    {
        $this->visible = true;

        $this->actions[Action::VIEW] = $view;
        $this->actions[Action::INDEX] = $index;

        return $this;
    }
1301344
public function setTransversalFlags($v)
    {
        if ($v !== null) {
            $v = (int) $v;
        }

        if ($this->transversal_flags !== $v) {
            $this->transversal_flags = $v;
            $this->modifiedColumns[SkillTableMap::COL_TRANSVERSAL_FLAGS] = true;
        }

        return $this;
    }
396800
public function setAncestorId($v)
    {
        if ($v !== null) {
            $v = (int) $v;
        }

        if ($this->ancestor_id !== $v) {
            $this->ancestor_id = $v;
            $this->modifiedColumns[LineageTableMap::COL_ANCESTOR_ID] = true;
        }

        if ($this->aAncestor !== null && $this->aAncestor->getId() !== $v) {
            $this->aAncestor = null;
        }

        return $this;
    }
23786
public function flip($flip_horizontal, $flip_vertical = false)
	{
		if (empty($this->resource))
		{
			return false;
		}
		$resource = $this->resource;
		$width = imagesx($resource);
		$height = imagesy($resource);
		$new_resource = imagecreatetruecolor($width, $height);

		for ($x=0; $x<$width; $x++)
		{
			for ($y=0; $y<$height; $y++)
			{
				if ($flip_horizontal && $flip_vertical)
				{
					imagecopy($new_resource, $resource, $width-$x-1, $height-$y-1, $x, $y, 1, 1);
				}
				else if ($flip_horizontal)
				{
					imagecopy($new_resource, $resource, $width-$x-1, $y, $x, $y, 1, 1);
				}
				else if ($flip_vertical)
				{
					imagecopy($new_resource, $resource, $x, $height-$y-1, $x, $y, 1, 1);
				}
			}
		}

		$this->resource = $new_resource;
		imagedestroy($resource);
	}