001// Copyright (c) FIRST and other WPILib contributors. 002// Open Source Software; you can modify and/or share it under the terms of 003// the WPILib BSD license file in the root directory of this project. 004 005package edu.wpi.first.util; 006 007/** Image pixel format. */ 008public enum PixelFormat { 009 /** Unknown format. */ 010 kUnknown(0), 011 /** Motion-JPEG (compressed image data). */ 012 kMJPEG(1), 013 /** YUY 4:2:2, 16 bpp. */ 014 kYUYV(2), 015 /** RGB 5-6-5, 16 bpp. */ 016 kRGB565(3), 017 /** BGR 8-8-8, 24 bpp. */ 018 kBGR(4), 019 /** Grayscale, 8 bpp. */ 020 kGray(5), 021 /** Grayscale, 16 bpp. */ 022 kY16(6), 023 /** YUV 4:2:2, 16 bpp. */ 024 kUYVY(7), 025 /** BGRA 8-8-8-8. 32 bpp. */ 026 kBGRA(8); 027 028 private final int value; 029 030 PixelFormat(int value) { 031 this.value = value; 032 } 033 034 /** 035 * Gets the integer value of the pixel format. 036 * 037 * @return Integer value 038 */ 039 public int getValue() { 040 return value; 041 } 042 043 private static final PixelFormat[] s_values = values(); 044 045 /** 046 * Gets a PixelFormat enum value from its integer value. 047 * 048 * @param pixelFormat integer value 049 * @return Enum value 050 */ 051 public static PixelFormat getFromInt(int pixelFormat) { 052 return s_values[pixelFormat]; 053 } 054}