BlackAndWhiteRasterImage¶
Small implementation of basic raster operations on PBM files to support creation of placeholder glyphs
Qualified name: | Mike42\GfxPhp\BlackAndWhiteRasterImage |
---|---|
Extends: | AbstractRasterImage |
-
class
BlackAndWhiteRasterImage
¶ -
clear
()¶
-
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) –
-
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.
-
invert
()¶
-
mapColor
(int $srcColor, RasterImage $destImage)¶ Parameters: - $srcColor (int) –
- $destImage (RasterImage) –
-
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
-
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
-
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.
-
toString
()¶
-
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
($width, $height[, array $data])¶ Parameters: - $width –
- $height –
- $data (array) – Default:
null
-