public IpcPixelFormatCustom(int channelsPerPixel, int bitsPerChannel, IpcChannelDataType ipcChannelDataType) { ChannelsPerPixel = channelsPerPixel; BitsPerChannel = bitsPerChannel; IpcPixelFormatType = IpcPixelFormatType.Custom; BitsPerPixel = channelsPerPixel * bitsPerChannel; BytesPerPixel = (int)Math.Round((double)BitsPerPixel / 8); }
internal IpcPixelFormatDefault(int channelsPerPixel, int bitsPerChannel, IpcChannelDataType ipcChannelDataType, IpcPixelFormatType type) { ChannelsPerPixel = channelsPerPixel; BitsPerChannel = bitsPerChannel; IpcChannelDataType = ipcChannelDataType; IpcPixelFormatType = type; BitsPerPixel = channelsPerPixel * bitsPerChannel; BytesPerPixel = (int)Math.Round((double)BitsPerPixel / 8); }
public static IpcPixelFormat GetMatchingFormat(int channels, int bits, IpcChannelDataType dataType) { foreach (var formatItem in DefaultFormatDictionary) { var format = formatItem.Value; if (format.BitsPerChannel == bits && format.ChannelsPerPixel == channels && format.IpcChannelDataType == dataType) { return(format); } if (format.IpcPixelFormatType == IpcPixelFormatType.RgbFloat24) { continue; } } throw new NotImplementedException("GetMatchingFormat does not currently implement custom types."); }