SetaPDF_Core_Image Base class for image handling

File: /SetaPDF/Core/Image.php

This class is responsible for getting the correct image type implementation for a desired image type.

Actually PNG and JPEG classes exist.

Class hierarchy

Summary

Constants

TYPE_GIF

const string SetaPDF_Core_Image::TYPE_GIF = 'gif'

Image type

TYPE_JPEG

const string SetaPDF_Core_Image::TYPE_JPEG = 'jpeg'

Image type

TYPE_JPEG2000

const string SetaPDF_Core_Image::TYPE_JPEG2000 = 'jpeg2000'

Image type

TYPE_PNG

const string SetaPDF_Core_Image::TYPE_PNG = 'png'

Image type

TYPE_TIFF

const string SetaPDF_Core_Image::TYPE_TIFF = 'tiff'

Image type

TYPE_UNKNOWN

const string SetaPDF_Core_Image::TYPE_UNKNOWN = 'unknown'

Image type


Properties

$_binaryReader

$_bitsPerComponent

protected integer SetaPDF_Core_Image::$_bitsPerComponent = 8

Bits per component

$_colorSpace

protected integer SetaPDF_Core_Image::$_colorSpace

The image type specific colorspace

$_dpiX

protected integer SetaPDF_Core_Image::$_dpiX = 0

Dots-per-inch in the X direction

$_dpiY

protected integer SetaPDF_Core_Image::$_dpiY = 0

Dots-per-inch in the Y direction

$_height

protected integer SetaPDF_Core_Image::$_height

The pixel height

$_inverted

protected boolean todo Use it SetaPDF_Core_Image::$_inverted = false

Flag for color inversion

$_width

protected integer SetaPDF_Core_Image::$_width

The pixel width


Static Methods

get()

static public SetaPDF_Core_Image SetaPDF_Core_Image::get ( SetaPDF_Core_Reader_ReaderInterface $reader )

Get an image by a reader.

Parameters
$reader : SetaPDF_Core_Reader_ReaderInterface

The reader instance

Exceptions

Throws SetaPDF_Exception_NotImplemented If the image type is not supported (supported types: JPEG, PNG, JPEG2000).

getByPath()

static public SetaPDF_Core_Image SetaPDF_Core_Image::getByPath ( string $path )

Get an image by a path.

Parameters
$path : string

The path to the image

getType()

static public string SetaPDF_Core_Image::getType ( SetaPDF_Core_Reader_ReaderInterface $reader )

Get an image type by a reader.

Parameters
$reader : SetaPDF_Core_Reader_ReaderInterface
 

Methods

__construct()

public SetaPDF_Core_Image::__construct ( [ SetaPDF_Core_Reader_ReaderInterface $reader = null ] )

The constructor.

Parameters
$reader : SetaPDF_Core_Reader_ReaderInterface
 

_process()

abstract protected void SetaPDF_Core_Image::_process ( void )

Processes the image data so all needed information is available.

getBitsPerComponent()

public number SetaPDF_Core_Image::getBitsPerComponent ( void )

Get the bits per component value.

getColorSpace()

public number SetaPDF_Core_Image::getColorSpace ( void )

Get the image type specific colorspace.

getDpiX()

public number SetaPDF_Core_Image::getDpiX ( void )

Get the dots-per-inch in the X direction.

getDpiY()

public number SetaPDF_Core_Image::getDpiY ( void )

Get the dots-per-inch in the Y direction.

getHeight()

public number SetaPDF_Core_Image::getHeight ( [ float $width = null ] )

Get the height.

Parameters
$width : float

Value for keeping the aspect ratio

getWidth()

public number SetaPDF_Core_Image::getWidth ( [ float $height = null ] )

Get the width.

Parameters
$height : float

Value for keeping the aspect ratio

toXObject()

abstract public SetaPDF_Core_XObject_Image SetaPDF_Core_Image::toXObject ( SetaPDF_Core_Document $document )

Converts an image to an external object.

Parameters
$document : SetaPDF_Core_Document