ASPiK SDK
iplatformbitmap.h
1 // This file is part of VSTGUI. It is subject to the license terms
2 // in the LICENSE file found in the top-level directory of this
3 // distribution and at http://github.com/steinbergmedia/vstgui/LICENSE
4 
5 #ifndef __iplatformbitmap__
6 #define __iplatformbitmap__
7 
9 
10 #include "../vstguifwd.h"
11 #include <vector>
12 
13 namespace VSTGUI {
14 using PNGBitmapBuffer = std::vector<uint8_t>;
15 class IPlatformBitmapPixelAccess;
16 
17 //-----------------------------------------------------------------------------
18 class IPlatformBitmap : public AtomicReferenceCounted
19 {
20 public:
21  static SharedPointer<IPlatformBitmap> create (CPoint* size = nullptr);
22  static SharedPointer<IPlatformBitmap> createFromPath (UTF8StringPtr absolutePath);
23 
25  static SharedPointer<IPlatformBitmap> createFromMemory (const void* ptr, uint32_t memSize);
26 
28  static PNGBitmapBuffer createMemoryPNGRepresentation (const SharedPointer<IPlatformBitmap>& bitmap);
29 
30  virtual bool load (const CResourceDescription& desc) = 0;
31  virtual const CPoint& getSize () const = 0;
32 
33  virtual SharedPointer<IPlatformBitmapPixelAccess> lockPixels (bool alphaPremultiplied) = 0;
34 
35  virtual void setScaleFactor (double factor) = 0;
36  virtual double getScaleFactor () const = 0;
37 };
38 
39 //------------------------------------------------------------------------------------
40 class IPlatformBitmapPixelAccess : public AtomicReferenceCounted
41 {
42 public:
43  enum PixelFormat {
44  kARGB,
45  kRGBA,
46  kABGR,
47  kBGRA
48  };
49 
50  virtual uint8_t* getAddress () const = 0;
51  virtual uint32_t getBytesPerRow () const = 0;
52  virtual PixelFormat getPixelFormat () const = 0;
53 };
54 
55 } // namespace
56 
58 
59 #endif // __iplatformbitmap__
Definition: customcontrols.cpp:8