aboutsummaryrefslogtreecommitdiff
path: root/Src/tataki/bitmap/mac/osx_bitmap_cgimage.h
blob: 0e842c085e4b51f099d1f8c066ec1057fae7180d (plain) (blame)
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#ifndef NULLSOFT_WASABI_OSX_BITMAP_CGIMAGE_H
#define NULLSOFT_WASABI_OSX_BITMAP_CGIMAGE_H

#include <tataki/export.h>
#include <bfc/platform/platform.h>
#include <tataki/canvas/api_canvas.h>
#include <api/wnd/ifc_bitmap.h>

/*
 TODO:
 need some kind of updateBits() so that the underlying image can be updated to reflect changes 
 */
class TATAKIAPI SkinBitmap : public ifc_bitmap
{
public:
  SkinBitmap(ARGB32 *bits, int w, int h); // added by benski, use if you have raw image bits
  SkinBitmap(const wchar_t *elementname, int cached = 1);
  ~SkinBitmap();
  int getWidth();
  int getHeight();
  int getFullWidth(); // aka pitch
  
  // blits
  void blit(api_canvas *canvas, int x, int y);
  void blitAlpha(api_canvas *canvas, int x, int y, int alpha = 255);
  // stretch blits
  void stretchToRect(api_canvas *canvas, RECT *r);
  void stretchToRectAlpha(api_canvas *canvas, RECT *r, int alpha = 255);
  void stretchToRectAlpha(api_canvas *canvas, RECT *src, RECT *dst, int alpha = 255);
// tiled blits  
  void blitTile(api_canvas *canvas, RECT *dest, int xoffs = 0, int yoffs = 0, int alpha = 255);
  
  ARGB32 getPixel(int x, int y);
public: // ifc_bitmap implementations
  OSBITMAPHANDLE GetBitmap() { return image; }
  uint8_t *getBits();
  void UpdateBits(uint8_t *bits);
  
private:
  CGImageRef image;
  CGContextRef imageContext;
  void *bits;
  
protected:
    RECVS_DISPATCH;
};

#endif