Encode method and error message inside LevelDB::Status message
[chromium-blink-merge.git] / ui / gfx / image / image_util.h
blob9ada2fe74ff7de792d712364e2cab548cedf5e55
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
3 // found in the LICENSE file.
5 #ifndef UI_GFX_IMAGE_IMAGE_UTIL_H_
6 #define UI_GFX_IMAGE_IMAGE_UTIL_H_
8 #include <vector>
10 #include "base/basictypes.h"
11 #include "ui/base/ui_export.h"
13 namespace gfx {
14 class Image;
17 namespace gfx {
19 // Creates an image from the given JPEG-encoded input. If there was an error
20 // creating the image, returns an IsEmpty() Image.
21 UI_EXPORT Image ImageFrom1xJPEGEncodedData(const unsigned char* input,
22 size_t input_size);
24 // Fills the |dst| vector with JPEG-encoded bytes of the 1x representation of
25 // the given image.
26 // Returns true if the image has a 1x representation and the 1x representation
27 // was encoded successfully.
28 // |quality| determines the compression level, 0 == lowest, 100 == highest.
29 // Returns true if the Image was encoded successfully.
30 UI_EXPORT bool JPEG1xEncodedDataFromImage(const Image& image,
31 int quality,
32 std::vector<unsigned char>* dst);
34 } // namespace gfx
36 #endif // UI_GFX_IMAGE_IMAGE_UTIL_H_