Home | History | Annotate | Download | only in image
      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.
      4 
      5 #ifndef UI_GFX_IMAGE_IMAGE_UTIL_H_
      6 #define UI_GFX_IMAGE_IMAGE_UTIL_H_
      7 
      8 #include <vector>
      9 
     10 #include "base/basictypes.h"
     11 #include "ui/base/ui_export.h"
     12 
     13 namespace gfx {
     14 class Image;
     15 }
     16 
     17 namespace gfx {
     18 
     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);
     23 
     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);
     33 
     34 }  // namespace gfx
     35 
     36 #endif  // UI_GFX_IMAGE_IMAGE_UTIL_H_
     37