aboutsummaryrefslogtreecommitdiff
path: root/include/cru/platform/graphics/Image.h
blob: 17d2170e476616914e2c1eaa4901b5030055736f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#pragma once
#include "Resource.h"

namespace cru::platform::graphics {
struct CRU_PLATFORM_GRAPHICS_API IImage : public virtual IGraphicsResource {
  virtual float GetWidth() = 0;
  virtual float GetHeight() = 0;
  virtual std::unique_ptr<IImage> CreateWithRect(const Rect& rect) = 0;

  /**
   * \brief Create a painter for this image.
   * \remarks Not all image could create a painter. If not this method will
   * throw. Currently we only ensure images returned by
   * IImageFactory::CreateBitmap or CloneToBitmap can create a painter.
   */
  virtual std::unique_ptr<IPainter> CreatePainter() = 0;

  /**
   * \brief Create a bitmap image with the same pixels as this image's.
   * \remarks This method can be used to create a bitmap image, so you can draw
   * on the new bitmap, if the original image can't be directly painted.
   */
  virtual std::unique_ptr<IImage> CloneToBitmap();
};
}  // namespace cru::platform::graphics