Class Pixel
- Namespace
- ImageMagick
- Assembly
- Magick.NET-Q8-AnyCPU.dll
Class that can be used to access an individual pixel of an image.
public sealed class Pixel : IPixel<byte>, IEquatable<IPixel<byte>?>, IEquatable<IMagickColor<byte>?>
- Inheritance
-
Pixel
- Implements
-
IPixel<byte>
- Inherited Members
Constructors
Pixel(int, int, byte[])
Initializes a new instance of the Pixel class.
public Pixel(int x, int y, byte[] value)
Parameters
x
intThe X coordinate of the pixel.
y
intThe Y coordinate of the pixel.
value
byte[]The value of the pixel.
Pixel(int, int, uint)
Initializes a new instance of the Pixel class.
public Pixel(int x, int y, uint channels)
Parameters
x
intThe X coordinate of the pixel.
y
intThe Y coordinate of the pixel.
channels
uintThe number of channels.
Properties
Channels
Gets the number of channels that the pixel contains.
public uint Channels { get; }
Property Value
this[uint]
Returns the value of the specified channel.
public byte this[uint channel] { get; set; }
Parameters
channel
uintThe channel to get the value for.
Property Value
X
Gets the X coordinate of the pixel.
public int X { get; }
Property Value
Y
Gets the Y coordinate of the pixel.
public int Y { get; }
Property Value
Methods
Equals(IMagickColor<byte>?)
Determines whether the specified color is equal to the current pixel.
public bool Equals(IMagickColor<byte>? other)
Parameters
other
IMagickColor<byte>The color to compare this pixel with.
Returns
- bool
True when the specified color is equal to the current pixel.
Equals(IPixel<byte>?)
Determines whether the specified pixel is equal to the current pixel.
public bool Equals(IPixel<byte>? other)
Parameters
other
IPixel<byte>The pixel to compare this pixel with.
Returns
- bool
True when the specified pixel is equal to the current pixel.
Equals(object?)
Determines whether the specified object is equal to the current pixel.
public override bool Equals(object? obj)
Parameters
obj
objectThe object to compare pixel color with.
Returns
- bool
True when the specified object is equal to the current pixel.
GetChannel(uint)
Returns the value of the specified channel.
public byte GetChannel(uint channel)
Parameters
channel
uintThe channel to get the value of.
Returns
- byte
The value of the specified channel.
GetHashCode()
Serves as a hash of this type.
public override int GetHashCode()
Returns
- int
A hash code for the current instance.
SetChannel(uint, byte)
Set the value of the specified channel.
public void SetChannel(uint channel, byte value)
Parameters
SetValues(byte[])
Sets the values of this pixel.
public void SetValues(byte[] values)
Parameters
values
byte[]The values.
ToArray()
Returns the value of this pixel as an array.
public byte[] ToArray()
Returns
ToColor()
Converts the pixel to a color. Assumes the pixel is RGBA.
public IMagickColor<byte>? ToColor()
Returns
- IMagickColor<byte>
A ImageMagick.IMagickColor<> instance.