RasterImage¶
Generic interface to raster images.
Qualified name: | Mike42\GfxPhp\RasterImage |
---|
-
interface
RasterImage
¶ -
getHeight
() → int¶ Get the height of the image in pixels.
Returns: int – The height of the image in pixels.
-
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.
-
getWidth
() → int¶ Get the width of the image in pixels.
Returns: int – The width of the image in pixels.
-
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.
-
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
-
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.
-