1e5c31af7Sopenharmony_ci// Copyright 2019 The Amber Authors.
2e5c31af7Sopenharmony_ci//
3e5c31af7Sopenharmony_ci// Licensed under the Apache License, Version 2.0 (the "License");
4e5c31af7Sopenharmony_ci// you may not use this file except in compliance with the License.
5e5c31af7Sopenharmony_ci// You may obtain a copy of the License at
6e5c31af7Sopenharmony_ci//
7e5c31af7Sopenharmony_ci//     http://www.apache.org/licenses/LICENSE-2.0
8e5c31af7Sopenharmony_ci//
9e5c31af7Sopenharmony_ci// Unless required by applicable law or agreed to in writing, software
10e5c31af7Sopenharmony_ci// distributed under the License is distributed on an "AS IS" BASIS,
11e5c31af7Sopenharmony_ci// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12e5c31af7Sopenharmony_ci// See the License for the specific language governing permissions and
13e5c31af7Sopenharmony_ci// limitations under the License.
14e5c31af7Sopenharmony_ci
15e5c31af7Sopenharmony_ci#ifndef SAMPLES_PPM_H_
16e5c31af7Sopenharmony_ci#define SAMPLES_PPM_H_
17e5c31af7Sopenharmony_ci
18e5c31af7Sopenharmony_ci#include <string>
19e5c31af7Sopenharmony_ci#include <utility>
20e5c31af7Sopenharmony_ci#include <vector>
21e5c31af7Sopenharmony_ci
22e5c31af7Sopenharmony_ci#include "amber/amber.h"
23e5c31af7Sopenharmony_ci#include "amber/result.h"
24e5c31af7Sopenharmony_ci
25e5c31af7Sopenharmony_cinamespace ppm {
26e5c31af7Sopenharmony_ci
27e5c31af7Sopenharmony_ci/// Converts the image of dimensions |width| and |height| and with pixels stored
28e5c31af7Sopenharmony_ci/// in row-major order in |values| with format B8G8R8A8 into PPM format,
29e5c31af7Sopenharmony_ci/// returning the PPM binary in |buffer|.
30e5c31af7Sopenharmony_ciamber::Result ConvertToPPM(uint32_t width,
31e5c31af7Sopenharmony_ci                           uint32_t height,
32e5c31af7Sopenharmony_ci                           const std::vector<amber::Value>& values,
33e5c31af7Sopenharmony_ci                           std::vector<uint8_t>* buffer);
34e5c31af7Sopenharmony_ci
35e5c31af7Sopenharmony_ci}  // namespace ppm
36e5c31af7Sopenharmony_ci
37e5c31af7Sopenharmony_ci#endif  // SAMPLES_PPM_H_
38