chromium/services/shape_detection/public/mojom/barcodedetection.mojom

// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

// https://wicg.github.io/shape-detection-api/#api

module shape_detection.mojom;

import "skia/public/mojom/bitmap.mojom";
import "ui/gfx/geometry/mojom/geometry.mojom";

// https://wicg.github.io/shape-detection-api/#barcodeformat-section
enum BarcodeFormat {
  AZTEC,
  CODE_128,
  CODE_39,
  CODE_93,
  CODABAR,
  DATA_MATRIX,
  EAN_13,
  EAN_8,
  ITF,
  PDF417,
  QR_CODE,
  UNKNOWN,
  UPC_A,
  UPC_E
};

struct BarcodeDetectionResult {
  // Barcode or QR extracted contents (see e.g.
  // https://github.com/zxing/zxing/wiki/Barcode-Contents).
  string raw_value;
  gfx.mojom.RectF bounding_box;
  BarcodeFormat format;
  array<gfx.mojom.PointF> corner_points;
};

interface BarcodeDetection {
  Detect(skia.mojom.BitmapN32 bitmap_data)
    => (array<BarcodeDetectionResult> results);
};