OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 PRINTING_IMAGE_H_ | 5 #ifndef PRINTING_IMAGE_H_ |
6 #define PRINTING_IMAGE_H_ | 6 #define PRINTING_IMAGE_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 #include "base/file_path.h" | |
13 #include "base/logging.h" | 12 #include "base/logging.h" |
14 #include "gfx/size.h" | 13 #include "gfx/size.h" |
15 #include "printing/native_metafile.h" | 14 #include "printing/native_metafile.h" |
16 | 15 |
| 16 class FilePath; |
| 17 |
17 namespace printing { | 18 namespace printing { |
18 | 19 |
19 // Lightweight raw-bitmap management. The image, once initialized, is immutable. | 20 // Lightweight raw-bitmap management. The image, once initialized, is immutable. |
20 // The main purpose is testing image contents. | 21 // The main purpose is testing image contents. |
21 class Image { | 22 class Image { |
22 public: | 23 public: |
23 // Creates the image from the given filename on disk. Uses extension to | 24 // Creates the image from the given file on disk. Uses extension to |
24 // defer file type. PNG and EMF (on Windows) currently supported. | 25 // defer file type. PNG and EMF (on Windows) currently supported. |
25 // If image loading fails size().IsEmpty() will be true. | 26 // If image loading fails size().IsEmpty() will be true. |
26 explicit Image(const std::wstring& filename); | 27 explicit Image(const FilePath& path); |
27 | 28 |
28 // Creates the image from the metafile. Deduces bounds based on bounds in | 29 // Creates the image from the metafile. Deduces bounds based on bounds in |
29 // metafile. If loading fails size().IsEmpty() will be true. | 30 // metafile. If loading fails size().IsEmpty() will be true. |
30 explicit Image(const NativeMetafile& metafile); | 31 explicit Image(const NativeMetafile& metafile); |
31 | 32 |
32 // Copy constructor. | 33 // Copy constructor. |
33 explicit Image(const Image& image); | 34 explicit Image(const Image& image); |
34 | 35 |
35 const gfx::Size& size() const { | 36 const gfx::Size& size() const { |
36 return size_; | 37 return size_; |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 // Flag to signal if the comparison functions should ignore the alpha channel. | 86 // Flag to signal if the comparison functions should ignore the alpha channel. |
86 const bool ignore_alpha_; // Currently always true. | 87 const bool ignore_alpha_; // Currently always true. |
87 | 88 |
88 // Prevent operator= (this function has no implementation) | 89 // Prevent operator= (this function has no implementation) |
89 Image& operator=(const Image& image); | 90 Image& operator=(const Image& image); |
90 }; | 91 }; |
91 | 92 |
92 } // namespace printing | 93 } // namespace printing |
93 | 94 |
94 #endif // PRINTING_IMAGE_H_ | 95 #endif // PRINTING_IMAGE_H_ |
OLD | NEW |