PHP Class SimpleSoftwareIO\QrCode\ImageMerge

Inheritance: implements SimpleSoftwareIO\QrCode\ImageMergeInterface
Show file Open project: simplesoftwareio/simple-qrcode Class Usage Examples

Protected Properties

Property Type Description
$centerX integer The position that the merge image is placed on top of the source image.
$centerY integer The position that the merge image is placed on top of the source image.
$mergeImage Image Holds the merging image.
$mergeImageHeight integer The height of the merge image.
$mergeImageWidth integer The width of the merge image.
$postMergeImageHeight integer The height of the merge image after it is merged.
$postMergeImageWidth integer The width of the merge image after it is merged.
$sourceImage Image Holds the QrCode image.
$sourceImageHeight integer The height of the source image.
$sourceImageWidth integer The width of the source image.

Public Methods

Method Description
__construct ( Image $sourceImage, Image $mergeImage ) Creates a new ImageMerge object.
merge ( $percentage ) : string Returns an QrCode that has been merge with another image.

Protected Methods

Method Description
createImage ( ) : string Creates a PNG Image.
setProperties ( $percentage ) Sets the objects properties.

Private Methods

Method Description
calculateCenter ( ) Calculates the center of the source Image using the Merge image.
calculateOverlap ( float $percentage ) Calculates the width of the merge image being placed on the source image.

Method Details

__construct() public method

Creates a new ImageMerge object.
public __construct ( Image $sourceImage, Image $mergeImage )
$sourceImage Image Image The image that will be merged over.
$mergeImage Image Image The image that will be used to merge with $sourceImage

createImage() protected method

Creates a PNG Image.
protected createImage ( ) : string
return string

merge() public method

This is usually used with logos to imprint a logo into a QrCode.
public merge ( $percentage ) : string
$percentage float The percentage of size relative to the entire QR of the merged image
return string

setProperties() protected method

Sets the objects properties.
protected setProperties ( $percentage )
$percentage float The percentage that the merge image should take up.

Property Details

$centerX protected property

The position that the merge image is placed on top of the source image.
protected int $centerX
return integer

$centerY protected property

The position that the merge image is placed on top of the source image.
protected int $centerY
return integer

$mergeImage protected property

Holds the merging image.
protected Image,SimpleSoftwareIO\QrCode $mergeImage
return Image

$mergeImageHeight protected property

The height of the merge image.
protected int $mergeImageHeight
return integer

$mergeImageWidth protected property

The width of the merge image.
protected int $mergeImageWidth
return integer

$postMergeImageHeight protected property

The height of the merge image after it is merged.
protected int $postMergeImageHeight
return integer

$postMergeImageWidth protected property

The width of the merge image after it is merged.
protected int $postMergeImageWidth
return integer

$sourceImage protected property

Holds the QrCode image.
protected Image,SimpleSoftwareIO\QrCode $sourceImage
return Image

$sourceImageHeight protected property

The height of the source image.
protected int $sourceImageHeight
return integer

$sourceImageWidth protected property

The width of the source image.
protected int $sourceImageWidth
return integer