PixelFormat Estrutura
Definição
Importante
Algumas informações dizem respeito a um produto pré-lançado que pode ser substancialmente modificado antes de ser lançado. A Microsoft não faz garantias, de forma expressa ou implícita, em relação à informação aqui apresentada.
Define um formato de píxel para imagens e superfícies baseadas em píxeis.
public value class PixelFormat : IEquatable<System::Windows::Media::PixelFormat>
[System.ComponentModel.TypeConverter(typeof(System.Windows.Media.PixelFormatConverter))]
[System.Serializable]
public struct PixelFormat : IEquatable<System.Windows.Media.PixelFormat>
[<System.ComponentModel.TypeConverter(typeof(System.Windows.Media.PixelFormatConverter))>]
[<System.Serializable>]
type PixelFormat = struct
Public Structure PixelFormat
Implements IEquatable(Of PixelFormat)
- Herança
- Atributos
- Implementações
Exemplos
O exemplo seguinte mostra como criar um PixelFormat e encontrar o valor das suas propriedades.
public PixelFormat createPixelFormat()
{
// Create a PixelFormat object.
PixelFormat myPixelFormat = new PixelFormat();
// Make this PixelFormat a Gray32Float pixel format.
myPixelFormat = PixelFormats.Gray32Float;
// Get the number of bits-per-pixel for this format. Because
// the format is "Gray32Float", the float value returned will be 32.
int bpp = myPixelFormat.BitsPerPixel;
// Get the collection of masks associated with this format.
IList<PixelFormatChannelMask> myChannelMaskCollection = myPixelFormat.Masks;
// Capture the mask info in a string.
String stringOfValues = " ";
foreach (PixelFormatChannelMask myMask in myChannelMaskCollection)
{
IList<byte> myBytesCollection = myMask.Mask;
foreach (byte myByte in myBytesCollection)
{
stringOfValues = stringOfValues + myByte.ToString();
}
}
// Return the PixelFormat which, for example, could be
// used to set the pixel format of a bitmap by using it to set
// the DestinationFormat of a FormatConvertedBitmap.
return myPixelFormat;
}
Public Function createPixelFormat() As PixelFormat
' Create a PixelFormat object.
Dim myPixelFormat As New PixelFormat()
' Make this PixelFormat a Gray32Float pixel format.
myPixelFormat = PixelFormats.Gray32Float
' Get the number of bits-per-pixel for this format. Because
' the format is "Gray32Float", the float value returned will be 32.
Dim bpp As Integer = myPixelFormat.BitsPerPixel
' Get the collection of masks associated with this format.
Dim myChannelMaskCollection As IList(Of PixelFormatChannelMask) = (myPixelFormat.Masks)
' Capture the mask info in a string.
Dim stringOfValues As String = " "
Dim myMask As PixelFormatChannelMask
For Each myMask In myChannelMaskCollection
Dim myBytesCollection As IList(Of Byte) = myMask.Mask
Dim myByte As Byte
For Each myByte In myBytesCollection
stringOfValues = stringOfValues + myByte.ToString()
Next myByte
Next myMask
' Return the PixelFormat which, for example, could be
' used to set the pixel format of a bitmap by using it to set
' the DestinationFormat of a FormatConvertedBitmap.
Return myPixelFormat
End Function 'createPixelFormat
End Class
End Namespace 'ImagingSnippetGallery
Observações
Uso de atributos XAML
<object property="pixelFormat"/>
Valores XAML
pixelFormat Um dos formatos de píxeis predefinidos definidos pela PixelFormats classe.
Propriedades
| Name | Description |
|---|---|
| BitsPerPixel |
Obtém o número de bits por píxel (bpp) para este PixelFormat. |
| Masks |
Obtém uma coleção de máscaras de bits associadas ao PixelFormat. |
Métodos
| Name | Description |
|---|---|
| Equals(Object) |
Determina se o objeto especificado é igual ao objeto atual. |
| Equals(PixelFormat, PixelFormat) |
Determina se as instâncias especificadas PixelFormat são consideradas iguais. |
| Equals(PixelFormat) |
Determina se o formato de píxeis é igual ao dado PixelFormat. |
| GetHashCode() |
Cria um código de hash a partir do valor deste Masks formato de pixel. |
| ToString() |
Cria uma representação de cadeia deste PixelFormat. |
Operadores
| Name | Description |
|---|---|
| Equality(PixelFormat, PixelFormat) |
Compara duas PixelFormat instâncias para a igualdade. |
| Inequality(PixelFormat, PixelFormat) |
Compara dois PixelFormat casos de desigualdade. |