本文整理汇总了C#中System.Windows.Media.PixelFormat.BitsPerPixel属性的典型用法代码示例。如果您正苦于以下问题:C# PixelFormat.BitsPerPixel属性的具体用法?C# PixelFormat.BitsPerPixel怎么用?C# PixelFormat.BitsPerPixel使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类System.Windows.Media.PixelFormat
的用法示例。
在下文中一共展示了PixelFormat.BitsPerPixel属性的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: createPixelFormat
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;
}