public static bool IsBottomUpFrameType(TIS.Imaging.FrameType frameType) { // Older versions of IC Imaging Control don't know the ADI1/ADI2 image formats, // so the IsBottomUp information is not available if (frameType.Subtype == ADI1.MediaSubtype) { return(false); } if (frameType.Subtype == ADC1.MediaSubtype) { return(false); } return(frameType.IsBottomUp); }
public static int BitsPerPixel(TIS.Imaging.FrameType frameType) { // Older versions of IC Imaging Control don't know the polarization image formats, // so the BitsPerPixel information is not available if (frameType.BitsPerPixel > 0) { return(frameType.BitsPerPixel); } if (frameType.Subtype == ADI1.MediaSubtype) { return(System.Runtime.InteropServices.Marshal.SizeOf(typeof(ADI1)) * 8); } if (frameType.Subtype == ADI2.MediaSubtype) { return(System.Runtime.InteropServices.Marshal.SizeOf(typeof(ADI2)) * 8); } if (frameType.Subtype == ADC1.MediaSubtype) { return(System.Runtime.InteropServices.Marshal.SizeOf(typeof(ADC1)) * 8); } if (frameType.Subtype == ADC2.MediaSubtype) { return(System.Runtime.InteropServices.Marshal.SizeOf(typeof(ADC2)) * 8); } if (frameType.Subtype == PPM1.MediaSubtype) { return(System.Runtime.InteropServices.Marshal.SizeOf(typeof(PPM1)) * 8); } if (frameType.Subtype == PPM2.MediaSubtype) { return(System.Runtime.InteropServices.Marshal.SizeOf(typeof(PPM2)) * 8); } if (frameType.Subtype == PPB1.MediaSubtype) { return(System.Runtime.InteropServices.Marshal.SizeOf(typeof(PPB1)) * 8); } if (frameType.Subtype == PPB2.MediaSubtype) { return(System.Runtime.InteropServices.Marshal.SizeOf(typeof(PPB2)) * 8); } return(0); }
private PixelFormat PixelFormatFromFrameType(TIS.Imaging.FrameType ftype) { switch (ftype.PixelFormat) { case System.Drawing.Imaging.PixelFormat.Format32bppArgb: return(PixelFormats.Bgra32); case System.Drawing.Imaging.PixelFormat.Format32bppRgb: return(PixelFormats.Bgr32); case System.Drawing.Imaging.PixelFormat.Format32bppPArgb: return(PixelFormats.Bgra32); case System.Drawing.Imaging.PixelFormat.Format24bppRgb: return(PixelFormats.Bgr24); case System.Drawing.Imaging.PixelFormat.Format8bppIndexed: return(PixelFormats.Gray8); default: throw new Exception("Unknown pixel Format"); } }