5 #ifndef __gdiplusbitmap__ 6 #define __gdiplusbitmap__ 8 #include "win32bitmapbase.h" 12 #include "../../cpoint.h" 13 #include "win32support.h" 18 class GdiplusBitmap :
public Win32BitmapBase
22 GdiplusBitmap (
const CPoint& size);
23 ~GdiplusBitmap () noexcept;
25 bool load (const CResourceDescription& desc) override;
26 const CPoint& getSize ()
const override {
return size; }
27 SharedPointer<IPlatformBitmapPixelAccess> lockPixels (
bool alphaPremultiplied)
override;
28 void setScaleFactor (
double factor)
override {}
29 double getScaleFactor ()
const override {
return 1.; }
31 Gdiplus::Bitmap* getBitmap ()
const {
return bitmap; }
32 HBITMAP createHBitmap ()
override;
33 bool loadFromStream (IStream* stream)
override;
34 PNGBitmapBuffer createMemoryPNGRepresentation ()
override;
38 class PixelAccess :
public IPlatformBitmapPixelAccess
42 ~PixelAccess () noexcept;
44 bool init (GdiplusBitmap* bitmap,
bool alphaPremulitplied);
46 uint8_t* getAddress ()
const {
return (uint8_t*)data.Scan0; }
47 uint32_t getBytesPerRow ()
const {
return static_cast<uint32_t
> (data.Stride); }
48 PixelFormat getPixelFormat ()
const {
return kBGRA; }
50 GdiplusBitmap* bitmap;
51 Gdiplus::BitmapData data;
53 Gdiplus::Bitmap* bitmap;
62 #endif // __gdiplusbitmap__ Definition: customcontrols.cpp:8