osx_bitmap_cgimage.h 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. #ifndef NULLSOFT_WASABI_OSX_BITMAP_CGIMAGE_H
  2. #define NULLSOFT_WASABI_OSX_BITMAP_CGIMAGE_H
  3. #include <bfc/platform/platform.h>
  4. #include <tataki/canvas/ifc_canvas.h>
  5. #include <api/wnd/ifc_bitmap.h>
  6. /*
  7. TODO:
  8. need some kind of updateBits() so that the underlying image can be updated to reflect changes
  9. */
  10. class SkinBitmap : public ifc_bitmap
  11. {
  12. public:
  13. SkinBitmap(ARGB32 *bits, int w, int h); // added by benski, use if you have raw image bits
  14. SkinBitmap(const wchar_t *elementname, int cached = 1);
  15. ~SkinBitmap();
  16. int getWidth();
  17. int getHeight();
  18. int getFullWidth(); // aka pitch
  19. // blits
  20. void blit(ifc_canvas *canvas, int x, int y);
  21. void blitAlpha(ifc_canvas *canvas, int x, int y, int alpha = 255);
  22. // stretch blits
  23. void stretchToRect(ifc_canvas *canvas, RECT *r);
  24. void stretchToRectAlpha(ifc_canvas *canvas, RECT *r, int alpha = 255);
  25. void stretchToRectAlpha(ifc_canvas *canvas, RECT *src, RECT *dst, int alpha = 255);
  26. // tiled blits
  27. void blitTile(ifc_canvas *canvas, RECT *dest, int xoffs = 0, int yoffs = 0, int alpha = 255);
  28. ARGB32 getPixel(int x, int y);
  29. public: // ifc_bitmap implementations
  30. OSBITMAPHANDLE GetBitmap() { return image; }
  31. uint8_t *getBits();
  32. void UpdateBits(uint8_t *bits);
  33. private:
  34. CGImageRef image;
  35. CGContextRef imageContext;
  36. void *bits;
  37. protected:
  38. RECVS_DISPATCH;
  39. };
  40. #endif