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 namespace image_diff_png { 13 14 // Decode a PNG into an RGBA pixel array. 15 bool DecodePNG(const unsigned char* input, 16 size_t input_size, 17 std::vector<unsigned char>* output, 18 int* width, 19 int* height); 20 21 // Encode a BGR pixel array into a PNG. 22 bool EncodeBGRPNG(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 RGBA pixel array into a PNG. 29 bool EncodeRGBAPNG(const unsigned char* input, 30 int width, 31 int height, 32 int row_byte_width, 33 std::vector<unsigned char>* output); 34 35 // Encode an BGRA pixel array into a PNG. 36 bool EncodeBGRAPNG(const unsigned char* input, 37 int width, 38 int height, 39 int row_byte_width, 40 bool discard_transparency, 41 std::vector<unsigned char>* output); 42 43 // Encode a grayscale pixel array into a PNG. 44 bool EncodeGrayPNG(const unsigned char* input, 45 int width, 46 int height, 47 int row_byte_width, 48 std::vector<unsigned char>* output); 49 50 } // namespace image_diff_png 51 52 #endif // TESTING_IMAGE_DIFF_IMAGE_DIFF_PNG_H_ 53