| 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 <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 // Fills the |dst| vector with JPEG-encoded bytes of the 1x representation of | 26 // Fills the |dst| vector with JPEG-encoded bytes of the 1x representation of |
| 27 // the given image. | 27 // the given image. |
| 28 // Returns true if the image has a 1x representation and the 1x representation | 28 // Returns true if the image has a 1x representation and the 1x representation |
| 29 // was encoded successfully. | 29 // was encoded successfully. |
| 30 // |quality| determines the compression level, 0 == lowest, 100 == highest. | 30 // |quality| determines the compression level, 0 == lowest, 100 == highest. |
| 31 // Returns true if the Image was encoded successfully. | 31 // Returns true if the Image was encoded successfully. |
| 32 GFX_EXPORT bool JPEG1xEncodedDataFromImage(const Image& image, | 32 GFX_EXPORT bool JPEG1xEncodedDataFromImage(const Image& image, |
| 33 int quality, | 33 int quality, |
| 34 std::vector<unsigned char>* dst); | 34 std::vector<unsigned char>* dst); |
| 35 | 35 |
| 36 bool JPEG1xEncodedDataFromSkiaRepresentation(const Image& image, | |
| 37 int quality, | |
| 38 std::vector<unsigned char>* dst); | |
| 39 | |
| 40 // Computes the width of any nearly-transparent regions at the sides of the | 36 // Computes the width of any nearly-transparent regions at the sides of the |
| 41 // image and returns them in |left| and |right|. This checks each column of | 37 // image and returns them in |left| and |right|. This checks each column of |
| 42 // pixels from the outsides in, looking for anything with alpha above a | 38 // pixels from the outsides in, looking for anything with alpha above a |
| 43 // reasonably small value. For a fully-opaque image, the margins will thus be | 39 // reasonably small value. For a fully-opaque image, the margins will thus be |
| 44 // (0, 0); for a fully-transparent image, the margins will be | 40 // (0, 0); for a fully-transparent image, the margins will be |
| 45 // (width / 2, width / 2), with |left| getting the extra pixel for odd widths. | 41 // (width / 2, width / 2), with |left| getting the extra pixel for odd widths. |
| 46 GFX_EXPORT void GetVisibleMargins(const ImageSkia& image, | 42 GFX_EXPORT void GetVisibleMargins(const ImageSkia& image, |
| 47 int* left, | 43 int* left, |
| 48 int* right); | 44 int* right); |
| 49 | 45 |
| 50 } // namespace gfx | 46 } // namespace gfx |
| 51 | 47 |
| 52 #endif // UI_GFX_IMAGE_IMAGE_UTIL_H_ | 48 #endif // UI_GFX_IMAGE_IMAGE_UTIL_H_ |
| OLD | NEW |