Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
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 TAttLine fAttLine; ///< current line attributes
46 TAttFill fAttFill; ///< current fill attributes
47 TAttMarker fAttMarker; ///< current marker attribute
48 TAttText fAttText; ///< current text attribute
49
51}
52
53- (id) initWithW : (unsigned) width H : (unsigned) height scaleFactor : (CGFloat) scaleFactor;
54- (BOOL) resizeW : (unsigned) width H : (unsigned) height scaleFactor : (CGFloat) scaleFactor;
55
56- (CGImageRef) createImageFromPixmap;
57- (CGImageRef) createImageFromPixmap : (ROOT::MacOSX::X11::Rectangle) cropArea;
58
59//X11Drawable protocol.
60
61@property (nonatomic, assign) unsigned fID;
62
63- (BOOL) fIsPixmap;
64- (BOOL) fIsOpenGLWidget;
65- (CGFloat) fScaleFactor;
66
67@property (nonatomic, readonly) CGContextRef fContext;
68
69- (unsigned) fWidth;
70- (unsigned) fHeight;
71
72//Graphical attributes
73@property (nonatomic, readonly) TAttLine *attLine;
74@property (nonatomic, readonly) TAttFill *attFill;
75@property (nonatomic, readonly) TAttMarker *attMarker;
76@property (nonatomic, readonly) TAttText *attText;
77
78- (void) setDirectDraw : (BOOL) mode;
79- (BOOL) isDirectDraw;
80
81
82- (void) copy : (NSObject<X11Drawable> *) src area : (ROOT::MacOSX::X11::Rectangle) area withMask : (QuartzImage *) mask
83 clipOrigin : (ROOT::MacOSX::X11::Point) origin toPoint : (ROOT::MacOSX::X11::Point) dstPoint;
84
85- (unsigned char *) readColorBits : (ROOT::MacOSX::X11::Rectangle) area;
86
87//
88- (unsigned char *) fData;
89
90//XPutPixel.
91- (void) putPixel : (const unsigned char *) data X : (unsigned) x Y : (unsigned) y;
92//XAddPixel.
93- (void) addPixel : (const unsigned char *) rgb;
94
95@end
96
97/////////////////////////////////////////////////////////
98// //
99// CGImageRef, created from external data source (raw //
100// data) //
101// //
102/////////////////////////////////////////////////////////
103
105@private
106 //32-bit Obj-C requires i-var to be declared (for a synthesized prop.).
108 unsigned fID;
109 //
110 unsigned fWidth;
111 unsigned fHeight;
112
113 TAttLine fAttLine; ///< current line attributes
114 TAttFill fAttFill; ///< current fill attributes
115 TAttMarker fAttMarker; ///< current marker attribute
116 TAttText fAttText; ///< current text attribute
117
119 std::vector<unsigned char> fImageData;
120}
121
122- (id) initWithW : (unsigned) width H : (unsigned) height data : (unsigned char *) data;
123- (id) initMaskWithW : (unsigned) width H : (unsigned) height bitmapMask : (unsigned char *) mask;
124- (id) initMaskWithW : (unsigned) width H : (unsigned) height;
125- (id) initFromPixmap : (QuartzPixmap *) pixmap;
126- (id) initFromImage : (QuartzImage *) image;
127- (id) initFromImageFlipped : (QuartzImage *) image;
128
129@property (nonatomic, readonly) BOOL fIsStippleMask;
130- (CGImageRef) fImage;
131
132//X11Drawable protocol.
133@property (nonatomic, assign) unsigned fID;
134
135- (BOOL) fIsPixmap;
136- (BOOL) fIsOpenGLWidget;
137
138- (unsigned) fWidth;
139- (unsigned) fHeight;
140
141- (unsigned char *) readColorBits : (ROOT::MacOSX::X11::Rectangle) area;
142
143//Graphical attributes
144@property (nonatomic, readonly) TAttLine *attLine;
145@property (nonatomic, readonly) TAttFill *attFill;
146@property (nonatomic, readonly) TAttMarker *attMarker;
147@property (nonatomic, readonly) TAttText *attText;
148
149@end
150
151
152namespace ROOT {
153namespace MacOSX {
154namespace X11 {
155
157//
158bool AdjustCropArea(const Rectangle &srcRect, Rectangle &cropArea);
162
163//Aux. function for TGCocoa.
164void FillPixmapBuffer(const unsigned char *bitmap, unsigned width, unsigned height, ULong_t foregroundPixel,
165 ULong_t backgroundPixel, unsigned depth, unsigned char *imageData);
166
167}
168}
169}
170
171#endif
unsigned long ULong_t
Unsigned long integer 4 bytes (unsigned long). Size depends on architecture.
Definition RtypesCore.h:69
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char bitmap
Option_t Option_t width
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t height
Fill Area Attributes class.
Definition TAttFill.h:21
Line Attributes class.
Definition TAttLine.h:21
Marker Attributes class.
Definition TAttMarker.h:21
Text Attributes class.
Definition TAttText.h:21
TAttFill fAttFill
current fill attributes
BOOL fIsStippleMask
ROOT::MacOSX::Util::CFScopeGuard< CGImageRef > fImage
TAttLine fAttLine
current line attributes
unsigned fID
unsigned fWidth
std::vector< unsigned char > fImageData
unsigned fHeight
TAttText fAttText
current text attribute
TAttMarker fAttMarker
current marker attribute
TAttLine fAttLine
current line attributes
TAttText fAttText
current text attribute
TAttFill fAttFill
current fill attributes
unsigned fHeight
std::vector< unsigned char > fData
TAttMarker fAttMarker
current marker attribute
ROOT::MacOSX::Util::CFScopeGuard< CGContextRef > fContext
unsigned fWidth
CGFloat fScaleFactor
unsigned fID
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)