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
026  private final int value;
027
028  PixelFormat(int value) {
029    this.value = value;
030  }
031
032  /**
033   * Gets the integer value of the pixel format.
034   *
035   * @return Integer value
036   */
037  public int getValue() {
038    return value;
039  }
040
041  private static final PixelFormat[] s_values = values();
042
043  /**
044   * Gets a PixelFormat enum value from its integer value.
045   *
046   * @param pixelFormat integer value
047   * @return Enum value
048   */
049  public static PixelFormat getFromInt(int pixelFormat) {
050    return s_values[pixelFormat];
051  }
052}