Logo ROOT  
Reference Guide
QuartzPixmap.h
Go to the documentation of this file.
1// @(#)root/graf2d:$Id$
2// Author: Timur Pocheptsov 16/02/2012
3
4/*************************************************************************
5 * Copyright (C) 1995-2012, Rene Brun and Fons Rademakers. *
6 * All rights reserved. *
7 * *
8 * For the licensing terms see $ROOTSYS/LICENSE. *
9 * For the list of contributors see $ROOTSYS/README/CREDITS. *
10 *************************************************************************/
11
12
13#ifndef ROOT_QuartzPixmap
14#define ROOT_QuartzPixmap
15
16#include <vector>
17
18#include <Cocoa/Cocoa.h>
19
20#include "CocoaGuiTypes.h"
21#include "CocoaUtils.h"
22#include "X11Drawable.h"
23#include "GuiTypes.h"
24
25///////////////////////////////////////////////////////
26// //
27// "Pixmap". Graphical context to draw into image. //
28// //
29///////////////////////////////////////////////////////
30
32@private
33 //32-bit Obj-C requires i-var to be declared (for a synthesized prop.).
34 unsigned fID;
35 //
36
37 unsigned fWidth;
38 unsigned fHeight;
39
40 std::vector<unsigned char> fData;
42
43 CGFloat fScaleFactor;
44}
45
46- (id) initWithW : (unsigned) width H : (unsigned) height scaleFactor : (CGFloat) scaleFactor;
47- (BOOL) resizeW : (unsigned) width H : (unsigned) height scaleFactor : (CGFloat) scaleFactor;
48
49- (CGImageRef) createImageFromPixmap;
50- (CGImageRef) createImageFromPixmap : (ROOT::MacOSX::X11::Rectangle) cropArea;
51
52//X11Drawable protocol.
53
54@property (nonatomic, assign) unsigned fID;
55
56- (BOOL) fIsPixmap;
57- (BOOL) fIsOpenGLWidget;
58- (CGFloat) fScaleFactor;
59
60@property (nonatomic, readonly) CGContextRef fContext;
61
62- (unsigned) fWidth;
63- (unsigned) fHeight;
64
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;
67
68- (unsigned char *) readColorBits : (ROOT::MacOSX::X11::Rectangle) area;
69
70//
71- (unsigned char *) fData;
72
73//XPutPixel.
74- (void) putPixel : (const unsigned char *) data X : (unsigned) x Y : (unsigned) y;
75//XAddPixel.
76- (void) addPixel : (const unsigned char *) rgb;
77
78@end
79
80/////////////////////////////////////////////////////////
81// //
82// CGImageRef, created from external data source (raw //
83// data) //
84// //
85/////////////////////////////////////////////////////////
86
88@private
89 //32-bit Obj-C requires i-var to be declared (for a synthesized prop.).
91 unsigned fID;
92 //
93 unsigned fWidth;
94 unsigned fHeight;
95
97 std::vector<unsigned char> fImageData;
98}
99
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;
106
107@property (nonatomic, readonly) BOOL fIsStippleMask;
108- (CGImageRef) fImage;
109
110//X11Drawable protocol.
111@property (nonatomic, assign) unsigned fID;
112
113- (BOOL) fIsPixmap;
114- (BOOL) fIsOpenGLWidget;
115
116- (unsigned) fWidth;
117- (unsigned) fHeight;
118
119- (unsigned char *) readColorBits : (ROOT::MacOSX::X11::Rectangle) area;
120
121@end
122
123
124namespace ROOT {
125namespace MacOSX {
126namespace X11 {
127
128CGImageRef CreateSubImage(QuartzImage *image, const Rectangle &area);
129//
130bool AdjustCropArea(const Rectangle &srcRect, Rectangle &cropArea);
131bool AdjustCropArea(QuartzImage *srcImage, Rectangle &cropArea);
132bool AdjustCropArea(QuartzImage *srcImage, NSRect &cropArea);
133bool AdjustCropArea(QuartzPixmap *srcImage, Rectangle &cropArea);
134
135//Aux. function for TGCocoa.
136void FillPixmapBuffer(const unsigned char *bitmap, unsigned width, unsigned height, ULong_t foregroundPixel,
137 ULong_t backgroundPixel, unsigned depth, unsigned char *imageData);
138
139}
140}
141}
142
143#endif
typedef void(GLAPIENTRYP _GLUfuncptr)(void)
unsigned long ULong_t
Definition: RtypesCore.h:55
include TDocParser_001 C image html pict1_TDocParser_001 png width
Definition: TDocParser.cxx:121
XFontStruct * id
Definition: TGX11.cxx:109
BOOL fIsStippleMask
Definition: QuartzPixmap.h:90
ROOT::MacOSX::Util::CFScopeGuard< CGImageRef > fImage
Definition: QuartzPixmap.h:96
unsigned fID
Definition: QuartzPixmap.h:91
unsigned fWidth
Definition: QuartzPixmap.h:93
std::vector< unsigned char > fImageData
Definition: QuartzPixmap.h:97
unsigned fHeight
Definition: QuartzPixmap.h:94
unsigned fHeight
Definition: QuartzPixmap.h:38
std::vector< unsigned char > fData
Definition: QuartzPixmap.h:40
ROOT::MacOSX::Util::CFScopeGuard< CGContextRef > fContext
Definition: QuartzPixmap.h:41
unsigned fWidth
Definition: QuartzPixmap.h:37
CGFloat fScaleFactor
Definition: QuartzPixmap.h:43
unsigned fID
Definition: QuartzPixmap.h:34
void FillPixmapBuffer(const unsigned char *bitmap, unsigned width, unsigned height, ULong_t foregroundPixel, ULong_t backgroundPixel, unsigned depth, unsigned char *imageData)
CGImageRef CreateSubImage(QuartzImage *image, const Rectangle &area)
bool AdjustCropArea(const Rectangle &srcRect, Rectangle &cropArea)
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...