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