blob: 7e0afecf8362de5c7150f6bd74e8c214e3e8e7dc [file] [log] [blame]
Tom Sepezaf18cb32015-02-05 15:06:01 -08001// 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 TOOLS_IMAGEDIFF_IMAGE_DIFF_PNG_H_
6#define TOOLS_IMAGEDIFF_IMAGE_DIFF_PNG_H_
7
Tom Sepezdbe2a8e2015-02-05 15:21:19 -08008#include <stdlib.h> // for size_t.
9
Tom Sepezaf18cb32015-02-05 15:06:01 -080010#include <vector>
11
12namespace image_diff_png {
13
14// Decode a PNG into an RGBA pixel array.
Nico Weber9d8ec5a2015-08-04 13:00:21 -070015bool DecodePNG(const unsigned char* input,
16 size_t input_size,
Tom Sepezaf18cb32015-02-05 15:06:01 -080017 std::vector<unsigned char>* output,
Nico Weber9d8ec5a2015-08-04 13:00:21 -070018 int* width,
19 int* height);
Tom Sepezaf18cb32015-02-05 15:06:01 -080020
21// Encode an RGBA pixel array into a PNG.
22bool EncodeRGBAPNG(const unsigned char* input,
23 int width,
24 int height,
25 int row_byte_width,
26 std::vector<unsigned char>* output);
27
28// Encode an BGRA pixel array into a PNG.
29bool EncodeBGRAPNG(const unsigned char* input,
30 int width,
31 int height,
32 int row_byte_width,
33 bool discard_transparency,
34 std::vector<unsigned char>* output);
35
36} // namespace image_diff_png
37
38#endif // TOOLS_IMAGEDIFF_IMAGE_DIFF_PNG_H_