Documentation

IMagickLuminanceSource extends LuminanceSourceAbstract
in package

This class is used to help decode images from files which arrive as Imagick Resource It does not support rotation.

Table of Contents

$height  : int
$luminances  : array<string|int, mixed>
$width  : int
$imagick  : Imagick
__construct()  : mixed
IMagickLuminanceSource constructor.
fromBlob()  : self
fromFile()  : self
getHeight()  : int
getMatrix()  : array<string|int, mixed>
Fetches luminance data for the underlying bitmap. Values should be fetched using: {@code int luminance = array[y * width + x] & 0xff}
getRow()  : array<string|int, mixed>
Fetches one row of luminance data from the underlying platform's bitmap. Values range from 0 (black) to 255 (white). Because Java does not have an unsigned byte type, callers will have to bitwise and with 0xff for each value. It is preferable for implementations of this method to only fetch this row rather than the whole image, since no 2D Readers may be installed and getMatrix() may never be called.
getWidth()  : int
checkFile()  : string
setLuminancePixel()  : void
setLuminancePixels()  : void

Properties

Methods

__construct()

IMagickLuminanceSource constructor.

public __construct(Imagick $imagick) : mixed
Parameters
$imagick : Imagick
Tags
throws
InvalidArgumentException
Return values
mixed

fromBlob()

public static fromBlob(string $blob) : self
Parameters
$blob : string
Tags
inheritDoc
Return values
self

fromFile()

public static fromFile(string $path) : self
Parameters
$path : string
Tags
inheritDoc
Return values
self

getHeight()

public getHeight() : int
Tags
inheritDoc
Return values
int

The height of the bitmap.

getMatrix()

Fetches luminance data for the underlying bitmap. Values should be fetched using: {@code int luminance = array[y * width + x] & 0xff}

public getMatrix() : array<string|int, mixed>
Tags
inheritDoc
Return values
array<string|int, mixed>

A row-major 2D array of luminance values. Do not use result.length as it may be larger than width * height bytes on some platforms. Do not modify the contents of the result.

getRow()

Fetches one row of luminance data from the underlying platform's bitmap. Values range from 0 (black) to 255 (white). Because Java does not have an unsigned byte type, callers will have to bitwise and with 0xff for each value. It is preferable for implementations of this method to only fetch this row rather than the whole image, since no 2D Readers may be installed and getMatrix() may never be called.

public getRow(int $y) : array<string|int, mixed>
Parameters
$y : int

The row to fetch, which must be in [0,getHeight())

Tags
inheritDoc
Return values
array<string|int, mixed>

An array containing the luminance data.

checkFile()

protected static checkFile(string $path) : string
Parameters
$path : string
Return values
string

setLuminancePixel()

protected setLuminancePixel(int $r, int $g, int $b) : void
Parameters
$r : int
$g : int
$b : int
Return values
void

Search results