OLD | NEW |
| (Empty) |
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 CHROME_BROWSER_CHROMEOS_LOGIN_USER_IMAGE_H_ | |
6 #define CHROME_BROWSER_CHROMEOS_LOGIN_USER_IMAGE_H_ | |
7 #pragma once | |
8 | |
9 #include <vector> | |
10 | |
11 #include "ui/gfx/image/image_skia.h" | |
12 | |
13 namespace chromeos { | |
14 | |
15 // Wrapper class for bitmaps and raw images when it's necessary. Could | |
16 // be used for storing profile images (including animated profile | |
17 // images) and user wallpapers. | |
18 class UserImage { | |
19 public: | |
20 typedef std::vector<unsigned char> RawImage; | |
21 | |
22 // Constructs UserImage from bitmap. Should be used where only | |
23 // static image is needed (e.g. wallpapers). | |
24 explicit UserImage(const gfx::ImageSkia& image); | |
25 | |
26 // Constructs UserImage from raw image and bitmap that should | |
27 // represent single frame from that one. Can be used for wrapping | |
28 // animated images. | |
29 UserImage(const gfx::ImageSkia& image, const RawImage& raw_image); | |
30 | |
31 virtual ~UserImage(); | |
32 | |
33 // Replaces already stored image to new |image|. Note, that | |
34 // |raw_image| will be reset after that operation. | |
35 void SetImage(const gfx::ImageSkia& image); | |
36 const gfx::ImageSkia& image() const { return image_; } | |
37 bool has_raw_image() const { return has_raw_image_; } | |
38 bool has_animated_image() const { return has_animated_image_; } | |
39 const RawImage& raw_image() const { return raw_image_; } | |
40 | |
41 private: | |
42 gfx::ImageSkia image_; | |
43 bool has_raw_image_; | |
44 bool has_animated_image_; | |
45 RawImage raw_image_; | |
46 }; | |
47 | |
48 } // namespace chromeos | |
49 | |
50 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_USER_IMAGE_H_ | |
OLD | NEW |