Tom Sepez | af18cb3 | 2015-02-05 15:06:01 -0800 | [diff] [blame] | 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 | |
Dan Sinclair | c7cd809 | 2016-02-18 15:02:55 -0500 | [diff] [blame] | 5 | #ifndef SAMPLES_IMAGE_DIFF_PNG_H_ |
| 6 | #define SAMPLES_IMAGE_DIFF_PNG_H_ |
Tom Sepez | af18cb3 | 2015-02-05 15:06:01 -0800 | [diff] [blame] | 7 | |
Tom Sepez | dbe2a8e | 2015-02-05 15:21:19 -0800 | [diff] [blame] | 8 | #include <stdlib.h> // for size_t. |
| 9 | |
Tom Sepez | af18cb3 | 2015-02-05 15:06:01 -0800 | [diff] [blame] | 10 | #include <vector> |
| 11 | |
| 12 | namespace image_diff_png { |
| 13 | |
| 14 | // Decode a PNG into an RGBA pixel array. |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 15 | bool DecodePNG(const unsigned char* input, |
| 16 | size_t input_size, |
Tom Sepez | af18cb3 | 2015-02-05 15:06:01 -0800 | [diff] [blame] | 17 | std::vector<unsigned char>* output, |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 18 | int* width, |
| 19 | int* height); |
Tom Sepez | af18cb3 | 2015-02-05 15:06:01 -0800 | [diff] [blame] | 20 | |
| 21 | // Encode an RGBA pixel array into a PNG. |
| 22 | bool 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. |
| 29 | bool 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 | |
Dan Sinclair | c7cd809 | 2016-02-18 15:02:55 -0500 | [diff] [blame] | 38 | #endif // SAMPLES_IMAGE_DIFF_PNG_H_ |