| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef UI_GFX_IMAGE_IMAGE_UTIL_H_ | 5 #ifndef UI_GFX_IMAGE_IMAGE_UTIL_H_ |
| 6 #define UI_GFX_IMAGE_IMAGE_UTIL_H_ | 6 #define UI_GFX_IMAGE_IMAGE_UTIL_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 11 #include "ui/base/ui_export.h" | 11 #include "ui/gfx/gfx_export.h" |
| 12 | 12 |
| 13 namespace gfx { | 13 namespace gfx { |
| 14 class Image; | 14 class Image; |
| 15 } | 15 } |
| 16 | 16 |
| 17 namespace gfx { | 17 namespace gfx { |
| 18 | 18 |
| 19 // Creates an image from the given JPEG-encoded input. If there was an error | 19 // Creates an image from the given JPEG-encoded input. If there was an error |
| 20 // creating the image, returns an IsEmpty() Image. | 20 // creating the image, returns an IsEmpty() Image. |
| 21 UI_EXPORT Image ImageFrom1xJPEGEncodedData(const unsigned char* input, | 21 UI_EXPORT Image ImageFrom1xJPEGEncodedData(const unsigned char* input, |
| 22 size_t input_size); | 22 size_t input_size); |
| 23 | 23 |
| 24 // Fills the |dst| vector with JPEG-encoded bytes of the 1x representation of | 24 // Fills the |dst| vector with JPEG-encoded bytes of the 1x representation of |
| 25 // the given image. | 25 // the given image. |
| 26 // Returns true if the image has a 1x representation and the 1x representation | 26 // Returns true if the image has a 1x representation and the 1x representation |
| 27 // was encoded successfully. | 27 // was encoded successfully. |
| 28 // |quality| determines the compression level, 0 == lowest, 100 == highest. | 28 // |quality| determines the compression level, 0 == lowest, 100 == highest. |
| 29 // Returns true if the Image was encoded successfully. | 29 // Returns true if the Image was encoded successfully. |
| 30 UI_EXPORT bool JPEG1xEncodedDataFromImage(const Image& image, | 30 UI_EXPORT bool JPEG1xEncodedDataFromImage(const Image& image, |
| 31 int quality, | 31 int quality, |
| 32 std::vector<unsigned char>* dst); | 32 std::vector<unsigned char>* dst); |
| 33 | 33 |
| 34 } // namespace gfx | 34 } // namespace gfx |
| 35 | 35 |
| 36 #endif // UI_GFX_IMAGE_IMAGE_UTIL_H_ | 36 #endif // UI_GFX_IMAGE_IMAGE_UTIL_H_ |
| OLD | NEW |