Table of Contents

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>
IEquatable<IMagickColor<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 int

The X coordinate of the pixel.

y int

The Y coordinate of the pixel.

channels int

The 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 int

The X coordinate of the pixel.

y int

The 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

int

this[int]

Returns the value of the specified channel.

public ushort this[int channel] { get; set; }

Parameters

channel int

The channel to get the value for.

Property Value

ushort

X

Gets the X coordinate of the pixel.

public int X { get; }

Property Value

int

Y

Gets the Y coordinate of the pixel.

public int Y { get; }

Property Value

int

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 object

The 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 int

The 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

channel int

The channel to set the value of.

value ushort

The value.

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

ushort[]

A ushort array.

ToColor()

Converts the pixel to a color. Assumes the pixel is RGBA.

public IMagickColor<ushort>? ToColor()

Returns

IMagickColor<ushort>

A ImageMagick.IMagickColor<> instance.