13 #ifndef ROOT_QuartzPixmap
14 #define ROOT_QuartzPixmap
18 #include <Cocoa/Cocoa.h>
31 @interface QuartzPixmap : NSObject<X11Drawable> {
40 std::vector<unsigned char> fData;
41 ROOT::MacOSX::Util::CFScopeGuard<CGContextRef> fContext;
46 - (id) initWithW : (
unsigned) width H : (
unsigned) height scaleFactor : (CGFloat) scaleFactor;
47 - (BOOL) resizeW : (
unsigned) width H : (
unsigned) height scaleFactor : (CGFloat) scaleFactor;
49 - (CGImageRef) createImageFromPixmap;
50 - (CGImageRef) createImageFromPixmap : (ROOT::MacOSX::X11::Rectangle) cropArea;
54 @property (nonatomic, assign)
unsigned fID;
57 - (BOOL) fIsOpenGLWidget;
58 - (CGFloat) fScaleFactor;
60 @property (nonatomic, readonly) CGContextRef fContext;
65 - (void) copy : (NSObject<X11Drawable> *) src area : (ROOT::MacOSX::X11::Rectangle) area withMask : (QuartzImage *) mask
66 clipOrigin : (ROOT::MacOSX::X11::Point) origin toPoint : (ROOT::MacOSX::X11::Point) dstPoint;
68 - (
unsigned char *) readColorBits : (ROOT::MacOSX::X11::Rectangle) area;
71 - (
unsigned char *) fData;
74 - (void) putPixel : (const
unsigned char *) data X : (
unsigned) x Y : (
unsigned) y;
76 - (void) addPixel : (const
unsigned char *) rgb;
87 @interface QuartzImage : NSObject<X11Drawable> {
96 ROOT::MacOSX::Util::CFScopeGuard<CGImageRef> fImage;
97 std::vector<unsigned char> fImageData;
100 - (id) initWithW : (
unsigned) width H : (
unsigned) height data : (
unsigned char *) data;
101 - (id) initMaskWithW : (
unsigned) width H : (
unsigned) height bitmapMask : (
unsigned char *) mask;
102 - (id) initMaskWithW : (
unsigned) width H : (
unsigned) height;
103 - (id) initFromPixmap : (QuartzPixmap *) pixmap;
104 - (id) initFromImage : (QuartzImage *) image;
105 - (id) initFromImageFlipped : (QuartzImage *) image;
107 @property (nonatomic, readonly) BOOL fIsStippleMask;
108 - (CGImageRef) fImage;
111 @property (nonatomic, assign)
unsigned fID;
114 - (BOOL) fIsOpenGLWidget;
117 - (unsigned) fHeight;
119 - (
unsigned char *) readColorBits : (ROOT::MacOSX::X11::Rectangle) area;
128 CGImageRef CreateSubImage(QuartzImage *image,
const Rectangle &area);
130 bool AdjustCropArea(
const Rectangle &srcRect, Rectangle &cropArea);
131 bool AdjustCropArea(QuartzImage *srcImage, Rectangle &cropArea);
132 bool AdjustCropArea(QuartzImage *srcImage, NSRect &cropArea);
133 bool AdjustCropArea(QuartzPixmap *srcImage, Rectangle &cropArea);
136 void FillPixmapBuffer(
const unsigned char *bitmap,
unsigned width,
unsigned height, ULong_t foregroundPixel,
137 ULong_t backgroundPixel,
unsigned depth,
unsigned char *imageData);