/// <summary> /// Initializes new instance of BitmapFormat class /// </summary> /// <param name="width">The width of the bitmap in pixels</param> /// <param name="height">The height of the bitmap in pixels</param> /// <param name="chroma">Chroma type of the bitmap</param> public BitmapFormat(int width, int height, ChromaType chroma) { m_width = width; m_height = height; m_chroma = chroma; Init(); Pitch = m_width * m_bpp; ImageSize = Pitch * height; Chroma = m_chroma.ToString(); }
/// <summary> /// Initializes new instance of BitmapFormat class /// </summary> /// <param name="width">The width of the bitmap in pixels</param> /// <param name="height">The height of the bitmap in pixels</param> /// <param name="chroma">Chroma type of the bitmap</param> public BitmapFormat(int width, int height, ChromaType chroma) { Width = width; Height = height; m_chroma = chroma; Planes = 1; Init(); Chroma = m_chroma.ToString(); if (IsRGB || !IsPlanarFormat) { m_sizes[0] = Pitch = Width * BitsPerPixel / 8; ImageSize = Pitch * Height; } }
private static PixelAlignmentType GetYuvType(ChromaType chromaType) { switch (chromaType) { case ChromaType.YV12: return PixelAlignmentType.YV12; case ChromaType.I420: return PixelAlignmentType.I420; case ChromaType.NV12: return PixelAlignmentType.NV12; case ChromaType.YUY2: return PixelAlignmentType.YUY2; case ChromaType.UYVY: return PixelAlignmentType.UYVY; default: throw new ArgumentException("Invalid parameter " + chromaType.ToString()); } }
/// <summary> /// Initializes new instance of BitmapFormat class /// </summary> /// <param name="width">The width of the bitmap in pixels</param> /// <param name="height">The height of the bitmap in pixels</param> /// <param name="chroma">Chroma type of the bitmap</param> public BitmapFormat(int width, int height, ChromaType chroma) { Width = width; Height = height; ChromaType = chroma; Planes = 1; PlaneSizes = new int[3]; Init(); Chroma = ChromaType.ToString(); if (IsRGB) { Pitch = Width * BitsPerPixel / 8; PlaneSizes[0] = ImageSize = Pitch * Height; Pitches = new int[1] { Pitch }; Lines = new int[1] { Height }; } }