Newer
Older
SmTIAS-Capture / lib / models / preview_frame.dart
import 'dart:typed_data';

/// カメラのプレビューストリームから取得した YUV_420_888 フレームを保持する不変クラス.
///
/// [_startImageStream] で生成し,[capturePreviewSnapshot] で消費する.
class PreviewFrame {
  /// 画像の幅(ピクセル).
  final int width;

  /// 画像の高さ(ピクセル).
  final int height;

  /// Y プレーンのバイト列.
  final Uint8List yPlane;

  /// U プレーンのバイト列.
  final Uint8List uPlane;

  /// V プレーンのバイト列.
  final Uint8List vPlane;

  /// Y プレーンの行ストライド(バイト).
  final int yRowStride;

  /// UV プレーンの行ストライド(バイト).
  final int uvRowStride;

  /// UV プレーンのピクセルストライド(バイト).
  final int uvPixelStride;

  const PreviewFrame({
    required this.width,
    required this.height,
    required this.yPlane,
    required this.uPlane,
    required this.vPlane,
    required this.yRowStride,
    required this.uvRowStride,
    required this.uvPixelStride,
  });
}