osx_bitmap_cgimage.h 1.4 KB

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