• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #ifndef TESTING_IMAGE_DIFF_IMAGE_DIFF_PNG_H_
6 #define TESTING_IMAGE_DIFF_IMAGE_DIFF_PNG_H_
7 
8 #include <stdlib.h>  // for size_t.
9 
10 #include <vector>
11 
12 #include "third_party/base/span.h"
13 
14 namespace image_diff_png {
15 
16 // Decode a PNG into an RGBA pixel array, or BGRA pixel array if
17 // |reverse_byte_order| is set to true.
18 std::vector<uint8_t> DecodePNG(pdfium::span<const uint8_t> input,
19                                bool reverse_byte_order,
20                                int* width,
21                                int* height);
22 
23 // Encode a BGR pixel array into a PNG.
24 std::vector<uint8_t> EncodeBGRPNG(pdfium::span<const uint8_t> input,
25                                   int width,
26                                   int height,
27                                   int row_byte_width);
28 
29 // Encode an RGBA pixel array into a PNG.
30 std::vector<uint8_t> EncodeRGBAPNG(pdfium::span<const uint8_t> input,
31                                    int width,
32                                    int height,
33                                    int row_byte_width);
34 
35 // Encode an BGRA pixel array into a PNG.
36 std::vector<uint8_t> EncodeBGRAPNG(pdfium::span<const uint8_t> input,
37                                    int width,
38                                    int height,
39                                    int row_byte_width,
40                                    bool discard_transparency);
41 
42 // Encode a grayscale pixel array into a PNG.
43 std::vector<uint8_t> EncodeGrayPNG(pdfium::span<const uint8_t> input,
44                                    int width,
45                                    int height,
46                                    int row_byte_width);
47 
48 }  // namespace image_diff_png
49 
50 #endif  // TESTING_IMAGE_DIFF_IMAGE_DIFF_PNG_H_
51