Flutter Impeller
screenshot.h
Go to the documentation of this file.
1 // Copyright 2013 The Flutter 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 FLUTTER_IMPELLER_GOLDEN_TESTS_SCREENSHOT_H_
6 #define FLUTTER_IMPELLER_GOLDEN_TESTS_SCREENSHOT_H_
7 
8 #include <cstddef>
9 #include <cstdint>
10 #include <memory>
11 #include <string>
12 
13 namespace impeller {
14 namespace testing {
15 
16 class Screenshot {
17  public:
18  virtual ~Screenshot() = default;
19 
20  /// Access raw data of the screenshot.
21  virtual const uint8_t* GetBytes() const = 0;
22 
23  /// Returns the height of the image in pixels.
24  virtual size_t GetHeight() const = 0;
25 
26  /// Returns the width of the image in pixels.
27  virtual size_t GetWidth() const = 0;
28 
29  /// Returns number of bytes required to represent one row of the raw image.
30  virtual size_t GetBytesPerRow() const = 0;
31 
32  /// Synchronously write the screenshot to disk as a PNG at `path`. Returns
33  /// `true` if it succeeded.
34  virtual bool WriteToPNG(const std::string& path) const = 0;
35 };
36 
37 } // namespace testing
38 } // namespace impeller
39 
40 #endif // FLUTTER_IMPELLER_GOLDEN_TESTS_SCREENSHOT_H_
virtual size_t GetHeight() const =0
Returns the height of the image in pixels.
virtual const uint8_t * GetBytes() const =0
Access raw data of the screenshot.
virtual size_t GetWidth() const =0
Returns the width of the image in pixels.
virtual bool WriteToPNG(const std::string &path) const =0
virtual ~Screenshot()=default
virtual size_t GetBytesPerRow() const =0
Returns number of bytes required to represent one row of the raw image.