IndexedRasterImage

Qualified name:Mike42\GfxPhp\IndexedRasterImage
Extends:AbstractRasterImage
class IndexedRasterImage
allocateColor(array $color)
Parameters:
  • $color (array) –
compose(RasterImage $source, int $startX, int $startY, int $destStartX, int $destStartY, int $width, int $height)
Parameters:
  • $source (RasterImage) –
  • $startX (int) –
  • $startY (int) –
  • $destStartX (int) –
  • $destStartY (int) –
  • $width (int) –
  • $height (int) –
deallocateColor(array $color)
Parameters:
  • $color (array) –
getHeight() → int

Get the height of the image in pixels.

Returns:int – The height of the image in pixels.
getMaxVal()
getPalette()
getPixel(int $x, int $y) → int

Get the value of a given pixel. The meaning of the integer value of this pixel is implementation-dependent.

Parameters:
  • $x (int) – X co-ordinate
  • $y (int) – Y co-ordinate
Returns:

int – The value of the pixel at ($x, $y).

getRasterData() → string

Get a binary string representing the underlying image data. The formatting of this data is implementation-dependent.

Returns:string – A binary string representation of the raster data for this image.
getTransparentColor()
getWidth() → int

Get the width of the image in pixels.

Returns:int – The width of the image in pixels.
indexToRgb(int $index)
Parameters:
  • $index (int) –
rect($startX, $startY, $width, $height[, $filled, $outline, $fill])

Produce a rectangle with the given properties.

Parameters:
  • $startX
  • $startY
  • $width
  • $height
  • $filled – Default: false
  • $outline – Default: 1
  • $fill (int) – Default: 1
rgbToIndex(array $rgb)
Parameters:
  • $rgb (array) –
scale(int $width, int $height) → RasterImage

Produce a new RasterImage based on this one. The new image will be scaled to the requested dimensions via resampling.

Parameters:
  • $width (int) – The width of the returned image.
  • $height (int) – The height of the returned image.
Returns:

RasterImage – A scaled version of the image.

setMaxVal(int $maxVal)
Parameters:
  • $maxVal (int) –
setPalette(array $palette)
Parameters:
  • $palette (array) –
setPixel(int $x, int $y, int $value)

Set the value of a given pixel.

Parameters:
  • $x (int) – X co-ordinate
  • $y (int) – Y co-ordinate
  • $value (int) – Value to set
setTransparentColor([])
Parameters:
  • $color (int) – Default: null
subImage(int $startX, int $startY, int $width, int $height)
Parameters:
  • $startX (int) –
  • $startY (int) –
  • $width (int) –
  • $height (int) –
toBlackAndWhite() → BlackAndWhiteRasterImage

Produce a copy of this RasterImage in a pure black-and-white colorspace.

Returns:BlackAndWhiteRasterImage – a black and white version of the image.
toGrayscale() → GrayscaleRasterImage

Produce a copy of this RasterImage in a monochrome colorspace.

Returns:GrayscaleRasterImage – A monochrome version of the image.
toIndexed() → IndexedRasterImage

Produce a copy of this RasterImage as an indexed image with an associated palette of unique colors.

Returns:IndexedRasterImage – An paletted version of the image.
toRgb() → RgbRasterImage

Produce a copy of this RasterImage in the RGB colorspace.

Returns:RgbRasterImage – An RGB version of the image.
write(string $filename)

Write the image to a file. The output format is determined by the file extension.

Parameters:
  • $filename (string) – Filename to write to.
static create(int $width, int $height[, array $data, array $palette, int $maxVal])
Parameters:
  • $width (int) –
  • $height (int) –
  • $data (array) – Default: null
  • $palette (array) – Default: []
  • $maxVal (int) – Default: 255